Some questions about tlb
Posted: Tue Dec 18, 2007 2:58 am
I've got some questions about TLB on PS2 (r5900). Well, some questions plus something I'm unsure of, so I'll be glad if someone would correct me if I'm wrong.
Normally when data/instruction is to be fetched, there occurs DTLB/ITLB lookup in parallel with JTLB lookup (this can decrease the overhead of looking in JTLB if DTLB/ITLB miss occurs). If DTLB/ITLB miss occurs, almost immediately there is available apropriate hit (if any) from JTLB (if none, TLB MISS exception occurs and TLB refill takes place).
Now the questions:
The JTLB is quite simple, 48 pairs of 2 entries each (starting virtual address aligned to page_size*2), variable page size 4kB-16MB in "multiplication by 4" steps. The format of entries is well described and pretty straight forward. Manuals say that ITLB is 2 entries and DTLB 4 entries. Does it mean 2/4 pairs of 2 entries (meaning 4/8 entries) or 1/2 pairs of 2 entries (meaning 2/4 entries) or 2/4 single entries (each is of constant 4kB page in opposition to JTLB's variable size). And what is directly bound to previous question, refilling of ITLB/DTLB. It is said that's done "in pseudo-LRU manner (least recently used entry of least recently used half is filled)" - if it's stored in pairs as in JTLB, that means in most cases the entire pair will be overwritten, because it would create some false (thus very bad) positives, right? It's generally about what is called "half" in the quotation above (is this the same as "pair", or it's just about half of the ITLB/DTLB).
Despite of the answer, there is also one more thing I would like you to confirm. The method of using JTLB/ITLB/DTLB means that no multiple matches should be allowed (the cpu allows it, but the result will be undetermined) - even if one would place such entries in specific order, this always can be broken by ITLB/DTLB hit? Just asking, because such use would help a bit to not make that many JTLB replacements by conserving TLB entries (for example mapping of 8MB of which first 512kB is write protected would require 7 double entries 2x256kB-write-protected, 2x256kB, 2x256kB, 2x256kB, 2x1MB, 2x1MB, 2x1MB; where in the other way it could be 2x256kB-write-protected and overlapping 2x4MB, assuming both vaddr and paddr are properly aligned... but the second may lead to some undefined results, mainly meaning that the page that is to be protected by not setting dirty bit will sometimes, or even most of the time, be available to writing, not causing tlb modify exception)?
It's not that much important to me, mostly curious (current implementation, where TLB is reorganized from time to time is efficient enough).
Thanks.
Normally when data/instruction is to be fetched, there occurs DTLB/ITLB lookup in parallel with JTLB lookup (this can decrease the overhead of looking in JTLB if DTLB/ITLB miss occurs). If DTLB/ITLB miss occurs, almost immediately there is available apropriate hit (if any) from JTLB (if none, TLB MISS exception occurs and TLB refill takes place).
Now the questions:
The JTLB is quite simple, 48 pairs of 2 entries each (starting virtual address aligned to page_size*2), variable page size 4kB-16MB in "multiplication by 4" steps. The format of entries is well described and pretty straight forward. Manuals say that ITLB is 2 entries and DTLB 4 entries. Does it mean 2/4 pairs of 2 entries (meaning 4/8 entries) or 1/2 pairs of 2 entries (meaning 2/4 entries) or 2/4 single entries (each is of constant 4kB page in opposition to JTLB's variable size). And what is directly bound to previous question, refilling of ITLB/DTLB. It is said that's done "in pseudo-LRU manner (least recently used entry of least recently used half is filled)" - if it's stored in pairs as in JTLB, that means in most cases the entire pair will be overwritten, because it would create some false (thus very bad) positives, right? It's generally about what is called "half" in the quotation above (is this the same as "pair", or it's just about half of the ITLB/DTLB).
Despite of the answer, there is also one more thing I would like you to confirm. The method of using JTLB/ITLB/DTLB means that no multiple matches should be allowed (the cpu allows it, but the result will be undetermined) - even if one would place such entries in specific order, this always can be broken by ITLB/DTLB hit? Just asking, because such use would help a bit to not make that many JTLB replacements by conserving TLB entries (for example mapping of 8MB of which first 512kB is write protected would require 7 double entries 2x256kB-write-protected, 2x256kB, 2x256kB, 2x256kB, 2x1MB, 2x1MB, 2x1MB; where in the other way it could be 2x256kB-write-protected and overlapping 2x4MB, assuming both vaddr and paddr are properly aligned... but the second may lead to some undefined results, mainly meaning that the page that is to be protected by not setting dirty bit will sometimes, or even most of the time, be available to writing, not causing tlb modify exception)?
It's not that much important to me, mostly curious (current implementation, where TLB is reorganized from time to time is efficient enough).
Thanks.