git: 9d6eb30abb29 - stable/12 - x86: Add sysctl flag CTLFLAG_TUN to loader tunables

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Thu, 12 Oct 2023 05:10:59 UTC
The branch stable/12 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=9d6eb30abb29ec6b71896b5a8e7c130375fa8549

commit 9d6eb30abb29ec6b71896b5a8e7c130375fa8549
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-10-09 10:30:21 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-10-12 05:09:31 +0000

    x86: Add sysctl flag CTLFLAG_TUN to loader tunables
    
    The following sysctl variables are actually loader tunables. Add sysctl
    flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.
    
     1. machdep.idle
     2. machdep.idle_apl31
    
    No functional change intended.
    
    Reviewed by:    kib, imp
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D42113
    
    (cherry picked from commit 149b9c234b00ff902718e1f76c809609a5465198)
    (cherry picked from commit 9eac775b415bf54080a98a9cf62524b8a6817595)
    (cherry picked from commit cabab5c36287e07cc2890ef76f7e849f16636164)
---
 sys/x86/x86/cpu_machdep.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c
index 26423228d5dc..8ea64970a391 100644
--- a/sys/x86/x86/cpu_machdep.c
+++ b/sys/x86/x86/cpu_machdep.c
@@ -640,7 +640,7 @@ out:
 }
 
 static int cpu_idle_apl31_workaround;
-SYSCTL_INT(_machdep, OID_AUTO, idle_apl31, CTLFLAG_RW,
+SYSCTL_INT(_machdep, OID_AUTO, idle_apl31, CTLFLAG_RWTUN | CTLFLAG_NOFETCH,
     &cpu_idle_apl31_workaround, 0,
     "Apollo Lake APL31 MWAIT bug workaround");
 
@@ -748,8 +748,10 @@ cpu_idle_sysctl(SYSCTL_HANDLER_ARGS)
 	return (cpu_idle_selector(buf) ? 0 : EINVAL);
 }
 
-SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0,
-    cpu_idle_sysctl, "A", "currently selected idle function");
+SYSCTL_PROC(_machdep, OID_AUTO, idle,
+    CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_NOFETCH,
+    0, 0, cpu_idle_sysctl, "A",
+    "currently selected idle function");
 
 static void
 cpu_idle_tun(void *unused __unused)