Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp336045pxf; Thu, 25 Mar 2021 05:25:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQLSz/LPNCF87QR5aRdAqa02wtXYxybGcUp8Jri/ElMWtuRLLJVQQ2pL7k4GKxMqz5BDeR X-Received: by 2002:a17:906:6817:: with SMTP id k23mr8979743ejr.6.1616675112219; Thu, 25 Mar 2021 05:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616675112; cv=none; d=google.com; s=arc-20160816; b=Ge5OSkCZ8S83ocdQkfpRn5GtVl+xENiEb8D/fRIZzpHJL4+BLdFy6ykLDCWuVFkQv4 iQNTLVwTMHBwmqmx78smbmnl20X90pr3daJYAQWZQOWEyYaJegEP49L4N4/DL2iamSyT mjpGuZQC9EwLA3l38KwBhApnL5AJsqCrUDukE9i0otXkXLtuG0wJ0xAIIzv4ebFuS78/ ZHGSxVJF/FBhrIucvjvZ3jnHOov72KG/6Vb1DHwjMFIlnsfkeE6EsRT1VzVj4FdX8aBf VJhqCbkRgO8+i1t2vmvor1lE8drdWBL9jG9QTycC+16QLhCrrxczxGV52hxjIzgdvf8m MJ2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to; bh=1WU/OxqWdp8DhWaaOp4yQHrXEMp7XoomEq5olfI1BHs=; b=zHrPHWm8gnc6X8O5GtAnpa1t+eJ6XGBFfSXRjSDf7LLYKrLHAsuVEKLihMlf/ngUQc +t1YFN43iD9u+50XC/MHFah10fdPn4yw3yRfVB/VrnT7i90vg+CmDy2GBSgaKuK48WPu WND/JxB307tbjRjZZSTWzSav6QZODX0wVxR7WkjrKUyvpIqiPkueu2IDSZ54gyVsCVCb 3tqgrm9NECaboq3rZSVSizcdnKqM7gXU6YIKlZ08DDCX2klO3raoTOI3BTEUtkvgaauw g9EZaTBurJ6OZRg28nQeQ20MX1tgDN/AHetPRuUKkgweJX0/Xro2zpcH5U3A+3tApIIk p8MA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v20si4141966edy.227.2021.03.25.05.24.48; Thu, 25 Mar 2021 05:25:12 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230298AbhCYMXl convert rfc822-to-8bit (ORCPT + 99 others); Thu, 25 Mar 2021 08:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbhCYMXS (ORCPT ); Thu, 25 Mar 2021 08:23:18 -0400 X-Greylist: delayed 601 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 25 Mar 2021 05:23:18 PDT Received: from cc-smtpout1.netcologne.de (cc-smtpout1.netcologne.de [IPv6:2001:4dd0:100:1062:25:2:0:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7A7EC06174A for ; Thu, 25 Mar 2021 05:23:18 -0700 (PDT) Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id 764D71392B; Thu, 25 Mar 2021 13:13:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id 661811207B; Thu, 25 Mar 2021 13:13:12 +0100 (CET) Received: from [78.34.170.195] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.19.0) (envelope-from ) id 605c7e58-36b0-7f0000012729-7f0000019960-1 for ; Thu, 25 Mar 2021 13:13:12 +0100 Received: from nas2.garloff.de (xdsl-78-34-170-195.nc.de [78.34.170.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Thu, 25 Mar 2021 13:12:54 +0100 (CET) Received: from [192.168.155.24] (ap4.garloff.de [192.168.155.15]) by nas2.garloff.de (Postfix) with ESMTPSA id A0907B3B1317; Thu, 25 Mar 2021 13:12:52 +0100 (CET) To: Doug Smythies , Salvatore Bonaccorso , Christian Kastner Cc: Chen Yu , Bas Nieuwenhuizen , Bingsong Si , erwanaliasr1@gmail.com, Len Brown , rjw@rjwysocki.net, Linux Kernel Mailing List , Len Brown , Zhang Rui , youling 257 References: <1f6d32e14f121a8ccf8807b8343597c3ae88c7d2.1587196252.git.yu.c.chen@intel.com> <20210308134957.23852-1-youling257@gmail.com> <20210308161548.GA37664@chenyu-desktop> <20210312134114.GA21436@chenyu-desktop> From: Kurt Garloff Subject: Re: [3/3,v3] tools/power turbostat: Enable accumulate RAPL display Message-ID: <54d08f41-b6ba-83e5-bd7b-b9897f2f2a2c@garloff.de> Date: Thu, 25 Mar 2021 13:12:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Doug, Am 24.03.21 um 15:44 schrieb 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 : >>> [...] >>> 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 Unsurprisingly, the patch from Bas works for me as well. (Tested on a Zen 3 and an embedded Zen.) Tested-by: Kurt Garloff Signed-off-by: Kurt Garloff Thanks, -- Kurt Garloff , Cologne, Germany