iamroot12CD / linux

linux kernel 4.1.6 for raspberrypi2
http://www.iamroot.org/
Other
6 stars 27 forks source link

39주차 2016년 1월 16일 스터디 #25

Open elinjkim opened 8 years ago

elinjkim commented 8 years ago

39주차 스터디 시작합니다. 토즈 강남토즈타워점

fehead commented 8 years ago

cache_flush_레지스터 상태값.xlsx

norux commented 8 years ago

cache_flush_routine.ods.zip

fehead commented 8 years ago
* clidr : cache level id register                              
* Figure 4.19. CLIDR bit assignments                           
*  29 27  24    21     18     15     12      9      6      3      0
*+-----------------------------------------------------------------+
*| |LoUU|Loc|LoUIS|Ctype7|Ctype6|Ctype5|Ctype4|Ctype3|Ctype2|Ctype1|
*+-----------------------------------------------------------------+
* Ctype1 : Level 1 cache의 구현 type                           
* Ctype2 : Level 2 Cache의 구현 type       
minidump commented 8 years ago

http://www.element14.com/community/servlet/JiveServlet/previewBody/17030-102-1-52869/ARM%20System%20Developers%20Guide-Designing%20and%20Optimizing%20System%20Software.pdf

캐시 구조와 관련해서 p413 참고

클린 & 플러시 관련 내용은 p431 "12.5.4 Cleaning the D-Cache Using Way and Set Index Addressing" 참고

norux commented 8 years ago

img_0854

fehead commented 8 years ago
 * L2 캐시 지원 여부를 알아아보는 소스                                          
 * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0464d/BABHCIHB.html
 * clidr[26:24] LoC                                                             
 *       Indicates the Level of Coherency for the cache hierarchy:              
 *       - 0b000 L2 cache not implemented on the processor.                         
 *       - 0b010 L2 cache coherency.                                            
 * r3 = clidr & 0x07000000;                                                     
 * r3 = r3 >> 23;                                                               
 * if(r3 == 0)  // L2 캐시 지원하지않음.                                        
 *      goto finished;                
elinjkim commented 8 years ago

위 그림에 대해 ARM 책에 나와있는 내용

Thrashing : 캐시 메모리 안에 동일한 위치에 대해 소프트웨어 병목 현상이 발생하는 것

Direct mapped cache에서는 메인 메모리로부터 값을 저장하기 위해 사용할 수 있는 공간이 하나이므로 가장 높은 thrashing을 야기할 수 있음 => thrashing 때문에 캐시 라인을 반복해서 제거하고 로딩하는 작업이 일어남

=> trashing(스레싱)을 줄이기위해서 캐시는 way라는 더 작은 단위로 쪼개짐 . 하나의 메인메모리 주소에 대해 캐시 안에 여러개의 저장 위치를 제공할 수 있음(세트 연상 캐시, set associativity)

12.2.4. Set Associativity

4-way 세트연상 (위의 그림)

norux commented 8 years ago

img_0855 img_0857

elinjkim commented 8 years ago

12.5.4. Cleaning The D-Cache Using Way and Set Index

way를 이용하여 캐시라인을 클린하고 플러시하는 데 사용하는 MRC명령어 (위의 표)

  • 명령어 캐시라인 플러시
  • 데이터 캐시라인 플러시
  • 데이터 캐시라인 클린
  • 데이터 캐시라인 클린 및 플러시
SehongKwon commented 8 years ago

Table 4-47 shows the individual bit field and complete register encodings for the CCSIDR. The CSSELR determines which CCSIDR to select.

결국 cssidr(캐시의 way나 라인수)를 읽어오기 전에 어떤 level의 캐시를 읽어올지 선택을 csselr로 해주는 것이라고 되어있습니다.

norux commented 8 years ago

https://ko.wikipedia.org/wiki/캐시_일관성

SehongKwon commented 8 years ago

https://en.wikipedia.org/wiki/ARM_Cortex-A7 라즈베리 파이가 사용하는 코어의 cache정보를 찾아봤습니다.

L1 cache 8–64 KB/8–64 KB <-- L1은 8 way 32KB+32KB 입니다. (32KB L1 instruction cache and a 32KB L1 ) L2 cache Optional, up to 1 MB <-- L2는 512kb입니다. ( 2836 has a 512KB L2 cache)

https://www.raspberrypi.org/forums/viewtopic.php?t=98428

fehead commented 8 years ago

cache_flush 레지스터 흐름

cache_flush_레지스터 상태값.xlsx

cache_flush_레지스터 상태값.ods.zip