Page MenuHomeFreeBSD

riscv: Remove unnecessary invalidations in pmap_enter_quick_locked()
ClosedPublic

Authored by markj on Oct 19 2023, 1:08 PM.
Tags
None
Referenced Files
F102753477: D42291.diff
Sat, Nov 16, 5:30 PM
Unknown Object (File)
Thu, Nov 7, 9:31 PM
Unknown Object (File)
Thu, Nov 7, 7:52 PM
Unknown Object (File)
Tue, Nov 5, 12:30 PM
Unknown Object (File)
Oct 16 2024, 8:30 PM
Unknown Object (File)
Oct 16 2024, 10:46 AM
Unknown Object (File)
Oct 15 2024, 6:38 PM
Unknown Object (File)
Oct 14 2024, 2:37 PM
Subscribers

Details

Summary

This function always overwrites an invalid PTE, so if
pmap_try_insert_pv_entry() fails it is certainly not necessary to
invalidate anything, because the PTE has not yet been written by that
point.

It should also not be necessary to invalidate TLBs after overwriting an
invalid entry. In principle the TLB could cache negative entries, but
then the worst case scenario is a spurious fault. Since pmap_enter()
does not bother issuing an sfence.vma, pmap_enter_quick_locked() should
behave similarly.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 54083
Build 50973: arc lint + arc unit

Event Timeline

markj requested review of this revision.Oct 19 2023, 1:08 PM

So RISC-V can cache -ve PTEs?

kib added inline comments.
sys/riscv/riscv/pmap.c
3465

BTW, return (NULL) there would be more clear

3479

And there

This revision is now accepted and ready to land.Oct 20 2023, 5:14 PM
In D42291#965582, @kib wrote:

So RISC-V can cache -ve PTEs?

Yes, and the spec explicitly calls this out.

markj marked 2 inline comments as done.

Simplify some return paths.

This revision now requires review to proceed.Oct 20 2023, 5:44 PM
This revision is now accepted and ready to land.Oct 20 2023, 5:49 PM