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] [day] [month] [year] [list]
Message-ID: <528C4E6F.20507@linaro.org>
Date:	Wed, 20 Nov 2013 11:23:51 +0530
From:	viresh kumar <viresh.kumar@...aro.org>
To:	rjw@...ysocki.net
CC:	linaro-kernel@...ts.linaro.org, patches@...aro.org,
	cpufreq@...r.kernel.org, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org, nm@...com, shawn.guo@...aro.org,
	ceh@...com, Viresh Kumar <viresh.kumar@...aro.org>
Subject: Re: [PATCH] cpufreq/stats: Add "unknown" frequency field in stats
 tables

On Tuesday 19 November 2013 11:10 AM, Viresh Kumar wrote:
> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
> index 4cf0d28..ebb21cd 100644
> --- a/drivers/cpufreq/cpufreq_stats.c
> +++ b/drivers/cpufreq/cpufreq_stats.c
> @@ -72,9 +72,13 @@ static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf)
>  		return 0;
>  	cpufreq_stats_update(stat->cpu);
>  	for (i = 0; i < stat->state_num; i++) {
> -		len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i],
> -			(unsigned long long)
> -			jiffies_64_to_clock_t(stat->time_in_state[i]));
> +		if (stat->freq_table[i] == -1)
> +			return sprintf(buf + len, "unknown");
> +		else
> +			return sprintf(buf + len, "%u", stat->freq_table[i]);
> +
> +		len += sprintf(buf + len, " %llu\n", (unsigned long long)
> +				jiffies_64_to_clock_t(stat->time_in_state[i]));
>  	}
>  	return len;

Somehow I forgot to add below fix with this patch, which I have tested at that time.


diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index ebb21cd..89012d1 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -73,9 +73,9 @@ static ssize_t show_time_in_state(struct cpufreq_policy
*policy, char *buf)
        cpufreq_stats_update(stat->cpu);
        for (i = 0; i < stat->state_num; i++) {
                if (stat->freq_table[i] == -1)
-                       return sprintf(buf + len, "unknown");
+                       len+= sprintf(buf + len, "unknown");
                else
-                       return sprintf(buf + len, "%u", stat->freq_table[i]);
+                       len+= sprintf(buf + len, "%u", stat->freq_table[i]);

                len += sprintf(buf + len, " %llu\n", (unsigned long long)
                                jiffies_64_to_clock_t(stat->time_in_state[i]));

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ