RE: Distinguish real vs. virtual CPUs?

From: Pallipadi, Venkatesh
Date: Mon Mar 21 2005 - 23:41:26 EST




>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.
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.

Thanks,
Venki
-
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/