Re: [PATCH 0/4] drivers core: Introduce CPU type sysfs interface
From: Ricardo Neri
Date: Tue Oct 06 2020 - 22:48:23 EST
On Tue, Oct 06, 2020 at 09:51:53AM +0100, Qais Yousef wrote:
> Hi Ricardo
Hi Qais,
Thanks for chiming in.
>
> Adding some people who might be interested.
>
> On 10/02/20 18:17, Ricardo Neri wrote:
> > Hybrid CPU topologies combine processors with more than one type of
> > micro-architecture. Hence, it is possible that individual CPUs support
> > slightly different features (e.g., performance counters) and different
> > performance properties. Thus, there may be user space entities interested
> > in knowing the topology of the system based on the types of available
> > CPUs.
> >
> > Currently, there exists an interface for the CPU capacity (/sys/devices/
> > system/cpu/cpuX/cpu_capacity). However, CPU capacity does not always map
> > to CPU types (by the way, I will submit a separate series to bring such
> > interface to x86).
>
> Why do you need to do this mapping?
>
> >
> > This series proposes the new interface /sys/devices/system/cpu/types
> > which, in hybrid parts, creates a subdirectory for each type of CPU.
> > Each subdirectory contains a CPU list and a CPU map that user space can
> > query.
>
> Why user space needs to query this info?
>
> The rationale is missing the intention behind all of this. It seems you're
> expecting software to parse this info and take decisions based on that?
I propose this interface to be consumed for application or libraries
wanting to know the topology of the system. Perhaps, a utility program
that wants to depict CPUs by type. Another example is a policy manager
wanting to create a cgroup cpuset of CPUs of a given type for
performance reasons. Similarly, a program may want to affinitize itself
to a type of CPU, if for instance certain performance events are only
counted on a given CPU type.
Also, an interface with cpumasks makes it convenient for userspace to
not have to traverse each CPU individually.
a) add the type of each CPU in /proc/cpuinfo
b) add the type of each CPU in /sys/devices/system/cpu/cpu#/type
c) for performance, derive the CPU type from
/sys/devices/system/cpu/cpu#/cpu_capacity
d) add an interface similar to what I propose in this series.
None of this imply that certain instructions will be able to run on one
type of CPU but not on another. Instead, better performance may be
obtained on one type CPU vs another.
Thanks and BR,
Ricardo