Page MenuHomeFreeBSD

pmap_enter_{l2,pde}: correct the handling of an error case
ClosedPublic

Authored by alc on Wed, Jul 16, 4:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 29, 11:46 AM
Unknown Object (File)
Mon, Jul 28, 11:27 PM
Unknown Object (File)
Mon, Jul 28, 6:45 PM
Unknown Object (File)
Mon, Jul 28, 3:37 PM
Unknown Object (File)
Mon, Jul 28, 4:21 AM
Unknown Object (File)
Mon, Jul 28, 3:09 AM
Unknown Object (File)
Mon, Jul 28, 2:57 AM
Unknown Object (File)
Sun, Jul 27, 10:40 PM
Subscribers

Details

Summary

When pmap_enter_object()'s call to pmap_enter_{l2,pde}() fails to create a managed mapping within the kernel address space due to the inability to allocate a PV entry, it needs to remove the kernel page table page from the pmap's trie of idle page table pages. Previously, it did not.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

alc requested review of this revision.Wed, Jul 16, 4:58 PM
sys/arm64/arm64/pmap.c
5835

Can you use ADDR_IS_KERNEL here?

alc marked an inline comment as done.Wed, Jul 16, 7:08 PM
This revision is now accepted and ready to land.Wed, Jul 16, 10:07 PM

Is my reading of the code correct where uwptpg == NULL in the new else case because it's only set for userspace maps? If so it means we will call pmap_remove_pt_page.

Is my reading of the code correct where uwptpg == NULL in the new else case because it's only set for userspace maps?

That's my understanding.

I have two related observations:

  1. !ADDR_IS_KERNEL() appears more frequently than ADDR_IS_KERNEL(). @andrew What would you think about adding ADDR_IS_USER()?
  2. @kib @markj What do you think about adding these macros to amd64 to eliminate trivial differences between the pmap implementations?
In D51353#1173408, @alc wrote:
  1. @kib @markj What do you think about adding these macros to amd64 to eliminate trivial differences between the pmap implementations?

I do not see why not. It is trivial macro, although I prefer a different way to write it for amd64, like

#define ADDR_IS_KERNEL(va) ((vm_offset_t)(va) >= kva_layout.kva_min)