Re: Is sysfs the right place to get cache and CPU topology info?

Andi Kleen
2008-07-02T15:14:17Z

Nathan Lynch wrote:
> Andi Kleen wrote:
>> Andrew Morton <akpm@linux-foundation.org> writes:
>>> sysfs is part of the kernel ABI. We should design our interfaces there
>>> as carefully as we design any others.
>> The basic problem is that sysfs exports an internal kernel object model
>> and these tend to change. To really make it stable would require
>> splitting it into internal and presented interface.
>
> True, but... /sys/devices/system/cpu has been there since around 2.6.5
> iirc. A google code search for that path shows plenty of programs
> (including hal) that hard-code it. Exposed object model or not,
> changing that path would break lots of software.

Yes it would.

But Greg is making noises of getting rid of sysdevs and it wouldn't
surprise me if that ended up being user visible since most object
model changes end up being visible.

>
>
>> I would be all
>> for it, but it doesn't seem realistic to me currently. If we cannot
>> even get basic interfaces like the syscall capability stable how would
>> you expect to stabilize the complete kobjects?
>>
>> And the specific problem with the x86 cache sysfs interface is that it's so
>> complicated that no human can really read it directly. This means to
>> actually use it you need some kind of frontend (i have a cheesy
>> lscache script for this).
>
> Human readability is nice,

When it's not human readable, then it's usually also not Joe Normal Programmer
usable.

> but a more important issue IMO is whether
> the cache interface can be considered stable enough for programs to
> rely on it. I notice there's no entry for it in Documentation/ABI.

For x86 it follows closely the Intel CPUID architectural specification, which
can be considered stable (at least for Intel, other vendors do not
necessarily implement it. But for AMD it is faked at least)

-Andi