How TLB misses are handled (part 2)

18 May, 2010 § 1 Comment

This blog post was co-authored by Brendan Grebur and Jared Wein.

As a follow up from the previous post on TLB misses, I’d like to cover a special case of TLB misses.

At boot time there is a “chicken-and-egg” dilemma where the TLB is empty yet TLB values are needed immediately.

How does a computer handle this? First to make some assumptions:

  • Linux Kernel
  • Hardware-managed TLB

The x86 chips boot up in Real Mode with a very limited memory space and the MMU disabled. The Linux kernel is uncompressed and loaded into low-memory by the boot loader. Assembly code initializes a page directory for the initial kernel process, sets the CR3 register, then enables the PG bit in CR0 to effectively enable the MMU and begin addressing in Protected Mode. Since this area is kernel memory, the virtual address will be identical to the physical address, as kernel memory is never swapped out. The init process begins running C code and making memory references to initialize the rest of the kernel. TLB misses occur, but resolve themselves as the MMU walks the page directory previously set up for the kernel process.

Sources:

  1. http://lkml.indiana.edu/hypermail/linux/kernel/0811.2/01602.html
  2. http://beaversource.oregonstate.edu/projects/cspfl/browser/trunk/software/u-boot-omap3/board/sbc8560/tlb.c?rev=376
  3. http://tldp.org/LDP/tlk/tlk.html
  4. http://lxr.linux.no/linux-old+v2.0.33/arch/i386/kernel/head.S#L286

Where Am I?

You are currently browsing entries tagged with linux at JAWS.

Follow

Get every new post delivered to your Inbox.

Join 1,004 other followers