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
Unknown Object (File)
Thu, May 9, 7:36 PM
Unknown Object (File)
Wed, May 8, 7:04 AM
Unknown Object (File)
Mon, May 6, 2:25 AM
Unknown Object (File)
Tue, Apr 30, 6:10 AM
Unknown Object (File)
Tue, Apr 30, 5:52 AM
Unknown Object (File)
Tue, Apr 30, 5:36 AM
Unknown Object (File)
Tue, Apr 30, 5:10 AM
Unknown Object (File)
Mon, Apr 29, 10:09 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 Not Applicable
Unit
Tests Not Applicable

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
3463

BTW, return (NULL) there would be more clear

3476

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