POWER (IBM RS/6000) Virtual Memory and Cache

The multilevel table scheme used by Intel works very well -- but as address spaces get larger, it gets impractical. The main thing is that on a TLB miss, you have to go through a memory access for each level of page table, until you finally get either a hit or a miss.

Consider the IBM RS/6000. It uses a 4K page, like Intel -- but it generates a 52 bit virtual address! To use the Intel multilevel scheme would require four levels of page table -- if IBM used a 4-byte PTE like Intel does. But they don't; they use an eight byte, which would make things worse (not to mention that a page table would no longer fit on a page).

A second problem is that if the TLB works well (ie, the vast majority of PTE lookups are TLB hits), we seldom do a lookup in the page table entries anyway. Instead, the majority of accesses to the page tables are to perform bookkeeping operations, such as searching for a page to eject, or updating the Accessed bits. The multilevel structure really isn't well suited to this; generally, for these functions, we're only interested in the pages actually in memory at the moment.

The solution is to invert the page tables: only have a single page table in the system, which maps physical pages to virtual pages. Now, when you need to do a translation, you do a search in this table: when you get a match, you know you've found the entry you're looking for.

We search by using yet another table: the Hash Anchor Table. The process PID and the VPN are combined and hashed to do a lookup in the HAT, which gets us to the beginning of a hash chain in the IPT. Each IPTE contains the VPN of the page that maps to the entry, and a pointer to the next page in the chain (the pointer can be marked as invalid, marking the end of the chain).

Addressing

32 bit Effective Address, divided as (bits are numbered left to right)

0-3
segment reg number
4-19
virtual page index
20-31
byte offset

So, high order four bits select one of 16 segment registers. Segment registers contain 24 segment ID bits, plus a bunch of others. I've seen references to:

Special bit
enable hardware locking mechanisms
IO
selects IO vs. memory space

Segment ID, virtual page index, offset are combined to form 52 bit virtual address.

Notice that with a 52 bit VM, multilevel page tables start to get impractical. In the exam, on TLB miss four levels of translation would have to be taken! See if we can tighten this up again.

Solution: HAT and PFT.

HAT: Hash Anchor Table. Hash the 40 page VPN to get an index into a hash table with the same number of entries as the size of physical memory. This provides a pointer into a Page Frame Table, which has one entry for each page of physical memory. This is a four word entry, containing (going from left to right):

Field Meaning Width
VPN Virtual Page Number 27
V Valid VPN 1
F Referenced 1
C Changed (dirty!) 1
PP Page Protect 2
I Invalid pointer 1
unused 11
Next PFT ptr 20
Lock bits 32
L Lock type 1
W Grant write locks 1
R Grant read locks 1
A Allow read 1
unused 12
TID Task ID 16 bits

Page translation is easy here. But wait a minute? Aren't we 13 bits short? Yes. Hash index is guaranteed to be unique in low order 13 bits. All done in hardware.

Locks? Better talk about read vs. write locks here.

Notice that the number of lock bits works out to 1 per cache line. All on a page will be the same type.

Lock type says read locks vs. write locks.

Finally, there is a logic table which determines circumstances under which accesses are allowed and locks are granted. First, the table for read accesses:
BLARTID MatchAccess PermittedNotes
--0-nono
0000yesno
0100yesyes
1000yesyes
1100yesyes
0001yesyesSet lock bit to 1
1001yesyes
-101yesyes
--1--yes

And now the table for write accesses:
BLWTID MatchAccess PermittedNotes
---nono
000yesno
010yesyes
100yesyes
110yesyes
001yesyesSet lock bit and lock type to 1; all other lock bits to 0
011yesyesSet lock bit to 1
111yesyes

Advantages of inverted page table:

Disadvantages:

RS/6000 Caches

Separate instruction and data caches

Instruction cache: 8K, 2-way set associative, real addresses. But notice that the cache is the right size to use the byte offset from the effective address to find a cache set, while the rest of the virtual address is being constructed! Another feature is that two cache lines can be read simultaneously, if both are on the same page.

64K data cache, 4 way set associative, 128 byte line, real address, partial writeback (two change bits per line). Notice that this means you have to complete a virtual address translation before you can start a cache access -- but they don't! Instead, there is a software requirement that the low order two bits of the virtual address can't be different from the low order two bits of the physical address (and, we'll see that they actually have more strenuous requirements than this!).

Cache miss requires 8 memory accesses to satisfy. Gets the first word first.

Misaligned accesses OK, IF the data all comes from a single cache line. Otherwise, fault handled by software.


Last modified: Mon Apr 11 08:59:08 MDT 2005