Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp680812pxb; Thu, 5 Nov 2020 10:06:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcydoQvjc0taWZns54Tm4uD3enyhQ28cOFDTvG9wRCIjxSwGsRphDF1iUkoH+pf9OJpnwA X-Received: by 2002:a05:6402:a51:: with SMTP id bt17mr3784612edb.328.1604599567769; Thu, 05 Nov 2020 10:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604599567; cv=none; d=google.com; s=arc-20160816; b=M8CEaq2SEzaiKbmLlwjRRWLm/g/mT1TR9RxSPYTRF3rAr89r23lQdxVjldA0AY5VNl iirymr6uOO48R7h4J+Gj/X3oaPDqfeIXIpwl3QMj6tdyVknID858LNILFHqAftdrQu6v fXT29exmuG/i6BsqwpSRtxREcPms6s+CVO4eJhFshanfKxw7Aed9LJhIjjWRm9EIXfoa uYX6tXNlaPALcfwEUkIAFxYMUGBUttuc5O8Y/aL8n9JEbpBotxhBWsNRD/CAjPGdLJlm 60FCCtFFk5vGxNDwU0xi6kzsxepwng0MEGQ/fB7cR7nEidXza9ouf5JKMgtaG/zo8lM6 dj6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fZEW0FLTlhtkCuLCYFRn8qd0K8eTghJ8GxCeZCmtQKE=; b=nGMt4z6T60yA7MONNMdwG8NA9yrgrRgxcg7a4ItYIsS2u8IJFC79hk+Ou086rgJM7G C0AVTm4PDVLnIUZOo7G32on5FPgxEl79Qlw7Hu3Meue8+WEC267ClC/GS6yFT7TmMsRo y2wNHcNv4ImH/enF21AhW/v9siEMyTvxHwwFtB2NRKsMvLQ+xFH1QGi+MwcyCgoxZzvT z2lIhwLpjuyh45CJSDK1PhYxWDDg95busUsSBC8T5DEwCubgpVzBWSlULJvNo7B81fh8 DNSQ3Ckq5rsfLdtX0nOeHv00uuQrzLebWvWfBxcNcrBnB2C+5aKoJrTKXSWBY9gQoISl XNbQ== 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 i14si1644915eje.464.2020.11.05.10.05.40; Thu, 05 Nov 2020 10:06:07 -0800 (PST) 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 S1731648AbgKESEN (ORCPT + 99 others); Thu, 5 Nov 2020 13:04:13 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:45138 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729783AbgKESEM (ORCPT ); Thu, 5 Nov 2020 13:04:12 -0500 Received: from 89-64-88-191.dynamic.chello.pl (89.64.88.191) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.514) id 4284eb2aea7df779; Thu, 5 Nov 2020 19:04:09 +0100 From: "Rafael J. Wysocki" To: Srinivas Pandruvada , Victor Ding Cc: Zhang Rui , LKML , Daniel Lezcano , Kim Phillips , linux-pm@vger.kernel.org, Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , Joerg Roedel , Kan Liang , Pawan Gupta , "Peter Zijlstra (Intel)" , Sean Christopherson , Thomas Gleixner , Tony Luck , Vineela Tummalapalli , x86@kernel.org Subject: Re: [PATCH v3 3/4] powercap: Add AMD Fam17h RAPL support Date: Thu, 05 Nov 2020 19:04:08 +0100 Message-ID: <2121012.oOYSSSs1xd@kreacher> In-Reply-To: <9ea15f21febf47d5d6f62911fe0141a2ae5d5e2b.camel@linux.intel.com> References: <20201027072358.13725-1-victording@google.com> <9ea15f21febf47d5d6f62911fe0141a2ae5d5e2b.camel@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, November 5, 2020 6:14:01 PM CET Srinivas Pandruvada wrote: > On Thu, 2020-11-05 at 14:53 +1100, Victor Ding wrote: > > On Wed, Nov 4, 2020 at 1:17 PM Srinivas Pandruvada > > wrote: > > > On Wed, 2020-11-04 at 12:43 +1100, Victor Ding wrote: > > > > On Wed, Nov 4, 2020 at 4:09 AM Srinivas Pandruvada > > > > wrote: > > > > > On Tue, 2020-11-03 at 17:10 +1100, Victor Ding wrote: > > > > > > On Mon, Nov 2, 2020 at 12:39 PM Zhang Rui < > > > > > > rui.zhang@intel.com> > > > > > > wrote: > > > > > > > On Tue, 2020-10-27 at 07:23 +0000, Victor Ding wrote: > > > > > > > > This patch enables AMD Fam17h RAPL support for the power > > > > > > > > capping > > > > > > > > framework. The support is as per AMD Fam17h Model31h > > > > > > > > (Zen2) > > > > > > > > and > > > > > > > > model 00-ffh (Zen1) PPR. > > > > > > > > > > > > > > > > Tested by comparing the results of following two sysfs > > > > > > > > entries > > > > > > > > and > > > > > > > > the > > > > > > > > values directly read from corresponding MSRs via > > > > > > > > /dev/cpu/[x]/msr: > > > > > > > > /sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj > > > > > > > > /sys/class/powercap/intel-rapl/intel-rapl:0/intel- > > > > > > > > rapl:0:0/energy_uj > > > > > > > > > > Is this for just energy reporting? No capping of power? > > > > Correct, the hardware does not support capping of power. > > > I wonder if there is no capping, is this the right interface? > > > Do you have specific user space, which cares about this? > > We have tools that previously developed to measure energy status > > on Intel via the powercap interface. Powercap is the only interface > > allowing reading RAPL energy counters without requiring MSR access > > privileges. We want to use these tools on AMD with minimal > > modifications. > > I believe the powercap interface should support these counters, > > regardless of the use cases, mainly for two reasons: > > 1. Powercap interface already supports monitoring-only power domains, > > e.g. power limit is locked by BIOS or the (Intel) CPU does not expose > > an > > MSR for certain power domains. The latter is the exact situation on > > AMD; > > 2. As AMD has partially introduced the equivalent of Intel's RAPL, we > > should leverage this opportunity to reduce the divergence in the > > APIs. i.e. > > OS as a hardware abstraction layer should allow users to use the same > > set of APIs to access RAPL features if it issupported on both Intel > > and AMD. > > In this specific case, if users can query for Intel's RAPL counters > > via > > powercap, they should be able to do so as well for AMD's. > > > I think these counters are already exposed via hwmon sysf. > > Yes, they were introduced early this year. However, it is not the > > same as > > the counters exposed via powercap interface: powercap exposes the > > actual value of the energy counters while hwmon adds an accumulation > > layer on top. > > In addition, I don't think Intel's RAPL counters are exposed via > > hwmon; > > therefore: 1. existing fine grade power monitoring tools are not > > based on > > hwmon; 2. new tools cannot query the same set of counters via the > > same > > API so that they have to actively maintain two sets of logic. > > Fine with me. OK, I'll queue up the series for 5.11 then if there are no other concerns. Thanks!