From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752138AbcAVA3d (ORCPT ); Thu, 21 Jan 2016 19:29:33 -0500 Received: from mgwym01.jp.fujitsu.com ([211.128.242.40]:52682 "EHLO mgwym01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416AbcAVA33 (ORCPT ); Thu, 21 Jan 2016 19:29:29 -0500 Subject: Re: [PATCH 1/3] powercap, intel_rapl, implement get_max_time_window To: Prarit Bhargava , References: <1453392910-9549-1-git-send-email-prarit@redhat.com> <1453392910-9549-2-git-send-email-prarit@redhat.com> CC: "Rafael J. Wysocki" , Radivoje Jovanovic , Mathias Krause , Ajay Thomas From: Seiichi Ikarashi Organization: Fujitsu Limited Message-ID: <56A1777F.6070809@jp.fujitsu.com> Date: Fri, 22 Jan 2016 09:27:43 +0900 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1453392910-9549-2-git-send-email-prarit@redhat.com> Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016-01-22 01:15, Prarit Bhargava wrote: > The MSR_PKG_POWER_INFO register (Intel ASDM, section 14.9.3 > "Package RAPL Domain") provides a maximum time window which the > system can support. This window is read-only and is currently > not examined when setting the time windows for the package. > > This patch implements get_max_time_window_us() and checks the window when > a user attempts to set power capping for the package. > > Before the patch it was possible to set the window to, for example, 10000 > micro seconds: > > [root@intel-chiefriver-03 rhel7]# echo 10000 > > /sys/devices/virtual/powercap/intel-rapl/intel-rapl\:0/constraint_0_time_window_us; > egrep ^ /sys/devices/virtual/powercap/intel-rapl/intel-rapl\:0/constraint_0_time_window_us > > /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_0_time_window_us:1:9765 > > but from 'turbostat -d', the package is limited to 976us: > > cpu0: MSR_PKG_POWER_INFO: 0x01200168 (45 W TDP, RAPL 36 - 0 W, 0.000977 sec.) > > (Note, there appears to be a rounding issue in turbostat which needs to > also be fixed. Looking at the values in the register it is clear the > value is 1/1024 = 976us.) > > After the patch we are limited by the maximum time window: > > [root@intel-chiefriver-03 rhel7]# echo 10000 > > /sys/devices/virtual/powercap/intel-rapl/intel-rapl\:0/constraint_0_time_window_us; > egrep ^ /sys/devices/virtual/powercap/intel-rapl/intel-rapl\:0/constraint_0_time_window_us > > -bash: echo: write error: Invalid argument > /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_0_time_window_us:1:976 > > Cc: "Rafael J. Wysocki" > Cc: Prarit Bhargava > Cc: Radivoje Jovanovic > Cc: Seiichi Ikarashi > Cc: Mathias Krause > Cc: Ajay Thomas > Signed-off-by: Prarit Bhargava > --- > drivers/powercap/intel_rapl.c | 31 +++++++++++++++++++++++++++++++ > drivers/powercap/powercap_sys.c | 6 ++++-- > 2 files changed, 35 insertions(+), 2 deletions(-) > > diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c > index cc97f08..f765b2c 100644 > --- a/drivers/powercap/intel_rapl.c > +++ b/drivers/powercap/intel_rapl.c > @@ -493,13 +493,42 @@ static int get_current_power_limit(struct powercap_zone *power_zone, int id, > return ret; > } > > +static int get_max_time_window(struct powercap_zone *power_zone, int id, > + u64 *data) The 2nd arg "id" is not necessary. -- Seiichi