Re: [PATCH] PM / EM: Expose the Energy Model in debugfs

From: Greg KH
Date: Tue Jan 22 2019 - 10:55:01 EST


On Tue, Jan 22, 2019 at 03:34:14PM +0000, Quentin Perret wrote:
> On Monday 07 Jan 2019 at 12:26:08 (+0000), Quentin Perret wrote:
> > diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
> > index d9dc2c38764a..8ef48daa62ff 100644
> > --- a/kernel/power/energy_model.c
> > +++ b/kernel/power/energy_model.c
> > @@ -10,6 +10,7 @@
> >
> > #include <linux/cpu.h>
> > #include <linux/cpumask.h>
> > +#include <linux/debugfs.h>
> > #include <linux/energy_model.h>
> > #include <linux/sched/topology.h>
> > #include <linux/slab.h>
> > @@ -23,6 +24,88 @@ static DEFINE_PER_CPU(struct em_perf_domain *, em_data);
> > */
> > static DEFINE_MUTEX(em_pd_mutex);
> >
> > +#ifdef CONFIG_DEBUG_FS
> > +static struct dentry *rootdir;
> > +
> > +static int em_debug_create_cs(struct em_cap_state *cs, struct dentry *pd)
> > +{
> > + struct dentry *d;
> > + char name[24];
> > +
> > + snprintf(name, sizeof(name), "cs:%lu", cs->frequency);
> > +
> > + d = debugfs_create_dir(name, pd);
> > + if (!d)
> > + return -ENOMEM;
> > +
> > + if (!debugfs_create_ulong("frequency", 0444, d, &cs->frequency))
> > + return -ENOMEM;
>
> Looking at the patches Greg just sent I assume all this is wrong.

Yes it is :)

> I'll send a v2 without the 'if' all over.

That would be wonderful, thanks.

greg k-h