Paul Sandhu's Weblog

Paul Sandhu's Weblog

All | General | Java | Music

Main | Next day (May 14, 2005) »
20050513 Friday May 13, 2005

Introduction

Introduction

Here's a brief introduction as a prelude to presenting more technical content in the future. I've worked as a software engineer with Sun for the past two years, working mostly on SPARC specific Virtual Memory related projects. In particular the HAT (Hardware Address Translation) layer which Joe describes in The Mad Hatter. I'm based in the UK on the Guillemont park campus, having previously worked with Solaris support for five years. Prior to that I worked for ICL/Fujitsu for more years than I care to count, mostly on kernel development on DRS6000, their multi-processor SPARC platform.

The HAT Layer

The HAT layer lends itself to a number of doubtful puns which I will carefully avoid. This layer acts as an interface between the generic VM code above it and the architecture-specific memory management hardware beneath. I have mostly been involved with the HAT software, which interfaces with the Sun4u platform, which is known as the sfmmu. If you browse the source code you will find a large number of VM routines prefixed with sfmmu, to indicate that they belong to this layer. One of the problems with making sense of this code is that a general understanding of the memory management hardware is required in order to get a good idea of what is going on.

SPARC MMU Hardware

The SPARC MMU hardware consists of (at least) two Translation Lookaside Buffers or TLBs together with a number of support registers. The TLBs vary in size and structure depending upon the particular processor type. Older processors have 64 entry fully associative TLBs, more recent processors have increased the number of entries but reduced the associativity. The common factors are that there are separate instruction and data TLBs and that each entry in the TLB is a TTE which may be thought of as a page table entry or PTE on other architectures. A TTE is made up of two components - the tag and the translation data, each of length 64 bits. The TTE tag contains the encoded virtual address and context number, and the TTE data contains the corresponding physical address together with various properties associated with the translation. The context number is a 13 bit quantity which is used to distinguish between different user address spaces, so that the same virtual addresses in different address spaces can coexist in the TLB. One of the most significant properties of the mapping is its size. Each TTE maps a contiguous area of memory, which can be 8KB, 64KB, 512KB or 4MB in size, on current processors. Larger page sizes will be supported on future processors. A TLB hit occurs if both the virtual address and context supplied to the TLB correspond to those of a particular TTE entry, In the event of a TLB miss trap, an in-memory array of translations, called the Translation Storage Buffer, provides a software managed, directly mapped cache, which is used to reload the TLB. When a translation is not present in the TSB, a software lookup mechanism is used to obtain the TTE. This is based on the hme_blk and its associated data structures which are used to keep track of active mappings. These structures perform a similar function to page tables in other architectures.

hme_blk structures

The hme_blk structures each define virtual to physical mappings for a particular address space and virtual address range. They are organised into a series of hash buckets based on an address space identifier, the virtual address and the page size used. In the event of a TSB miss a hash of these elements is used to obtain the correct hash bucket and then a linear search of the list is made to find the corresponding hme_blk for the mapping.

Something Completely Different

My main interests outside work are focussed on music and books. I am passionate about classical music, one of the advantages of living in the UK (apart from the weather!) is that we have an excellent classical radio station in BBC Radio 3. One of my favourite writers is Saul Bellow, who died recently, I have admired his work for many years. More recently, I have just finished a book by Haldor Laxness, a Nobel prize winning Icelandic writer, called "Under the Glacier" which is both very amusing and unlike anything I've have ever read before.

( May 13 2005, 07:02:12 AM PDT ) Permalink Comments [0]


Today's Page Hits: 29