Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1057016ybe; Thu, 5 Sep 2019 09:39:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAe5hbcCOVMtRLO1TwBCLPxBljKbBLO8mMwMvwBQjRFeRyvObjgnmJtbTPdLBNrspv7LY2 X-Received: by 2002:a17:902:7441:: with SMTP id e1mr4520748plt.332.1567701541473; Thu, 05 Sep 2019 09:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567701541; cv=none; d=google.com; s=arc-20160816; b=E5wv5yF/ILkAPowFeDvSHCwdAodqUWSkatIHlQOwu0LyTpjDVBZUzUocJe2BVSZfxI 9rraRJR9J2RpQ3cS3r8zVq/7z3wQ/m07bvn6jq5vLiWgkGc/x/ahwckEGp4sIRRMb5j0 +uiSlkUU099KdrbbPXpado1yjKtCdbTHrhf3hwdwiCJ+IvTR/xldR5ExKVMjMfJwrxSn bj74ETrwYJbCjUVNv/upC045hDw5y8iKYQ7k+4wP8RnY7ZSh9d+Vtgb5aDSxsNxrO1fj Yvc1eQ17GtNbku4zKSmtuZhEFpOwp0K/BKyhEeQYCGrEC8r3InAMDFdmG3pKEE1KPCH6 oAIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XQgqEWHADSqKcGxg5sN3UIbFtdt58PN9JwWPODSZoVI=; b=abeUSqz3xTDkDSKfnGXxVBmp2skjrVFMSBhrZ4K6yINxEIXFDZj/4RMPd9ldJobILv qH+lVHRX6EnYT0i2ZnvawAPQToTZ4s1EeuMMLX+SLD3OiosuXUahB+B1SjZAbNOHTA6W TnJegAwLn1Y4xdKB3nn9W/v298cqJErN4/odDYKegzhIfM38RSK6XaC/J9uHqtcgW3H/ NQGXy5MQjNtXOTR4tp48XgFDFzt6NTnhqo14lDZsL5oyngF+EkAYMyo/uMIM9iiee+0U X9OaBdA+x6BhqbXXAk3+Ptulwd2CeCQzkJZ85iikYunNbGE2CMDM+W6varEla74uuoz4 cWhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15si2159511pgk.537.2019.09.05.09.38.45; Thu, 05 Sep 2019 09:39:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389106AbfIEMD2 (ORCPT + 99 others); Thu, 5 Sep 2019 08:03:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60162 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389086AbfIEMD0 (ORCPT ); Thu, 5 Sep 2019 08:03:26 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA60A7FDF4; Thu, 5 Sep 2019 12:03:25 +0000 (UTC) Received: from prarit.bos.redhat.com (prarit-guest.khw1.lab.eng.bos.redhat.com [10.16.200.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0269A1001284; Thu, 5 Sep 2019 12:03:24 +0000 (UTC) From: Prarit Bhargava To: platform-driver-x86@vger.kernel.org Cc: andriy.shevchenko@intel.com, Prarit Bhargava , Srinivas Pandruvada , David Arcari , linux-kernel@vger.kernel.org Subject: [PATCH v2 7/9] tools/power/x86/intel-speed-select: Output human readable CPU list Date: Thu, 5 Sep 2019 08:03:09 -0400 Message-Id: <20190905120311.15286-8-prarit@redhat.com> In-Reply-To: <20190905120311.15286-1-prarit@redhat.com> References: <20190905120311.15286-1-prarit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 05 Sep 2019 12:03:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The intel-speed-select tool currently only outputs a hexidecimal CPU mask, which requires translation for use with kernel parameters such as isolcpus. Along with the CPU mask, output a human readable CPU list. Signed-off-by: Prarit Bhargava Cc: Srinivas Pandruvada Cc: David Arcari Cc: linux-kernel@vger.kernel.org --- .../x86/intel-speed-select/isst-display.c | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tools/power/x86/intel-speed-select/isst-display.c b/tools/power/x86/intel-speed-select/isst-display.c index cfeee0beb78d..890a01bfee4b 100644 --- a/tools/power/x86/intel-speed-select/isst-display.c +++ b/tools/power/x86/intel-speed-select/isst-display.c @@ -8,6 +8,33 @@ #define DISP_FREQ_MULTIPLIER 100 +static void printcpulist(int str_len, char *str, int mask_size, + cpu_set_t *cpu_mask) +{ + int i, first, curr_index, index; + + if (!CPU_COUNT_S(mask_size, cpu_mask)) { + snprintf(str, str_len, "none"); + return; + } + + curr_index = 0; + first = 1; + for (i = 0; i < get_topo_max_cpus(); ++i) { + if (!CPU_ISSET_S(i, mask_size, cpu_mask)) + continue; + if (!first) { + index = snprintf(&str[curr_index], + str_len - curr_index, ","); + curr_index += index; + } + index = snprintf(&str[curr_index], str_len - curr_index, "%d", + i); + curr_index += index; + first = 0; + } +} + static void printcpumask(int str_len, char *str, int mask_size, cpu_set_t *cpu_mask) { @@ -166,6 +193,12 @@ static void _isst_pbf_display_information(int cpu, FILE *outf, int level, pbf_info->core_cpumask); format_and_print(outf, disp_level + 1, header, value); + snprintf(header, sizeof(header), "high-priority-cpu-list"); + printcpulist(sizeof(value), value, + pbf_info->core_cpumask_size, + pbf_info->core_cpumask); + format_and_print(outf, disp_level + 1, header, value); + snprintf(header, sizeof(header), "low-priority-base-frequency(MHz)"); snprintf(value, sizeof(value), "%d", pbf_info->p1_low * DISP_FREQ_MULTIPLIER); @@ -287,6 +320,12 @@ void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level, ctdp_level->core_cpumask); format_and_print(outf, base_level + 4, header, value); + snprintf(header, sizeof(header), "enable-cpu-list"); + printcpulist(sizeof(value), value, + ctdp_level->core_cpumask_size, + ctdp_level->core_cpumask); + format_and_print(outf, base_level + 4, header, value); + snprintf(header, sizeof(header), "thermal-design-power-ratio"); snprintf(value, sizeof(value), "%d", ctdp_level->tdp_ratio); format_and_print(outf, base_level + 4, header, value); -- 2.21.0