Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp413676pxf; Wed, 24 Mar 2021 07:46:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpu61s1w0mYhX29Itysd5zUR/sd7JkXmOwOdat3knQXc9fw4rIlgwy/J9OXp1n2LZs4QvM X-Received: by 2002:a05:6402:3047:: with SMTP id bu7mr3790890edb.227.1616597194320; Wed, 24 Mar 2021 07:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616597194; cv=none; d=google.com; s=arc-20160816; b=phhV/Bs9JZVYPK0bsV4xMo0Yp/wxjKwLS2LrFXn9DEVIhiT04cyP7WgLFWwb3bMhWB w+CZYwW1Kmzk7OviLx9XCyKb5tolJQUFw1z9mrybpxqPXL3Oqr6/2M9kRiZY44bdnn1S +m8Szh6UkzQnu5SDvHKBRQ7jHa5wkAVX9iDVv+wzaIXNUA9emMRg+46ZuxSZvERhst9u 65tUCFPt82HIiD4T5Nuoie/b/1tnOFQHs+QZqJrpJD/m5zItB5tN9Jej9+bg7oc+3dLD dJHndHHNMaCxnDbUO4ZbWCjz38c5Rf9CBN94XV/qqtaxH+Mnqq4zKPyxvRxT7LsT/OZX VGeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=o6Ne1DOKut/gFcsE+ZWDCYBIkt/suIOC8sMXwNq3Kcs=; b=oP1SMrsj1BqV6t98hrHC6yn2yeO6oUa0X77ITRkr18IM+XTZxGHXPJ7FkXdHHQPjYT dM0mASsbbrJMDSaeiGkUOV3nHsVKFo3U+jf2BX/xAHJwamvpj6JtdfbXi6j24Z2vFLmd 24M5lcMSkVdm0WifAdejN0A9TgWUWZ4EzlYq2AQA9GfJycXO1gbjZK0TIg7fT8IUtkMn tV4quV1YD9kD8CocZhszUO0esxpMs3aR1EYgPo+oBTVZOmXiu03++Q12oJjHC3h6yW23 Ji9tcVGYv8E8PNeHAMresTHYMmR8/Pzcg3mHN8R1E4INiaMWkGFtZaWJa2hFedieP53f Un7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@telus.net header.s=google header.b="I0PQCZ/7"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=telus.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gf19si2037197ejb.500.2021.03.24.07.46.10; Wed, 24 Mar 2021 07:46:34 -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; dkim=pass header.i=@telus.net header.s=google header.b="I0PQCZ/7"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=telus.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236316AbhCXOpN (ORCPT + 99 others); Wed, 24 Mar 2021 10:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235922AbhCXOoy (ORCPT ); Wed, 24 Mar 2021 10:44:54 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9842C061763 for ; Wed, 24 Mar 2021 07:44:53 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id v26so21767261iox.11 for ; Wed, 24 Mar 2021 07:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telus.net; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=o6Ne1DOKut/gFcsE+ZWDCYBIkt/suIOC8sMXwNq3Kcs=; b=I0PQCZ/7r0cets66AjRQyZf3d5YnT9U5Ge9ga7hrAam+5cdiiHwqh2NdotTfXQVqvM RkbX5H8jw+b/TFb/6cwxW8Et2MbX7WERN/4fdcL2nY2/OQdgo9XsT6jEgkp3seoHyF8H K2hKQC6lxb5YdoJfACGSf8rqDJoHdS1njc87lR57z0IzfNbYxmZo1BMwy9TNhozQG/ru fuubiuPzCh67Ko0ySVuU7aleTYd3iBDFdv/tVYMMiHVKaDgF4YzzDktwjQOhyKT9r7bC Y72D+AADEODD8MTPg3T4E/UABQ+4pClmTiQ9D9v1Ypq3Tyyfjqs/mYJ3xW5oCoGiI93t 3D2Q== 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=o6Ne1DOKut/gFcsE+ZWDCYBIkt/suIOC8sMXwNq3Kcs=; b=Pm39jBYLqNUo4JH7k8QCp3FdYCLVygNMwbYn3O3RsEzoM1d8PxeYJsgtF2YaMAZXDe cAAXCM6Pnc8a6XNcHcYNfzFP+85l44YrUXfNvx4gEMY1SYRB0vAccyJhHb3p+jx6uMby flAnC0SLxdLj+7RUWLvTFKNa0V6hyYYflqsPX3z/xS/6SuLzTAu52JHjeIsGOYFkzTGm IlhAHp+0K2kLPkD3GGBqAsf7puimMOPQPYrpDoEIcawtRcIbKqgqR3QNGYdtoG+UQFLo zaGAI2GsrvyJRnPKk5IrPPOFUYsH5twEvxDb9X58T4sOaU294x/UKCXMrnu9E6+AWTuC nEDw== X-Gm-Message-State: AOAM5323uILoeinO1q0HgLkiQuU06erVyJWOSQPXNghq+8mdu23JgUvj 4GlEohBrO4kUFYPco7xbIdQ6w1cQ++8mFTLOcKZjRQ== X-Received: by 2002:a02:7419:: with SMTP id o25mr3182025jac.100.1616597093098; Wed, 24 Mar 2021 07:44:53 -0700 (PDT) MIME-Version: 1.0 References: <1f6d32e14f121a8ccf8807b8343597c3ae88c7d2.1587196252.git.yu.c.chen@intel.com> <20210308134957.23852-1-youling257@gmail.com> <20210308161548.GA37664@chenyu-desktop> <20210312134114.GA21436@chenyu-desktop> In-Reply-To: From: Doug Smythies Date: Wed, 24 Mar 2021 07:44:46 -0700 Message-ID: Subject: Re: [3/3,v3] tools/power turbostat: Enable accumulate RAPL display To: Salvatore Bonaccorso , Christian Kastner , Kurt Garloff 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 , dsmythies Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > >