Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Disabling HyperThreading?

2 views
Skip to first unread message

Jack L.

unread,
May 5, 2010, 11:41:06 AM5/5/10
to
sysctl machdep.hyperthreading_allowed=0 will disable it.

On Mon, Apr 26, 2010 at 6:48 AM, John Baldwin <j...@freebsd.org> wrote:
> On Monday 26 April 2010 5:59:19 am oklahoma wrote:
>> Hubert Tournier wrote:
>> >
>> > I forgot to specify that the system is a remote dedicated server, for
> which
>> > i have no physical access.
>> >
>> > I could rent a virtual KVM in order to try to access its BIOS settings,
> but
>> > i'm not sure this would work.
>> >
>> > Any other software solution?
>> if the server is dedicated entirely to you, ask your colo support to
>> disable it for you.
>> other thing i find was
>>
>> machdep.hlt_cpus
>>
>> is suppose to tell the scheduler that there is extra cores but not to use
> them.
>> try to enable and see with top is there app that use logical cores.
>
> You can manually disable any CPU (except for the boot CPU), via
> 'hint.lapic.X.disabled=1' in loader.conf.  You can find the APIC IDs to use in
> place of 'X' in dmesg.
>
> --
> John Baldwin
> _______________________________________________
> freeb...@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-smp
> To unsubscribe, send any mail to "freebsd-smp...@freebsd.org"
>
_______________________________________________
freeb...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-smp
To unsubscribe, send any mail to "freebsd-smp...@freebsd.org"

Hubert Tournier

unread,
May 5, 2010, 7:26:27 PM5/5/10
to

Hello,


Jack L.-3 wrote:
>
> sysctl machdep.hyperthreading_allowed=0 will disable it.
>

Thank you for this lead.

It gives the following result on my system:
sysctl: unknown oid 'machdep.hyperthreading_allowed'

Searching a little bit, i found 2 references to this OID in the kernel
source code:
/usr/src/sys/amd64/amd64/mp_machdep.c
/usr/src/sys/i386/i386/mp_machdep.c

Maybe it's missing because (as i read in these files):
SCHED_ULE doesn't allow enabling/disabling HT cores at run-time.

I'm not sure i could use the OID in /boot/loader.conf however?

I also see in the source code that the default is to enable HT cores:
static int hyperthreading_allowed = 1;

So i will test a custom kernel with this disabled.

For reference, here is the CPU i use:
CPU: Intel(R) Xeon(R) CPU X5650 @ 2.67GHz (2666.65-MHz K8-class
CPU)
Origin = "GenuineIntel" Id = 0x206c2 Stepping = 2
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>

Features2=0x9ee3fd<SSE3,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,<b17>,DCA,SSE4.1,SSE4.2,POPCNT>
AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
AMD Features2=0x1<LAHF>
TSC: P-state invariant
FreeBSD/SMP: Multiprocessor System Detected: 24 CPUs
FreeBSD/SMP: 2 package(s) x 6 core(s) x 2 SMT threads

Best regards,

Hubert
--
View this message in context: http://old.nabble.com/Disabling-HyperThreading--tp28357071p28467645.html
Sent from the freebsd-smp mailing list archive at Nabble.com.

Hubert Tournier

unread,
May 6, 2010, 4:57:38 PM5/6/10
to

Hello,


Hubert Tournier wrote:
>
> I also see in the source code that the default is to enable HT cores:
> static int hyperthreading_allowed = 1;
>
> So i will test a custom kernel with this disabled.
>

Well, it's not enough, i still have my 24 CPUs.

I'll give a try to John's way of disabling CPUs, hoping to avoid disabling
the wrong ones.

Best regards,

Hubert
--
View this message in context: http://old.nabble.com/Disabling-HyperThreading--tp28357071p28479447.html

Hubert Tournier

unread,
May 9, 2010, 4:55:24 PM5/9/10
to

Hello,


Hubert Tournier wrote:
>
> I'll give a try to John's way of disabling CPUs, hoping to avoid disabling
> the wrong ones.
>

With the kern.sched.topology_spec OID, i had the confirmation that the
hyperthreading "other halves" of the CPU were the even ones:

#sysctl kern.sched.topology_spec
kern.sched.topology_spec: <groups>
<group level="1" cache-level="0">
<cpu count="24" mask="0xffffff">0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23</cpu>
<flags></flags>
<children>
<group level="3" cache-level="2">
<cpu count="12" mask="0xfff">0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11</cpu>
<flags></flags>
<children>
<group level="5" cache-level="1">
<cpu count="2" mask="0x3">0, 1</cpu>
<flags><flag name="THREAD">SMT group</flag>
</flags>
</group>
<group level="5" cache-level="1">
<cpu count="2" mask="0xc">2, 3</cpu>
<flags><flag name="THREAD">SMT group</flag>

Hubert Tournier wrote:
>
> My use case is a VirtualBox dedicated server where I believe using HTT
> might be problematic because:
> 1/ running two busy virtual machines on the same physical core could
> severely impact their performance
> 2/ the virtualizer might expose the real CPU to the virtual machines,
> which might in turn attempt to use HTT for themselves
>

2/ The real CPU (or at least its HTT feature) is exposed to the virtual
machines, but they don't attempt to use HyperThreading (or at least the
FreeBSD guest that I use).

Looking at the differences between my FreeBSD host and guest, i noticed that
there were 2 additional OID in the guest:
machdep.hlt_logical_cpus: 0
machdep.logical_cpus_mask: 254

The vCPU given to the guest appears as cores: "FreeBSD/SMP: 1 package(s) x 8
core(s)".

1/ The risk is confirmed by the now-oracle engineers.

I think i will leave the hyperthreading enabled and just be careful not to
use more vCPU than the number of cores.

Thanks to all of you for your help and time.

Best regards,

Hubert
--
View this message in context: http://old.nabble.com/Disabling-HyperThreading--tp28357071p28505250.html

0 new messages