trace161

Learning Outcome

Interpret the TLB activity produced by trace161.

Introduction

In assignment 3 of the Operating Systems course, you are required to use functions to fill a TLB. trace161 can provide debugging information for each of the TLB operations performed including page numbers, frame numbers and TLB flags.

Applicable subjects

COMP3231


Running trace161

To run your os161 kernel you would normally use:

os161 kernel

To run trace161 and have it print out the TLB activity use:

trace161 -t t kernel

Interpreting trace161 Output

Operations

tlblookup - tlb lookup finds the frame that matches a particular page number.

tlbp - tlb probe finds the index that matches a particular page number.

tlbwi - tlb write index writes a TLB entry into the TLB slot at a particular index.

tlbwr - tlb write random writes a TLB entry into a random TLB slot.

tlbr - tlb read reads a TLB entry at a particular index.

tlbwi and tlbwr are the two operations we care about, so we can grep the output of trace for these. See the Searching Output module for instructions on using grep.

TLB Index

The index of the entry within the TLB

Page Number

The virtual address divided by the page size. Page numbers are mapped to frame numbers via the tlb.

Frame Number

The physical address divided by the page size.

Offset

The offset of the address within the page/frame.

TLB Flags

N - noncached (Not very important for assignment 3)

D - dirty (If set, writes are permitted, if not, a TLB Modify exception occurrs)

V - valid (If set it is valid to use this TLB entry to translate addresses)

G - global (Not very important for assignment 3, can be left as 0)


Example

An example of a trace161 output is:

trace: 00 tlblookup: 00400/000-> 00050 -V--: [15] - OK
trace: 00 tlblookup: 0070d/000 -> no match
trace: 00 tlbwr: [21] 0051d/000 -> 0098 -VD- ==> 0070d/000 ->00114 -VD-

We can analyse this line by line. From the first line we know that there is a TLB lookup to determine if the address 0x400000 (page number (0x400) * page size (0x1000) + offset (0x000)) is in the TLB:

trace: 00 tlblookup:  00400/    000   ->  00050     -V--:   [15]   - OK
            ^          ^         ^          ^         ^       ^
        operation     page     offset     frame     flags   index

It is.

Then, there is another TLB lookup to determine if the address 0x70d000 is in the TLB:

trace: 00 tlblookup:   0070d/  000    ->    no match
            ^            ^      ^               ^
        operation      page   offset   page not found in TLB

It isn’t so we perform a TLB write random to add it to the TLB:

trace: 00 tlbwr:    [21]   0051d/   000 ->  0098   -VD- ==> 0070d/  000  -> 00114  -VD-
            ^        ^       ^       ^        ^      ^        ^      ^        ^      ^
        operation  index   page   offset   frame  flags     page   offset  frame   flags
                    \                                  /     \                          /
                     ----------------------------------       --------------------------
                               ejected page                            new page

Page 0x51d (the entry at index 21) is randomly chosen to be ejected from the TLB and replaced with page 0x70d.

Module author: Liz Willer <e.willer@unsw.edu.au>

Date

2020-02-13