lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 4 Apr 2022 17:02:23 +0100
From:   Ionela Voinescu <ionela.voinescu@....com>
To:     Lukasz Luba <lukasz.luba@....com>
Cc:     linux-kernel@...r.kernel.org, dietmar.eggemann@....com,
        Pierre.Gondois@....com, viresh.kumar@...aro.org, rafael@...nel.org,
        daniel.lezcano@...aro.org, linux-pm@...r.kernel.org,
        mka@...omium.org, nm@...com, sboyd@...nel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org, cristian.marussi@....com,
        sudeep.holla@....com, matthias.bgg@...il.com
Subject: Re: [RESEND][PATCH 5/8] PM: EM: Remove old debugfs files and print
 all 'flags'

Hi Lukasz,

IMO the debugfs files were fine as they were:
 - They offered information on units and inefficiencies without having
   to dig into the code to see which bit is for which flag.
 - I believe the artificial EM power values fit under bogoWatts as unit,
   so that part would still be correct.

On the other hand, your new file offers more information: we'd be able
to see in debugfs whether we're dealing with an artificial EM, despite
needing a bit more looking over the code to understand the output.

I don't have a strong opinion and the code looks fine, so:

Reviewed-by: Ionela Voinescu <ionela.voinescu@....com>


On Monday 21 Mar 2022 at 09:57:26 (+0000), Lukasz Luba wrote:
> The Energy Model gets more bits used in 'flags'. Avoid adding another
> debugfs file just to print what is the status of a new flag. Simply
> remove old debugfs files and add one generic which prints all flags
> as a hex value.
> 
> Signed-off-by: Lukasz Luba <lukasz.luba@....com>
> ---
>  kernel/power/energy_model.c | 24 +++++-------------------
>  1 file changed, 5 insertions(+), 19 deletions(-)
> 
> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
> index babefc72085d..092513575e4e 100644
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -54,28 +54,15 @@ static int em_debug_cpus_show(struct seq_file *s, void *unused)
>  }
>  DEFINE_SHOW_ATTRIBUTE(em_debug_cpus);
>  
> -static int em_debug_units_show(struct seq_file *s, void *unused)
> +static int em_debug_flags_show(struct seq_file *s, void *unused)
>  {
>  	struct em_perf_domain *pd = s->private;
> -	char *units = (pd->flags & EM_PERF_DOMAIN_MILLIWATTS) ?
> -		"milliWatts" : "bogoWatts";
>  
> -	seq_printf(s, "%s\n", units);
> +	seq_printf(s, "%#lx\n", pd->flags);
>  
>  	return 0;
>  }
> -DEFINE_SHOW_ATTRIBUTE(em_debug_units);
> -
> -static int em_debug_skip_inefficiencies_show(struct seq_file *s, void *unused)
> -{
> -	struct em_perf_domain *pd = s->private;
> -	int enabled = (pd->flags & EM_PERF_DOMAIN_SKIP_INEFFICIENCIES) ? 1 : 0;
> -
> -	seq_printf(s, "%d\n", enabled);
> -
> -	return 0;
> -}
> -DEFINE_SHOW_ATTRIBUTE(em_debug_skip_inefficiencies);
> +DEFINE_SHOW_ATTRIBUTE(em_debug_flags);
>  
>  static void em_debug_create_pd(struct device *dev)
>  {
> @@ -89,9 +76,8 @@ static void em_debug_create_pd(struct device *dev)
>  		debugfs_create_file("cpus", 0444, d, dev->em_pd->cpus,
>  				    &em_debug_cpus_fops);
>  
> -	debugfs_create_file("units", 0444, d, dev->em_pd, &em_debug_units_fops);
> -	debugfs_create_file("skip-inefficiencies", 0444, d, dev->em_pd,
> -			    &em_debug_skip_inefficiencies_fops);
> +	debugfs_create_file("flags", 0444, d, dev->em_pd,
> +			    &em_debug_flags_fops);
>  
>  	/* Create a sub-directory for each performance state */
>  	for (i = 0; i < dev->em_pd->nr_perf_states; i++)
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ