Page MenuHomeFreeBSD

riscv pmap: add a demotion assertion
ClosedPublic

Authored by mhorne on Jan 12 2021, 1:43 AM.
Tags
None
Referenced Files
F102910274: D28109.id82159.diff
Mon, Nov 18, 3:32 PM
F102908914: D28109.id82160.diff
Mon, Nov 18, 3:07 PM
Unknown Object (File)
Mon, Nov 11, 5:50 AM
Unknown Object (File)
Thu, Nov 7, 9:10 PM
Unknown Object (File)
Tue, Nov 5, 1:23 PM
Unknown Object (File)
Thu, Oct 31, 4:12 PM
Unknown Object (File)
Tue, Oct 22, 7:22 AM
Unknown Object (File)
Oct 17 2024, 11:49 AM
Subscribers

Details

Summary

Add a KASSERT to pmap_remove_write() to ensure that the page obtained
from the PV list is not a superpage where we don't expect one. An
identical KASSERT already exists in pmap_clear_modify().

This may help with debugging the panic reported in PR 250866, in which
l3 was found to be NULL. Adding this KASSERT will help narrow down the
cause of this panic the next time it occurs.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I think pmap_page_test_mappings() and pmap_page_wired_mappings() could use a similar treatment.

This revision is now accepted and ready to land.Jan 12 2021, 1:49 AM
sys/riscv/riscv/pmap.c
3919

Slightly unrelated, but do you know why the fcmpset/retry loop is required here? pmap_clear_modify is structured similarly but performs pmap_clear_bits on the PTE instead.

Also, can it ever advance without updating oldl3?

I think pmap_page_test_mappings() and pmap_page_wired_mappings() could use a similar treatment.

Sure, I can add those as well.

sys/riscv/riscv/pmap.c
3919

Forget the second question, I double checked the semantics of fcmpset.

sys/riscv/riscv/pmap.c
3919

I believe it was done this way to handle races with the hardware setting PTE_D. We want to make sure we don't end up clearing PTE_D without observing that it was set. pmap_clear_modify() doesn't care so it can simply clear the bits.

atomic_fcmpset_* updates the old value upon failure, in contrast with atomic_cmpset_*.

Add asserts to pmap_page_test_mappings() and pmap_page_wired_mappings().

Use __func__ to avoid extra line wrapping.

This revision now requires review to proceed.Jan 12 2021, 2:07 PM
This revision is now accepted and ready to land.Jan 12 2021, 2:35 PM
This revision was automatically updated to reflect the committed changes.