Page MenuHomeFreeBSD

riscv pmap: add a demotion assertion
ClosedPublic

Authored by mhorne on Jan 12 2021, 1:43 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 12, 9:07 PM
Unknown Object (File)
Fri, Apr 12, 9:07 PM
Unknown Object (File)
Wed, Apr 10, 8:51 PM
Unknown Object (File)
Sun, Mar 31, 1:49 PM
Unknown Object (File)
Mar 10 2024, 5:40 AM
Unknown Object (File)
Jan 12 2024, 5:28 AM
Unknown Object (File)
Dec 22 2023, 10:23 PM
Unknown Object (File)
Dec 20 2023, 5:10 PM
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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 36131
Build 33020: arc lint + arc unit

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
3914

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
3914

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

sys/riscv/riscv/pmap.c
3914

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.