Re: Distinguish real vs. virtual CPUs?

From: Bill Davidsen
Date: Tue Mar 22 2005 - 16:24:20 EST


Pallipadi, Venkatesh wrote:



This is 2xXeonHT, is, 4 cpus on 2 packages:

cat /proc/cpuinfo:

processor : 0
...
physical id : 0
siblings : 2
core id : 0
cpu cores : 1

processor : 1
...
physical id : 0
siblings : 2
core id : 0
cpu cores : 1

processor : 2
...
physical id : 3
siblings : 2
core id : 3
cpu cores : 1

processor : 3
...
physical id : 3
siblings : 2
core id : 3
cpu cores : 1

So something like:

cat /proc/cpuinfo | grep 'core id' | uniq | wc -l

would give you the number of packages or 'real cpus'. Then you have to
choose which ones are unrelated. Usually evens are siblings of odds, but
I won't trust on it...



Number of unique physical id will tell you the number of physical CPU
packages in the system.

For some Intel processors... Tom Vier just posted his cpuinfo which shows all of his processors, which he notes are in separate sockets, are identified as physical zero. I didn't find any Intel systems which lacked unique physical ID, but clearly that's not true everywhere.

It's not clear if that's bizarre practice on AMD system boards or if it's mis-reported. Of course Tom may be running a NUMA setup, in which case I won't guess what's expected to be displayed. I've added him to the CC list, in hopes of comment.

Number of unique core id will tell you the total number of CPU cores in
the system.
Number of processor will tell you the total number of logical CPUs on
the system.

Then to find out the matching pairs, - to pair up all HT siblings on a core: Processors that have same "core
id" are HT siblings in a core.
- to pair up all CPUs in a package: Processors that have same "physical
id" are all the CPUs belonging to the same physical package.


--
-bill davidsen (davidsen@xxxxxxx)
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/