Page MenuHomeFreeBSD

Invalidate cache for the pdir page when using PAE paging but PAT is not supported.
ClosedPublic

Authored by kib on Feb 26 2019, 10:50 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 10 2024, 9:36 PM
Unknown Object (File)
Feb 2 2024, 10:48 PM
Unknown Object (File)
Jan 17 2024, 2:57 PM
Unknown Object (File)
Dec 20 2023, 3:59 AM
Unknown Object (File)
Nov 15 2023, 9:21 PM
Unknown Object (File)
Nov 6 2023, 9:10 PM
Unknown Object (File)
Oct 28 2023, 8:21 PM
Unknown Object (File)
Oct 14 2023, 8:19 PM
Subscribers

Details

Summary

According to SDM rev. 69 vol. 3, for PDPTE registers loads:

  • when PAT is not supported, access to the pdir page is performed as UC, see 4.9.1;
  • when PAT is supported, the access is WB, see 4.9.2.

So potentially CPU might load stale memory as PDPTEs if both PAT and self-snoop are not implemented. To be safe, add total local cache flush to pmap_cold() before initial load of cr3, and flush pdir in pmap_pinit(), if PAT is not implemented.

PS. Due to a note in 4.9.2 I was tempted to always flush pdir, but then backed it off.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PS. Due to a note in 4.9.2 I was tempted to always flush pdir, but then backed it off.

Because the note implicitly applies only when PAT is supported?

sys/i386/i386/pmap.c
2048 ↗(On Diff #54411)

Shouldn't it be pm_pdir + NBPTD?

PS. Due to a note in 4.9.2 I was tempted to always flush pdir, but then backed it off.

Because the note implicitly applies only when PAT is supported?

My initial interpretation was that it somehow applies to older processor but with PAT support.
My later interpretation of 'some older IA-32 processors' is 'processors that are older than PAT support', esp. in conjunction with reference to 4.9.1. After I backed it off, I consider that the note claims that some pre-PAT processors might use WB and not UB.

sys/i386/i386/pmap.c
2048 ↗(On Diff #54411)

It should be (vm_offset_t)pmap->pm_pdir + NPGPTD * sizeof(pdpt_entry_t), but because pmap_invalidate_cache_range() asserts that start and end are on page boundary, I decided to be more explicit.

sys/i386/i386/pmap.c
2048 ↗(On Diff #54411)

Shouldn't it be flushing pmap->pm_pdpt then?

Fix the location which is invalidated.

This revision is now accepted and ready to land.Feb 28 2019, 7:09 PM
This revision was automatically updated to reflect the committed changes.