From patchwork Fri Mar 20 05:22:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 212532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9307CC4332B for ; Fri, 20 Mar 2020 05:23:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 680DC20739 for ; Fri, 20 Mar 2020 05:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584681787; bh=jCbKyDvPkRjAJ5wIbIVJ1XEuYLYi0Oq1HtRDnKFD0n4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=zVuqr2JAK0IYP9b71kMacKjoEB0br+5bNf3CBeTCFEhOYjPLhr8sce3EEYs62VzON ft3WRSEu/jn3swm6iSPReUenDXq3I0o9t93PxSgkemIM6lqIGkDasaoerW1RDGuonm WvWl6NGji6d5yvnNShvE4ydwkyMS9fXMmxUlRa7k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726892AbgCTFXH (ORCPT ); Fri, 20 Mar 2020 01:23:07 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:38321 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726867AbgCTFXG (ORCPT ); Fri, 20 Mar 2020 01:23:06 -0400 Received: by mail-qk1-f194.google.com with SMTP id h14so5736349qke.5 for ; Thu, 19 Mar 2020 22:23:06 -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=Kgy3nHrtHVFvpakh6OjnW7F1z3CYkEhOyxCVAShYdjg=; b=e0n1xEUzdPjZTRB0TcJcomo5xZZP/p+B11xKgKqa2zMetz6DjW2kJfHgo38cbbR3Ai nS5xqP3T+Rgudk2szMZslfOr7OgX4DjOrIOBs6g2HCXbeCxGJMdmRIVf7dDJSS4ZEaLB dBRfWMKTLNCdrHQGDzZ6o2VqJrQ4KxYEYa4m8kb9NsBziXCmR0LsL7ioQSiZUnY+j2Ez 5wWc2oc8cTFlrcrUSUiTWW+Pmi05JEYm5x7pR1TQLj7XbNmY6F848HTPfWVJ6Qr5UpBL ZmO1QAW69cNmyta10O/C2vx0LHJiI8siVGX01a4TOEP9KqNttm+DGlrGyMjGefdgCCOH PANw== 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=Kgy3nHrtHVFvpakh6OjnW7F1z3CYkEhOyxCVAShYdjg=; b=Z/gF1qT+Woq45eo37rfwXsIZef1/hWab/xdFPDaYPtztInf2KcjgsJ0+YTaPfZOnJx u3yMJhw8BKb5LD5FnjmxM5m2OXwvnRnr2u8ygAbNCAuz3s/zKQn7kVpxSHMlrhGPHrHt BAMXILyBs6pkg4AsW2XJDtL7UeIJUasbkG4nT5DVQHzMcckhPoWTE6pE/Jj4ZEp7bhLd Unk/LHW9uQKWNKP1HWaoa9SoBkAwvfc4Bs3v5P4IuK+pngIQy3CiopnWahmeG0EgIb6l g/oKWsBlKaIioDr/ZiJya4cjRVqQkqruGtQlPgO/mcghWIWazzJPwNh9JrDcwADc3Qg1 KAMA== X-Gm-Message-State: ANhLgQ2S6rXpdrEMYdE0QN8xdJQRPIt7UUt3MA+Z2TpZGIZqPb+nFFMa 9olnM5BNz7vid13aCJr4MjC1r/P7 X-Google-Smtp-Source: ADFU+vtjs5v0lzb374hBRkTxq64Dl7tWMXBjTe3hnQxHmdoys6sdvRHHHiWcTxY7codDo+K1aG19tg== X-Received: by 2002:a37:aec3:: with SMTP id x186mr6253704qke.419.1584681785628; Thu, 19 Mar 2020 22:23:05 -0700 (PDT) Received: from localhost.localdomain (h96-61-82-19.cntcnh.dsl.dynamic.tds.net. [96.61.82.19]) by smtp.gmail.com with ESMTPSA id w134sm3273383qka.127.2020.03.19.22.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 22:23:05 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Chen Yu , Len Brown Subject: [PATCH 05/10] tools/power turbostat: Support Jasper Lake Date: Fri, 20 Mar 2020 01:22:43 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: <081c54323b27d8d4b40df6b2375b9e1f6846d827.1584679387.git.len.brown@intel.com> References: <081c54323b27d8d4b40df6b2375b9e1f6846d827.1584679387.git.len.brown@intel.com> 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: Chen Yu Jasper Lake, like Elkhart Lake, uses a Tremont CPU. So reuse the code. Signed-off-by: Chen Yu 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 26088b2a27cc..e953afb2e7a1 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4623,6 +4623,9 @@ unsigned int intel_model_duplicates(unsigned int model) case INTEL_FAM6_ATOM_TREMONT_D: return INTEL_FAM6_ATOM_GOLDMONT_D; + case INTEL_FAM6_ATOM_TREMONT_L: + return INTEL_FAM6_ATOM_TREMONT; + case INTEL_FAM6_ICELAKE_X: return INTEL_FAM6_SKYLAKE_X; } From patchwork Fri Mar 20 05:22:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 212531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE095C4332D for ; Fri, 20 Mar 2020 05:23:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A046C20739 for ; Fri, 20 Mar 2020 05:23:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584681790; bh=DfWGUI/YRBC+QoiSb9mI/WDtstzZZl0zXRyZ3giisYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=k26bFb31ybF4USHITH3R2LWuohOywB92I78JLUifuoLQv/NU8OT40OjB/B0mngz/o N/awQQEUzgIy8XiC9NaqytesVFN54t3Hm8UyDvAGcV5HF1TzK4EprSCrPbOR3kgmiU 2rth+f+PvnmEYHZghIiUJR0HdfdNGK62t7Zc3TBQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726894AbgCTFXK (ORCPT ); Fri, 20 Mar 2020 01:23:10 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:45414 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726867AbgCTFXK (ORCPT ); Fri, 20 Mar 2020 01:23:10 -0400 Received: by mail-qt1-f195.google.com with SMTP id z8so3964574qto.12 for ; Thu, 19 Mar 2020 22:23:08 -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=wi1k/IuAlSMQ0sD08Rluy7qCovjgpl4TLmxMEPLrgCI=; b=VcRrHxEKrxJc/jUHv0LxovHX/jrDt9JvcdzvUkkOBTe34rVhONiUz+oFX4sXEuN+U4 zInN9aPQxkAcQ7+Uw+c2abwNgIKI0QlmziNccqEzAQxvpkGUTXwikzEhk5bnDHvVP0cu q4/H1tx406b34If84wjUcfBhk4HjQzf5cWuUt3tlhi7C9T2luQAU8gvJUdd+4SKFLUeC d4bF9Fcrdq05qbOYFd1kE4Dd9lv11Fmogyzvvqq0pnM67O3kTzcgz07csXgjN817BBQm /XIuyrhnkulpB1AyxVsk1CjCdY7Q97iMdd165QCAz/NmtpM+RRp+H1x/4zOJqgjFiMZk Yeig== 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=wi1k/IuAlSMQ0sD08Rluy7qCovjgpl4TLmxMEPLrgCI=; b=VuJKmV9WSoRJdLRpatSv9x0dd7/XsmwovEnAYYihIRYJPAlF5AGtBnn4kHGpK8NF2c v6yGvbR09wjecoUP46lb+iEjIgnCAlovnZcVSoUB+peGd+NeCBxfFKFRnaqZ8a0RIdLk q+9DBIl+5NDuhP5qXLdLy0+WUjYzrxpEj3JVy4XASANjNlEfNWkCywZ0qB5Lh7lzwTPx M9hhhlbgzNIg88Wokj187W7aG3+OJHTrwTtZ+SDcV/Z+cgVD1cuYT9dtcrXsiBSbbLtz +81nTiVzWWCaclDZAmbuvmO4Hiig6pij/LnbZqz8N77UjN6uwTowggL5IHVWD3bKerWT Ting== X-Gm-Message-State: ANhLgQ1AiR3NC2blZGMOAKoLdhn6MEpDueEEMXaJ0osGVLc3ObNy6Gyl /YHc9inssITNOgezPQonVN7n621e X-Google-Smtp-Source: ADFU+vtJ1CVSTuSYNL+DFPTnyAU+7CLu5HOGMumxbON5+pljo2V015tolTCoJKCCjNzpuV7NYQMQgg== X-Received: by 2002:ac8:3656:: with SMTP id n22mr6553067qtb.296.1584681788095; Thu, 19 Mar 2020 22:23:08 -0700 (PDT) Received: from localhost.localdomain (h96-61-82-19.cntcnh.dsl.dynamic.tds.net. [96.61.82.19]) by smtp.gmail.com with ESMTPSA id w134sm3273383qka.127.2020.03.19.22.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 22:23:07 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Len Brown Subject: [PATCH 07/10] tools/power turbostat: Fix missing SYS_LPI counter on some Chromebooks Date: Fri, 20 Mar 2020 01:22:45 -0400 Message-Id: <1f81c5efc020314b2db30d77efe228b7e117750d.1584679387.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <081c54323b27d8d4b40df6b2375b9e1f6846d827.1584679387.git.len.brown@intel.com> References: <081c54323b27d8d4b40df6b2375b9e1f6846d827.1584679387.git.len.brown@intel.com> 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 Some Chromebook BIOS' do not export an ACPI LPIT, which is how Linux finds the residency counter for CPU and SYSTEM low power states, that is exports in /sys/devices/system/cpu/cpuidle/*residency_us When these sysfs attributes are missing, check the debugfs attrubte from the pmc_core driver, which accesses the same counter value. Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 761146c4f9bc..3ecbf709a48c 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -304,6 +304,10 @@ int *irqs_per_cpu; /* indexed by cpu_num */ void setup_all_buffers(void); +char *sys_lpi_file; +char *sys_lpi_file_sysfs = "/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us"; +char *sys_lpi_file_debugfs = "/sys/kernel/debug/pmc_core/slp_s0_residency_usec"; + int cpu_is_not_present(int cpu) { return !CPU_ISSET_S(cpu, cpu_present_setsize, cpu_present_set); @@ -2916,8 +2920,6 @@ int snapshot_gfx_mhz(void) * * record snapshot of * /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us - * - * return 1 if config change requires a restart, else return 0 */ int snapshot_cpu_lpi_us(void) { @@ -2941,17 +2943,14 @@ int snapshot_cpu_lpi_us(void) /* * snapshot_sys_lpi() * - * record snapshot of - * /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us - * - * return 1 if config change requires a restart, else return 0 + * record snapshot of sys_lpi_file */ int snapshot_sys_lpi_us(void) { FILE *fp; int retval; - fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", "r"); + fp = fopen_or_die(sys_lpi_file, "r"); retval = fscanf(fp, "%lld", &cpuidle_cur_sys_lpi_us); if (retval != 1) { @@ -4946,10 +4945,16 @@ void process_cpuid() else BIC_NOT_PRESENT(BIC_CPU_LPI); - if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", R_OK)) + if (!access(sys_lpi_file_sysfs, R_OK)) { + sys_lpi_file = sys_lpi_file_sysfs; BIC_PRESENT(BIC_SYS_LPI); - else + } else if (!access(sys_lpi_file_debugfs, R_OK)) { + sys_lpi_file = sys_lpi_file_debugfs; + BIC_PRESENT(BIC_SYS_LPI); + } else { + sys_lpi_file_sysfs = NULL; BIC_NOT_PRESENT(BIC_SYS_LPI); + } if (!quiet) decode_misc_feature_control(); From patchwork Fri Mar 20 05:22:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 212530 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02390C43332 for ; Fri, 20 Mar 2020 05:23:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC96620739 for ; Fri, 20 Mar 2020 05:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584681792; bh=OKHrbvYOlw4EVytfCiS9FY7KWSbni72/eZ5/qdYtVTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-ID: From; b=k0DvJcY/gz0TtAAPaWNx/TxCZtL5DXV53o8KrLHbzv+LvTOpN4R1THyI2cNyY7ejo J7FcV97lV4GmTieV7/54CuE4kg+MmFPMg1MSBCPsqk5QmSDJVZOPjN59SG42LIUvGZ jcnZNrvlyc6VIeEQSY/PBR72JdrH+odYr+jpUAeM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726896AbgCTFXM (ORCPT ); Fri, 20 Mar 2020 01:23:12 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:42753 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726897AbgCTFXM (ORCPT ); Fri, 20 Mar 2020 01:23:12 -0400 Received: by mail-qt1-f193.google.com with SMTP id t9so48010qto.9 for ; Thu, 19 Mar 2020 22:23:11 -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=9w31pVo9yQoAO2jOqhauobcS56RYPSJajRdXocwsTSg=; b=MN21bowByjC91bwqg3e2jOLTv06WM/ndv4qmWDEGfON2Ke7iG2aMvtnfiR+hy9Xop6 woJA5DIlLGDavOiX0etaqSF0VXQEDhQ3ognUvtxOhGUkw3u9smEcYOT4rTV5MXzTv2sM KggfxOm2pvyR70jG7vxE4kwINUiuQu0cNuZKsCndcOndfMiOht2dnOGrG3qms9fohSWQ FgvAV72/1ebL6h5sl/vUmRkE8H5Oh9k995Vz0GaiBfeWLvERW16B3n6waXMqYiAcFm9u +az6rvEpYlHqqiIuKHi7+W6hRfTyq7mIeZOJUyhBZAtEZ26AfKZfsoeyNbofeCPNPLs9 Bi6A== 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=9w31pVo9yQoAO2jOqhauobcS56RYPSJajRdXocwsTSg=; b=edX8j2V+2YhHr2bSVbW6b+oNCYlxv0XRTlLzmUdCXmg5ZffWVYQKPtwQouKn/SCfCs SBADlW1D1djG1PwIn2qj+4DfwSxCd42mwt2JcN7+aSK+1h4kSjGpkeuFY0rPlbKrjPfQ 4omXRsmFM5rAq9WaUkFjCkPFzGoKeFjHMCJF1aTqiZcyuJaV+hFJ+bRjXs8+2xOpakT2 IRKi3WwC2txvmmbWZbmLkx0ecbYOUX77UFOJgZPBGuLVhDmzPiuoavo284im/3jVosVH B59OFHB1glBTqWimNlOMbswdHW6TVqLP3dlSTz58+dYnGnVguB+RUp/9odxyMTDZn0nx tXxw== X-Gm-Message-State: ANhLgQ1C7el0tLeWb3KGeG3xq1E0BOBFfEdMKwQn/Bw1LTzLTyRHtXh6 8U5TEkwM8LL5F34Q3cBLzE9s0nPX X-Google-Smtp-Source: ADFU+vsFQdR9pfxQvtaigjGlgs8oYJg/15SQp2gE33/TYYQzFUF8OPI7CjVk1XfBYzeTmQQJiWBjiw== X-Received: by 2002:aed:21c5:: with SMTP id m5mr6403929qtc.42.1584681790605; Thu, 19 Mar 2020 22:23:10 -0700 (PDT) Received: from localhost.localdomain (h96-61-82-19.cntcnh.dsl.dynamic.tds.net. [96.61.82.19]) by smtp.gmail.com with ESMTPSA id w134sm3273383qka.127.2020.03.19.22.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 22:23:10 -0700 (PDT) From: Len Brown To: linux-pm@vger.kernel.org Cc: Antti Laakso , Len Brown Subject: [PATCH 09/10] tools/power turbostat: Print cpuidle information Date: Fri, 20 Mar 2020 01:22:47 -0400 Message-Id: <7c3808082a40a96e95808864fe814b4e68238a46.1584679387.git.len.brown@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <081c54323b27d8d4b40df6b2375b9e1f6846d827.1584679387.git.len.brown@intel.com> References: <081c54323b27d8d4b40df6b2375b9e1f6846d827.1584679387.git.len.brown@intel.com> 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: Antti Laakso Print cpuidle driver and governor. Signed-off-by: Antti Laakso Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 77f89371ec5f..c9e299e99c2f 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -3509,6 +3509,7 @@ dump_sysfs_cstate_config(void) char path[64]; char name_buf[16]; char desc[64]; + char cpuidle_buf[64]; FILE *input; int state; char *sp; @@ -3516,6 +3517,35 @@ dump_sysfs_cstate_config(void) if (!DO_BIC(BIC_sysfs)) return; + if (access("/sys/devices/system/cpu/cpuidle", R_OK)) { + fprintf(outf, "cpuidle not loaded\n"); + return; + } + + sprintf(path, "/sys/devices/system/cpu/cpuidle/current_driver"); + input = fopen(path, "r"); + if (input == NULL) { + fprintf(outf, "NSFOD %s\n", path); + return; + } + if (!fgets(cpuidle_buf, sizeof(cpuidle_buf), input)) + err(1, "%s: failed to read file", path); + fclose(input); + + fprintf(outf, "cpuidle driver: %s", cpuidle_buf); + + sprintf(path, "/sys/devices/system/cpu/cpuidle/current_governor_ro"); + input = fopen(path, "r"); + if (input == NULL) { + fprintf(outf, "NSFOD %s\n", path); + return; + } + if (!fgets(cpuidle_buf, sizeof(cpuidle_buf), input)) + err(1, "%s: failed to read file", path); + fclose(input); + + fprintf(outf, "cpuidle governor: %s", cpuidle_buf); + for (state = 0; state < 10; ++state) { sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name",