linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: andriy.shevchenko@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org, prarit@redhat.com,
	linux-kernel@vger.kernel.org,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH 01/27] tools/power/x86/intel-speed-select: Warn for invalid package id
Date: Thu,  5 Mar 2020 14:45:12 -0800	[thread overview]
Message-ID: <20200305224538.490864-2-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <20200305224538.490864-1-srinivas.pandruvada@linux.intel.com>

When CPU is offline, we can't get package id. So print error for this
and don't use output.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 tools/power/x86/intel-speed-select/isst-config.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index c922cfd7ba50..3f019f4f90df 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -261,6 +261,10 @@ static void for_each_online_package_in_set(void (*callback)(int, void *, void *,
 		if (die_id < 0)
 			die_id = 0;
 		pkg_id = get_physical_package_id(i);
+		if (pkg_id < 0) {
+			fprintf(stderr, "Failed to get package id, CPU %d may be offline\n", i);
+			continue;
+		}
 		/* Create an unique id for package, die combination to store */
 		pkg_id = (MAX_PACKAGE_COUNT * pkg_id + die_id);
 
@@ -362,6 +366,10 @@ static void set_cpu_present_cpu_mask(void)
 				die_id = 0;
 
 			pkg_id = get_physical_package_id(i);
+			if (pkg_id < 0) {
+				fprintf(stderr, "Failed to get package id, CPU %d may be offline\n", i);
+				continue;
+			}
 			if (pkg_id < MAX_PACKAGE_COUNT &&
 			    die_id < MAX_DIE_PER_PACKAGE) {
 				int core_id = get_physical_core_id(i);
-- 
2.24.1


  reply	other threads:[~2020-03-05 22:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 22:45 [PATCH 00/27] tools/power/x86/intel-speed-select: Enhancements Srinivas Pandruvada
2020-03-05 22:45 ` Srinivas Pandruvada [this message]
2020-03-05 22:45 ` [PATCH 02/27] tools/power/x86/intel-speed-select: Make target CPU optional for core-power info Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 03/27] tools/power/x86/intel-speed-select: Enhance core-power info command Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 04/27] tools/power/x86/intel-speed-select: Use more verbiage for clos information Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 05/27] tools/power/x86/intel-speed-select: Special handling for CPU 0 online/offline Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 06/27] tools/power/x86/intel-speed-select: Max CPU count calculation when CPU0 is offline Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 07/27] tools/power/x86/intel-speed-select: Store topology information Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 08/27] tools/power/x86/intel-speed-select: Helpful warning for missing kernel interface Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 09/27] tools/power/x86/intel-speed-select: Enhance help Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 10/27] tools/power/x86/intel-speed-select: Enhance --info option Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 11/27] tools/power/x86/intel-speed-select: Add an API for error/information print Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 12/27] tools/power/x86/intel-speed-select: Improve error display for perf-profile feature Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 13/27] tools/power/x86/intel-speed-select: Check feature status first Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 14/27] tools/power/x86/intel-speed-select: Display error for invalid priority type Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 15/27] tools/power/x86/intel-speed-select: Enhance help for core-power assoc Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 16/27] tools/power/x86/intel-speed-select: Improve output of perf-profile commands Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 17/27] tools/power/x86/intel-speed-select: Improve error display for base-freq feature Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 18/27] tools/power/x86/intel-speed-select: Improve error display for turbo-freq feature Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 19/27] tools/power/x86/intel-speed-select: Kernel interface error handling Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 20/27] tools/power/x86/intel-speed-select: Improve core-power result and error display Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 21/27] tools/power/x86/intel-speed-select: Show error for invalid CPUs in the options Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 22/27] tools/power/x86/intel-speed-select: Improve CLX commands Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 23/27] tools/power/x86/intel-speed-select: Fix avx options for turbo-freq feature Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 24/27] tools/power/x86/intel-speed-select: Print friendly warning for bad command line Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 25/27] tools/power/x86/intel-speed-select: Add display for enabled cpus count Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 26/27] tools/power/x86/intel-speed-select: Avoid duplicate Package strings for json Srinivas Pandruvada
2020-03-05 22:45 ` [PATCH 27/27] tools/power/x86/intel-speed-select: Update version Srinivas Pandruvada

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=20200305224538.490864-2-srinivas.pandruvada@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=prarit@redhat.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;
as well as URLs for NNTP newsgroup(s).