Re: [PATCH] tools/lib/thermal: Add a thermal library

From: srinivas pandruvada
Date: Fri Feb 04 2022 - 18:04:05 EST


On Fri, 2022-02-04 at 23:16 +0100, Daniel Lezcano wrote:
>
> Hi Srinivas,
>
> On 04/02/2022 20:32, srinivas pandruvada wrote:
> > On Fri, 2022-02-04 at 18:11 +0100, Rafael J. Wysocki wrote:
> > > CC Rui and Srinivas
> > >
> > > On Fri, Feb 4, 2022 at 5:15 PM Daniel Lezcano
> > > <daniel.lezcano@xxxxxxxxxx> wrote:
> > > >
> > > > The thermal framework implements a netlink notification
> > > > mechanism
> > > > to
> > > > be used by the userspace to have a thermal configuration
> > > > discovery,
> > > > trip point changes or violation, cooling device changes
> > > > notifications,
> > > > etc...
> > > >
> > > > This library provides a level of abstraction for the thermal
> > > > netlink
> > > > notification allowing the userspace to connect to the
> > > > notification
> > > > mechanism more easily. The library is callback oriented.
> > > >
> > > > As it is the very first iteration, the API may be subject to
> > > > changes. For this reason, the documentation will be provided
> > > > after
> > > > those are stabilized.
> > >
> > > So shouldn't this be an RFC?
> > >
> > > Also, I would prefer documentation to be provided or at least
> > > some
> > > intended usage examples to be given.
> > >
> > > > Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
> > > > ---
> > > >   tools/Makefile                           |  14 +-
> > > >   tools/include/uapi/linux/thermal.h       |  91 ++++++
> > This is duplicating the file at include/uapi/linux. I know this is
> > done
> > for other tools also. In my use I am copying and using symbolic
> > link.
>
> Why copy and symbolic link ? Should it be create a symbolic link only
> ?
Correct, symbolic only by making change in Makefile:

$(OUTPUT)include/linux/thermal.h:
../../../../include/uapi/linux/thermal.h
mkdir -p $(OUTPUT)include/linux 2>&1 || true
ln -sf $(CURDIR)/../../../../include/uapi/linux/thermal.h $@

Thanks,
Srinivas

>
> > BTW I have potential usage of netlink targeted for next release in
> > linux tools.
> >
> > https://github.com/spandruvada/linux-kernel/blob/intel-sst/tools/power/x86/intel-speed-select/hfi-events.c
> >
> > I can replace with libthermal calls once ready. I will check the
> > code
> > below next week.
>
> Great, thanks!
>
> In attachment a test file as an example of the library usage.
>
>