From patchwork Sat Aug 31 19:34:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124967 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41A0C14E5 for ; Sat, 31 Aug 2019 19:35:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CE112187F for ; Sat, 31 Aug 2019 19:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280121; bh=jBHplXCjjYXTVoJB9sqb0VPwI/yPXT2hEKoSPDPli7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=uxNtdexVDS2nuyPdHh7Vneb+TXYRLnp8DoCm0oEq0vkWu4emNRx7nAqB3PQS+YeGT yvDTNo7BNrEs6U1o00yr1mhLK9j/oYvQ2sxQKFx0Qabz7Gp5pirmkOjWYH7BkP8WR1 3HHK8/6SRZ8tsTJayAfojjSsesc4Ycvm6cgS3eVs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728488AbfHaTfU (ORCPT ); Sat, 31 Aug 2019 15:35:20 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:34954 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfU (ORCPT ); Sat, 31 Aug 2019 15:35:20 -0400 Received: by mail-io1-f66.google.com with SMTP id b10so21163226ioj.2 for ; Sat, 31 Aug 2019 12:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=JYg10VqX7rTAkx/JExMqEMdDn29Ok8oTJWNgkcB1Vgg=; b=rGxCIdpLSxQu84FG9VyjvnPrTydFgBKzx4f6h+JLk7JTYwYBtTMtCf7KE8dUmsl8hK h6iAvlO1u2qVHeUaFfmTdZsUNj3tpe4MKj+Q5lX8LpWeT8JcQxiuFCvoiQMi/Ou2j+pX uoXjmXNpXMRNx/SsVso7rDLKThtM6HLz1MWzDu+DE6+gpPwxsrw4qwW/v8Ib4H8A4Ajf ZLhW4DEIZrV/s6+2RlBKO07irQAk8162mQvF9UYbDowgQAAx7UmkCIB8qKUydNgDhqpi rXVnOgLfEvxz2dYnFQrXVITmmz9Wj8yh/tmyYZVW/2QnZgdsuNs6ZeOqX+BT7R42Yx2k Q7hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=JYg10VqX7rTAkx/JExMqEMdDn29Ok8oTJWNgkcB1Vgg=; b=QxKVWRYAaMXpk7RjnxB4/XBHoyo4PFCKhKTkZLWspl6h3jWpj/RJDHhfsXJR3OpM/e uZUIhSQgMnL8UwKtpCKATDLf0DWD2H8+F4LIrfp0sKJndofDOjZf3ujtG4clO+RAo5Fz pbGtVPwfjtpIKbaK+nZOyC29rCDqmrXjXvYrh5pP/2fAufyezkgtBjTREQn0ZQsCDa2b 357Jl1tGyCnPQgDCcslibvbX0AIxDDHPhwWQ4tWlormtHxpu6CBlbwanuDZCW9ms3Y5z Z5SziQ8Ikr8xh2S0zAs7DPhWEHQ9nbdVTJJl2cRzJFO73hq5Q3l2PNTkq/mNjDeee8Su D0ig== X-Gm-Message-State: APjAAAU+muDGZXn2wQcF30DJI2Xi2QYwD3L0NlUhogVptkcNuHSghp0g odhrdtX2p2wqvy/KEWiDY4QAERzs X-Google-Smtp-Source: APXvYqxprwafgLBkOj35lQdotRs/H0J0iR3d3zx3jlujXHWkDkEf2xkX/q7UivVR4K5Zs3pTRmSwow== X-Received: by 2002:a5d:9dc9:: with SMTP id 9mr17413524ioo.199.1567280119044; Sat, 31 Aug 2019 12:35:19 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:18 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Ben Hutchings , Len Brown Subject: [PATCH 01/19] tools/power x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2 Date: Sat, 31 Aug 2019 15:34:40 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190831193458.12698-1-lenb@kernel.org> References: <20190831193458.12698-1-lenb@kernel.org> MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Ben Hutchings x86_energy_perf_policy first uses __get_cpuid() to check the maximum CPUID level and exits if it is too low. It then assumes that later calls will succeed (which I think is architecturally guaranteed). It also assumes that CPUID works at all (which is not guaranteed on x86_32). If optimisations are enabled, gcc warns about potentially uninitialized variables. Fix this by adding an exit-on-error after every call to __get_cpuid() instead of just checking the maximum level. Signed-off-by: Ben Hutchings Signed-off-by: Len Brown --- .../x86_energy_perf_policy.c | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c index 34a796b303fe..7663abef51e9 100644 --- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c +++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c @@ -1259,6 +1259,15 @@ void probe_dev_msr(void) if (system("/sbin/modprobe msr > /dev/null 2>&1")) err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" "); } + +static void get_cpuid_or_exit(unsigned int leaf, + unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) +{ + if (!__get_cpuid(leaf, eax, ebx, ecx, edx)) + errx(1, "Processor not supported\n"); +} + /* * early_cpuid() * initialize turbo_is_enabled, has_hwp, has_epb @@ -1266,15 +1275,10 @@ void probe_dev_msr(void) */ void early_cpuid(void) { - unsigned int eax, ebx, ecx, edx, max_level; + unsigned int eax, ebx, ecx, edx; unsigned int fms, family, model; - __get_cpuid(0, &max_level, &ebx, &ecx, &edx); - - if (max_level < 6) - errx(1, "Processor not supported\n"); - - __get_cpuid(1, &fms, &ebx, &ecx, &edx); + get_cpuid_or_exit(1, &fms, &ebx, &ecx, &edx); family = (fms >> 8) & 0xf; model = (fms >> 4) & 0xf; if (family == 6 || family == 0xf) @@ -1288,7 +1292,7 @@ void early_cpuid(void) bdx_highest_ratio = msr & 0xFF; } - __get_cpuid(0x6, &eax, &ebx, &ecx, &edx); + get_cpuid_or_exit(0x6, &eax, &ebx, &ecx, &edx); turbo_is_enabled = (eax >> 1) & 1; has_hwp = (eax >> 7) & 1; has_epb = (ecx >> 3) & 1; @@ -1306,7 +1310,7 @@ void parse_cpuid(void) eax = ebx = ecx = edx = 0; - __get_cpuid(0, &max_level, &ebx, &ecx, &edx); + get_cpuid_or_exit(0, &max_level, &ebx, &ecx, &edx); if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e) genuine_intel = 1; @@ -1315,7 +1319,7 @@ void parse_cpuid(void) fprintf(stderr, "CPUID(0): %.4s%.4s%.4s ", (char *)&ebx, (char *)&edx, (char *)&ecx); - __get_cpuid(1, &fms, &ebx, &ecx, &edx); + get_cpuid_or_exit(1, &fms, &ebx, &ecx, &edx); family = (fms >> 8) & 0xf; model = (fms >> 4) & 0xf; stepping = fms & 0xf; @@ -1340,7 +1344,7 @@ void parse_cpuid(void) errx(1, "CPUID: no MSR"); - __get_cpuid(0x6, &eax, &ebx, &ecx, &edx); + get_cpuid_or_exit(0x6, &eax, &ebx, &ecx, &edx); /* turbo_is_enabled already set */ /* has_hwp already set */ has_hwp_notify = eax & (1 << 8); From patchwork Sat Aug 31 19:34:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DA9814E5 for ; Sat, 31 Aug 2019 19:35:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C9892187F for ; Sat, 31 Aug 2019 19:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280122; bh=ZPyE6GzU+VI5GsDtoCm8eHjAROu6QHj2iwynsk0mia0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=rroR6QdFEjHmTwLZ2+KJVeLcV/doiE3+EEkmdQ3Mp3aRw4dD/KXvSkNKZV2gkhRHR zibBI4iLFiwQgjfGaIfxPtyMgm4P2T8olB4EGmSwMHJd4mbxmNBs31svsqQVhjeZ4S mLx8igqNqRmGE3leWrANIW6IoXWYcdRQGGaTJXwk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728497AbfHaTfV (ORCPT ); Sat, 31 Aug 2019 15:35:21 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:44385 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfV (ORCPT ); Sat, 31 Aug 2019 15:35:21 -0400 Received: by mail-io1-f66.google.com with SMTP id j4so21033135iog.11 for ; Sat, 31 Aug 2019 12:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=3jrtH4QPMegn0RNPk9aukm+I7ke9BQFMqSbfVMu+JR8=; b=CIetX9kaBkddmunFUMGxUiesVvBvdqc1YTx2iPksEmPdZBTvyBzGTpfd/Z6WmAVj0N rhDQaluNitXeFCeMkqQeIRyG3zstkoQpvFXsGQdR4gpBw+t6709L4XbdVKYVzRnyJ/EJ wbqToLIJWlkadlndU/1dhWbjvNSHpIbsu9X7eVjpi5YKoQASfncmC9jeaNmMo9shDiky nDqyEiOy8xRxDkm22MNyb1SFytrvja3SBDl8jNrHqNFQfkxsILUBSSEQZBdPJx0XI6op 215+ByIaZ+QHiy/tS8XZw+VmFmma3PKinA/yNHC+kdkTZyip41/xj7Fyct7RryHA6c6Z nfGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=3jrtH4QPMegn0RNPk9aukm+I7ke9BQFMqSbfVMu+JR8=; b=a0ewkr6s63AxBhri4vRVWovfZQ9BCJsTaL3Uk+f7kF/O+WNZRiXX6pS16aWRK8GcAg eSZifpaQdJRAiQ3GC4bKkuTny5bhnQ/YwRtZLyk9fIORlyQGZH32gAesQQkvhxowOeQf aq/x2JD9nqw+GcYmtvKvGMKbwasKlPqN3eGZjtheJQgd0KU2z+U2sdHxDVdP8zNBnJTH qyZpU5kvGQEqY25CsDZ8QTOL44ieHX9VvTD7ar1cPYVNYl8Wk8hwaQvBe/g4S6l6snas V+axlZkr1Ps6lcJziVvlo13I5F/XfBRIH/bYj9nyWjcVtU10tqcwsNDvtwyPVnrsSX2s 824w== X-Gm-Message-State: APjAAAVA2n3zn4/0DpHvSswZFeSUC+bmWmYHceXtYMJG94MH+baxpRWx 5vdvB3ipQYUwYu3Ma/sjM6fb7Qza X-Google-Smtp-Source: APXvYqyUKkzsdHp1Fh8iYabE7pKXvocUssxyqT5SvKImXCDhRpsUDKyl/mc9TowZ8XQItEAC3etVMA== X-Received: by 2002:a02:ac84:: with SMTP id x4mr17930316jan.2.1567280120194; Sat, 31 Aug 2019 12:35:20 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:19 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Ben Hutchings , Len Brown Subject: [PATCH 02/19] tools/power/x86: Enable compiler optimisations and Fortify by default Date: Sat, 31 Aug 2019 15:34:41 -0400 Message-Id: <6ac1730f7db86f0a92d4de0f2b4ca9cd124080fe.1567277326.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Ben Hutchings Compiling without optimisations is silly, especially since some warnings depend on the optimiser. Use -O2. Fortify adds warnings for unchecked I/O (among other things), which seems to be a good idea for user-space code. Enable that too. Signed-off-by: Ben Hutchings Signed-off-by: Len Brown --- tools/power/x86/turbostat/Makefile | 3 ++- tools/power/x86/x86_energy_perf_policy/Makefile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile index 045f5f7d68ab..13f1e8b9ac52 100644 --- a/tools/power/x86/turbostat/Makefile +++ b/tools/power/x86/turbostat/Makefile @@ -9,9 +9,10 @@ ifeq ("$(origin O)", "command line") endif turbostat : turbostat.c -override CFLAGS += -Wall -I../../../include +override CFLAGS += -O2 -Wall -I../../../include override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' +override CFLAGS += -D_FORTIFY_SOURCE=2 %: %.c @mkdir -p $(BUILD_OUTPUT) diff --git a/tools/power/x86/x86_energy_perf_policy/Makefile b/tools/power/x86/x86_energy_perf_policy/Makefile index 1fdeef864e7c..666b325a62a2 100644 --- a/tools/power/x86/x86_energy_perf_policy/Makefile +++ b/tools/power/x86/x86_energy_perf_policy/Makefile @@ -9,8 +9,9 @@ ifeq ("$(origin O)", "command line") endif x86_energy_perf_policy : x86_energy_perf_policy.c -override CFLAGS += -Wall -I../../../include +override CFLAGS += -O2 -Wall -I../../../include override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' +override CFLAGS += -D_FORTIFY_SOURCE=2 %: %.c @mkdir -p $(BUILD_OUTPUT) From patchwork Sat Aug 31 19:34:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CF9E14E5 for ; Sat, 31 Aug 2019 19:35:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5CC092187F for ; Sat, 31 Aug 2019 19:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280123; bh=ocKWO769v93tSaxUbji08F1nO3n2yG2yssA7T6Xndm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=yNnYcALPJPoEYg29ebWN2xIBDPbe+kBI5USlP+3y7szCY4t7dpcXma57ZbzZKftFN ada8ppQXjaatoYp86sZz9HlRdAYLIfGOzEcbL0tZu7X/DANI7briXB9AkCHfPpbTvx eFe9Baf9H+uc8J0I8g/7Kv1TGC34P4aEjgMDS3Sc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728504AbfHaTfW (ORCPT ); Sat, 31 Aug 2019 15:35:22 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:42353 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfW (ORCPT ); Sat, 31 Aug 2019 15:35:22 -0400 Received: by mail-io1-f65.google.com with SMTP id n197so19118359iod.9 for ; Sat, 31 Aug 2019 12:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=oI9aGM88Fs4bIGGOK6OU19vcrLkdBifiBfV7o5jmHIQ=; b=TFMZa8VMlAYhWJsaF81spJPY+NbTm6ikmV8zSKH/gxZoyU9Ke0wn3vVRdnQTqiPy8e 2zbkZ71GFAAnAYN5PB2PkoHi2qso/ukVY4G5xtQvwbhCLcVf07HfAGoe3de5SgxYNIYe tR/l8XMPsNjW0Pf1rDKXr4XEGAXS2G2Mc0Y7N6wKeJjUs0pYo6M44h6FZNUoIKKoIRph QDOQGtOrkAyeGkoNJKmgTlk+p4FjzneU34rKEBD8ssw7hr/vWO/TbsgnEJt4kVe5wdCW txfhJ9UxB1IU38Srm5LeBN9NVS4F+X95Q4DirIcOmSOVZHVS/D+K17KJuG+XHgyZkK9V 6HuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=oI9aGM88Fs4bIGGOK6OU19vcrLkdBifiBfV7o5jmHIQ=; b=K+t2BRP6UosOJYbt4Li9Pda9IUfHC/VUpLwRSfrFRszzsSKYt9fiDkjgc/0Ul7OxIO QNtWpkJbEuTvRtc54zRgIM1XeUGkQgT4foDo+gwYg6dO7QaFkvPHKudCcM00RJnsF32m abXdr+IhtYcQ+C+1rcrz9mzzwnMuu1DzSuAc7vl1rTdKWy+Yy+RD9GYIUwBdoN2ynwg8 h47lT1HfseLCzll85mOvJrvDVPo3VxWE5GgvTTH/ysVLA3USxXFlhWpZHaOzJTMsn744 xYbU7z+RZNsM3WHcq/oodX5XKTCpiBIM9WtbSAFuAG8EfxSupHN8iNg9QLIrudH9XsX0 jYiA== X-Gm-Message-State: APjAAAUC8cGbbjQmO/gcJQB+z/ULIxmWxKgbNN2tytkqtP42TUiX6ZHq hZ1YyfVMUdtcvZCNewBWpMjn9Cpa X-Google-Smtp-Source: APXvYqx6VyyKZqSIwqBdE75LjdnseyrPabFZjfaxMuKg5UgOw71Z5uutLDEsrWOw8xoHVwuvnXYMuw== X-Received: by 2002:a5d:9282:: with SMTP id s2mr7476121iom.283.1567280121587; Sat, 31 Aug 2019 12:35:21 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:20 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Matt Lupfer , Len Brown Subject: [PATCH 03/19] tools/power: Fix typo in man page Date: Sat, 31 Aug 2019 15:34:42 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Matt Lupfer From context, we mean EPB (Enegry Performance Bias). Signed-off-by: Matt Lupfer Signed-off-by: Len Brown --- tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 index 17db1c3af4d0..78c6361898b1 100644 --- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 +++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 @@ -40,7 +40,7 @@ in the same processor package. Hardware P-States (HWP) are effectively an expansion of hardware P-state control from the opportunistic turbo-mode P-state range to include the entire range of available P-states. -On Broadwell Xeon, the initial HWP implementation, EBP influenced HWP. +On Broadwell Xeon, the initial HWP implementation, EPB influenced HWP. That influence was removed in subsequent generations, where it was moved to the Energy_Performance_Preference (EPP) field in From patchwork Sat Aug 31 19:34:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124973 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E1F8112C for ; Sat, 31 Aug 2019 19:35:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DE972187F for ; Sat, 31 Aug 2019 19:35:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280124; bh=9qSzBbFHMG9gzgxxeiCp0LX0IB84LLEP0owLlq3IdNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=D8+j5SFSXy/UCYVa9hUcsDNFFv6NFTZopEBdp1rrJimLYw+y3o3LNvwPHhrq6V8Wc ExGMZL47YCePEnc01A0DeA1pJ46QPgfY97urNBU5V01CNSoikfRtU73jhr0vSVStmw 42H53tErx4Dj//EpPFK3v6sXu486Y2qjIHoaFjCY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728506AbfHaTfY (ORCPT ); Sat, 31 Aug 2019 15:35:24 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:36467 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfX (ORCPT ); Sat, 31 Aug 2019 15:35:23 -0400 Received: by mail-io1-f67.google.com with SMTP id o9so21126150iom.3 for ; Sat, 31 Aug 2019 12:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=Brotjj0bAWiTq6owzVL+v4eiuQaLRD+EexpYdyEwa2s=; b=T4Xy5SGiLIkTpgXCj8LdhbteiWXlGu8wEtmi2G4gZjCT8t3fc/RSU6nAKGuX3/dsTA mfPO1SUdQBnQUWwPZ5a/xqhMiuP+my4FxSF36dFCWKTbXrygYjge5LBTyOCh3CUdAuIC fuKbtQR7g0xoHNCeV6ZHDZaBFbzeNXFosPVugd8u/p7kFYsJ1KGV7xZOfDwF2D3Sopvn GQc0gXQkgLNIVkLMN2unAVs20dRm0O+fhJCExhKv8UCVU4JyDmQlX/XzcltfRpiFSJrl DBDaSRRbXTNTYq77vbYnq2rVdShGbQYFvvsK2xDcVGP5YCzMPnpexBwn2pYygZ/z6ijj VZBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=Brotjj0bAWiTq6owzVL+v4eiuQaLRD+EexpYdyEwa2s=; b=PoqPdIUU/Lxo5lxUOis+nn4mxwnjhCzBDooDiYv1xXUnaZFCMKv47hrJ9Q5EASYFJm RESqR3Y6rDvsNf2L0npBqvZY2TKTUvq2gGRq/1J1EcJpQu7Hmm4G5e0MQFqK+fC/fZzQ VCbjlBdIElUJaKFxFs+65fRvnZvVh386IQNkOo5DlPZ7Uz9s0Gth63grJbMjU+hCeDWV j5uLlUJcq62O/zmqoxFNyhnT2Trg2aDCtVmMWAC/h6ajYGpy3Sx4IVi5t9oSUbciWoF0 oMJnE+wwg8E7y96vNblPP0pvsyACLw7Y5O5aKZukC6ALeM47ySlst9I3rJeHOcD08Dlf M9NQ== X-Gm-Message-State: APjAAAUYBypn5vFBda4jcPrJBDnlK2TaNHqXQ7cYB4icZkXFT5xLWp1r 4oiBpopiu5z1O20dgdrAvcogPsVM X-Google-Smtp-Source: APXvYqwmWYhA+2HiEzM6KHToXRpF3aAqgrrZ5mVoso6ya2zU/s/QMb3cLK5FJ9KJPLbbrNhBsIC4dA== X-Received: by 2002:a5d:8444:: with SMTP id w4mr21230006ior.51.1567280122723; Sat, 31 Aug 2019 12:35:22 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:22 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: "Zephaniah E. Loss-Cutler-Hull" , Len Brown Subject: [PATCH 04/19] tools/power x86_energy_perf_policy: Fix argument parsing Date: Sat, 31 Aug 2019 15:34:43 -0400 Message-Id: <03531482402a2bc4ab93cf6dde46833775e035e9.1567277326.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: "Zephaniah E. Loss-Cutler-Hull" The -w argument in x86_energy_perf_policy currently triggers an unconditional segfault. This is because the argument string reads: "+a:c:dD:E:e:f:m:M:rt:u:vw" and yet the argument handler expects an argument. When parse_optarg_string is called with a null argument, we then proceed to crash in strncmp, not horribly friendly. The man page describes -w as taking an argument, the long form (--hwp-window) is correctly marked as taking a required argument, and the code expects it. As such, this patch simply marks the short form (-w) as requiring an argument. Signed-off-by: Zephaniah E. Loss-Cutler-Hull Signed-off-by: Len Brown --- tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c index 7663abef51e9..3fe1eed900d4 100644 --- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c +++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c @@ -545,7 +545,7 @@ void cmdline(int argc, char **argv) progname = argv[0]; - while ((opt = getopt_long_only(argc, argv, "+a:c:dD:E:e:f:m:M:rt:u:vw", + while ((opt = getopt_long_only(argc, argv, "+a:c:dD:E:e:f:m:M:rt:u:vw:", long_options, &option_index)) != -1) { switch (opt) { case 'a': From patchwork Sat Aug 31 19:34:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E971C14E5 for ; Sat, 31 Aug 2019 19:35:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C926723407 for ; Sat, 31 Aug 2019 19:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280125; bh=nomrr7/ZwaXfFP9Vugu1XnDb9O594s25KZVJY/zHus0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=WBugd+DPbmamBCm+8PNEkK85h2NIMRg/UgwiRqL2ZMqHYNpZs38SzqdSPEAQfeOK3 dcIS54TroM5nwvpxeL5R0IYMMuTSqaJEvckBUApKVi9O+zEzOyCVwp2Sixkkm8J9bP +FuV9X4e5onPFadPzESO7G09Q9CMtJC2ffGysimg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728510AbfHaTfZ (ORCPT ); Sat, 31 Aug 2019 15:35:25 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:38476 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfZ (ORCPT ); Sat, 31 Aug 2019 15:35:25 -0400 Received: by mail-io1-f66.google.com with SMTP id p12so21119613iog.5 for ; Sat, 31 Aug 2019 12:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=N9muUaZvpx7q/k9h+lDLMlI0BBAXFFcb+pnVMkHbM+g=; b=Q2O2Y/0h3+ecjJRPs8kLmReV/R3MbGIGkAykIxCz2NpMLJt5cIW3GAaGIfR0Sz21Pw QpqW7uoA1O1MhVMxM5swJVH8ZFTQzV5wXpRPOWIgoQLM1KIVsNDv58TlSuh1K1qaIoXu 8k8zhm2W8Pk6rN0vZ3m5axQO/ebdPQd8S+Nyx2CN6nz6PbAoOEL/gL1uWLPFuun3gyRW 07zEL9oOu+epr7UXZ3dHFTlkLGfW+ansr82i05ILiE3JyzqaMKIZ+6f9YoBSiDzi732p AOG9agEVqfcqAqjG3j0YVotbgNQHIH7TZcLMYT7fSiUTWZuj03VhKnlf06+G+oNFiNuS Ljdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=N9muUaZvpx7q/k9h+lDLMlI0BBAXFFcb+pnVMkHbM+g=; b=eHUuw7p5M6DfjpyHZVd3iG9TlAlDydNat8z2+2p20n7LfQBpMvgafBJEQazCmqBVDz gMrixY7tWc0ma7uRPhLZNeIIMMTASZrAfgC3in7WTSlAf+zwTYKmeNM6BEaa4XzIqYqY Ngyrg4N70JzWAUBjM1XKTr7QAKZRfxZKxswFoIAUQ9p4TNrXefZ8+tao781QOhatyEC3 4meRSg+9Vc2lPv2K/UIAn4oItpASWMdS6neeBFHnIuH3b1/pjTK3ko4Es5njuh6XgN63 wRoAdTI9DaUM/rGE3hUfUq8sulxO4BkaRvTh3bnWzajualMjpxrG8DzzYJPKE/GlnHBi AkJg== X-Gm-Message-State: APjAAAVdFwoiLlj1m/ShKhNcfVd2tYwyvDiLrBREOU5KS54JlIk6XFLt s1CKgiAm3XOXywpipnM+BGX6od7/ X-Google-Smtp-Source: APXvYqz8nKoySfeFlsrIiMdlLAz4qpQU+Xfk9eb4ytLIP67xI86f31M6xRaJOx1xKYCI8TVq5TGG7Q== X-Received: by 2002:a5d:9aca:: with SMTP id x10mr24512335ion.11.1567280123932; Sat, 31 Aug 2019 12:35:23 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:23 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown , Naoya Horiguchi Subject: [PATCH 05/19] tools/power turbostat: remove duplicate pc10 column Date: Sat, 31 Aug 2019 15:34:44 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Len Brown Remove the duplicate pc10 column. Fixes: be0e54c4ebbf ("turbostat: Build-in "Low Power Idle" counters support") Reported-by: Naoya Horiguchi Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 75fc4fb9901c..90f7e8b4d4d4 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -849,7 +849,6 @@ int dump_counters(struct thread_data *t, struct core_data *c, outp += sprintf(outp, "pc8: %016llX\n", p->pc8); outp += sprintf(outp, "pc9: %016llX\n", p->pc9); outp += sprintf(outp, "pc10: %016llX\n", p->pc10); - outp += sprintf(outp, "pc10: %016llX\n", p->pc10); outp += sprintf(outp, "cpu_lpi: %016llX\n", p->cpu_lpi); outp += sprintf(outp, "sys_lpi: %016llX\n", p->sys_lpi); outp += sprintf(outp, "Joules PKG: %0X\n", p->energy_pkg); From patchwork Sat Aug 31 19:34:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09FA914E5 for ; Sat, 31 Aug 2019 19:35:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDEBE23405 for ; Sat, 31 Aug 2019 19:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280126; bh=ranycQGxZ+1doLSDhrqTiZKNgvLhwh98cBhJtcY+JRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=BXbg3Yv82Lv7ZpRUai4lLqdEpUHpiYS48DmXrf9Xw9/U9mK2JYOsyt8wKpTLSCQNV Jv4hUYpwP26ScN99TCvQp/zzU+7S58PvRnd+YVcGq0IB+c7bXyv8Ce0X7SMHOdfDIa WevT7ZpwE/bdCYhuG1juZXSWiVlbtDkpj5Awv/xU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728512AbfHaTf0 (ORCPT ); Sat, 31 Aug 2019 15:35:26 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:43926 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTf0 (ORCPT ); Sat, 31 Aug 2019 15:35:26 -0400 Received: by mail-io1-f66.google.com with SMTP id u185so17282144iod.10 for ; Sat, 31 Aug 2019 12:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=q4Zs/UJMkBwDNYS4GmBE0C8tk0RrfjDvpeBJ36dOl/k=; b=hyIvdzsfKiFKAwi2/yro6+Bj/oMar5IceicR4zrVQzj/LOKPPxeK21bbn/CX4FtWk5 13gnNVWy7AUomill3UQ8BPlwnuTAyxVDxNU8TBpC84l6ER0vkHFHa8xM4ncMYO0c6sNw cixvMC6nSpwBBNyQXkuRF3lwBDR85U6XkkyYXluZNcvJ/MOlhBKhAwnw4qa+aOPF9MP9 SVz3wWB2kVfY9L0g+E+W9/YHW6y9fxkYShHtSBnzlYzuAAksHDpmej2ySWfoHPbQDyPj UFh0WYAvb5HpmSMSUPtmdR6eRX4T9HhxQD37bty2oe3N5H0Bve1/rjIDzQE72u478YYY DspA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=q4Zs/UJMkBwDNYS4GmBE0C8tk0RrfjDvpeBJ36dOl/k=; b=nRmUJcySD6YxU8RmIru/T9r3nfsdXh9fIc6EmNMHf9UFXIImO3bw03gZWjTjaHxh30 AEFL8yqkge+HuaWY2IEJYwaB1KuDIRpDxF482uNthYN5GrVfq27aFG1nObkFZuAlIla0 QVGKw60w+J+FOh6ztdrfgC27BCOtW0PAS688Tx7tnr+ndjuifhymnqy2GYp0vu9wwbJK CX7MCs81urFPJkbQnn02GkhuIZrsiUEaM/5/5S20Vk3w8ybaJ+HwR3+Ec15hyD2sinWv ynPYgKFqL3Z0YfF8jNpqEhBMulW0LcI4FJvd3+YQzuHAcNpzk/Vx4AGzldGmLkIhEM4Y RK+Q== X-Gm-Message-State: APjAAAXt4LZJ6DUtcvaWXnpN5b2YSYyVWRsMVHVrZ7FnCQLmPnztJVG8 AKcmHChTScIrrebKa4riLrfpxvRI X-Google-Smtp-Source: APXvYqzOlx58S5EQqgNx6cTgqPHWyfmHu/6DatRAGUG5RsVP0b9WCoOZFwm2vxiEj/nnV05xqYxy6A== X-Received: by 2002:a5d:9c08:: with SMTP id 8mr19724985ioe.9.1567280125168; Sat, 31 Aug 2019 12:35:25 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:24 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Yazen Ghannam , Len Brown Subject: [PATCH 06/19] tools/power turbostat: Make interval calculation per thread to reduce jitter Date: Sat, 31 Aug 2019 15:34:45 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Yazen Ghannam Turbostat currently normalizes TSC and other values by dividing by an interval. This interval is the delta between the start of one global (all counters on all CPUs) sampling and the start of another. However, this introduces a lot of jitter into the data. In order to reduce jitter, the interval calculation should be based on timestamps taken per thread and close to the start of the thread's sampling. Define a per thread time value to hold the delta between samples taken on the thread. Use the timestamp taken at the beginning of sampling to calculate the delta. Move the thread's beginning timestamp to after the CPU migration to avoid jitter due to the migration. Use the global time delta for the average time delta. Signed-off-by: Yazen Ghannam Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 90f7e8b4d4d4..02813a2a8ffd 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -166,6 +166,7 @@ size_t cpu_present_setsize, cpu_affinity_setsize, cpu_subset_size; struct thread_data { struct timeval tv_begin; struct timeval tv_end; + struct timeval tv_delta; unsigned long long tsc; unsigned long long aperf; unsigned long long mperf; @@ -910,7 +911,7 @@ int format_counters(struct thread_data *t, struct core_data *c, if (DO_BIC(BIC_TOD)) outp += sprintf(outp, "%10ld.%06ld\t", t->tv_end.tv_sec, t->tv_end.tv_usec); - interval_float = tv_delta.tv_sec + tv_delta.tv_usec/1000000.0; + interval_float = t->tv_delta.tv_sec + t->tv_delta.tv_usec/1000000.0; tsc = t->tsc * tsc_tweak; @@ -1308,6 +1309,7 @@ delta_thread(struct thread_data *new, struct thread_data *old, * over-write old w/ new so we can print end of interval values */ + timersub(&new->tv_begin, &old->tv_begin, &old->tv_delta); old->tv_begin = new->tv_begin; old->tv_end = new->tv_end; @@ -1403,6 +1405,8 @@ void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data t->tv_begin.tv_usec = 0; t->tv_end.tv_sec = 0; t->tv_end.tv_usec = 0; + t->tv_delta.tv_sec = 0; + t->tv_delta.tv_usec = 0; t->tsc = 0; t->aperf = 0; @@ -1572,6 +1576,9 @@ void compute_average(struct thread_data *t, struct core_data *c, for_all_cpus(sum_counters, t, c, p); + /* Use the global time delta for the average. */ + average.threads.tv_delta = tv_delta; + average.threads.tsc /= topo.num_cpus; average.threads.aperf /= topo.num_cpus; average.threads.mperf /= topo.num_cpus; @@ -1761,13 +1768,13 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) struct msr_counter *mp; int i; - gettimeofday(&t->tv_begin, (struct timezone *)NULL); - if (cpu_migrate(cpu)) { fprintf(outf, "Could not migrate to CPU %d\n", cpu); return -1; } + gettimeofday(&t->tv_begin, (struct timezone *)NULL); + if (first_counter_read) get_apic_id(t); retry: From patchwork Sat Aug 31 19:34:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F012112C for ; Sat, 31 Aug 2019 19:35:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F276C23407 for ; Sat, 31 Aug 2019 19:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280128; bh=w9mOTQOK9Dmcs78UbrBYU4bVtcFFy35wo987SkcqqnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=fwqH1QgiWuardZpZTLNeBCZRAwc7yEI+njOlp/WmkDUSScvVZPW35jmjrAk+aqss1 qMysnsrgwGE0maEQ4Ku8w5WW4d1aqXFGfaDQCAFO21k8sgU0de2/nCEbhNF7X6vaVa OMeAQTNQ2V5NGBEai2ql1a+Ir/6hs5YBVoKO21eM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728514AbfHaTf1 (ORCPT ); Sat, 31 Aug 2019 15:35:27 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:33335 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTf1 (ORCPT ); Sat, 31 Aug 2019 15:35:27 -0400 Received: by mail-io1-f68.google.com with SMTP id z3so21192771iog.0 for ; Sat, 31 Aug 2019 12:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=k6plyY31z8FLjLduOrjM6cc+MzPm6Svu5Cwr3fZPjlY=; b=PH9wgczBIWF6sZkXtMDPu1fwFfqzdjvgH5deW1K8U+xArhx+mAjHTHqTmC6AVx0o9g yUls3EOK3sAT0nrQc4yH6Ci2i//MxwBJgXvU94SUa1QNqX9Ezgl1OlxdKKu3OtHVYPHG +BGr1VWa1UGFF68kUgXGAmnNMewS0oUct8RkyWXphzIJCqmr9T+AYgiJ9LLOpQlyD+UE A7zfZxYNWuwDPNPkQym8rEr/KaZPA/uRzViKwymCc3V/aSNPuf8pByOfzNoUQPp/Y+sZ aTuAcfk9Tdr8+lKjqIkXkYbILIlejSmWh7wtVWSOv0eP2R+jc9iCpkT0ybsNOf8LvPOs qloA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=k6plyY31z8FLjLduOrjM6cc+MzPm6Svu5Cwr3fZPjlY=; b=rHhJq7V6AfR6I8ZqrcLBDswdOI73ro0VuzG9wjfi5jHpGmJ91ixQi1vkCPcibxz3Q+ aPNtmjqfy43Aqs5MwI0d7zdXTmzCL2FZhVqbFWFF+mguaL8txT03I+zc2HaS0JYrh86C gkk36jfnGZUBfHbBQHx2cyuMNmZdspV2naeD24bdsxUXDIjHCjSnrEZNVljbjjIQ0CK3 jhdr1KjUsjmyWbRGCrq1SGmKmpeO9uTbpTLA0MfImZ5M47CDgcuaw41YKff5byU9LF9R hXcp0wbW34sild7x4BjOgPGENDeedRj+G0JVahsDMqFNyyuyWJPFAjobW/AOSAGxZQRX WtPg== X-Gm-Message-State: APjAAAX4BF0zY9P1Z5ZF5xe7U7YVv98xhzS12d/jgsDPbi3U08oXVUmP WIUEEKRKThOps7bMYjGKZVhsQoWX X-Google-Smtp-Source: APXvYqz39g11+H0iTUhnwuzKvTcQAt7OeF4j3tBZ/jFRRFcv0daoSnWdxh5HQdnjrwubL0rJX0sLFw== X-Received: by 2002:a5d:8cd2:: with SMTP id k18mr20929679iot.242.1567280126261; Sat, 31 Aug 2019 12:35:26 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:25 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Colin Ian King , Len Brown Subject: [PATCH 07/19] tools/power turbostat: fix leak of file descriptor on error return path Date: Sat, 31 Aug 2019 15:34:46 -0400 Message-Id: <15423b958f33132152e209e98df0dedc7a78f22c.1567277326.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Colin Ian King Currently the error return path does not close the file fp and leaks a file descriptor. Fix this by closing the file. Fixes: 5ea7647b333f ("tools/power turbostat: Warn on bad ACPI LPIT data") Signed-off-by: Colin Ian King Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 02813a2a8ffd..41cf1206273c 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -2944,6 +2944,7 @@ int snapshot_sys_lpi_us(void) if (retval != 1) { fprintf(stderr, "Disabling Low Power Idle System output\n"); BIC_NOT_PRESENT(BIC_SYS_LPI); + fclose(fp); return -1; } fclose(fp); From patchwork Sat Aug 31 19:34:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124981 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3840214E5 for ; Sat, 31 Aug 2019 19:35:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 171BF23405 for ; Sat, 31 Aug 2019 19:35:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280129; bh=172B9vI3YPdColePZgaUFRNCeLeXd3sl5GUkIBqbK8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=kWvDZevy+6wt8XNp3bAh+cN3vFMpnP2mP7cZniP1pblWKfytUjvFoU/jZAZioP8co QnSGP4It9NH+hL0yXe/YrUmYqx10rrVRwdP8e0h7Jr1mRbcjPCvYCFbNcFcod3eND1 pzL4JgKyxrDGaHy2Rb5BrtemTntgYd7eZ5IGDpCg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728517AbfHaTf2 (ORCPT ); Sat, 31 Aug 2019 15:35:28 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:34669 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTf2 (ORCPT ); Sat, 31 Aug 2019 15:35:28 -0400 Received: by mail-io1-f68.google.com with SMTP id s21so21166147ioa.1 for ; Sat, 31 Aug 2019 12:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=gZJL2iIhBB5yJYfE+IFqeqeHKpBTg3suwKsoFE3jUes=; b=Gy5vAJtTN0q/XYWIidE6ZzKes+QqfcpW8Ksc7B0k81R8COC+3S6xTN292OhZZGOhzf X6Nx2yhs/AXIXhK0ILT0Yc8pQdmbL9fzKAEdGUNHQRUrfq+Usd/hY2768qycanDviugy eGehsbbJL4BTkxs4bnDInjeioftRShxtXNHA8ebbOeRcLdERSAMIln6yTrulT40pUB3a DyvmNrj0fGgyFAytn9y8++mcIvb3zfmGYIeczWpx5ljIVEnpWAts1bQzsgcGXntduje5 tPy/YkydQGF+veGb07wYQMfs/9oXrXf/pAVeeAnsbjNVHdSBAk+x5KfCFLOTPq+EvGEx VAbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=gZJL2iIhBB5yJYfE+IFqeqeHKpBTg3suwKsoFE3jUes=; b=lbuKatEmBi9hCYGNzFtZejAqubaIhHVgtSyBWwp08rxATix1Y2sKVfGcOBLs97LDNT JXSZxPPYdp48KN/4otpGkFiTu4PJf7i+yqJICT5esneu2uYkoUxXNjpXNRocNQmGQpCt pmtwAvpC99IC9l6JH+HgpO0CNzrpigKvIkuwpgoRZ5CCsQfW8MjFyWpomWLibAkQrjd2 UqnDCT39MsIyNcvUuNs2qGASY7B7GisS7UuHOVUQc6088+gZtdJBYtM6NH/AosiVArlj QouILI20qWPCoY+2+wUQfVoatEQjXjPp1sWx1meafZ+0JNITqrBx8cGLExdLuZjrnAt8 XpPQ== X-Gm-Message-State: APjAAAUlrjN7+21rsgiTmIghDBJpzA/wd2xcHkfj++piCkcbA86xK2PP 2Wqdpp88p/rKHVxS2bDxTIrgIRMN X-Google-Smtp-Source: APXvYqyktVPQs4RHO3+1uvUSqjFAiqy0hfcs5IswK+LxoTMzUaokPTyN/m74dD9IjsruyuPvxVWntA== X-Received: by 2002:a5d:9551:: with SMTP id a17mr9884521ios.37.1567280127396; Sat, 31 Aug 2019 12:35:27 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:26 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: "Gustavo A. R. Silva" , Prarit Bhargava , Len Brown Subject: [PATCH 08/19] tools/power turbostat: fix file descriptor leaks Date: Sat, 31 Aug 2019 15:34:47 -0400 Message-Id: <605736c6929d541c78a85dffae4d33a23b6b2149.1567277326.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: "Gustavo A. R. Silva" Fix file descriptor leaks by closing fp before return. Addresses-Coverity-ID: 1444591 ("Resource leak") Addresses-Coverity-ID: 1444592 ("Resource leak") Fixes: 5ea7647b333f ("tools/power turbostat: Warn on bad ACPI LPIT data") Signed-off-by: Gustavo A. R. Silva Reviewed-by: Prarit Bhargava Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 41cf1206273c..2fb5c155289b 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -2918,6 +2918,7 @@ int snapshot_cpu_lpi_us(void) if (retval != 1) { fprintf(stderr, "Disabling Low Power Idle CPU output\n"); BIC_NOT_PRESENT(BIC_CPU_LPI); + fclose(fp); return -1; } From patchwork Sat Aug 31 19:34:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124983 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4868D14E5 for ; Sat, 31 Aug 2019 19:35:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2802A23405 for ; Sat, 31 Aug 2019 19:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280130; bh=TIFubHzjYpunUTvA5wUrOoLpeDOrS6cA6VY6OjBzuQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=epFyDzIMpcjrernqy6FdJC0bPLO2RDG+x5eT6bqts5Wij2wrFR4fI571lIpHomTnu hOOVtAtApOrK6FEjMbfCBoZlLgomDK5lHUlhO1fIgusu/Ca4hbuOpRhIpIvE9AK2Eg vVE6Wr/TC3Sp7S8KkaIEborreXQ2WDg7PSEUhxP4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728519AbfHaTf3 (ORCPT ); Sat, 31 Aug 2019 15:35:29 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:33337 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTf3 (ORCPT ); Sat, 31 Aug 2019 15:35:29 -0400 Received: by mail-io1-f66.google.com with SMTP id z3so21192865iog.0 for ; Sat, 31 Aug 2019 12:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=ife59CansJdiuUBisqVTeUVM1g1vLhLaLfQdgHpFelc=; b=YW20kUuojr7RFMNv8I/JDd6DjUHGL8S3OzQf06g+tv+35fab1epRPSIKGGDf3yQYXt BUiPBSByWWIEBtpqtIa9bnDXTrgBHCfv72RZwC9lpjvHNTPLxDoL8mV4jaH9vHblSK4u Y2jHwH+rh8NoGRYYxHE31kmjYKL9yFKrZ5wqEOGQkuj4o1fW1toGv5NRo2F0BDnL8jLt Sbuhv62OktQ08SfkXntaoMsL9qyxL8EOEP28Sh48L9Ux7qbtFquzjOqE5LYWB8Slv4Vz PTOLfxivfD1Ag3osBv4+pk/UyyBn9IbLCs5pA5QuIdRY0AHP/QfQHUF9m1fsO59Jy6Vo SCNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=ife59CansJdiuUBisqVTeUVM1g1vLhLaLfQdgHpFelc=; b=OBAgvd3KpWCQbCgBV2M7zyPl5If/Rvryb6+Rn3Bt+Tw2ZghB/d4G/DP9x3+h4o8dEQ dG8q1v/ju5rV5FXvS8EZ0dRfO5EO0cKqERKnpFQoEfiyNgiNkr8TUUEC2zh4ySINzLn/ SZ0jfLH0Zb1V4KRTXoRk98i63/wp9wGFvtnAjUOnniKDPrT7kRwN+kobZx4u9Uutxt1s kgZdNXQ1m1EZyMZqcvsGK9IWPZ4TxoU4oj48jR51Prnk1ygtcV6w02rBkE5K2JNWGWRB vrNunvj3ZLpe+FTy0Dx+ceZEIjtgtUpnf2E0vzz7bUC+q5QtJDDuI2gnzw4qOdy9hCep QzCg== X-Gm-Message-State: APjAAAXa3EUETnmzSadiz6wcGR6ijEtT6b/RAhVp+N90zXv8EPzFjQ9Y 6IO2/Y53IVnhLD+8uypBHVoQ8E7V X-Google-Smtp-Source: APXvYqwpLlvwxlwFXSI32Je8tI2O7F1WW17i8L78IW0EZrta8peIx8Ojg1ZjMBvXCgzxlP8236jMBQ== X-Received: by 2002:a5d:9d49:: with SMTP id k9mr10822195iok.106.1567280128468; Sat, 31 Aug 2019 12:35:28 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:27 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Naoya Horiguchi , Len Brown Subject: [PATCH 09/19] tools/power turbostat: fix buffer overrun Date: Sat, 31 Aug 2019 15:34:48 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Naoya Horiguchi turbostat could be terminated by general protection fault on some latest hardwares which (for example) support 9 levels of C-states and show 18 "tADDED" lines. That bloats the total output and finally causes buffer overrun. So let's extend the buffer to avoid this. Signed-off-by: Naoya Horiguchi Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 2fb5c155289b..f8f4e1c130a6 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -5131,7 +5131,7 @@ int initialize_counters(int cpu_id) void allocate_output_buffer() { - output_buffer = calloc(1, (1 + topo.num_cpus) * 1024); + output_buffer = calloc(1, (1 + topo.num_cpus) * 2048); outp = output_buffer; if (outp == NULL) err(-1, "calloc output buffer"); From patchwork Sat Aug 31 19:34:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124985 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F362112C for ; Sat, 31 Aug 2019 19:35:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E9EE23405 for ; Sat, 31 Aug 2019 19:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280131; bh=Ou8yuRohXW8Uxe2FUN8ctU4QH2aJ6YZ0QP+lZlUH4zQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=bHsmPGe/O+ES42sRhc9MaOi6JfJ9Pn3LctbaIdI3fTIdIXhwbT1I88x9TmP2kqET5 s++33nNr0TnmTqOAJ+SnZXSeanhj7FutX0pajUJa50FKQpeyZA5pmoank9VuirvML0 PnbDevy5Uq3W2uHhLIBIld6sF2acHjnpocYkMjvo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728526AbfHaTfa (ORCPT ); Sat, 31 Aug 2019 15:35:30 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:41362 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfa (ORCPT ); Sat, 31 Aug 2019 15:35:30 -0400 Received: by mail-io1-f68.google.com with SMTP id j5so21051378ioj.8 for ; Sat, 31 Aug 2019 12:35:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=YtAgTdw/rysthovZPX64XjklJsUxVge/haMZznY1gms=; b=Lz/E+JRiRVkEwgb419X69FWgmT/paqrh8oeJkaiAkpxodxwhoT0WzeM5Hd02ojyZ4o 41+CPioXKyBYXIDXPRuW3+C9N/I/itToREcA6klAoRotOyitWIy1GkSAB+S5GJ8SJ4Ub OyO3nvOvClLuXFLPniM3nJr50n7BZfGQE4OS0dBMe4bijpNI1pdvkAxA9ZcwuQUWbZ7n r0VsOJvQcvMnLuXuV+y0VZ5J1ChgSFazu4aZm3gNO4vVu/iZYKGmxhJ8hZmLtJzBBMxM s9bMqGAKDVthdTJ5dRpSbrvUsePLwIaerLbDd2ejNAP+fshvfJR5vTxFJqwPWc6mhr56 VdtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=YtAgTdw/rysthovZPX64XjklJsUxVge/haMZznY1gms=; b=ajO6C1LO/VFgYKjwcq+BlOeDy7JtKBbQqo1IImG3xwdo9BcLnLotsaynn88P/iTkTM 9imyKi/6nhYmZI2zCGIimkwJ6xyLm88tRRZumjztdlP+LlCTtdoQ6mvoXMgia6khiOo5 WHm/8//pcTFzFQBWWs9bzP2Vha3ujEx4Jx3S4YTYQF1L4BEQsZoQj22rvNfuwKM8Ymjn nmIRM9xpiJJkqt7xpApsmklgbffUV1f/vSJJFFuBvYnf4K49RQEZLcFb9iZM4nUTfSBX Lyk5CKEIpdhAlgBS0T571GiiKcPZ9KCljWHPEgsDUhMTAX76TVjO3cX3gXiGKTneYtGA GoSw== X-Gm-Message-State: APjAAAX6qKSFjLda4nhYTS2kj4Ptrb+exiWkzwfPAEzhlMmTBKByWzQi DFSjZynN9TRApU1/c7N3dYKvs5HJ X-Google-Smtp-Source: APXvYqwHejdJJvMW3icPtoD11xRClVxBAN5hnFCvFLAhfJXb0eLGFSC08Z0jGwBFT3+ZTD4ipjBQkg== X-Received: by 2002:a5d:8a10:: with SMTP id w16mr4605505iod.175.1567280129551; Sat, 31 Aug 2019 12:35:29 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:28 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Zhang Rui , Len Brown Subject: [PATCH 10/19] tools/power turbostat: add Jacobsville support Date: Sat, 31 Aug 2019 15:34:49 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Zhang Rui Jacobsville behaves like Denverton. Signed-off-by: Zhang Rui Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index f8f4e1c130a6..35f4366a522e 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4591,6 +4591,9 @@ unsigned int intel_model_duplicates(unsigned int model) case INTEL_FAM6_ICELAKE_MOBILE: return INTEL_FAM6_CANNONLAKE_MOBILE; + + case INTEL_FAM6_ATOM_TREMONT_X: + return INTEL_FAM6_ATOM_GOLDMONT_X; } return model; } From patchwork Sat Aug 31 19:34:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124987 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CA0E112C for ; Sat, 31 Aug 2019 19:35:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B44223407 for ; Sat, 31 Aug 2019 19:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280132; bh=/Hc2Rem7ENVXcliNKvWnw3LkIyCb99+X2tYFOPd5r3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=xcFb3Hi/4zLqV9xAbg9m71p5sLRj9/FB0be3AunN2vTfk1I5cwOS5taagVXoVZk8v o2L4/U8zBMCLhEqLf9310K2CMVtp90BuWet2zrcC/42YI52XOAJnXSLswByEVMS59o e7lav+mMD5FziLz3dk9AL2DaO7A4BQqplFRq/m7U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728528AbfHaTfb (ORCPT ); Sat, 31 Aug 2019 15:35:31 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:36483 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfb (ORCPT ); Sat, 31 Aug 2019 15:35:31 -0400 Received: by mail-io1-f67.google.com with SMTP id o9so21126549iom.3 for ; Sat, 31 Aug 2019 12:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=xKyYA9KsO1EO5NoXY2+q1lFzQrl8ewmkWHBmX9CJ9h8=; b=Oc0WBv1wp2Th5YIHJyG27V9qkYFpqvcZcCrlwBOdKCbwI/uYeRExwIy73iZ/F6QIbU S0r3TFvMr4Idl3magmWf+ytjNAwv8O/DsyomJTwLiqggovTBi6kUu6Zlra4JfGy3vWsF 9SxQoFOzkmmuZf74EFKXPM/8VOjR3/oZ4qJSKreNxRwprGQFgy6eApbOGlJVMV8KmO9X PrQY9zESKU95QLBUuyirTl0p//THsIh9EgmQA0sv7X3+w9sw7y2bWnwKgG11EwoQWJYc 6T8iWGW1brhDpypeT9i7Auz7pSRQRXh5wCjHd2rJsTbbY9Y+t2rk8DYi9BV0WqIW9z3x YhpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=xKyYA9KsO1EO5NoXY2+q1lFzQrl8ewmkWHBmX9CJ9h8=; b=AxCK6B2hS3qdXZTz4q8R3+g+WsJPgAFgvCXrmkow+P0ZQ8tW2kb2MKiNl4g6lI1yJp zjh1IDcHGYHve9clVaSpMwBjyUahV7QkjmI5FI4JVuMZh0GCEqv6gcNEKCA8kRS4t+aW 1gRNSzVuAx3P5sO7v/RZcRtbkE3nGLsGxfkCHy0UW9yw8g18N8HuG65rO+0ov2tjG2CY PZ6Y0m/7wtgEXIE6qfW1FkDpGaUV3t/R43Jz/tpvwySQfy+0/Cos6KZkZk4SC/Lo2zf6 yEUiRBakWpWiEcXz3APlUMyuT8OC47TpnpNPdbgQ+ueR/IIBS+4ceKRReWlNp5a1M6XG zrww== X-Gm-Message-State: APjAAAVWzVEGTJQdCuyZgJN+PCjpoYnJVGk2QMWXsir++CMi15D8vzY/ 8bkAgWR0PhhKz4yIWHdgNkl/Yfqe X-Google-Smtp-Source: APXvYqyWoO918KI09CabWk9bxpfwPVate1lncW2H2rscwhb6o7LWMDdzx/jZhirj7Mg5xjkEj+LzEA== X-Received: by 2002:a02:c652:: with SMTP id k18mr16761184jan.44.1567280130649; Sat, 31 Aug 2019 12:35:30 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:30 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown , Prarit Bhargava , Kosuke Tatsukawa Subject: [PATCH 11/19] tools/power turbostat: Fix Haswell Core systems Date: Sat, 31 Aug 2019 15:34:50 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Len Brown turbostat: cpu0: msr offset 0x630 read failed: Input/output error because Haswell Core does not have C8-C10. Output C8-C10 only on Haswell ULT. Fixes: f5a4c76ad7de ("tools/power turbostat: consolidate duplicate model numbers") Reported-by: Prarit Bhargava Suggested-by: Kosuke Tatsukawa Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 35f4366a522e..78e7c94b94bf 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -3217,6 +3217,7 @@ int probe_nhm_msrs(unsigned int family, unsigned int model) break; case INTEL_FAM6_HASWELL_CORE: /* HSW */ case INTEL_FAM6_HASWELL_X: /* HSX */ + case INTEL_FAM6_HASWELL_ULT: /* HSW */ case INTEL_FAM6_HASWELL_GT3E: /* HSW */ case INTEL_FAM6_BROADWELL_CORE: /* BDW */ case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ @@ -3413,6 +3414,7 @@ int has_config_tdp(unsigned int family, unsigned int model) case INTEL_FAM6_IVYBRIDGE: /* IVB */ case INTEL_FAM6_HASWELL_CORE: /* HSW */ case INTEL_FAM6_HASWELL_X: /* HSX */ + case INTEL_FAM6_HASWELL_ULT: /* HSW */ case INTEL_FAM6_HASWELL_GT3E: /* HSW */ case INTEL_FAM6_BROADWELL_CORE: /* BDW */ case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ @@ -3849,6 +3851,7 @@ void rapl_probe_intel(unsigned int family, unsigned int model) case INTEL_FAM6_SANDYBRIDGE: case INTEL_FAM6_IVYBRIDGE: case INTEL_FAM6_HASWELL_CORE: /* HSW */ + case INTEL_FAM6_HASWELL_ULT: /* HSW */ case INTEL_FAM6_HASWELL_GT3E: /* HSW */ case INTEL_FAM6_BROADWELL_CORE: /* BDW */ case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ @@ -4040,6 +4043,7 @@ void perf_limit_reasons_probe(unsigned int family, unsigned int model) switch (model) { case INTEL_FAM6_HASWELL_CORE: /* HSW */ + case INTEL_FAM6_HASWELL_ULT: /* HSW */ case INTEL_FAM6_HASWELL_GT3E: /* HSW */ do_gfx_perf_limit_reasons = 1; case INTEL_FAM6_HASWELL_X: /* HSX */ @@ -4259,6 +4263,7 @@ int has_snb_msrs(unsigned int family, unsigned int model) case INTEL_FAM6_IVYBRIDGE_X: /* IVB Xeon */ case INTEL_FAM6_HASWELL_CORE: /* HSW */ case INTEL_FAM6_HASWELL_X: /* HSW */ + case INTEL_FAM6_HASWELL_ULT: /* HSW */ case INTEL_FAM6_HASWELL_GT3E: /* HSW */ case INTEL_FAM6_BROADWELL_CORE: /* BDW */ case INTEL_FAM6_BROADWELL_GT3E: /* BDW */ @@ -4292,7 +4297,7 @@ int has_hsw_msrs(unsigned int family, unsigned int model) return 0; switch (model) { - case INTEL_FAM6_HASWELL_CORE: + case INTEL_FAM6_HASWELL_ULT: /* HSW */ case INTEL_FAM6_BROADWELL_CORE: /* BDW */ case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */ case INTEL_FAM6_CANNONLAKE_MOBILE: /* CNL */ @@ -4576,9 +4581,6 @@ unsigned int intel_model_duplicates(unsigned int model) case INTEL_FAM6_XEON_PHI_KNM: return INTEL_FAM6_XEON_PHI_KNL; - case INTEL_FAM6_HASWELL_ULT: - return INTEL_FAM6_HASWELL_CORE; - case INTEL_FAM6_BROADWELL_X: case INTEL_FAM6_BROADWELL_XEON_D: /* BDX-DE */ return INTEL_FAM6_BROADWELL_X; From patchwork Sat Aug 31 19:34:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124989 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E33F214E5 for ; Sat, 31 Aug 2019 19:35:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C300423407 for ; Sat, 31 Aug 2019 19:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280133; bh=4GevN5A1nTOsJrixomW+8wGx74fLAiYm3QrNW3jnQbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=CWQ/P042gSx1lCVyCefhZ2/p0gSv7Z6IEfd6bWW7v+ePGglC5NeBj43lXVIKKc5wT Gz7BanIl2/9mYZKZ7rTq1mx565M++eoENqRRdNO1KIkXtT0xMi9RhssKcauCiZ063s /zojPPcOc3hLDRlN0GjegvN8UX3Li3XSmRYSe8hc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728529AbfHaTfd (ORCPT ); Sat, 31 Aug 2019 15:35:33 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:46300 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfd (ORCPT ); Sat, 31 Aug 2019 15:35:33 -0400 Received: by mail-io1-f66.google.com with SMTP id x4so20979451iog.13 for ; Sat, 31 Aug 2019 12:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=S0OD9wVgE6v58M4Qw6sw2QVJIjux+G04iwcrpqNzrbs=; b=c8LPbumJpvJgcZ3HYonEdLFsm3D6vt7veJFpNsuQccDe9hOxM50VFzAVKu1V78DOsl 501vT94V75CQoYnVQVzR9kAj2F5rhGaS3PyCOJR9qrmxTvRFFe5OimSxGCNeFqVhUym1 /8+EW1H5XTYo04AVO7HrzDowFwHJIfyttuUH8TXICYshfvs0Fdn/X3CZzgtxWMYqy/Sv S/BfJNujpnjp3a7n3Vin10fVHLgFbY9Pz/e05fRXvvx4yOT/996Q/8Aq+EFn5Vmp5roN /LbmC6x2CXFKknd0/bcFe4pKnC1wBCeW6JlkHKqEqg+W+ogOP5xFX9v47QngD2kdSCeg C2pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=S0OD9wVgE6v58M4Qw6sw2QVJIjux+G04iwcrpqNzrbs=; b=dFLc3msfo+6u9vMl13ZhnZ+Fkd9S//O23r1UTeMn+jHHz2yOBDDewewAdC785sJxTu yNQX8uMrykKoz39y8oLUujcZa9HWvke58kBrs4znKFcygvJ60Wvd/2dUB96AAY5PvtQh LiPukKjtBKc/rwMoP6E3D74n/bCVoHMwTigkAghPpAf9KgjdIm7mWZyggW/i79qXv7WT 9r5sY6pUmAExoJAk/iSSsEK0QD2RmFi+gXtF50NsyKYzSOJHIgbtZkX5FHY81wGE5eXh NMzMNdm1TBcbS0Q12oU27+pnLPZoU1yHRICVjVZAd/wd9IfFJfJ0osh50HHJj504Y6H5 6wtg== X-Gm-Message-State: APjAAAWtH6LMzUzGb6iPGSIxtDU9i+TiXxI3+Y+UZRrLYwKKRyygEx4h sGBNWTcd5dSTetm4G81ZS1sgadJo X-Google-Smtp-Source: APXvYqzrwImkwBJlIoQDqRwd8sOlsRxF1zob7vVBVqT7B1RhwroyIYkh90ycNTvUj2FBRA4quwS5GA== X-Received: by 2002:a5d:8506:: with SMTP id q6mr11752441ion.43.1567280131821; Sat, 31 Aug 2019 12:35:31 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:31 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown Subject: [PATCH 12/19] tools/power turbostat: rename has_hsw_msrs() Date: Sat, 31 Aug 2019 15:34:51 -0400 Message-Id: <570992fc5733b5e1b00a4bdb9272df1e25d63972.1567277326.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Len Brown Perhaps if this more descriptive name had been used, then we wouldn't have had the HSW ULT vs HSW CORE bug, fixed by the previous commit. Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 78e7c94b94bf..51c739043214 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4280,7 +4280,7 @@ int has_snb_msrs(unsigned int family, unsigned int model) } /* - * HSW adds support for additional MSRs: + * HSW ULT added support for C8/C9/C10 MSRs: * * MSR_PKG_C8_RESIDENCY 0x00000630 * MSR_PKG_C9_RESIDENCY 0x00000631 @@ -4291,7 +4291,7 @@ int has_snb_msrs(unsigned int family, unsigned int model) * MSR_PKGC10_IRTL 0x00000635 * */ -int has_hsw_msrs(unsigned int family, unsigned int model) +int has_c8910_msrs(unsigned int family, unsigned int model) { if (!genuine_intel) return 0; @@ -4833,12 +4833,12 @@ void process_cpuid() BIC_NOT_PRESENT(BIC_CPU_c7); BIC_NOT_PRESENT(BIC_Pkgpc7); } - if (has_hsw_msrs(family, model)) { + if (has_c8910_msrs(family, model)) { BIC_PRESENT(BIC_Pkgpc8); BIC_PRESENT(BIC_Pkgpc9); BIC_PRESENT(BIC_Pkgpc10); } - do_irtl_hsw = has_hsw_msrs(family, model); + do_irtl_hsw = has_c8910_msrs(family, model); if (has_skl_msrs(family, model)) { BIC_PRESENT(BIC_Totl_c0); BIC_PRESENT(BIC_Any_c0); From patchwork Sat Aug 31 19:34:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124991 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D9CEA14E5 for ; Sat, 31 Aug 2019 19:35:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA1F723407 for ; Sat, 31 Aug 2019 19:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280134; bh=cVrKS/uy3awKsqvptQdRd/8LQ/Pf4+v5IvcopOOkGHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=ZF3bwck7MfFPLd9X2WksZA2/4QCHhJBmgY5r4ySpybapAZbAx+HflhKtiZH3NKZkN uIVz1ajIX3TpkErIhgjjGP7mtvz5Ya5xRKwZV6pCVNy3SpOLRuw+fStZ84ts0Pgf8r RVpq48xZfOlSAMIyp4lMTf0kOsV3UpN1m8+AE4DA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728532AbfHaTfe (ORCPT ); Sat, 31 Aug 2019 15:35:34 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:36947 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfe (ORCPT ); Sat, 31 Aug 2019 15:35:34 -0400 Received: by mail-io1-f68.google.com with SMTP id r4so5857326iop.4 for ; Sat, 31 Aug 2019 12:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=r0BZFCqeNNMORYOqW9EwnjHAkQAb/FSxUgaPTHccQvM=; b=OHyX9QE8nCNrdxEBg/kpA3vvZlDLVkF1RkPKA6mgMM29gjltAQLreqaNK9WVEX0hbp ICmO+CpN9uWQbnA5AuLGOC4dqJViB5EEEadz/xjcF3t2Nuu17DbI93huDXhjEPZfGtFI s/4uyvfpp7qOgbXK+k1zKOXGJ5OIsUqqfiOE/sOUaJCkMINdMf0OYCOIAC/a+j0js2FZ csAaK+JqbQlk6hHSl+Gb+5ajiNhIdh1jnantQLzNKOiS9v+MivWLBHVVW9XvGgQwFJT0 SadLfm9YszzCfOIQ9thl3K1ettnn2smLFi9WkchZJsMt01ioqClBKNeHnXm20jXtNyug akIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=r0BZFCqeNNMORYOqW9EwnjHAkQAb/FSxUgaPTHccQvM=; b=lO0Fkyd8JvMvTVbJP0TGcQxJM5DjQwvKFVoaxbMiR8d+IfOqDytq+oyFXS85UT3vCd rooRYsA9EH3k/I3GXOwHmYQCm/xu1uqZavNXU+5NEedwm/ra7u7kSijyAv+CqomS2ae5 xADWixfXLqJ7CBEkg2L/ov/bZPy5Fj2U1Jo8xTTf2sUkSBRkDozKl67iC0yxh/IrkzpA D5Eo301+wqwjwTPIdKQTp1tQcQiNUwbxQIwPw6dz2jYsJB5LZwRAYWxprmAyVaHwu7zD qRnoFjKFd6U/aq0Fpp6++r+aCVoxDEQqxU+86kI86VXl2HOLLpx07ty+AutHol2dRYF2 kMPg== X-Gm-Message-State: APjAAAX86eY0VqijYWbxtvXzVUfX1+JuK1QXLbzSesTJYEaB+kOEiua7 QJPQ5++QleT1F63eRnVIau6blXFs X-Google-Smtp-Source: APXvYqym8TZilZO6TpF5qwwBAQayVi08S1W5Ofu+KFVZOqN00nSyFjcu4/lUEgqPCCccYD05XFo5FA== X-Received: by 2002:a02:3004:: with SMTP id q4mr23345678jaq.55.1567280132971; Sat, 31 Aug 2019 12:35:32 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:32 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Rajneesh Bhardwaj , Len Brown Subject: [PATCH 13/19] tools/power turbostat: Add Ice Lake NNPI support Date: Sat, 31 Aug 2019 15:34:52 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Rajneesh Bhardwaj This enables turbostat utility on Ice Lake NNPI SoC. Link: https://lkml.org/lkml/2019/6/5/1034 Signed-off-by: Rajneesh Bhardwaj Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 51c739043214..393509655449 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4592,6 +4592,7 @@ unsigned int intel_model_duplicates(unsigned int model) return INTEL_FAM6_SKYLAKE_MOBILE; case INTEL_FAM6_ICELAKE_MOBILE: + case INTEL_FAM6_ICELAKE_NNPI: return INTEL_FAM6_CANNONLAKE_MOBILE; case INTEL_FAM6_ATOM_TREMONT_X: From patchwork Sat Aug 31 19:34:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124993 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1E7F112C for ; Sat, 31 Aug 2019 19:35:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1AEC23407 for ; Sat, 31 Aug 2019 19:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280135; bh=ZzZB4N919oP3p1PcsF62eNmMMKjGO6MVDqMMDxPD5dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=NbJ1jFlbxjJp1/4Rl9s1ei18TPbgM1WdR+fTWSuVuMUjzt3BoFlDq9YUyzrILLUnJ KobhY9aJxjhqcseFYpO9/LiNsMwyuc4GM4//PfboX1h1EAN+ztC1nCbuf19HqRoD2r Q67b+hI3XI9g4qYslbGDGPvDutGmBC2DMowojmcc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728534AbfHaTff (ORCPT ); Sat, 31 Aug 2019 15:35:35 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:33349 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTff (ORCPT ); Sat, 31 Aug 2019 15:35:35 -0400 Received: by mail-io1-f66.google.com with SMTP id z3so21193189iog.0 for ; Sat, 31 Aug 2019 12:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=W8IjgHJgjRQgzqQRCvs9HodXbINZHTbofSu+T/nBITE=; b=Ghawx0arY68zwQEv2cC8j36tNlC+m2OJTBOuCw4txYuGQAwettTvO/BFN9sjZexjqX 0xCwueZyQ4swiCE2275lCufGuTosEpWSb/RhiqShE8kXtgx+qliJRRD4pHFC7+CEjUrB /X+TJFnRpThZBvoAFfEV5V4ZMDXGzixfAdkn4X3t3ytodKY95dCgtr+mBjLQ2Me2ZVKq 2rvutO17MKgNj8okePcJWG1RlCC+zJtz6LQ9y62A2p6qhJT3nmik3j4vHypJceTJt6T5 n8Fiy6n22TiEOuF4K8/9B50ACkpoDAIHkOiyfvdg8vkRzZCv8nC4dmOhTzESFEPgb3lw nqvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=W8IjgHJgjRQgzqQRCvs9HodXbINZHTbofSu+T/nBITE=; b=lCDT30mRKX9LlR1l4uN9IdK3GVtQ6tpYYwEiPRXlsO8+1Cc/8F4ZfwHXr5n+Q6rdHU IT8Sxg7YvZ/kXqQe22fY2dZ6wnQ3kHbSQz0VMFDOXkpauIa91s5H9oz81qhyqYenNJAQ KJJg9w1RRWVJFIbHwJ7xydNvy4JVk5K/Xn3TM5uf84kjN/sIdxXYfgt5QBMSAshdVpZA Rz8CqXWcu95GKskuo8FUaosiAhcpfyc4J5dvSoYQVyIN9H20g0qO5EsPKzJOZbehtH55 ct99HcPbqIBQl0H8xIURd5K/w3h1h2TJYpAH/DFXHKkYBQQQ6NMNG6hovC8TLRKnZ7nM rE1Q== X-Gm-Message-State: APjAAAXwn0G/1CwksewitRQ6yTtbLrEuA5MHnqW5iJIOzXO+K1XwvNmR RxIH5FqMVJ7Mjfkv2hszAzJ/TP/w X-Google-Smtp-Source: APXvYqw4njIhTizFyWCZ/Vqjy129RSUFopud4XHiqDxmyTFD1ot+FG130AFFIT80MpJcnmknFSloWw== X-Received: by 2002:a6b:5a0b:: with SMTP id o11mr25364941iob.98.1567280134240; Sat, 31 Aug 2019 12:35:34 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:33 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Artem Bityutskiy , Len Brown Subject: [PATCH 14/19] tools/power turbostat: read from pipes too Date: Sat, 31 Aug 2019 15:34:53 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Artem Bityutskiy Commit '47936f944e78 tools/power turbostat: fix printing on input' make a valid fix, but it completely disabled piped stdin support, which is a valuable use-case. Indeed, if stdin is a pipe, turbostat won't read anything from it, so it becomes impossible to get turbostat output at user-defined moments, instead of the regular intervals. There is no reason why this should works for terminals, but not for pipes. This patch improves the situation. Instead of ignoring pipes, we read data from them but gracefully handle the EOF case. Signed-off-by: Artem Bityutskiy Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 393509655449..095bd52cc086 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -100,6 +100,7 @@ unsigned int has_hwp_epp; /* IA32_HWP_REQUEST[bits 31:24] */ unsigned int has_hwp_pkg; /* IA32_HWP_REQUEST_PKG */ unsigned int has_misc_feature_control; unsigned int first_counter_read = 1; +int ignore_stdin; #define RAPL_PKG (1 << 0) /* 0x610 MSR_PKG_POWER_LIMIT */ @@ -3013,26 +3014,37 @@ void setup_signal_handler(void) void do_sleep(void) { - struct timeval select_timeout; + struct timeval tout; + struct timespec rest; fd_set readfds; int retval; FD_ZERO(&readfds); FD_SET(0, &readfds); - if (!isatty(fileno(stdin))) { + if (ignore_stdin) { nanosleep(&interval_ts, NULL); return; } - select_timeout = interval_tv; - retval = select(1, &readfds, NULL, NULL, &select_timeout); + tout = interval_tv; + retval = select(1, &readfds, NULL, NULL, &tout); if (retval == 1) { switch (getc(stdin)) { case 'q': exit_requested = 1; break; + case EOF: + /* + * 'stdin' is a pipe closed on the other end. There + * won't be any further input. + */ + ignore_stdin = 1; + /* Sleep the rest of the time */ + rest.tv_sec = (tout.tv_sec + tout.tv_usec / 1000000); + rest.tv_nsec = (tout.tv_usec % 1000000) * 1000; + nanosleep(&rest, NULL); } /* make sure this manually-invoked interval is at least 1ms long */ nanosleep(&one_msec, NULL); From patchwork Sat Aug 31 19:34:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124995 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B26014E5 for ; Sat, 31 Aug 2019 19:35:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE80623407 for ; Sat, 31 Aug 2019 19:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280136; bh=WglaG10q/vx4kgu6MmDH3QTXtCOtBd84c9vEbXeg8CA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=si736ZXb5apxslRhGxyoVLL4YbQxr84938JZSEI95BlNpa/6EHJZ6ieEylLs0Xgdo yAYHtuyPKvSTb8n9lPXuPI2MhgM5jew2bVdHXmcjsaDYK4w/5sz13t4Vj/lxJVMu2J j/7AxpHRVl7N30zqSj9GlQgN5hgnc5LpBBxqP0q4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728535AbfHaTfg (ORCPT ); Sat, 31 Aug 2019 15:35:36 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:34995 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfg (ORCPT ); Sat, 31 Aug 2019 15:35:36 -0400 Received: by mail-io1-f66.google.com with SMTP id b10so21164073ioj.2 for ; Sat, 31 Aug 2019 12:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=m4A5h0f2b2nIrrIPM5usQ/YpBoauyjrswSSVHT+GqA4=; b=OTE1NmxrAPQTE79fVy3rHqSygD/ToDFmqIOgXu2AEpIXjahPUW32vjR/apVhWZSaFd Egf0PDwzEBYOj1N19A4thGRR5RZ7vpZavaqwBWEmj54lpOHKurBoO0WbolUvg7ZlVNK5 5B+qwqIU0SAcdA3yUkSu3CVNL7ZzHY47IjdHRFuSW9LkxeYZE8AjNxMnBd09ja7D+iBq c/zNayemBQErDboHY3t9xygkZG+xAH7QNF3+nYbKk99BPWJLEkq9A1nGo/ZoHzJMlEll ZBb+E5dV6sn7JCdhnkrkjGcK8lfc7FZEnyGnhSxfjUuK/S/T1IFouQgh/t8ySzA7Ccdi Y5aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=m4A5h0f2b2nIrrIPM5usQ/YpBoauyjrswSSVHT+GqA4=; b=aPp9vE0cMY5ysonEdGrAcZ6evuZpIbxsM7SrLvWwX/ptl/MBLWpWXmDe5HapQVOtG0 GmBhgT7m4yRZOlOA9PeIQG/YbCu27eN8S14QVPxiTU/T41FNnyHARR2+LxwuRQlq27e8 SD5qbbKHslpg9+wZpN/v//hRcyFVq8NvTr4Mibb0AKne5Vp1kG0wlGg7NLIyj9i+f54Q KlMyYud7RyZ6j2lwqERf2T11VnqzfiMy760KrqhPUW0b5WnCmX8+m2BfTC5Z+xlUDafT Z+WCQQtai06wLGU9uHZljJI6WAmpaQ0R3F0FIblmuo9EKgbyglmUw/kfZq9B/HclV/wV GGlw== X-Gm-Message-State: APjAAAXZQqrDk9N0uI8lC2v31yVxCiPTaO55PFmCiajF0TeZK1aMog/5 UC+bBZXRzB2KdsIe78ipavDcK/BX X-Google-Smtp-Source: APXvYqyYI7mAUMw3DsAj31YazUrUV2bO7R4gVtjB0/jBA7cUIY99G3KhSABAedILEgNnJ68qAABS5Q== X-Received: by 2002:a5d:9dc9:: with SMTP id 9mr17414434ioo.199.1567280135258; Sat, 31 Aug 2019 12:35:35 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:34 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Artem Bityutskiy , Len Brown Subject: [PATCH 15/19] tools/power turbostat: do not enforce 1ms Date: Sat, 31 Aug 2019 15:34:54 -0400 Message-Id: <6ee9fc63d2e7999f93a466e202ae3b557e9c739c.1567277326.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Artem Bityutskiy Turbostat works by taking a snapshot of counters, sleeping, taking another snapshot, calculating deltas, and printing out the table. The sleep time is controlled via -i option or by user sending a signal or a character to stdin. In the latter case, turbostat always adds 1 ms sleep before it reads the counters, in order to avoid larger imprecisions in the results in prints. While the 1 ms delay may be a good idea for a "dumb" user, it is a problem for an "aware" user. I do thousands and thousands of measurements over a short period of time (like 2ms), and turbostat unconditionally adds a 1ms to my interval, so I cannot get what I really need. This patch removes the unconditional 1ms sleep. This is an expert user tool, after all, and non-experts will unlikely ever use it in the non-fixed interval mode anyway, so I think it is OK to remove the 1ms delay. Signed-off-by: Artem Bityutskiy Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 095bd52cc086..7d72268e546d 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -39,7 +39,6 @@ FILE *outf; int *fd_percpu; struct timeval interval_tv = {5, 0}; struct timespec interval_ts = {5, 0}; -struct timespec one_msec = {0, 1000000}; unsigned int num_iterations; unsigned int debug; unsigned int quiet; @@ -2994,8 +2993,6 @@ static void signal_handler (int signal) fprintf(stderr, "SIGUSR1\n"); break; } - /* make sure this manually-invoked interval is at least 1ms long */ - nanosleep(&one_msec, NULL); } void setup_signal_handler(void) @@ -3046,8 +3043,6 @@ void do_sleep(void) rest.tv_nsec = (tout.tv_usec % 1000000) * 1000; nanosleep(&rest, NULL); } - /* make sure this manually-invoked interval is at least 1ms long */ - nanosleep(&one_msec, NULL); } } From patchwork Sat Aug 31 19:34:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124997 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B6A514E5 for ; Sat, 31 Aug 2019 19:35:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B97B23407 for ; Sat, 31 Aug 2019 19:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280138; bh=w8zoqllFXz3c5Wfi5Su9xGxpJhhH45/vkZpnlBF5iTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=FCenpo6Tepwmrnue0P2AGJ21aDw805T1Fze5RHmozfwDCsIdt446bB4E0ymAQrPR7 feWGpdC5x2puLEYHnYr09eHk+2PHkWaO1P/H3/EKO0HyiGbykHJgrYf0pDKMwlHQ4g JvcqzYbxdIjPCWv041nIk4txYGf7B93ETt0amaMU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728538AbfHaTfi (ORCPT ); Sat, 31 Aug 2019 15:35:38 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:40851 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfh (ORCPT ); Sat, 31 Aug 2019 15:35:37 -0400 Received: by mail-io1-f66.google.com with SMTP id h144so5755164iof.7 for ; Sat, 31 Aug 2019 12:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=AUc8NEFTnhlWM3noPKwbR9TPdg7/y9VDPfoK01TXc1Y=; b=RhRO793uwXfHMpRIfMSS61BWK9LMw4eD/W1agPBaU0GfZRMctJsYuFS5JzOb1uuOfq ItOA4SW/eqNbqDlaWMKgYxMFlMX7lYLWTvdbYDYuVwXC+BRYQiXzn7Pc4H8jYvGLQ0RV qNUsl4Cl7UmLgSGJgL+pbg/+7Bhqpe5u7SpoAPl21uUu8mH/Io7Uu2t/Y2UJtY5ZF3hu p+tdP+FC3J+nm/xgOOY//SHawWqCoH+915CuYSWzMKRPZZ+nPDK617CaBhky054RUrQb EPRcrfiENNKGc9/G9YzvD+sgWQr6tevK2fPQs7HygHY9pOW3B/l/TCONXWW91oRNODNz 8rYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=AUc8NEFTnhlWM3noPKwbR9TPdg7/y9VDPfoK01TXc1Y=; b=cNqPhS1a9n4RXqruBxsbgEQXjCR6g2UGliJZWqDQhSCkTgGEzkmu968wGsDq70W9k1 8Qo06ALkJpYm1me8QiXpRe9DuV8Adgwqk5/z4PGUtC1wRFKbqyuaBUcagHg6jINJspRu mjdIaG3UiewXM7Zs2Jg05jODP1FotcgYJmZ+tKplmiJWmYijxRBvhwTM3TBUxiX2HFhA AbLBuJI4AcEQ2iFJgqnlABSDpt+5QN99Ydy6CNz8j+gifKjlyxuYJ73UlGZWa7Hu9Bo6 PN7aorWse5l7mCkwhBJ/a91R11NjicFWWi1XLXnY95cj0pi1muJGiVyjxmc3zsYhNzSc dRqQ== X-Gm-Message-State: APjAAAWpPCneQDQn53vTjYSrv39pQeQ/cZSwGv44fFNs7LdxjDXDIGgZ ORU28dxM4hr7ZA0SYl9eLRvHnz3v X-Google-Smtp-Source: APXvYqyPKfWM9r1pdUz4kuyUpmZ+UnV3xIhlSuj7rYqL7XuIS5ZWpNBp2vt5li7MG85Z1JxNOEteAA== X-Received: by 2002:a02:495:: with SMTP id 143mr22977859jab.94.1567280136433; Sat, 31 Aug 2019 12:35:36 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:35 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Srinivas Pandruvada , Len Brown Subject: [PATCH 16/19] tools/power turbostat: Fix CPU%C1 display value Date: Sat, 31 Aug 2019 15:34:55 -0400 Message-Id: <1e9042b9c8d46ada9ee7b3339a31f50d12e5d291.1567277326.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Srinivas Pandruvada In some case C1% will be wrong value, when platform doesn't have MSR for C1 residency. For example: Core CPU CPU%c1 - - 100.00 0 0 100.00 0 2 100.00 1 1 100.00 1 3 100.00 But adding Busy% will fix this Core CPU Busy% CPU%c1 - - 99.77 0.23 0 0 99.77 0.23 0 2 99.77 0.23 1 1 99.77 0.23 1 3 99.77 0.23 This issue can be reproduced on most of the recent systems including Broadwell, Skylake and later. This is because if we don't select Busy% or Avg_MHz or Bzy_MHz then mperf value will not be read from MSR, so it will be 0. But this is required for C1% calculation when MSR for C1 residency is not present. Same is true for C3, C6 and C7 column selection. So add another define DO_BIC_READ(), which doesn't depend on user column selection and use for mperf, C3, C6 and C7 related counters. So when there is no platform support for C1 residency counters, we still read these counters, if the CPU has support and user selected display of CPU%c1. Signed-off-by: Srinivas Pandruvada Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 7d72268e546d..f57c4023231e 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -507,6 +507,7 @@ unsigned long long bic_enabled = (0xFFFFFFFFFFFFFFFFULL & ~BIC_DISABLED_BY_DEFAU unsigned long long bic_present = BIC_USEC | BIC_TOD | BIC_sysfs | BIC_APIC | BIC_X2APIC; #define DO_BIC(COUNTER_NAME) (bic_enabled & bic_present & COUNTER_NAME) +#define DO_BIC_READ(COUNTER_NAME) (bic_present & COUNTER_NAME) #define ENABLE_BIC(COUNTER_NAME) (bic_enabled |= COUNTER_NAME) #define BIC_PRESENT(COUNTER_BIT) (bic_present |= COUNTER_BIT) #define BIC_NOT_PRESENT(COUNTER_BIT) (bic_present &= ~COUNTER_BIT) @@ -1287,6 +1288,14 @@ delta_core(struct core_data *new, struct core_data *old) } } +int soft_c1_residency_display(int bic) +{ + if (!DO_BIC(BIC_CPU_c1) || use_c1_residency_msr) + return 0; + + return DO_BIC_READ(bic); +} + /* * old = new - old */ @@ -1323,7 +1332,8 @@ delta_thread(struct thread_data *new, struct thread_data *old, old->c1 = new->c1 - old->c1; - if (DO_BIC(BIC_Avg_MHz) || DO_BIC(BIC_Busy) || DO_BIC(BIC_Bzy_MHz)) { + if (DO_BIC(BIC_Avg_MHz) || DO_BIC(BIC_Busy) || DO_BIC(BIC_Bzy_MHz) || + soft_c1_residency_display(BIC_Avg_MHz)) { if ((new->aperf > old->aperf) && (new->mperf > old->mperf)) { old->aperf = new->aperf - old->aperf; old->mperf = new->mperf - old->mperf; @@ -1780,7 +1790,8 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) retry: t->tsc = rdtsc(); /* we are running on local CPU of interest */ - if (DO_BIC(BIC_Avg_MHz) || DO_BIC(BIC_Busy) || DO_BIC(BIC_Bzy_MHz)) { + if (DO_BIC(BIC_Avg_MHz) || DO_BIC(BIC_Busy) || DO_BIC(BIC_Bzy_MHz) || + soft_c1_residency_display(BIC_Avg_MHz)) { unsigned long long tsc_before, tsc_between, tsc_after, aperf_time, mperf_time; /* @@ -1857,20 +1868,20 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) goto done; - if (DO_BIC(BIC_CPU_c3)) { + if (DO_BIC(BIC_CPU_c3) || soft_c1_residency_display(BIC_CPU_c3)) { if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3)) return -6; } - if (DO_BIC(BIC_CPU_c6) && !do_knl_cstates) { + if ((DO_BIC(BIC_CPU_c6) || soft_c1_residency_display(BIC_CPU_c6)) && !do_knl_cstates) { if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) return -7; - } else if (do_knl_cstates) { + } else if (do_knl_cstates || soft_c1_residency_display(BIC_CPU_c6)) { if (get_msr(cpu, MSR_KNL_CORE_C6_RESIDENCY, &c->c6)) return -7; } - if (DO_BIC(BIC_CPU_c7)) + if (DO_BIC(BIC_CPU_c7) || soft_c1_residency_display(BIC_CPU_c7)) if (get_msr(cpu, MSR_CORE_C7_RESIDENCY, &c->c7)) return -8; From patchwork Sat Aug 31 19:34:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11124999 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2ED66112C for ; Sat, 31 Aug 2019 19:35:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E17323405 for ; Sat, 31 Aug 2019 19:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280140; bh=cdLGpekFvUdEIwLTnMII2+cID0LPKrm1ubg4DiE9xcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=JKmp1e/6ILT2+NFTIkpZze5qgLiCh3mZwPtiSBiGvCOLnIpEVENCr+y9zhPvS/YSx 6HDFoNjvdDCzC4zIGaqWVBLHavkLd6Bzj4wl8eg5XfT/HS1TKdasLaVtaN7jonK1Ko xYLIVR4nkypDNRrwu0sfLIFQ4TQRrF7Xiu5tFW3U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728541AbfHaTfj (ORCPT ); Sat, 31 Aug 2019 15:35:39 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:35004 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfi (ORCPT ); Sat, 31 Aug 2019 15:35:38 -0400 Received: by mail-io1-f68.google.com with SMTP id b10so21164205ioj.2; Sat, 31 Aug 2019 12:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=8Hqd/SPehqjaIk2A5e2YsWPDyi1jXgD+VxsLa5kvdB4=; b=npg/ARhUtTzphx6ooZRB0DsV6WgbeUFJAs4mus5tNTyae96RlyBIAEIPV7Z1lGwocJ 4HKzY240e+G53cicRpohHrdPv0EhCfQKKCpSqP/btau/Ktsc2bzhWlxe3ODAq48FyZf7 gT1eF5v/G3Na0Bz990oy4roTpgT2cyAUyxlS0yPKomprfvQErdh6PngE62NWBTCI7u/e QJErUoxqsL3ZUzBwHOOyBuSIsYvrJEQ5W4pyQObWkX+5hvjZ75xvrUjJxzhZVoD6dPaY ibTlz2f2XAUZ1rJx+JfHqD62xg5z26EnVQW+i2Au4Er96Yw9FZdavYxQN0uYQZpc3nkL tg+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=8Hqd/SPehqjaIk2A5e2YsWPDyi1jXgD+VxsLa5kvdB4=; b=lmTjMwZ/uIJNVO/7oQ0+Mw+RLa3fAz1qiDJq7+dteRxi+tBqmLD1xjq9Gt4viwYuJK xIWOB9aZ3up73GqC7O7+ZrCeIXKJnGANSh8OKg1aJofpfTvVnmWOPb6a7qm9mlMc2dSm bp1hwaI03jEwyhNdoULtU5jVrF7rN23lZKaS9I1bXnBKNnDLBBDn4RnBv5yFFW66TBIU pRF4+w8fWrSTbVnsMjdKKWt3qFB6NtBbNPz3oN0+4PZ1eZ7U9hPA37jWVjZTZ5pinI2k 5NlVGUlQityK4hK3z1CT9WvzE6esf3hOEnk+L8h34UmJEITqxOdY6kmAOC0WPaVczQ1o D3sQ== X-Gm-Message-State: APjAAAXqKWyJmkXVaU3121M/kM82euPAMBrFMW7s/b0z29PurrDeYVxx if7NUrxdghwlrBxudw5mW7TDlom2 X-Google-Smtp-Source: APXvYqxxWj26OxGM7iJ2cUlCjYPdpj3d21c7TTfcX0yvRNl5d+bhobgzfUWfRj7U7nqEbBiC6MLkJw== X-Received: by 2002:a6b:ba54:: with SMTP id k81mr26316892iof.143.1567280137664; Sat, 31 Aug 2019 12:35:37 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:37 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Pu Wen , stable@vger.kernel.org, Calvin Walton , Len Brown Subject: [PATCH 17/19] tools/power turbostat: Fix caller parameter of get_tdp_amd() Date: Sat, 31 Aug 2019 15:34:56 -0400 Message-Id: <9cfa8e042f7cbb1994cc5923e46c78b36f6054f4.1567277326.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Pu Wen Commit 9392bd98bba760be96ee ("tools/power turbostat: Add support for AMD Fam 17h (Zen) RAPL") add a function get_tdp_amd(), the parameter is CPU family. But the rapl_probe_amd() function use wrong model parameter. Fix the wrong caller parameter of get_tdp_amd() to use family. Cc: # v5.1+ Signed-off-by: Pu Wen Reviewed-by: Calvin Walton Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index f57c4023231e..6cec6aa01241 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4031,7 +4031,7 @@ void rapl_probe_amd(unsigned int family, unsigned int model) rapl_energy_units = ldexp(1.0, -(msr >> 8 & 0x1f)); rapl_power_units = ldexp(1.0, -(msr & 0xf)); - tdp = get_tdp_amd(model); + tdp = get_tdp_amd(family); rapl_joule_counter_range = 0xFFFFFFFF * rapl_energy_units / tdp; if (!quiet) From patchwork Sat Aug 31 19:34:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11125001 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C987F1800 for ; Sat, 31 Aug 2019 19:35:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8A362342E for ; Sat, 31 Aug 2019 19:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280140; bh=+wmH48XUJLWfm4flgr44Q59hK0tHLC3HYl6ztfoOkc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=t1vWILivlr7TiQUdGGpr9jRVy6pmy4Uk4IriqPzg1kQzfcyJckOJxWnVh6VY5e7aN 3o1FZyX/d0sYN4FBekwAbc+3pJs41vePrzQEdCm4AYu0yPr3L0qmbBvTN5EyWjIQwM gko6XGlEO1NFGGNx+KPMOSZwjzS1G0Wn2cMKwjLs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728542AbfHaTfk (ORCPT ); Sat, 31 Aug 2019 15:35:40 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:38511 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfj (ORCPT ); Sat, 31 Aug 2019 15:35:39 -0400 Received: by mail-io1-f68.google.com with SMTP id p12so21120347iog.5 for ; Sat, 31 Aug 2019 12:35:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=TJAgY0/lGSieq/yTPh5m6qoZ24u/ZjIG1jCgb3s0F6s=; b=vHhw7+/mIMfa5vweut78O7+zTeRaoXl+MGDPw8S7+4wsKvuo/FHdVaNBUdioQNG3wR U6x4zdPrbnSQ5csgozDOUg3YFDQv7/FWm6Dmdzq4l82epz0vjQo5w6cbDyKFiXQFSmz5 1oRkq0jghlFgYqBtlRmEJQ3umiAzxOdTnKUsQIJLJ3WiIWsAZDRtSPv+7V+2JA4EhC5+ iSjPL9xiJupJs52pPHg8EaJmLzjil+BnY+4QJwTTOvtHPSfd3wNLXxKCLHGC7qcas1Pt a9lJUaxbRk2BzhsEvozU45BmsqXsQ1mMmS3k09BPXA0BA6Faq51tzSYb3Whhr9sATsIn Rzsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=TJAgY0/lGSieq/yTPh5m6qoZ24u/ZjIG1jCgb3s0F6s=; b=GzkrGPp+EtJssZelYneglB+Cahv05pIgqTtbtjend2Z8YbaKerihK76ag3zOa+YAqg nfLyELGRQUfNZ9HyxyQ71c6ARtv9tWL/EV3CZISIojbJsIVcU8fsTAPtmWFvZ0qUgAaA vlATfNZ8ZbZKR4u/+TRdhtWp37HQ7FveLfUbjoq540T2TWD9cW12X26m1ujDKOFbWOO7 CPSzf3bgK8qBNe0bGNIOBoBl6+3JbkHQc6kbHluJu4de/G8yyc3tS1l3mLohag1Z4rwv sNlbZIme0Yevxm6S775CLwrF1/SEPs6xTczM8v2fJ7v93iM1JlclReJswXkBm0LVK+85 ndeQ== X-Gm-Message-State: APjAAAWHIZ9krHCVlct6irAV2lGFC1xBFgU0uOBNvJeM+Bvxbt/1ZcOL nKFFeXD6BIGl0pLVXfuqO6v+qCEC X-Google-Smtp-Source: APXvYqysRLs/ZZNqGRkOV4ovsCm4UpI4aeqZGq/qabrAL84xP4VUJ6E0juBqlwTyG+C1jd4pUizf8g== X-Received: by 2002:a6b:ec18:: with SMTP id c24mr994515ioh.72.1567280138800; Sat, 31 Aug 2019 12:35:38 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:38 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Pu Wen , Calvin Walton , Len Brown Subject: [PATCH 18/19] tools/power turbostat: Add support for Hygon Fam 18h (Dhyana) RAPL Date: Sat, 31 Aug 2019 15:34:57 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Pu Wen Commit 9392bd98bba760be96ee ("tools/power turbostat: Add support for AMD Fam 17h (Zen) RAPL") and the commit 3316f99a9f1b68c578c5 ("tools/power turbostat: Also read package power on AMD F17h (Zen)") add AMD Fam 17h RAPL support. Hygon Family 18h(Dhyana) support RAPL in bit 14 of CPUID 0x80000007 EDX, and has MSRs RAPL_PWR_UNIT/CORE_ENERGY_STAT/PKG_ENERGY_STAT. So add Hygon Dhyana Family 18h support for RAPL. Already tested on Hygon multi-node systems and it shows correct per-core energy usage and the total package power. Signed-off-by: Pu Wen Reviewed-by: Calvin Walton Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 6cec6aa01241..e8b6c608d6d1 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -59,6 +59,7 @@ unsigned int do_irtl_hsw; unsigned int units = 1000000; /* MHz etc */ unsigned int genuine_intel; unsigned int authentic_amd; +unsigned int hygon_genuine; unsigned int max_level, max_extended_level; unsigned int has_invariant_tsc; unsigned int do_nhm_platform_info; @@ -1730,7 +1731,7 @@ void get_apic_id(struct thread_data *t) if (!DO_BIC(BIC_X2APIC)) return; - if (authentic_amd) { + if (authentic_amd || hygon_genuine) { unsigned int topology_extensions; if (max_extended_level < 0x8000001e) @@ -3831,6 +3832,7 @@ double get_tdp_amd(unsigned int family) { switch (family) { case 0x17: + case 0x18: default: /* This is the max stock TDP of HEDT/Server Fam17h chips */ return 250.0; @@ -4011,6 +4013,7 @@ void rapl_probe_amd(unsigned int family, unsigned int model) switch (family) { case 0x17: /* Zen, Zen+ */ + case 0x18: /* Hygon Dhyana */ do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY; if (rapl_joules) { BIC_PRESENT(BIC_Pkg_J); @@ -4047,7 +4050,7 @@ void rapl_probe(unsigned int family, unsigned int model) { if (genuine_intel) rapl_probe_intel(family, model); - if (authentic_amd) + if (authentic_amd || hygon_genuine) rapl_probe_amd(family, model); } @@ -4632,6 +4635,8 @@ void process_cpuid() genuine_intel = 1; else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) authentic_amd = 1; + else if (ebx == 0x6f677948 && ecx == 0x656e6975 && edx == 0x6e65476e) + hygon_genuine = 1; if (!quiet) fprintf(outf, "CPUID(0): %.4s%.4s%.4s ", From patchwork Sat Aug 31 19:34:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 11125003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A46CF112C for ; Sat, 31 Aug 2019 19:35:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 841B72342C for ; Sat, 31 Aug 2019 19:35:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567280141; bh=Vr9zyl9Kz/1H6Sd33Z9RzgHzHYUGc+yaCD073MVku2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=x39PJsXNRejxlBRZoSGV2SfQ12oKKaoNPIXfDuLIr2GEn2F2GO+pxdm+bCerEZtjx bYVD+9zsDBel58xZDexBd+fXRwLIiB8y8xqW85w3Bzkbc1woNSsXtlsgr9gOqiDF9p XGI/pq4C9I1wB+AVLVMHHICl2v8CE2ZO4Qz8lByA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728543AbfHaTfl (ORCPT ); Sat, 31 Aug 2019 15:35:41 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:41386 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfHaTfk (ORCPT ); Sat, 31 Aug 2019 15:35:40 -0400 Received: by mail-io1-f68.google.com with SMTP id j5so21051902ioj.8 for ; Sat, 31 Aug 2019 12:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:reply-to:organization:content-transfer-encoding; bh=dOYCARJAXbdzDNt2l66LDCjrByZn+oDuMXEZVZLikvM=; b=BfANC23qPs1iFJn5TBsUUywcuHhFPriH/5vtQ0nbSWOd8C/XXb1hGsV6xAJJqm8v4d uUTQLCz6rBkBiLmPk4E2YQyS76b2c12Awq2Uqk2k+FAAeyVtCkKbitQ4Fb2Ati+mevFk RZw3z36zeUn3mtPgtzcUOFz9SYueoPua4fLMH6w0d9+7Gl/65r14vN+LjB29wjvB/V+1 0NFsYUIXLzaJRr/ZrOY5QFlOtBBtoVaBxSLj1jJSr5b9JxbdohAGkiNVYZSMGJxQ3EGv 0mSFpA8OU6epvv5+D8inVfdeZnhHSOYgFTFDPiDgiiPFNzwGlLZQ9SDN4FGrHXLQvbNb CZPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:reply-to:organization :content-transfer-encoding; bh=dOYCARJAXbdzDNt2l66LDCjrByZn+oDuMXEZVZLikvM=; b=OnXC1Dke4F0qkONZ/jTIk/oe3jtH5rdddjk+jTY4zzKH2/jwmnTWyUSnYJyUCST9lb srG64krJ4dAu1LfPQRw1wfrwTrZu3dfrZ/lOjlgbeFG4R2zhAX34wbmh57RAR1oj0hXV 92yYN04iVKebzSTdllzqPN/iCFXBpo/Sb/+omyHlskuInFQVsxPrXgzdvsSni/rxULBw XD7I37D6x3p7xDgXn6rAktepbj0OQroiq3nmvV0uCH9SXm3/fuTbGUlkzAmHtAMxw/mA bqj4dcLErOVir/isf1/xFWN6TUcOJkbfg679FfK/PIgdBTmifrgfOitF9GK0W94RW5vH doDg== X-Gm-Message-State: APjAAAXnN3EEWPpkljVfAX+eLIb95Sf+hFQ7FV85GCGth4G/9AVG6AU0 xe9me4omgWr/cVxYu7JhcH8l11dN X-Google-Smtp-Source: APXvYqzHsWZJGf2jNsa8oUZPkCBwE0L7kCZCoaEmHs0sNivNg4jv4rJicYnF1ceeXFL9dsw4d6mwZg== X-Received: by 2002:a5d:8444:: with SMTP id w4mr21231025ior.51.1567280139965; Sat, 31 Aug 2019 12:35:39 -0700 (PDT) Received: from nuc8.tds (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id r2sm6937376ioh.61.2019.08.31.12.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2019 12:35:39 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown Subject: [PATCH 19/19] tools/power turbostat: update version number Date: Sat, 31 Aug 2019 15:34:58 -0400 Message-Id: <9eb4b5180d33c827f16829644ae0cd7382ecdb82.1567277326.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Len Brown Today is 19.08.31, at least in some parts of the world. Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index e8b6c608d6d1..b2a86438f074 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -5306,7 +5306,7 @@ int get_and_dump_counters(void) } void print_version() { - fprintf(outf, "turbostat version 19.03.20" + fprintf(outf, "turbostat version 19.08.31" " - Len Brown \n"); }