linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* detecting hyperthreading in linux 2.4.19
@ 2003-01-09 20:02 Jason Lunz
  2003-01-09 21:37 ` James Cleverdon
  2003-01-10  0:20 ` Dave Jones
  0 siblings, 2 replies; 15+ messages in thread
From: Jason Lunz @ 2003-01-09 20:02 UTC (permalink / raw)
  To: linux-kernel

Is there a way for a userspace program running on linux 2.4.19 to tell
the difference between a single hyperthreaded xeon P4 with HT enabled
and a dual hyperthreaded xeon P4 with HT disabled? The /proc/cpuinfos
for the two cases are indistinguishable.

Jason


^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: detecting hyperthreading in linux 2.4.19
@ 2003-01-09 22:29 Kamble, Nitin A
  0 siblings, 0 replies; 15+ messages in thread
From: Kamble, Nitin A @ 2003-01-09 22:29 UTC (permalink / raw)
  To: lunz, jamesclv, linux-kernel
  Cc: Nakajima, Jun, Saxena, Sunil, Mallick, Asit K, Schlobohm, Bruce

Hi James,
I have posted a patch for this on LKML. Please have look at:
http://www.uwsg.indiana.edu/hypermail/linux/kernel/0301.0/1886.html
http://www.uwsg.indiana.edu/hypermail/linux/kernel/0301.0/1887.html

It should solve the problem you are trying to solve.

Nitin

> -----Original Message-----
> From: Jason Lunz [mailto:lunz@falooley.org]
> Sent: Thursday, January 09, 2003 1:57 PM
> To: linux-kernel@vger.kernel.org
> Subject: Re: detecting hyperthreading in linux 2.4.19
> 
> jamesclv@us.ibm.com said:
> > I don't know of any way to do this in userland.  The whole point is
> > that the sibling processors are supposed to look like real ones.
> 
> That's unfortunately not always true. I'm writing a program that will
> run on a system that will be doing high-load routing. Testing has
shown
> that we get better performance when binding each NIC's interrupts to a
> separate physical processor using /proc/irq/*/smp_affinity (especially
> when all the interrupts would hit the first CPU, another problem i've
> yet to address). That only works for real processors, though, not
> HT siblings.
> 
> I'm writing a program to run on machines of unknown (by me)
> configuration, that will spread out the NIC interrupts appropriately.
> So userspace needs to know the difference, at least until interrupts
can
> be automatically distributed by the kernel in a satisfactory way.
> 
> Jason

^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: detecting hyperthreading in linux 2.4.19
@ 2003-01-09 23:26 Pallipadi, Venkatesh
  0 siblings, 0 replies; 15+ messages in thread
From: Pallipadi, Venkatesh @ 2003-01-09 23:26 UTC (permalink / raw)
  To: Jason Lunz, linux-kernel


Systems running the latest RH, SuSE releases, with standard smp kernel
should see some entries in /proc/cpuinfo, which gives information about
HT configuration on the system. The latest 2.5 kernel also has similar
information in /proc/cpuinfo.
The entries look something like:
Physical processor ID   : 0
Number of siblings      : 2

Unfortunately, 2.4.19 doesn't have such information. One possible
workaround is to check big enough 'dmesg' and look for cpu_sibling_map.
That tells you the mapping of logical processors to physical package. Or
you can have a init script like this (attached) in place, to run at boot
time, so that you have a better chance of finding these particular
messages in log (without overflowing).

HTH,
Venkatesh

-------------------
#!/bin/sh
# checkht kernel RC file.
#
# chkconfig: 35 98 98
# description: check for hyperthreaded CPUs

HASHT=`/bin/dmesg | /bin/grep cpu_sibling_map`

if [ -n "$HASHT" ]; then
        /bin/echo "Machine is running HT"
        /bin/echo 1 > /etc/hyperthreaded
else
        /bin/echo "Machine isn't running HT"
        /bin/echo 0 > /etc/hyperthreaded
Fi
--------------


> -----Original Message-----
> From: Jason Lunz [mailto:lunz@falooley.org] 
> Sent: Thursday, January 09, 2003 12:03 PM
> To: linux-kernel@vger.kernel.org
> Subject: detecting hyperthreading in linux 2.4.19
> 
> 
> Is there a way for a userspace program running on linux 2.4.19 to tell
> the difference between a single hyperthreaded xeon P4 with HT enabled
> and a dual hyperthreaded xeon P4 with HT disabled? The /proc/cpuinfos
> for the two cases are indistinguishable.
> 
> Jason
> 
> -
> To unsubscribe from this list: send the line "unsubscribe 
> linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: detecting hyperthreading in linux 2.4.19
@ 2003-01-10  8:16 Pallipadi, Venkatesh
  2003-01-10  8:43 ` Mikael Pettersson
  0 siblings, 1 reply; 15+ messages in thread
From: Pallipadi, Venkatesh @ 2003-01-10  8:16 UTC (permalink / raw)
  To: Mikael Pettersson, jamesclv; +Cc: Jason Lunz, linux-kernel


> -----Original Message-----
> From: Mikael Pettersson [mailto:mikpe@csd.uu.se]
> 
> My performance monitoring counters driver uses this approach 
> in kernel-space
> using smp_call_function(). I don't use the siblings tables 
> because they suck :-)
> [I don't think they distinguish between logical CPUs #0 and 
> #1, and they aren't
> exported to modules. The CPUID check is simple and portable 
> across kernel versions.]

I believe it is better to use a OS interface to find out HT, rather than 
using CPUID. The reason being, it is possible to have HT disabled, in OS,
even after processor and the BIOS supports it. 
1) Consider the case when processor and BIOS supports HT, but linux
was booted with "noht" boot option (now I am not sure whether that option is 
there in 2.4.19. But is is certainly there in some other kernels).
2) What about some other kernel which is totally ignorant about HT, and 
doesn't initialize logical processor (kernel which looks at MPS in place
of ACPI)
I think, in both these cases cpuid can still say HT is present.

I know that sibling table is not exported. But I couldn't get your other
comment about sibling table "they distinguish between logical CPUs #0 and #1:"
Can you elaborate..

Thanks,
-Venkatesh

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2003-01-10 12:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-09 20:02 detecting hyperthreading in linux 2.4.19 Jason Lunz
2003-01-09 21:37 ` James Cleverdon
2003-01-09 21:54   ` John Bradford
2003-01-10  0:16     ` James Cleverdon
2003-01-10  0:58     ` Mike Dresser
2003-01-09 21:57   ` Jason Lunz
2003-01-10 12:29     ` Mark Hounschell
2003-01-10  7:05   ` Mikael Pettersson
2003-01-10 11:05     ` Dave Jones
2003-01-10 11:19       ` Mikael Pettersson
2003-01-10  0:20 ` Dave Jones
  -- strict thread matches above, loose matches on Subject: below --
2003-01-09 22:29 Kamble, Nitin A
2003-01-09 23:26 Pallipadi, Venkatesh
2003-01-10  8:16 Pallipadi, Venkatesh
2003-01-10  8:43 ` Mikael Pettersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).