next up previous contents
Next: 5.3.3 DTLB allocation Up: 5.3 Distributed Memory Managers Previous: 5.3.1 DMM

5.3.2 Distributed TLBs

A DTLB is a set of translations. Not every existing translation must be present in it. The DTLB should be considered to be a cache of the translations being used. However, on architectures with page tables, the cache may actually hold a copy of every existing translation to local memory.

Page faults and remaining events for the DTLB will be delivered to its owner (see off_Resource, for details).

DTLBs are at the same time abstract resource units and physical resource containers. However, they are primarily considered to be abstract resource units; make_available is not implemented for address translations, and the relocation table is never used for individual translations (the per-node relocation table is used only for remote page frames which happen to be cached in the local node).

Each DTLB contains a set of remote translations, some of which happen to be local ones (see figure [*]). Every translation is taken from a translation allocator, AddrTrAllocator, which provides methods to allocate and deallocate AddrTrs. The allocator will keep local translations just in the local (machine dependent) address translation table to save some memory.

\begin{figure}[htb]

 

<Off DTLB. >=
class off_DTLB : public AbsResUnit {
public:

  // Returns a pointer to the address translation allocator.
  virtual off_AddrTrAllocator *get_allocator(void);

  <Other public methods of off_DTLB. >

protected:
  <Other protected methods of off_DTLB. >
private:

  off_mdepDTLB        d_mdep;   // machine dependent addr translation table.
  off_AddrTrAllocator d_alloc; // (remote) address translation allocator. 
};
Defines off_DTLB (links are to index).

<Off DTLB dependencies. >=
#include <klib/AbsResUnit.h>

A \dtlb{} is created by supplying a protection and a domain.

<Other public methods of off_DTLB. >= (<-U) [D->]
// Creates a DTLB
off_DTLB(const off_Protection &p, const off_prtl_id_t &domain);

<off_DTLB::off_DTLB implementation. >= [D->]
// Creates a DTLB
off_DTLB::off_DTLB(const off_Protection &p, const off_prtl_id_t &domain) :
  off_AbsResUnit(p,domain),
  d_alloc(d_mdep),
  <Initialize other aggregate members of off_DTLB. >
{
  <Initialize other private members of off_DTLB. >
}

Remaining \dtlb{} data is pre-initialized. First, a zero-argument constructor permits declaration of uninitialized DTLBs.

<Other public methods of off_DTLB. >+= (<-U) [<-D->]
//  Allows uninitialized DTLBS
off_DTLB(void);

<off_DTLB::off_DTLB implementation. >+= [<-D->]
//  Allows uninitialized DTLBs.
off_DTLB::off_DTLB(void) :
  off_AbsResUnit(off_Protection(), OFF_PRTL_NULL, 
                 OFF_DTLB_NULL, OFF_MAGIC_DTLB, NULL),
  d_alloc(d_mdep)
{;}

Later, another constructor is used to pre-initialize those shuttle fields which are unlikely to change.

<Other public methods of off_DTLB. >+= (<-U) [<-D->]
// Pre-initializes a DTLB
off_DTLB(const off_dtlb_id_t &id, const off_magic_t &m, off_DMM *c);

<off_DTLB::off_DTLB implementation. >+= [<-D]
// Pre-initializes a DTLB.
off_DTLB::off_DTLB(const off_dtlb_id_t &id, const off_magic_t &m, off_DMM *c):
  off_AbsResUnit(id,m,(off_AbsCompResource*)c),
  d_alloc(d_mdep)
{;}

Where the magic number has to be defined.

<Off magic numbers. >+= [<-D]
OFF_MAGIC_DTLB, // DTLB magic nb.

We can now add another case to the implementation of Magic::nameof.

<off_Magic::nameof case for m_numbers. >+= [<-D]
case OFF_MAGIC_DTLB:
  return "off_DTLB";

\dtlb{} users can check their references to processors using this method.

<Other public methods of off_DTLB. >+= (<-U) [<-D->]
// Does this look like a DTLB?
inline boolean_t valid(void) const;

<off_DTLB::valid implementation. >=
// Does this look like a DTLB?
inline boolean_t off_DTLB::valid(void) const 
{ return get_magic() == OFF_MAGIC_DTLB; }

\subsection{Address translations}

An address translation is a map from a virtual page to an address translation value (AddrTrVal). Such translation value includes information about the target page frame as well as the translation protection. Remote translations will lead to intensive use of the kernel relocation table to use local page frames as cache for remote ones.

<Off address translation. >=
class off_AddrTr  {
public:
  inline vm_offset_t get_va(void) const;
  inline const off_pg_id_t &get_pa(void) const;
  inline vm_offset_t get_ma(void) const;
  inline off_mod_t   get_mod(void) const;

  <Other public methods of off_AddrTr. >

private:
  vm_offset_t   a_va;           // Virtual address
  off_AddrTrVal a_dst;          // Translation target.
};

Defines off_AddrTr (links are to index).

<off_AddrTr::get_va implementation. >=
inline vm_offset_t get_va(void) const { return a_va; }

<off_AddrTr::get_pa implementation. >=
inline const off_pg_id_t &get_pa(void) const { return a_dst.get_pa(); }
inline vm_offset_t get_ma(void) const { return a_dst.get_ma(); }

<off_AddrTr::get_mod implementation. >=
inline off_mod_t   get_mod(void) const { return a_dst.get_mod(); }

An address translation can be also used to mean the virtual address it is translating.

<Other public methods of off_AddrTr. >= (<-U) [D->]
operator vm_offset_t(void) const; 

<off_AddrTr::operator vm_offset_t implementation. >=
off_AddrTr::operator vm_offset_t(void) const { return a_va; }

Usually, translations are built by supplying the source and target addresses with an optional mode parameter granting read and write access for the translation.

<Other public methods of off_AddrTr. >+= (<-U) [<-D]
// Creates an address translation.
off_AddrTr(vm_offset_t va, const off_pg_id_t &pa, 
           off_mod_t mod=OFF_MOD_RW|OFF_MOD_V);

<off_AddrTr::off_AddrTr implementation. >=
// Creates an address translation.
off_AddrTr::off_AddrTr(vm_offset_t va, const off_pg_id_t &pa, off_mod_t mod) :
  a_va(va), a_dst(pa,mod)
{;}

A (maybe remote) translation target includes, as said, the physical address and the protection (mode) bits (which are typically codified inside the physical address).

<Off remote address translation value. >=
class off_RemAddrTrVal {
private:
  off_pg_id_t a_pa;             // Physical address
  off_mod_t   a_mod;            // mode bits.

public:
  // Creates a translation target. 
  off_RemAddrTrVal(const off_pg_id_t &pa, off_mod_t mod) :
    a_pa(pa), a_mod(mod)
  {;}

  // Return the page identifier, address and mode.
  inline const off_pg_id_t &get_pa(void) const { return a_pa; }
  inline vm_offset_t get_ma(void) const { return a_pa.i_offset; }
  inline off_mod_t   get_mod(void) const {return a_mod;  }

  // Set the page identifier and mode.
  inline void set_pa(const off_pg_id_t &pa) { a_pa=pa; }
  inline void set_mod(off_mod_t mod)  {a_mod=mod;  }

  <Other public methods of off_RemAddrTrVal. >

};

Defines off_RemAddrTrVal (links are to index).

Mode bits are defined in a machine dependent way so that they match the encoding used by the hardware.

<Off address translation mode bits. >=
typedef off_mdep_mod_t off_mod_t;


next up previous contents
Next: 5.3.3 DTLB allocation Up: 5.3 Distributed Memory Managers Previous: 5.3.1 DMM
Francisco J. Ballesteros
1998-05-25