public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: "Shreyas B. Prabhu" <shreyas@linux.vnet.ibm.com>
Cc: rjw@rjwysocki.net, pavsubra@linux.vnet.ibm.com,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH] cpupower tools: Fix error when running cpupower monitor
Date: Mon, 10 Aug 2015 14:28:59 +0200	[thread overview]
Message-ID: <9534146.fFc3TD2C5D@skinner> (raw)
In-Reply-To: <1438582560-13352-1-git-send-email-shreyas@linux.vnet.ibm.com>

On Monday, August 03, 2015 11:46:00 AM Shreyas B. Prabhu wrote:
> get_cpu_topology() tries to get topology info from all cpus by reading
> files in the topology sysfs dir. If a cpu is offlined, since it doesn't
> have topology dir, this function fails and returns -1. This causes
> functions relying on get_cpu_topology() to fail. For example-
> 
> $ cpupower monitor
> Cannot read number of available processors
> 
> Fix this by skipping fetching topology info for offline cpus.

Looks fine.

Thanks!

Acked-by: Thomas Renninger <trenn@suse.de>


> 
> Signed-off-by: Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com>
> Reported-by: Pavaman Subramaniyam <pavsubra@linux.vnet.ibm.com>
> ---
>  tools/power/cpupower/utils/helpers/topology.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/power/cpupower/utils/helpers/topology.c
> b/tools/power/cpupower/utils/helpers/topology.c index
> c13120af519b..cea398c176e7 100644
> --- a/tools/power/cpupower/utils/helpers/topology.c
> +++ b/tools/power/cpupower/utils/helpers/topology.c
> @@ -73,6 +73,8 @@ int get_cpu_topology(struct cpupower_topology *cpu_top)
>  	for (cpu = 0; cpu < cpus; cpu++) {
>  		cpu_top->core_info[cpu].cpu = cpu;
>  		cpu_top->core_info[cpu].is_online = sysfs_is_cpu_online(cpu);
> +		if (!cpu_top->core_info[cpu].is_online)
> +			continue;
>  		if(sysfs_topology_read_file(
>  			cpu,
>  			"physical_package_id",


  reply	other threads:[~2015-08-10 12:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03  6:16 [PATCH] cpupower tools: Fix error when running cpupower monitor Shreyas B. Prabhu
2015-08-10 12:28 ` Thomas Renninger [this message]
2015-08-17  7:52   ` Shreyas B Prabhu
2015-08-25 11:59     ` Shreyas B Prabhu
2015-09-03  6:21       ` Shreyas B Prabhu
2015-09-04 14:51         ` Rafael J. Wysocki
2015-09-04 14:29           ` Shreyas B Prabhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9534146.fFc3TD2C5D@skinner \
    --to=trenn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavsubra@linux.vnet.ibm.com \
    --cc=rjw@rjwysocki.net \
    --cc=shreyas@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox