Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Domain in arm architecture means what

Tags:

arm

cortex-a

mmu

When I debug MMU in Cortex-A9 MPCore, I always see Domain Access Control Register, but, what does domain means ? up to 16 domains ? Anyone can give me a link to explain this ?

like image 741
kavin zhuang Avatar asked Apr 14 '16 02:04

kavin zhuang


1 Answers

TL;DR The DACR not only decreases the context switch code path, but can also speed execution after the context switch occurs.


There are several links which explain the specifics of Domain Access Control Register or DACR. For example ARM's Memory access permissions and domains. However, this page and many others don't explain why you might need this feature; especially for people use to embedded applications.

A prior ARM feature (ARM architecture V5) was the PID. The reason for this feature is the same as the DACR and domains. What is an MMU used for?

  • Privilege separation - or giving some entities (task, thread, etc) access to memory and other limited (read-only) or none.
  • Memory remapping - a virtual to physical translation allows sparse/separated memory to become continuous.
  • Paging - a fault handler can swap in/out memory on access by less privileged code.
  • Access behaviour - the MMU can specify whether memory is cacheable, read/write, should be buffered, etc.

The DACR (and PID) are only concerned with the first (Privilege separation). On a context switch an OS must manage this separation. With most MMUs (historically on the ARM), there are only two privileges being user and super. In order to accommodate multiple tasks, the super MMU code must alter the MMU table. This is complex as the ARM has a TLB and cache, both of which have virtual addresses and depend on the MMU table.

The DACR (and PID) allow the MMU mappings to change with a single register write. Moreover, the TLB and cache also have domain information (and modified address for PID). This means these entries do not need to be flushed (and repopulated) on a context switch. The domains are advantageous to the PID as multiple access profiles can exist. For instance, shared library code may remain accessible on a context switch while the main task/thread binary is switched out.

Compare work with the DACR versus updating the MMU tables.

  1. Change at least the L1 page tables to map correct profile.
  2. clean/invalidate the L1 table and others in page table update (see below).
  3. invalidate the TLB entries (most likely the whole thing for simplicity).
  4. invalidate the cache entries in MMU table; probably the whole thing again.

This is versus changing a single register. Moreover, you will probably invalidate the entire cache and TLB. With the DACR and a brief context switch, code/data can remain in the cache and MMU page table entries in the TLB. For example, a system with a check email task and a movie player.

The decoding of audio/video is highly CPU and memory intensive. Occasionally, the email client will poll a network server for information. Usually there is nothing. During this brief transition only a small (1-4k) of check email code may be needed; a single TLB entry. Cache is typically 32k+, so much of the audio/video cache and TLB entries can remain valid.

So the DACR not only decreases the context switch code path, but can also speed execution after the context switch occurs.

like image 197
artless noise Avatar answered Sep 24 '22 08:09

artless noise