Page MenuHomeFreeBSD

arm64 pmap_fault: a local TLB invalidation suffices when enabling write access
ClosedPublic

Authored by alc on Tue, Oct 6, 6:53 PM.
Tags
None
Referenced Files
F175142972: D60417.id188893.diff
Thu, Oct 8, 3:05 PM
F175112102: D60417.diff
Thu, Oct 8, 8:34 AM
F175109197: D60417.id188971.diff
Thu, Oct 8, 8:05 AM
F175107506: D60417.id188893.diff
Thu, Oct 8, 7:48 AM
Unknown Object (File)
Wed, Oct 7, 1:50 PM
Unknown Object (File)
Wed, Oct 7, 3:07 AM
Unknown Object (File)
Tue, Oct 6, 7:52 PM
Unknown Object (File)
Tue, Oct 6, 7:52 PM
Subscribers

Details

Test Plan

Over the course of a buildworld on a 16-core Cortex-A72 machine, ~78M broadcast invalidations were replaced by local ones, and there were only 13 spurious write faults.

Diff Detail

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

Event Timeline

alc requested review of this revision.Tue, Oct 6, 6:53 PM

pmap_enter() should similarly be using a local invalidation when it is upgrading a R/O mapping to R/W. Comparing the amd64 and arm64 pmap_enter()s is what led me to discover all of this.

P.S. I found that Linux made similar changes last November: https://lkml.org/lkml/2025/11/4/601

This revision is now accepted and ready to land.Tue, Oct 6, 8:03 PM
In D60417#1385873, @alc wrote:

pmap_enter() should similarly be using a local invalidation when it is upgrading a R/O mapping to R/W. Comparing the amd64 and arm64 pmap_enter()s is what led me to discover all of this.

amd64 will do a (targeted) remote invalidation when upgrading a R/O mapping, I believe. Do you mean that it too should only issue a local invalidation in that case?

In D60417#1385873, @alc wrote:

pmap_enter() should similarly be using a local invalidation when it is upgrading a R/O mapping to R/W. Comparing the amd64 and arm64 pmap_enter()s is what led me to discover all of this.

amd64 will do a (targeted) remote invalidation when upgrading a R/O mapping, I believe. Do you mean that it too should only issue a local invalidation in that case?

Oh, amd64 doesn't issue an invalidation at all in that case. arm64 can't get away with that but a local invalidation there makes more sense.

In D60417#1385873, @alc wrote:

pmap_enter() should similarly be using a local invalidation when it is upgrading a R/O mapping to R/W. Comparing the amd64 and arm64 pmap_enter()s is what led me to discover all of this.

amd64 will do a (targeted) remote invalidation when upgrading a R/O mapping, I believe. Do you mean that it too should only issue a local invalidation in that case?

Oh, amd64 doesn't issue an invalidation at all in that case. arm64 can't get away with that but a local invalidation there makes more sense.

Yes. On a page fault, amd64 processors automatically flush any TLB entry for the faulting address, but arm64 processors do not.