This allows us to use it when we only need to check if the virtual address
is valid. For example when checking if an address in the DMAP region is
mapped.
Details
- Reviewers
manu markj kib - Group Reviewers
arm64 - Commits
- rGf64329bcdc4f: Extract the logic from pmap_kextract
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 35417 Build 32331: arc lint + arc unit
Event Timeline
I was always envy for aarch64 AT instructions. AT S1E0R (or W) seems to do exactly what you want, and avoid manual parsing of the page tables. Why not use the instruction?
sys/arm64/arm64/pmap.c | ||
---|---|---|
1379 | Why do we need to disable interrupts around AT ? |
sys/arm64/arm64/pmap.c | ||
---|---|---|
1379 | It's two instructions. The at instruction stores the result in par_el1 so we then need the following to get the result in x1: at s1e1r, x0 mrs x1, par_el1 If a interrupt happens after the at, but before the mrs we may have an invalid value in par_el, e.g. if the thread is moved to a new CPU. We could handle this by restarting the instruction, however disabling interrupts on arm64 is cheap so there is no need. |
sys/arm64/arm64/pmap.c | ||
---|---|---|
1379 | May be add a comment there noting that operation is not atomic? |
sys/arm64/arm64/pmap.c | ||
---|---|---|
1373–1374 | Extra newline. | |
1379 | Or perhaps disable interrupts in the implementation rather than the caller. | |
6861 | I think pmap_klookup() might be a better name. kva_to_pa is a bit confusing since 1) translating KVAs to PAs is ostensibly pmap_kextract()'s job, and 2) the function is used here only to see if the address is valid. |
I expect we could do something similar in pmap_extract. We would need to limit it to stage 1 pmaps (i.e. non-hypervisor pmaps), and need to check if it's a userspace or kernel pmap.
It looks like we would only need the page table walking code for stage 2 pmaps as we only modify them with the pmap lock that pmap_extract holds.