From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 676D5C433E9 for ; Mon, 1 Feb 2021 09:18:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 159EC64E45 for ; Mon, 1 Feb 2021 09:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232849AbhBAJSn (ORCPT ); Mon, 1 Feb 2021 04:18:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232785AbhBAJRE (ORCPT ); Mon, 1 Feb 2021 04:17:04 -0500 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 F30CEC061574 for ; Mon, 1 Feb 2021 01:06:42 -0800 (PST) Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id C65B813693; Mon, 1 Feb 2021 10:06:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id C2CB311F48; Mon, 1 Feb 2021 10:06:41 +0100 (CET) Received: from [213.196.193.186] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.19.0) (envelope-from ) id 6017c4a1-0254-7f0000012729-7f000001abb8-1 for ; Mon, 01 Feb 2021 10:06:41 +0100 Received: from nas2.garloff.de (xdsl-213-196-193-186.nc.de [213.196.193.186]) (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; Mon, 1 Feb 2021 10:06:39 +0100 (CET) Received: from [192.168.155.202] (ap4.garloff.de [192.168.155.15]) by nas2.garloff.de (Postfix) with ESMTPSA id 6AEF6B3B13A5; Mon, 1 Feb 2021 10:06:39 +0100 (CET) Subject: [PATCH 1/1]: turbostat: Fix Pkg Power on Zen From: Kurt Garloff To: Len Brown , LKML References: <1f1fb01e-0616-34ea-ede6-dc7dd679c3d4@garloff.de> Message-ID: Date: Mon, 1 Feb 2021 10:06:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 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 commit 5d399d05df42ffcaa2b3836b580631c4024487a0 Author: Kurt Garloff Date:   Mon Feb 1 09:01:47 2021 +0000     turbostat: Fix Pkg Power tracking on Zen         AMD Zen processors use a different MSR (MSR_PKG_ENERGY_STAT) than intel     (MSR_PKG_ENERGY_STATUS) to track package power; however we want to record     it at the same offset in our package_data.     offset_to_idx() however only recognized the intel MSR, erroring     out with -13 on Zen.         With this fix, it will support the Zen MSR.     Tested successfully on Ryzen 3000 & 5000.         Signed-off-by: Kurt Garloff diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 389ea5209a83..cb830e73d899 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -325,6 +325,7 @@ int offset_to_idx(int offset)      int idx;        switch (offset) { +    case MSR_PKG_ENERGY_STAT:      case MSR_PKG_ENERGY_STATUS:          idx = IDX_PKG_ENERGY;          break; -- Kurt Garloff Cologne, Germany