kern/60596: No need to read CPUID if model/family indicated CPU has invariant TSC

"[email protected] via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
>Number:         60596
>Category:       kern
>Synopsis:       No need to read CPUID if model/family indicated CPU has invariant TSC
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 15 08:45:00 +0000 2026
>Originator:     RVP
>Release:        11.99.7
>Organization:
>Environment:
NetBSD CoreBook.local 11.99.7 NetBSD 11.99.7 (COREBOOK_DIAG) #0: Sat Aug 15 04:21:15 UTC 2026  [email protected]:/tmp/obj/usr/src/sys/arch/amd64/compile/COREBOOK_DIAG amd64
>Description:
If the CPU model and family indicate a invariant TSC, don't bother
checking the CPUID again. This is a teeny optimization.
>How-To-Repeat:

>Fix:
```
--- sys/arch/x86/x86/tsc.c.orig	2026-03-01 13:57:41.000000000 +0000
+++ sys/arch/x86/x86/tsc.c	2026-03-19 04:50:09.497920788 +0000
@@ -153,6 +153,9 @@
 		}
 	}
 
+	if (invariant)
+		return true;
+
 	/*
 	 * The best way to check whether the TSC counter is invariant or not
 	 * is to check CPUID 80000007.
```
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.