Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp956152pxf; Thu, 25 Mar 2021 19:27:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0nobEqp2PgmSVctmZu7I0axyEoUFn+riNmxZ8XbAE3vQMCk5GXb59qgwcIafBE9E3KhhE X-Received: by 2002:a05:6402:549:: with SMTP id i9mr12747483edx.379.1616725669663; Thu, 25 Mar 2021 19:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616725669; cv=none; d=google.com; s=arc-20160816; b=TtlP44oBAcBAnY2hFrUsj4hjABB8Ozi5/B71pHgMUMsRbBxJ09G/VOdPNAn27/kel/ gpH17VeMP2bjHj4nNvsHifTfYo/XZjYxh4eKarlSScRhNxYy3+cjmzR8b/LppeBkiTXT YcntXH+mVLE9aHJr/6kksBwu94JN2rL35dexWl8HEzF0HMBnWgC21byXhnCa40fld+5q Et1N6RPcoiY+BfGompVo4r8IgoBeAIKTeRT9OMPoQIyDbsKFf709EhOcShTFmbUyd5kc OLH7iGSHIyJByX8oThnOOztpL4uEC2RaQ9Kfy3oIJYCyKw+Bm0nw+rBrxSNonMMAXK5q NPFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=sKq+wPzbx1nXsaGfvo8Hi6rDeaJK6q0KNyLk3lQve5U=; b=YHQ/MDpdbG+xZOHaPMtY3FsPob48T1OCQ2+L0s5ULZQzEocH2QLknNV7IRle4b+Fow BpBda4jbDiB6ov53lGA+DrQeO1J8cxStIF7/MAjFH9yxfkE8fqATj+rnfUcbcOt9u9Ob vmlzGA7oZl0vsIRKt9mojnwVZMH421A1PuQ8S4E1UT/bgyCKNlZ/bV14gVwbp9pLEiH+ gP7DpHie9pzAFsLj0pXLlv/RS1E7HITHTowmoZodK+6wcdve4u2FgkYk6V2IGw6iS6Jb xB4mu5nHPQPcOf5znwCYQSCcg2IWqJSusiywOQjLGzYZjTpbuDr8XhtBCZWEyOlF4qUx WqTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucloud.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si6350373edq.493.2021.03.25.19.27.27; Thu, 25 Mar 2021 19:27:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucloud.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230269AbhCZCYa convert rfc822-to-8bit (ORCPT + 99 others); Thu, 25 Mar 2021 22:24:30 -0400 Received: from mail-m2452.qiye.163.com ([220.194.24.52]:55568 "EHLO mail-m2452.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230216AbhCZCYX (ORCPT ); Thu, 25 Mar 2021 22:24:23 -0400 X-Greylist: delayed 585 seconds by postgrey-1.27 at vger.kernel.org; Thu, 25 Mar 2021 22:24:23 EDT Received: from [192.168.203.71] (unknown [117.48.120.186]) by mail-m2452.qiye.163.com (Hmail) with ESMTPA id 18FA64CC8FA; Fri, 26 Mar 2021 10:14:35 +0800 (CST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: [3/3,v3] tools/power turbostat: Enable accumulate RAPL display From: sibingsong In-Reply-To: Date: Fri, 26 Mar 2021 10:14:34 +0800 Cc: Salvatore Bonaccorso , Christian Kastner , Kurt Garloff , Chen Yu , Bas Nieuwenhuizen , erwanaliasr1@gmail.com, Len Brown , rjw@rjwysocki.net, Linux Kernel Mailing List , Len Brown , Zhang Rui , youling 257 Content-Transfer-Encoding: 8BIT Message-Id: <57D29045-C7F6-458C-A397-CC43E4C86729@ucloud.cn> References: <1f6d32e14f121a8ccf8807b8343597c3ae88c7d2.1587196252.git.yu.c.chen@intel.com> <20210308134957.23852-1-youling257@gmail.com> <20210308161548.GA37664@chenyu-desktop> <20210312134114.GA21436@chenyu-desktop> To: Doug Smythies X-Mailer: Apple Mail (2.3654.60.0.2.21) X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSUI3V1ktWUFJV1kPCR oVCBIfWUFZSU1LGBlPShlKSBpNVkpNSk1MSU9DTE5PSUhVGRETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS0hKTFVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Kww6KSo5Lz04KRIzAxhLMygq EjxPCz5VSlVKTUpNTElPQ0xOTU5JVTMWGhIXVRQMHhVVCBI7DhgXFA4fVRgVRVlXWRILWUFZSkpM VU9DVUpJS1VKQ01ZV1kIAVlBTUtMTDcG X-HM-Tid: 0a786c4fd8608c11kuqt18fa64cc8fa Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It works for me on Zen2. > 2021年3月24日 下午10:44,Doug Smythies 写道: > > Just resending to previously missed people who should also test this. > (See other e-mail: Re: turbostat: Fix Pkg Power on Zen) > > On Sat, Mar 13, 2021 at 5:49 AM youling 257 wrote: >> >> test this patch, turbostat can work. >> >> 2021-03-12 21:41 GMT+08:00, Chen Yu : >>> Hi Youling, Bas, and Bingsong, >>> On Wed, Mar 10, 2021 at 04:03:31PM -0800, Doug Smythies wrote: >>>> Hi Yu, >>>> >>>> I am just resending your e-mail, adjusting the "To:" list to >>>> include the 3 others that have submitted similar patches. >>>> >>>> ... Doug >>>> >>> Could you please help check if the following combined patch works? >>> >>> Thanks, >>> Chenyu >>> >>> >>> From 00e0622b1b693a5c7dc343aeb3aa51614a9e125e Mon Sep 17 00:00:00 2001 >>> From: Bas Nieuwenhuizen >>> Date: Fri, 12 Mar 2021 21:27:40 +0800 >>> Subject: [PATCH] tools/power/turbostat: Fix turbostat for AMD Zen CPUs >>> >>> It was reported that on Zen+ system turbostat started exiting, >>> which was tracked down to the MSR_PKG_ENERGY_STAT read failing because >>> offset_to_idx wasn't returning a non-negative index. >>> >>> This patch combined the modification from Bingsong Si and >>> Bas Nieuwenhuizen and addd the MSR to the index system as alternative for >>> MSR_PKG_ENERGY_STATUS. >>> >>> Fixes: 9972d5d84d76 ("tools/power turbostat: Enable accumulate RAPL >>> display") >>> Reported-by: youling257 >>> Co-developed-by: Bingsong Si >>> Signed-off-by: Chen Yu >>> --- >>> tools/power/x86/turbostat/turbostat.c | 8 ++++++-- >>> 1 file changed, 6 insertions(+), 2 deletions(-) >>> >>> diff --git a/tools/power/x86/turbostat/turbostat.c >>> b/tools/power/x86/turbostat/turbostat.c >>> index a7c4f0772e53..a7c965734fdf 100644 >>> --- a/tools/power/x86/turbostat/turbostat.c >>> +++ b/tools/power/x86/turbostat/turbostat.c >>> @@ -297,7 +297,10 @@ int idx_to_offset(int idx) >>> >>> switch (idx) { >>> case IDX_PKG_ENERGY: >>> - offset = MSR_PKG_ENERGY_STATUS; >>> + if (do_rapl & RAPL_AMD_F17H) >>> + offset = MSR_PKG_ENERGY_STAT; >>> + else >>> + offset = MSR_PKG_ENERGY_STATUS; >>> break; >>> case IDX_DRAM_ENERGY: >>> offset = MSR_DRAM_ENERGY_STATUS; >>> @@ -326,6 +329,7 @@ int offset_to_idx(int offset) >>> >>> switch (offset) { >>> case MSR_PKG_ENERGY_STATUS: >>> + case MSR_PKG_ENERGY_STAT: >>> idx = IDX_PKG_ENERGY; >>> break; >>> case MSR_DRAM_ENERGY_STATUS: >>> @@ -353,7 +357,7 @@ int idx_valid(int idx) >>> { >>> switch (idx) { >>> case IDX_PKG_ENERGY: >>> - return do_rapl & RAPL_PKG; >>> + return do_rapl & (RAPL_PKG | RAPL_AMD_F17H); >>> case IDX_DRAM_ENERGY: >>> return do_rapl & RAPL_DRAM; >>> case IDX_PP0_ENERGY: >>> -- >>> 2.25.1 >>> >>> >