Page MenuHomeFreeBSD

Enable hardware updates to the accessed flag and dirty state on recent arm64 processors
ClosedPublic

Authored by alc on Dec 22 2019, 11:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 11 2024, 12:35 AM
Unknown Object (File)
Dec 20 2023, 7:20 AM
Unknown Object (File)
Nov 12 2023, 3:09 PM
Unknown Object (File)
Nov 6 2023, 9:24 PM
Unknown Object (File)
Nov 6 2023, 8:16 PM
Unknown Object (File)
Oct 6 2023, 2:02 PM
Unknown Object (File)
Oct 5 2023, 8:24 PM
Unknown Object (File)
Oct 5 2023, 7:24 PM

Details

Test Plan

I've tested this patch on cores with and without hardware support for accessed flag and dirty state updates. The recently removed printf() calls showed that the Translation Control Registrar is correctly configured.

Diff Detail

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

Event Timeline

alc edited the summary of this revision. (Show Details)
alc edited the test plan for this revision. (Show Details)

Remove diagnostic printf() calls. This version is ready to commit.

This revision is now accepted and ready to land.Dec 30 2019, 12:33 AM

I also tested this patch with the following added changes:

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 7f96431648d..ea394d12ee0 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -5983,8 +5983,8 @@ pmap_sync_icache(pmap_t pmap, vm_offset_t va, vm_size_t sz
)
        }
 }
 
-int
-pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
+static int
+_pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
 {
        pt_entry_t pte, *ptep;
        register_t intr;
@@ -6076,6 +6076,27 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
        return (rv);
 }
 
+static SYSCTL_NODE(_debug, OID_AUTO, counters, CTLFLAG_RD, 0, "");
+
+static long successes;
+SYSCTL_ULONG(_debug_counters, OID_AUTO, successes, CTLFLAG_RD, &successes, 0, "");
+
+static long failures;
+SYSCTL_ULONG(_debug_counters, OID_AUTO, failures, CTLFLAG_RD, &failures, 0, "");
+
+int
+pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
+{
+       int rv;
+
+       rv = _pmap_fault(pmap, esr, far);
+       if (rv == KERN_SUCCESS)
+               atomic_add_long(&successes, 1);
+       else
+               atomic_add_long(&failures, 1);
+       return (rv);
+}
+
 /*
  *     Increase the starting virtual address of the given mapping if a
  *     different alignment might result in more superpage mappings.

The effect of this patch should be a reduction in the number of "successes" on hardware that performs access flag and dirty state updates, and in fact that's what I see. After a "buildworld", the counts are

debug.counters.failures: 214131371
debug.counters.successes: 16036

with this patch applied. In contrast, the counts are

debug.counters.failures: 214137681
debug.counters.successes: 223485437

without hardware access flag and dirty state updates.