git: 3c253d03d94e - main - Hide acpi_timer_test behind a tunable

Colin Percival cperciva at FreeBSD.org
Wed Sep 8 01:32:32 UTC 2021


The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=3c253d03d94e89cf1a26716b58fc27653df2a4f3

commit 3c253d03d94e89cf1a26716b58fc27653df2a4f3
Author:     Colin Percival <cperciva at FreeBSD.org>
AuthorDate: 2021-09-07 23:58:18 +0000
Commit:     Colin Percival <cperciva at FreeBSD.org>
CommitDate: 2021-09-08 01:31:50 +0000

    Hide acpi_timer_test behind a tunable
    
    When hw.acpi.timer_test_enabled is set to 0, this makes acpi_timer_test
    return 1 without actually testing the ACPI timer; this results in the
    ACPI-fast timecounter always being used rather than potentially using
    ACPI-safe.
    
    The ACPI timer testing was introduced in 2002 as a workaround for
    errata in Pentium II and Pentium III chipsets, and is unlikely to be
    needed in 2021.
    
    While I'm here, add TSENTER/TSEXIT to make it easier to see the time
    spent on the test (if it is enabled).
    
    Reviewed by:    allanjude, imp
    MFC After:      1 week
---
 sys/dev/acpica/acpi_timer.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c
index 763a47a1a959..8be6e0edea7f 100644
--- a/sys/dev/acpica/acpi_timer.c
+++ b/sys/dev/acpica/acpi_timer.c
@@ -79,6 +79,8 @@ static int	acpi_timer_sysctl_freq(SYSCTL_HANDLER_ARGS);
 static void	acpi_timer_boot_test(void);
 
 static int	acpi_timer_test(void);
+static int	acpi_timer_test_enabled = 1;
+TUNABLE_INT("hw.acpi.timer_test_enabled", &acpi_timer_test_enabled);
 
 static device_method_t acpi_timer_methods[] = {
     DEVMETHOD(device_identify,	acpi_timer_identify),
@@ -404,6 +406,12 @@ acpi_timer_test()
     int delta, max, max2, min, n;
     register_t s;
 
+    /* Skip the test based on the hw.acpi.timer_test_enabled tunable. */
+    if (!acpi_timer_test_enabled)
+	return (1);
+
+    TSENTER();
+
     min = INT32_MAX;
     max = max2 = 0;
 
@@ -434,6 +442,8 @@ acpi_timer_test()
     if (bootverbose)
 	printf(" %d/%d", n, delta);
 
+    TSEXIT();
+
     return (n);
 }
 #undef N


More information about the dev-commits-src-all mailing list