2005-12-14 03:11:07

by Zhang, Yanmin

[permalink] [raw]
Subject: [PATCH] Export cpu topology for IA32 and x86_64 by sysfs

The patch exports the cpu topology info through sysfs on ia32/x86_64
machines. The info is similar to /proc/cpuinfo.

The exported items are:
/sys/devices/system/cpu/cpuX/topology/physical_package_id(representing
the physical package id of cpu X)
/sys/devices/system/cpu/cpuX/topology/core_id (representing the cpu core
id to cpu X)
/sys/devices/system/cpu/cpuX/topology/thread_siblings (representing the
thread siblings to cpu X)
/sys/devices/system/cpu/cpuX/topology/core_siblings (represeting the
core siblings to cpu X)

Signed-off-by: Zhang Yanmin <[email protected]>


Attachments:
cpu_topology_2.6.14_mm1_ia32_x86_64.v6.patch (3.48 kB)
cpu_topology_2.6.14_mm1_ia32_x86_64.v6.patch

2005-12-14 03:51:13

by Andi Kleen

[permalink] [raw]
Subject: Re: [discuss] [PATCH] Export cpu topology for IA32 and x86_64 by sysfs

On Wed, Dec 14, 2005 at 11:11:00AM +0800, Zhang, Yanmin wrote:
> The patch exports the cpu topology info through sysfs on ia32/x86_64
> machines. The info is similar to /proc/cpuinfo.
>
> The exported items are:
> /sys/devices/system/cpu/cpuX/topology/physical_package_id(representing
> the physical package id of cpu X)
> /sys/devices/system/cpu/cpuX/topology/core_id (representing the cpu core
> id to cpu X)
> /sys/devices/system/cpu/cpuX/topology/thread_siblings (representing the
> thread siblings to cpu X)
> /sys/devices/system/cpu/cpuX/topology/core_siblings (represeting the
> core siblings to cpu X)

Hmm, I'm not sure it is that useful. Did someone decide to move
all information from cpuinfo into sysfs?

And if it's done I think it needs Documentation somewhere.

Anyways, the notifier is wrong. You need to handle CPU_UP_CANCELLED
too.

And you could probably shrink the code size of the show function
in half by switching data instead of functions.


-Andi