How can I disable hyperthreads, but NOT smp ?

2011-09-20 Thread Jason Usher
FreeBSD 6.4-RELEASE system with two physical CPUs, each of which are HT 
capable.  From dmesg:

cpu0 (BSP): APIC ID: 0
cpu1 (AP): APIC ID: 1
cpu2 (AP): APIC ID: 6
cpu3 (AP): APIC ID: 7

I also see this:

machdep.hyperthreading_allowed: 0

The problem is, I have reason to believe that my workload benefits greatly from 
SMP, but is not playing nicely with hyperthreading.  That is, it is trying to 
farm out 4 things at a time to a cpu setup that really is only able to do two 
things at a time.

How can I disable HT completely, but still retain ALL the benefits of SMP ?

Thanks.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How can I disable hyperthreads, but NOT smp ?

2011-09-20 Thread Richard Collyer

On 20/09/2011 21:34, Jason Usher wrote:

FreeBSD 6.4-RELEASE system with two physical CPUs, each of which are HT 
capable.  From dmesg:

cpu0 (BSP): APIC ID: 0
cpu1 (AP): APIC ID: 1
cpu2 (AP): APIC ID: 6
cpu3 (AP): APIC ID: 7

I also see this:

machdep.hyperthreading_allowed: 0

The problem is, I have reason to believe that my workload benefits greatly from 
SMP, but is not playing nicely with hyperthreading.  That is, it is trying to 
farm out 4 things at a time to a cpu setup that really is only able to do two 
things at a time.

How can I disable HT completely, but still retain ALL the benefits of SMP ?

Thanks.


It's usually a setting in the BIOS to disable Hyperthreading then 
reconfigure the kernel to only use 2 cores (which it might do 
automatically).


Hyperthreading is outside the world of FreeBSD. As far as it knows there 
is still 4 logical processors. Disabling hyperthreading it should see 
2 LPs.


Richard

--
Richard Collyer
Blue Apex Ltd
07900 997 380

Registered as a company in England and Wales (Reg Number: 05982514).
Registered Address: 42 King Richards Hill, Earl Shilton, Leicester, LE9 7EY



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 6480 (20110920) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How can I disable hyperthreads, but NOT smp ?

2011-09-20 Thread RW
On Tue, 20 Sep 2011 22:28:18 +0100
Richard Collyer wrote:

 On 20/09/2011 21:34, Jason Usher wrote:
  FreeBSD 6.4-RELEASE system with two physical CPUs, each of which
  are HT capable.  From dmesg:
 
  cpu0 (BSP): APIC ID: 0
  cpu1 (AP): APIC ID: 1
  cpu2 (AP): APIC ID: 6
  cpu3 (AP): APIC ID: 7
 
  I also see this:
 
  machdep.hyperthreading_allowed: 0

  How can I disable HT completely, but still retain ALL the benefits
  of SMP ?
 
  Thanks.
 
 It's usually a setting in the BIOS to disable Hyperthreading then 
 reconfigure the kernel to only use 2 cores (which it might do 
 automatically).
 
 Hyperthreading is outside the world of FreeBSD. As far as it knows
 there is still 4 logical processors.

It's not completely outside; an OS should still be able to determine
which logical CPUs are on the same core. And, presumably
machdep.hyperthreading_allowed=0 tells  the scheduler not to use the
additional logical CPUs. I'm wondering if hyperthreading is unused, but
the full set of logical CPU is still displayed, or perhaps 6.4 is
failing to recognise the hardware.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How can I disable hyperthreads, but NOT smp ?

2011-09-20 Thread b. f.
 On 20/09/2011 21:34, Jason Usher wrote:
  FreeBSD 6.4-RELEASE system with two physical CPUs, each of which are HT 
  capable.  From dmesg:
 
  cpu0 (BSP): APIC ID: 0
  cpu1 (AP): APIC ID: 1
  cpu2 (AP): APIC ID: 6
  cpu3 (AP): APIC ID: 7
 
  I also see this:
 
  machdep.hyperthreading_allowed: 0
 
  The problem is, I have reason to believe that my workload benefits greatly 
  from SMP, but is not playing nicely with hyperthreading.  That is, it is 
  trying to farm out 4 things at a time to a cpu setup that really is only 
  able to do two things at a time.
 
  How can I disable HT completely, but still retain ALL the benefits of SMP ?

If you are sure about your machine's hardware, and that
machdep.hyperthreading_allowed is really set to 0 in loader.conf(5),
then you may want to glance at:

http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/i386/mp_machdep.c?annotate=1.252.2.16

to see where the enforcement of this tunable is failing, and file a
PR.  Although I have not tried to use them, there are supposed to be
alternative mechanisms to disable cpus, or at least to ignore them in
certain circumstances:

--on recent versions of FreeBSD ( 6) you could use cpuset(1) to
ignore some of them in certain circumstances;
--on older versions of FreeBSD ( 9) you could use the sysctl
machdep.hlt_logical_cpus=1 (see smp(4));
--on older versions of FreeBSD ( 9) you could use the sysctl
machdep.hlt_cpus to add a bitmap of the logical cpus that you want to
disable (see smp(4));
--you can use the loader hint hint.lapic.X.disable=1 to disable a cpu
with APIC ID X.

But note the warnings in the Andriy Gapon's commit message and
UPDATING entry for:

http://svnweb.FreeBSD.org/base?view=revisionrevision=222853



 It's usually a setting in the BIOS to disable Hyperthreading then
 reconfigure the kernel to only use 2 cores (which it might do
 automatically).

 Hyperthreading is outside the world of FreeBSD. As far as it knows there
 is still 4 logical processors. Disabling hyperthreading it should see
 2 LPs.

This isn't completely true.  Yes, many systems have a BIOS setting to
toggle hyperthreading on and off.  The loader tunable can be used for
those machines that don't have such a setting, or for remote machines
for which it is not convenient to change the setting.  But FreeBSD
attempts to determine if any of the logical cpus are hyperthreads, so
that the loader tunable machdep.hyperthreading_allowed can be enforced
(it was introduced a long time ago when a security hole was discovered
with some early hyperthread implementations), and also because
hyperthreads are treated differently from physical cpus with regard to
interrupt handling, scheduling (with ULE), ACPI, PMC, etc.  So FreeBSD
is supposed to be hyperthread-aware.

b.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org