Re: [PATCH 1/2] pseries/smp: export the smt level in the SYS FS.

From: Srikar Dronamraju
Date: Tue Apr 18 2023 - 13:25:53 EST


* Laurent Dufour <ldufour@xxxxxxxxxxxxx> [2023-04-13 17:38:51]:

> On 13/04/2023 15:37:59, Michael Ellerman wrote:
> > Hi Laurent,
> >
> > Laurent Dufour <ldufour@xxxxxxxxxxxxx> writes:
> >> There is no SMT level recorded in the kernel neither in user space.
> >> Indeed there is no real constraint about that and mixed SMT levels are
> >> allowed and system is working fine this way.
> >>
> >> However when new CPU are added, the kernel is onlining all the threads
> >> which is leading to mixed SMT levels and confuse end user a bit.
> >>
> >> To prevent this exports a SMT level from the kernel so user space
> >> application like the energy daemon, could read it to adjust their settings.
> >> There is no action unless recording the value when a SMT value is written
> >> into the new sysfs entry. User space applications like ppc64_cpu should
> >> update the sysfs when changing the SMT level to keep the system consistent.
> >>
> >> Suggested-by: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx>
> >> Signed-off-by: Laurent Dufour <ldufour@xxxxxxxxxxxxx>
> >> ---
> >> arch/powerpc/platforms/pseries/pseries.h | 3 ++
> >> arch/powerpc/platforms/pseries/smp.c | 39 ++++++++++++++++++++++++
> >> 2 files changed, 42 insertions(+)
> >
> > There is a generic sysfs interface for smt in /sys/devices/system/cpu/smt
> >
> > I think we should be enabling that on powerpc and then adapting it to
> > our needs, rather than adding a pseries specific file.
>
> Thanks Michael, I was not aware of this sysfs interface.
>
> > Currently the generic code is only aware of SMT on/off, so it would need
> > to be taught about SMT4 and 8 at least.
>
> Do you think we should limit our support to SMT4 and SMT8 only?

smt2 is also a valid already supported configuration and we are evaluating
smt6 mode based on some inputs from ISV teams.

So I believe having a value for all modes would be good.

>
> > There are already hooks in the generic code to check the SMT level when
> > bringing CPUs up, see cpu_smt_allowed(), they may work for the pseries
> > hotplug case too, though maybe we need some additional logic.
> >
> > Wiring up the basic support is pretty straight forward, something like
> > the diff below.
>

--
Thanks and Regards
Srikar Dronamraju