VM-implementation Flashcards

1
Q

On syscall, OS must run and use its own internal data structures
But we don’t want every system call to induce a context switch

What optimization can the OS do?

A

map OS data structures to address space of all
processes
– Use the “user/supervisor bit” to indicate that only the OS (“ring 0”)
can access this memory area, whereas user code (“ring 3”) cannot
– Further, set the “global page” bit in the PTEs associated with the OS
memory, which would then leave the corresponding TLB translations
valid across context switches

Not used anymore, because of the meltdown attack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Who inserts the VA=>PA translation to the TLB?

A

The HW, at the end of a page walk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Who’s responsible for setting bits (e.g. dirty & accessed)

A

HW, the OS turns them off.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Who invalidates the TLB?

– E.g., upon munmap() or context switch

A

OS invalidates TLB entries

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Each core has its own TLB. when, e.g., one core invalidates PTE or changes
access, who is responsible for synching the TLB with the other cores?

A

OS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How many address bits does current x86_64 HW use?

A

48 bits (256TB).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How many page tree hierarchies there are in x86_64?

A

4 levels.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What sizes of huge pages are supported in x86_64?

A

2MB, 4MB, 1GB.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the 3 different address types of PPC? describe each one.

A

3 address types: effective => virtual => real

Effective
– Each process uses 64-bit “effective” addresses
– Effective addresses aren’t unique per-process
– More or less equivalent to x86 “virtual” addresses
– Get translated to PPC “virtual” addresses

Virtual
– A huge 80-bit address space
– All processes live in and share this (single) space
– Namely, if two processes have a page with the same virtual address
• Then it’s the same page (= a shared page)
– Not equivalent to x86 virtual addresses
– Get translated into physical (“real”) address

Physical (a.k.a. real)
– 62-bit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the size of PPC effective and virtual segments?

A

Effective & virtual spaces are partitioned into contiguous
segments of 256MB

Each segment is contiguous in the per-process effective memory space
Each segment is contiguous in the single, huge virtual space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How many segments can there be in an effective space?

A

– Effective space size is 2^64; so can be 2^(64-28) = 2^36 segments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How many segments can there be in the virtual space?

A

– Effective space size is 2^80; so can be 2^(80-28) = 2^52 segments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What’s the purpose of SLB (segment lookaside buffer) in PPC?

A

HW searches SLB
– To find ESID=>VSID mapping
– Each STE (segment table entry)
contains ESID & VSID info

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Who manages the SLB? and what happens upon context switch?

A

OS explicitly manages SLB
– Maintains ESID=>VSID for all
segments of the process

Upon context switch
– OS invalidates SLB (not shared)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happens upon SLB miss?

A

Upon SLB miss
– HW raises “segment fault” interrupt
– OS will then insert right STE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What’s the purpose of TLB in PPC?

A

TLB is a (less) fast HW cache, bigger the SLB.

HW searches TLB
– To find VPN=>PPN mapping
– Each PTE (page table entry)
contains VPN & PPN info

• Shared by all processes
– Since virtual space is shared
– Unlike in x86
– Not invalidated upon context switch

17
Q

Who manages the TLB in ppc?

A

Managed by HW & OS
– Upon miss, HW populates TLB
– By “walking the page table”, which is
in fact the “HTAB”…

18
Q

What’s the difference between PPC PTE and x86 PTE?

A

PPC Contains VPN (the “tag”; why do we need it?) & PPN

x86 contains only PPN.

19
Q

What’s a PTEG (page table entry group)?

A

Contains 8 PTEs

– 8 * 16 = 128 bytes = |cache line|

20
Q

What’s HTAB?

A

At boot time, OS allocates in DRAM the “HTAB” array
• Holds k PTEGs, where k is configurable

OS saves HTAB’s size & base in “SDR1” (storage description register)

21
Q

What happens upon a TLB miss in PPC?

A

– HW hashes VPN (modulo k)
• Recall that HW knows about HTAB location and size via SDR1
• The hash function is well-known and documented in the PPC spec

– HW accesses HTAB and gets the so called “primary” PTEG of the VPN

– HW searches for the VPN in the 8 PTEs populating the primary PTEG

– If found, HW puts VPN=>PPN in TLB and re-executes operation

– Otherwise, HW uses a secondary well-known hash function to obtain
the “secondary” PTEG

– If VPN found, HW puts VPN=>PPN in TLB and re-executes operation

– Otherwise, HW triggers page-fault interrupt

– OS will then resolve the page fault and put the appropriate PTE in one
of the associated two PTEGs (primary or secondary)

– After interrupt is handled, HW will re-execute the operation; now it’ll
find the VPN in one of the 2 PTEGs

22
Q

What’s the PPC ERAT?

A

ERAT (effective to real translation)

A small, fast HW cache
– O(128) entries
– Quicker than 1-cycle to access (on the critical path)
– Translates from effective to real (physical)
– Analogous to x86 TLB (L1)
– Updated to hold the most recent effective=>physical mappings used
• On an LRU basis
– If hit, don’t need to go through the SLB/TLB process
• Typically, obviates the need to do costly SLB=>TLB=>HTAB
translations