From patchwork Wed Mar 1 05:27:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 9597563 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C0F1F600CB for ; Wed, 1 Mar 2017 05:36:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B22A028306 for ; Wed, 1 Mar 2017 05:36:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6A542842B; Wed, 1 Mar 2017 05:36:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3779628410 for ; Wed, 1 Mar 2017 05:36:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750787AbdCAFgG (ORCPT ); Wed, 1 Mar 2017 00:36:06 -0500 Received: from mail-qk0-f195.google.com ([209.85.220.195]:33371 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750738AbdCAFfX (ORCPT ); Wed, 1 Mar 2017 00:35:23 -0500 Received: by mail-qk0-f195.google.com with SMTP id n186so8198720qkb.0; Tue, 28 Feb 2017 21:35:22 -0800 (PST) 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 :in-reply-to:references:reply-to:organization; bh=1tLTHYbLNDlzVbMQ6PiP+/x+1B9WllP5UkmDxBYwTho=; b=Odm0MvHMq2Ed0dsoAm6aiNQd0eHoLbWmnw7J3gwiJZ9ucUGh2Qkv3gV1kz507ACgLR CnWUvpint9N6SdZ9a/p26JbN11aRMq5gVgnB2qPcQIeJ6Ftnl8kuKziwNydeTVdNN24X VKu2qIrykyf+4Dxjv6DpBHRtsIP/YFMa1InhmdKzgduuRXze9g5xmbWqiHsf2wC/Spfo ocG5Dr8Fxk+Qoea36m+h43rh1obEmq8jji9IHI1hc406HZbqnDNC8fESKSNi1DR6QLGI 1cRGE061MjR/1NCkn5B94E7tVODkZwdHDEa8h8pmVFopaMMCTgtSRMr5N8wxUUCygtXN Km3g== 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:in-reply-to:references:reply-to:organization; bh=1tLTHYbLNDlzVbMQ6PiP+/x+1B9WllP5UkmDxBYwTho=; b=RluvTm9Ccictqp0PoGZE+JagZp17sHg5k4rBWzu+CT9tvat3GpjJhoD7D8of4sl9gK 9LVacrgkLX3feMXTdYekwM9X8E2/zIoaU60MqajtcY3t3HTuwsH6PH+jTTTNDXUuQ8zt KWIKhESDJSlxsu04uIpE0LhrmFnqb7uBwVP9OJuwXuaiLZcL+kVARhTm4zQJvbuQdjCv CMBU4dse0koeiZ/6/giBVz6+nWc+lJ9jpMh4Qy/FgT0tYznpS59JbDydXnMumzLyBiK7 DYU4pfTy1LPPX5Ve5Ld+HV/WdE7OEYKhHZR7Yb59igEa66E5uUIcefzkC1gb8GsrxMa5 0tyg== X-Gm-Message-State: AMke39kuhCemarNc4NtYhucMQq1S0vM0pfOFixIoTCNpV/j6KMqCCaBBb25onsE02QFKHQ== X-Received: by 10.200.48.244 with SMTP id w49mr5759063qta.77.1488346120403; Tue, 28 Feb 2017 21:28:40 -0800 (PST) Received: from z87.localdomain (pool-96-230-116-151.bstnma.fios.verizon.net. [96.230.116.151]) by smtp.gmail.com with ESMTPSA id c141sm2530517qkb.10.2017.02.28.21.28.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Feb 2017 21:28:40 -0800 (PST) From: Len Brown To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Len Brown Subject: [PATCH 26/44] tools/power turbostat: Denverton: use HW CC1 counter, skip C3, C7 Date: Wed, 1 Mar 2017 00:27:30 -0500 Message-Id: <7170a374377d7c70d63a2d3eb38f8fe32e6ffadd.1488345270.git.len.brown@intel.com> X-Mailer: git-send-email 2.11.0.161.g6610af872 In-Reply-To: <20170301052748.27810-1-lenb@kernel.org> References: <20170301052748.27810-1-lenb@kernel.org> In-Reply-To: <678a3bd1b3de6d2ebf604e7d708bc8150bb667e9.1488345270.git.len.brown@intel.com> References: <678a3bd1b3de6d2ebf604e7d708bc8150bb667e9.1488345270.git.len.brown@intel.com> 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 X-Virus-Scanned: ClamAV using ClamSMTP From: Len Brown The CC1 column in tubostat can be computed by subtracting the core c-state residency countes from the total Cx residency. CC1 = (Idle_time_as_measured by MPERF) - (all core C-states with residency counters) However, as the underlying counter reads are not atomic, error can be noticed in this calculations, especially when the numbers are small. Denverton has a hardware CC1 residency counter to improve the accuracy of the cc1 statistic -- use it. At the same time, Denverton has no concept of CC3, PC3, CC7, PC7, so skip collecting and printing those columns. Finally, a note of clarification. Turbostat prints the standard PC2 residency counter, but on Denverton hardware, that actually means PC1E. Turbostat prints the standard PC6 residency counter, but on Denverton hardware, that actually means PC2. At this point, we document that differnce in this commit message, rather than adding a quirk to the software. Signed-off-by: Len Brown --- tools/power/x86/turbostat/turbostat.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 819d67fbb6ca..1010135ee973 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -2572,6 +2572,18 @@ int has_slv_msrs(unsigned int family, unsigned int model) } return 0; } +int is_dnv(unsigned int family, unsigned int model) +{ + + if (!genuine_intel) + return 0; + + switch (model) { + case INTEL_FAM6_ATOM_DENVERTON: + return 1; + } + return 0; +} int has_nhm_turbo_ratio_limit(unsigned int family, unsigned int model) { @@ -3851,6 +3863,14 @@ void process_cpuid() BIC_PRESENT(BIC_Mod_c6); use_c1_residency_msr = 1; } + if (is_dnv(family, model)) { + BIC_PRESENT(BIC_CPU_c1); + BIC_NOT_PRESENT(BIC_CPU_c3); + BIC_NOT_PRESENT(BIC_Pkgpc3); + BIC_NOT_PRESENT(BIC_CPU_c7); + BIC_NOT_PRESENT(BIC_Pkgpc7); + use_c1_residency_msr = 1; + } if (has_hsw_msrs(family, model)) { BIC_PRESENT(BIC_Pkgpc8); BIC_PRESENT(BIC_Pkgpc9);