NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Disabling hyperthreading on NetBSD



On Wed, Nov 25, 2026 at 10:29:57 +0000, Stephen Borrill wrote:

> On Sat, 21 Nov 2026, Ben Collver wrote:
> > On Sun, Nov 22, 2026 at 04:48:22AM +0100, Ellie wrote:
> > > Is there some easy way, e.g. a simple sysctl call, to disable hyperthreading
> > > on NetBSD?
> > 
> > Here's what DDG turned up for me:
> > 
> > Should you not be able to disable SMT/HT in your BIOS, you can put
> > smtoff=YES in your /etc/rc.conf file.
> > 
> > <https://man.netbsd.org/rc.conf.5>
> 
> That will offline all CPUs except for 0, leaving you running in uniprocessor
> mode (like booting with boot -1). Take a look at /etc/rc.d/smtoff for what
> it does. I don't think that's what you want.

No, smtoff DTRT :)  It looks at SMT ID, not Core ID.
E.g. on my old intel mac mini:

# for cpu in $(jot $(sysctl -n hw.ncpu) 0); do cpuctl identify $cpu | egrep '(Core|SMT) ID'; done
cpu0: Core ID 0
cpu0: SMT ID 0
cpu1: Core ID 1
cpu1: SMT ID 0
cpu2: Core ID 0
cpu2: SMT ID 1
cpu3: Core ID 1
cpu3: SMT ID 1

-uwe


Home | Main Index | Thread Index | Old Index