[Ukfreebsd] Disabling hyperthreading on Intel CPUs

andy thomas andy at time-domain.co.uk
Wed Jan 26 11:41:57 GMT 2011


On Wed, 26 Jan 2011, Robert N. M. Watson wrote:

>
> On 26 Jan 2011, at 09:44, andy thomas wrote:
>
>> On Wed, 26 Jan 2011, Mark Blackman wrote:
>>
>>> On Wed, 26 Jan 2011 09:33:12 -0000, andy thomas <andy at time-domain.co.uk> wrote:
>>>
>>>> I want to disable HT because it can impact performance when used to execute code compiled for parallel execution across multiple PCs.
>>>
>>> So your code is so efficient at utilizing execution resources, (i.e. not really ever stalling), that the HT overhead slows you down?
>>
>> I suspect it is! So that's why we'd like to find out by running benchmarks over maybe 150 PCs but fiddling with the BIOS on this many machines is not an enjoyable use of my time. If it can't be disabled via sysctl, then we may well have to do this one weekend and as you have hinted, it could all be a massive waste of time if there's no difference in the results!
>
> FreeBSD treats threads as CPU cores, so you should be able to disable them in device.hints using lines like:
>
>  hint.apic.0.disabled="1"
>
> Of course, this requires awareness of the specific topology of a machine to decide which APICs to disable. You can query the scheduler's idea of the topology (which is derived from ACPI, usually, which is sometimes right), by reading the sysctl kern.sched.topology_spec. What with packages, cores, threads, ... scheduler policy is becoming more and more tricky. For some of the SMP work I'm doing for Juniper, we want to have software worker threads for each hardware package, rather than each core, or each thread, etc, and then direct work from within the same package to its dedicated worker thread. Then non-uniform memory access kicks in..

I need to find out more about the specific hardware and see what features 
their CPUs have/supprt.

> If they're all identical boxes, then you can figure it out on one, and then apply the device.hints to all of them (I think it those lines can also go into loader.conf, if that's more convenient for you).

That's very helpful - the quad-core boxes are all the same HP model and 
they boot the same image over the network via PXE from a boot server so 
there's only one /boot/loader.conf to update. The HP dual-core boxes boot 
the same image in the same way but there are two generations of these with 
slightly different hardware so obviously it will be more complex to 
support 3 hardware ranges.

I think I'll run some benchmarks on a group of 4 PCs with & without HT 
(set via the BIOS) to see whether it is worth pursuing the 'no HT' idea 
any further.

Thanks for your comments,

Andy


More information about the Ukfreebsd mailing list