Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp155862img; Wed, 20 Mar 2019 16:38:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU3j/TJVNCUcy7bn7hObQpQTcdUp75tdrDLG9jyaDaHcXwVPEc5RoBHuX5N+ejePX6sBAD X-Received: by 2002:a63:5415:: with SMTP id i21mr605091pgb.106.1553125117725; Wed, 20 Mar 2019 16:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553125117; cv=none; d=google.com; s=arc-20160816; b=px7bawltcuz9uv1SEoFcOP3GQEEpc/kBe5m5UPMKDzOietkAY+BsQD0uVOXFq1zIhE NDUBHZomWPVhRpF1y1gQXKZj2/xeknIPN984yuqGpxg1PrKl/JCo1NLQWNfgFkj7/DUU 3nUl2T/N8MzWTE0oFoLCrnSC6vQRyVCpTkWtUOEgUWazTFsAYzSfQGhhLNLJqECmDZz4 X4BDn9NyOnRuAo9H7UJ8yb6UtBUZO3pv73bY4cXVyuyGg0FjEnMawfWqDVpCMBuHS+Cg PAHhrrK5FM7XZdKGLSD1v8iMLdjxj6zPd+amRvqmtcT/osM0W3euxVTkCa1mrHYslf4s xa3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ushezcBHXWI6B6QX5Mtp0NVcZN/Sz1kfM0fpYGf14CU=; b=K5TcGr6Fg5azJWj60ajDvbW4nnHN/V6y0hoyb53FAun2PYErlf8b8S5MpD1tkI9VUq 6jwHPzTek338ycXU2qNx/JmhBpYQ0wSgct70kr4QPYoc/T9TkJ8X5fDgH0vJk7TflV+7 4PIvFBj88KJRtj6YlfNbQsD+7vOhsFX4ruoyMa9hlDjQ6K2vgdHtUqfl9opU6WIm5bmM CXWQYqRSIk7GDagHX/Rch//3V7kVcSji+TQZwUsjGw6D3EY0JVjd0i16YsuqLtsPinq6 RB26ThhrYrpYlHHKYC6dT8t9Moj1dou99bO/Koc5Wi7srbcW5GejYD4gHuPn337vGx4D BQlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si2813079pgh.221.2019.03.20.16.38.22; Wed, 20 Mar 2019 16:38:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727672AbfCTXhJ (ORCPT + 99 others); Wed, 20 Mar 2019 19:37:09 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:45793 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726169AbfCTXhI (ORCPT ); Wed, 20 Mar 2019 19:37:08 -0400 Received: by mail-ed1-f66.google.com with SMTP id m16so3474350edd.12; Wed, 20 Mar 2019 16:37:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ushezcBHXWI6B6QX5Mtp0NVcZN/Sz1kfM0fpYGf14CU=; b=jKO3wib2HwaJzXGdQbXLJgaoSmVhe90wXbFSMVz73En//1ewgG3TqRYG0srErsudv1 pBDTrwUEw2F3/y74czooMbs1ak5ppMeZYCK7fluqOqF4O/j9dvr4UUP9oaR0Bc2RxeMM /pHKQJNjS8+fY/q5WTm8G1d1Po//mGBACFLoeJ5dNCa6MZqu8xH/mC3yPvgB/vY/sKUo gnQEUNDWQZZR0yJsFNIXlKw2uqNocnHqkipog6K7yQ5L+F9qsB9f4JbJobQihcM9+AsF P4h6Vvb3BIVE/VT3WrBN59yas7qIQSKMevgXMUIYAOs8EPudCYpTu1aFNGf4B1a9ddL4 ZH6w== X-Gm-Message-State: APjAAAVtmKzYskWgXPbSNIrlyNvCK7HcHwDWUATNA3KHWaGt/ynNFxEa R9iTg6o/SyfE7QLeSIxjy0IzkRsLdCwsqzE18p9ynQ== X-Received: by 2002:a50:b8e2:: with SMTP id l89mr393297ede.140.1553125026988; Wed, 20 Mar 2019 16:37:06 -0700 (PDT) MIME-Version: 1.0 References: <20180817163442.10065-1-calvin.walton@kepstin.ca> <20180817163442.10065-3-calvin.walton@kepstin.ca> In-Reply-To: <20180817163442.10065-3-calvin.walton@kepstin.ca> From: Len Brown Date: Wed, 20 Mar 2019 19:36:55 -0400 Message-ID: Subject: Re: [PATCH v3 2/2] [WIP] tools/power turbostat: Also read package power on AMD F17h (Zen) To: Calvin Walton Cc: Linux PM list , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Calvin, I'm inclined to apply this -- because it will not break anything, and it would at least enable testing by people, who have this hardware. thoughts? -Len On Fri, Aug 17, 2018 at 12:35 PM Calvin Walton wrote: > > The package power can also be read from an MSR. It's not clear exactly > what is included, and whether it's aggregated over all nodes or > reported separately. > > It does look like this is reported separately per CCX (I get a single > value on the Ryzen R7 1700), but it might be reported separately per- > die (node?) on larger processors. If that's the case, it would have to > be recorded per node and aggregated for the socket. > > Note that although Zen has these MSRs reporting power, it looks like > the actual RAPL configuration (power limits, configured TDP) is done > through PCI configuration space. I have not yet found any public > documentation for this. > > Signed-off-by: Calvin Walton > --- > tools/power/x86/turbostat/turbostat.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c > index 89d4e2e75774..675c894b8595 100644 > --- a/tools/power/x86/turbostat/turbostat.c > +++ b/tools/power/x86/turbostat/turbostat.c > @@ -1973,6 +1973,11 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) > return -16; > p->rapl_dram_perf_status = msr & 0xFFFFFFFF; > } > + if (do_rapl & RAPL_AMD_F17H) { > + if (get_msr(cpu, MSR_PKG_ENERGY_STAT, &msr)) > + return -13; > + p->energy_pkg = msr & 0xFFFFFFFF; > + } > if (DO_BIC(BIC_PkgTmp)) { > if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_STATUS, &msr)) > return -17; > @@ -3986,10 +3991,13 @@ void rapl_probe_amd(unsigned int family, unsigned int model) > switch (family) { > case 0x17: /* Zen, Zen+ */ > do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY; > - if (rapl_joules) > + if (rapl_joules) { > + BIC_PRESENT(BIC_Pkg_J); > BIC_PRESENT(BIC_Cor_J); > - else > + } else { > + BIC_PRESENT(BIC_PkgWatt); > BIC_PRESENT(BIC_CorWatt); > + } > break; > default: > return; > -- > 2.18.0 > -- Len Brown, Intel Open Source Technology Center