Message ID | 20231004183455.27797-1-ville.syrjala@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp330417vqb; Wed, 4 Oct 2023 11:36:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMDDL3/2+3vLDzRWMKrxNKLo76tsmKcjElLIgLMZfT507Fz1/eX4G2V9yY0i0sHSB/WxbH X-Received: by 2002:a17:902:c404:b0:1c3:e130:18f1 with SMTP id k4-20020a170902c40400b001c3e13018f1mr4071948plk.20.1696444570899; Wed, 04 Oct 2023 11:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696444570; cv=none; d=google.com; s=arc-20160816; b=qneI8pQf9q5xPqogdjSqIdwIC/5Hgyrb3DI7Hn+Kl27PZ2CECrpiduiDMM3pUy34Lt FfvEn5aRkWNr62MWpGJHsPO/pWPdbNfUJIUkoMmnQbfX+I4in8TWsa9PL7nthZcDBPdP K16y9MG1FWWgTbY6Dpw35DqgqQmEmlKvlB6G4j9/4Z+jArKKmDNhKXjxYSqwcMhG6RdQ 4iq5zEsA6XJ07qL13E9syQo2wa0th7oeiFzVteN0lV7RqbWP2KGASRD4Sj+eHz5pIqh3 huX6wKsCBRp2CIYP8ZtKLT6GIoRqczQ24B229rJ6/Nuj7lzQvtyAsock5bwJyuWfPFtr t19Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=xhUX+t55d7QJ25pJlDnr2GycIz6WNjBOYVsWGG70cIU=; fh=5dd+yZaSM5r1RhK83vA4++n3GlTBZASjd+EB6beB7HU=; b=EwS5J8tfG4iFXdS+x5UK8s1MR4StpavFIAfhoZThJ/D+TXC2oKz1ToFIJ1F9lb437P uYpMJJ3JYYslEUbLftHjI589iAYiUosekgUcxxtqsWHIDDp8Fquv0DswQb9/i9vBv4bc Dl4BcFBgbq1Um8qsXQDtyDIx0QGq7WPkpoFbkXQ2t9djNAvpqCovL0Ayx3xRXw5ID++6 Zq1FsLdASWhcAjgqB0uI0q/23/qTSS33GjelQbnfWEHz11FUYsqGLVOuRhEhq0ErfDxm /tZO4D+7NGs/yE7t5MISizeROuYalZCRKp90yBwAMWMz6G7qRze/OqUdBNEUvXApLeKH rRlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Uo9vqPMr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id n17-20020a170902d2d100b001c3da86939csi4669661plc.546.2023.10.04.11.36.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:36:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Uo9vqPMr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 7C93581A8A84; Wed, 4 Oct 2023 11:35:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244424AbjJDSfG (ORCPT <rfc822;ezelljr.billy@gmail.com> + 19 others); Wed, 4 Oct 2023 14:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244415AbjJDSfE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 4 Oct 2023 14:35:04 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4FF0A7; Wed, 4 Oct 2023 11:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696444500; x=1727980500; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=bpSnUeyMCwr5z8q24pn1zkzo5CtrPo+vd10q6+Wf0l0=; b=Uo9vqPMr/6k6DuxuUB+ra/S5yf6o8RCQosIHI7cQKqv19sEEnFWwUE6S T6vq7Ka5Kq3dfueJD3tFpPLRydKWFDpk99YuUgj6RSxNDFH2upM4JkS1g InCjUpR7hVDbD9bFX9rvEafBwG8CZleg3BkBVd74oGq4sxWmzo8szJWeK umtSU11W+XSvK6vbPqo829RW+q0bl50Dk5ngWznNsrj8uFN3j4PEb+Noi 2Ff7+9ajvtyqrEnk9AOyylSsfka2YCsoiv8LqCABR7N2a3SLYDNVOheUF 7Yt3oDiF7322Zoc59FEnYvzYxTFOvNtF28xDHUos+8SNdLsYTS1REeA7l Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="383168102" X-IronPort-AV: E=Sophos;i="6.03,201,1694761200"; d="scan'208";a="383168102" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 11:34:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="780909015" X-IronPort-AV: E=Sophos;i="6.03,201,1694761200"; d="scan'208";a="780909015" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.153]) by orsmga008.jf.intel.com with SMTP; 04 Oct 2023 11:34:55 -0700 Received: by stinkbox (sSMTP sendmail emulation); Wed, 04 Oct 2023 21:34:55 +0300 From: Ville Syrjala <ville.syrjala@linux.intel.com> To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, Zhang Rui <rui.zhang@intel.com>, Wang Wendy <wendy.wang@intel.com>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Srinivas Pandruvada <srinivas.pandruvada@intel.com> Subject: [PATCH] powercap: intel_rapl: Don't warn about BIOS locked limits during resume Date: Wed, 4 Oct 2023 21:34:55 +0300 Message-ID: <20231004183455.27797-1-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 04 Oct 2023 11:35:57 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778851062311141976 X-GMAIL-MSGID: 1778851062311141976 |
Series |
powercap: intel_rapl: Don't warn about BIOS locked limits during resume
|
|
Commit Message
Ville Syrjälä
Oct. 4, 2023, 6:34 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com> Restore enough of the original behaviour to stop spamming dmesg with warnings about BIOS locked limits when trying to restore them during resume. This still doesn't 100% match the original behaviour as we no longer attempt to blindly restore the BIOS locked limits. No idea if that makes any difference in practice. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Wang Wendy <wendy.wang@intel.com> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com> Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits support") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> --- drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
Comments
On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Restore enough of the original behaviour to stop spamming > dmesg with warnings about BIOS locked limits when trying > to restore them during resume. > > This still doesn't 100% match the original behaviour > as we no longer attempt to blindly restore the BIOS locked > limits. No idea if that makes any difference in practice. > I lost the context here. Why can't we simply change pr_warn to pr_debug here? Thanks, Srinivas > Cc: Zhang Rui <rui.zhang@intel.com> > Cc: Wang Wendy <wendy.wang@intel.com> > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com> > Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits > support") > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------ > -- > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/drivers/powercap/intel_rapl_common.c > b/drivers/powercap/intel_rapl_common.c > index 40a2cc649c79..9a6a40c83f82 100644 > --- a/drivers/powercap/intel_rapl_common.c > +++ b/drivers/powercap/intel_rapl_common.c > @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain > *rd, int pl, > return rapl_read_data_raw(rd, prim, xlate, data); > } > > -static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > - enum pl_prims pl_prim, > - unsigned long long value) > +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl, > + enum pl_prims pl_prim, > + unsigned long long value) > { > enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim); > > if (!is_pl_valid(rd, pl)) > return -EINVAL; > > - if (rd->rpl[pl].locked) { > - pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > rd->name, pl_names[pl]); > + if (rd->rpl[pl].locked) > return -EACCES; > - } > > return rapl_write_data_raw(rd, prim, value); > } > + > +static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > + enum pl_prims pl_prim, > + unsigned long long value) > +{ > + int ret; > + > + ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value); > + if (ret == -EACCES) > + pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > rd->name, pl_names[pl]); > + > + return ret; > +} > + > /* > * Raw RAPL data stored in MSRs are in certain scales. We need to > * convert them into standard units based on the units reported in > @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void) > rd = power_zone_to_rapl_domain(rp->power_zone); > for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++) > if (rd->rpl[i].last_power_limit) > - rapl_write_pl_data(rd, i, PL_LIMIT, > - rd- > >rpl[i].last_power_limit); > + rapl_write_pl_data_nowarn(rd, i, > PL_LIMIT, > + rd- > >rpl[i].last_power_limit); > } > cpus_read_unlock(); > }
On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote: > On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > Restore enough of the original behaviour to stop spamming > > dmesg with warnings about BIOS locked limits when trying > > to restore them during resume. > > > > This still doesn't 100% match the original behaviour > > as we no longer attempt to blindly restore the BIOS locked > > limits. No idea if that makes any difference in practice. > > > I lost the context here. Why can't we simply change pr_warn to pr_debug > here? I presume someone wanted to make it pr_warn() for a reason. I don't mind either way. > > Thanks, > Srinivas > > > Cc: Zhang Rui <rui.zhang@intel.com> > > Cc: Wang Wendy <wendy.wang@intel.com> > > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com> > > Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits > > support") > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > --- > > drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------ > > -- > > 1 file changed, 20 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/powercap/intel_rapl_common.c > > b/drivers/powercap/intel_rapl_common.c > > index 40a2cc649c79..9a6a40c83f82 100644 > > --- a/drivers/powercap/intel_rapl_common.c > > +++ b/drivers/powercap/intel_rapl_common.c > > @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain > > *rd, int pl, > > return rapl_read_data_raw(rd, prim, xlate, data); > > } > > > > -static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > > - enum pl_prims pl_prim, > > - unsigned long long value) > > +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl, > > + enum pl_prims pl_prim, > > + unsigned long long value) > > { > > enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim); > > > > if (!is_pl_valid(rd, pl)) > > return -EINVAL; > > > > - if (rd->rpl[pl].locked) { > > - pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > > rd->name, pl_names[pl]); > > + if (rd->rpl[pl].locked) > > return -EACCES; > > - } > > > > return rapl_write_data_raw(rd, prim, value); > > } > > + > > +static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > > + enum pl_prims pl_prim, > > + unsigned long long value) > > +{ > > + int ret; > > + > > + ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value); > > + if (ret == -EACCES) > > + pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > > rd->name, pl_names[pl]); > > + > > + return ret; > > +} > > + > > /* > > * Raw RAPL data stored in MSRs are in certain scales. We need to > > * convert them into standard units based on the units reported in > > @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void) > > rd = power_zone_to_rapl_domain(rp->power_zone); > > for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++) > > if (rd->rpl[i].last_power_limit) > > - rapl_write_pl_data(rd, i, PL_LIMIT, > > - rd- > > >rpl[i].last_power_limit); > > + rapl_write_pl_data_nowarn(rd, i, > > PL_LIMIT, > > + rd- > > >rpl[i].last_power_limit); > > } > > cpus_read_unlock(); > > } >
On Wed, Oct 04, 2023 at 09:59:47PM +0300, Ville Syrjälä wrote: > On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote: > > On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote: > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > > > Restore enough of the original behaviour to stop spamming > > > dmesg with warnings about BIOS locked limits when trying > > > to restore them during resume. > > > > > > This still doesn't 100% match the original behaviour > > > as we no longer attempt to blindly restore the BIOS locked > > > limits. No idea if that makes any difference in practice. > > > > > I lost the context here. Why can't we simply change pr_warn to pr_debug > > here? > > I presume someone wanted to make it pr_warn() for a reason. > I don't mind either way. Ping. Can someone make a decision on how this should get fixed so we get this moving forward? > > > > > Thanks, > > Srinivas > > > > > Cc: Zhang Rui <rui.zhang@intel.com> > > > Cc: Wang Wendy <wendy.wang@intel.com> > > > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com> > > > Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits > > > support") > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > --- > > > drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------ > > > -- > > > 1 file changed, 20 insertions(+), 8 deletions(-) > > > > > > diff --git a/drivers/powercap/intel_rapl_common.c > > > b/drivers/powercap/intel_rapl_common.c > > > index 40a2cc649c79..9a6a40c83f82 100644 > > > --- a/drivers/powercap/intel_rapl_common.c > > > +++ b/drivers/powercap/intel_rapl_common.c > > > @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain > > > *rd, int pl, > > > return rapl_read_data_raw(rd, prim, xlate, data); > > > } > > > > > > -static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > > > - enum pl_prims pl_prim, > > > - unsigned long long value) > > > +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl, > > > + enum pl_prims pl_prim, > > > + unsigned long long value) > > > { > > > enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim); > > > > > > if (!is_pl_valid(rd, pl)) > > > return -EINVAL; > > > > > > - if (rd->rpl[pl].locked) { > > > - pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > > > rd->name, pl_names[pl]); > > > + if (rd->rpl[pl].locked) > > > return -EACCES; > > > - } > > > > > > return rapl_write_data_raw(rd, prim, value); > > > } > > > + > > > +static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > > > + enum pl_prims pl_prim, > > > + unsigned long long value) > > > +{ > > > + int ret; > > > + > > > + ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value); > > > + if (ret == -EACCES) > > > + pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > > > rd->name, pl_names[pl]); > > > + > > > + return ret; > > > +} > > > + > > > /* > > > * Raw RAPL data stored in MSRs are in certain scales. We need to > > > * convert them into standard units based on the units reported in > > > @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void) > > > rd = power_zone_to_rapl_domain(rp->power_zone); > > > for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++) > > > if (rd->rpl[i].last_power_limit) > > > - rapl_write_pl_data(rd, i, PL_LIMIT, > > > - rd- > > > >rpl[i].last_power_limit); > > > + rapl_write_pl_data_nowarn(rd, i, > > > PL_LIMIT, > > > + rd- > > > >rpl[i].last_power_limit); > > > } > > > cpus_read_unlock(); > > > } > > > > -- > Ville Syrjälä > Intel
On Tue, Oct 24, 2023 at 7:11 PM Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > > On Wed, Oct 04, 2023 at 09:59:47PM +0300, Ville Syrjälä wrote: > > On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote: > > > On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote: > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > > > > > Restore enough of the original behaviour to stop spamming > > > > dmesg with warnings about BIOS locked limits when trying > > > > to restore them during resume. > > > > > > > > This still doesn't 100% match the original behaviour > > > > as we no longer attempt to blindly restore the BIOS locked > > > > limits. No idea if that makes any difference in practice. > > > > > > > I lost the context here. Why can't we simply change pr_warn to pr_debug > > > here? > > > > I presume someone wanted to make it pr_warn() for a reason. > > I don't mind either way. > > Ping. Can someone make a decision on how this should get fixed > so we get this moving forward? I thought we were going to replace the pr_warn() with pr_debug(). > > > > Cc: Zhang Rui <rui.zhang@intel.com> > > > > Cc: Wang Wendy <wendy.wang@intel.com> > > > > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com> > > > > Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits > > > > support") > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > --- > > > > drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------ > > > > -- > > > > 1 file changed, 20 insertions(+), 8 deletions(-) > > > > > > > > diff --git a/drivers/powercap/intel_rapl_common.c > > > > b/drivers/powercap/intel_rapl_common.c > > > > index 40a2cc649c79..9a6a40c83f82 100644 > > > > --- a/drivers/powercap/intel_rapl_common.c > > > > +++ b/drivers/powercap/intel_rapl_common.c > > > > @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain > > > > *rd, int pl, > > > > return rapl_read_data_raw(rd, prim, xlate, data); > > > > } > > > > > > > > -static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > > > > - enum pl_prims pl_prim, > > > > - unsigned long long value) > > > > +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl, > > > > + enum pl_prims pl_prim, > > > > + unsigned long long value) > > > > { > > > > enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim); > > > > > > > > if (!is_pl_valid(rd, pl)) > > > > return -EINVAL; > > > > > > > > - if (rd->rpl[pl].locked) { > > > > - pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > > > > rd->name, pl_names[pl]); > > > > + if (rd->rpl[pl].locked) > > > > return -EACCES; > > > > - } > > > > > > > > return rapl_write_data_raw(rd, prim, value); > > > > } > > > > + > > > > +static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > > > > + enum pl_prims pl_prim, > > > > + unsigned long long value) > > > > +{ > > > > + int ret; > > > > + > > > > + ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value); > > > > + if (ret == -EACCES) > > > > + pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > > > > rd->name, pl_names[pl]); > > > > + > > > > + return ret; > > > > +} > > > > + > > > > /* > > > > * Raw RAPL data stored in MSRs are in certain scales. We need to > > > > * convert them into standard units based on the units reported in > > > > @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void) > > > > rd = power_zone_to_rapl_domain(rp->power_zone); > > > > for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++) > > > > if (rd->rpl[i].last_power_limit) > > > > - rapl_write_pl_data(rd, i, PL_LIMIT, > > > > - rd- > > > > >rpl[i].last_power_limit); > > > > + rapl_write_pl_data_nowarn(rd, i, > > > > PL_LIMIT, > > > > + rd- > > > > >rpl[i].last_power_limit); > > > > } > > > > cpus_read_unlock(); > > > > } > > > > > > > --
On Tue, Oct 24, 2023 at 08:31:34PM +0200, Rafael J. Wysocki wrote: > On Tue, Oct 24, 2023 at 7:11 PM Ville Syrjälä > <ville.syrjala@linux.intel.com> wrote: > > > > On Wed, Oct 04, 2023 at 09:59:47PM +0300, Ville Syrjälä wrote: > > > On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote: > > > > On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote: > > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > > > > > > > Restore enough of the original behaviour to stop spamming > > > > > dmesg with warnings about BIOS locked limits when trying > > > > > to restore them during resume. > > > > > > > > > > This still doesn't 100% match the original behaviour > > > > > as we no longer attempt to blindly restore the BIOS locked > > > > > limits. No idea if that makes any difference in practice. > > > > > > > > > I lost the context here. Why can't we simply change pr_warn to pr_debug > > > > here? > > > > > > I presume someone wanted to make it pr_warn() for a reason. > > > I don't mind either way. > > > > Ping. Can someone make a decision on how this should get fixed > > so we get this moving forward? > > I thought we were going to replace the pr_warn() with pr_debug(). I didn't get any answer whether anyone wants to keep the pr_warn(). If everyone is happy with pr_debug() that then I can send a patch for it. > > > > > > Cc: Zhang Rui <rui.zhang@intel.com> > > > > > Cc: Wang Wendy <wendy.wang@intel.com> > > > > > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > > Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com> > > > > > Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits > > > > > support") > > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > > --- > > > > > drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------ > > > > > -- > > > > > 1 file changed, 20 insertions(+), 8 deletions(-) > > > > > > > > > > diff --git a/drivers/powercap/intel_rapl_common.c > > > > > b/drivers/powercap/intel_rapl_common.c > > > > > index 40a2cc649c79..9a6a40c83f82 100644 > > > > > --- a/drivers/powercap/intel_rapl_common.c > > > > > +++ b/drivers/powercap/intel_rapl_common.c > > > > > @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain > > > > > *rd, int pl, > > > > > return rapl_read_data_raw(rd, prim, xlate, data); > > > > > } > > > > > > > > > > -static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > > > > > - enum pl_prims pl_prim, > > > > > - unsigned long long value) > > > > > +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl, > > > > > + enum pl_prims pl_prim, > > > > > + unsigned long long value) > > > > > { > > > > > enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim); > > > > > > > > > > if (!is_pl_valid(rd, pl)) > > > > > return -EINVAL; > > > > > > > > > > - if (rd->rpl[pl].locked) { > > > > > - pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > > > > > rd->name, pl_names[pl]); > > > > > + if (rd->rpl[pl].locked) > > > > > return -EACCES; > > > > > - } > > > > > > > > > > return rapl_write_data_raw(rd, prim, value); > > > > > } > > > > > + > > > > > +static int rapl_write_pl_data(struct rapl_domain *rd, int pl, > > > > > + enum pl_prims pl_prim, > > > > > + unsigned long long value) > > > > > +{ > > > > > + int ret; > > > > > + > > > > > + ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value); > > > > > + if (ret == -EACCES) > > > > > + pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, > > > > > rd->name, pl_names[pl]); > > > > > + > > > > > + return ret; > > > > > +} > > > > > + > > > > > /* > > > > > * Raw RAPL data stored in MSRs are in certain scales. We need to > > > > > * convert them into standard units based on the units reported in > > > > > @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void) > > > > > rd = power_zone_to_rapl_domain(rp->power_zone); > > > > > for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++) > > > > > if (rd->rpl[i].last_power_limit) > > > > > - rapl_write_pl_data(rd, i, PL_LIMIT, > > > > > - rd- > > > > > >rpl[i].last_power_limit); > > > > > + rapl_write_pl_data_nowarn(rd, i, > > > > > PL_LIMIT, > > > > > + rd- > > > > > >rpl[i].last_power_limit); > > > > > } > > > > > cpus_read_unlock(); > > > > > } > > > > > > > > > > --
On Tue, Oct 24, 2023 at 8:48 PM Ville Syrjälä <ville.syrjala@linux.intel.com> wrote: > > On Tue, Oct 24, 2023 at 08:31:34PM +0200, Rafael J. Wysocki wrote: > > On Tue, Oct 24, 2023 at 7:11 PM Ville Syrjälä > > <ville.syrjala@linux.intel.com> wrote: > > > > > > On Wed, Oct 04, 2023 at 09:59:47PM +0300, Ville Syrjälä wrote: > > > > On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote: > > > > > On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote: > > > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > > > > > > > > > Restore enough of the original behaviour to stop spamming > > > > > > dmesg with warnings about BIOS locked limits when trying > > > > > > to restore them during resume. > > > > > > > > > > > > This still doesn't 100% match the original behaviour > > > > > > as we no longer attempt to blindly restore the BIOS locked > > > > > > limits. No idea if that makes any difference in practice. > > > > > > > > > > > I lost the context here. Why can't we simply change pr_warn to pr_debug > > > > > here? > > > > > > > > I presume someone wanted to make it pr_warn() for a reason. > > > > I don't mind either way. > > > > > > Ping. Can someone make a decision on how this should get fixed > > > so we get this moving forward? > > > > I thought we were going to replace the pr_warn() with pr_debug(). > > I didn't get any answer whether anyone wants to keep the pr_warn(). > If everyone is happy with pr_debug() that then I can send a patch > for it. Yes, please.
diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c index 40a2cc649c79..9a6a40c83f82 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain *rd, int pl, return rapl_read_data_raw(rd, prim, xlate, data); } -static int rapl_write_pl_data(struct rapl_domain *rd, int pl, - enum pl_prims pl_prim, - unsigned long long value) +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl, + enum pl_prims pl_prim, + unsigned long long value) { enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim); if (!is_pl_valid(rd, pl)) return -EINVAL; - if (rd->rpl[pl].locked) { - pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]); + if (rd->rpl[pl].locked) return -EACCES; - } return rapl_write_data_raw(rd, prim, value); } + +static int rapl_write_pl_data(struct rapl_domain *rd, int pl, + enum pl_prims pl_prim, + unsigned long long value) +{ + int ret; + + ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value); + if (ret == -EACCES) + pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]); + + return ret; +} + /* * Raw RAPL data stored in MSRs are in certain scales. We need to * convert them into standard units based on the units reported in @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void) rd = power_zone_to_rapl_domain(rp->power_zone); for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++) if (rd->rpl[i].last_power_limit) - rapl_write_pl_data(rd, i, PL_LIMIT, - rd->rpl[i].last_power_limit); + rapl_write_pl_data_nowarn(rd, i, PL_LIMIT, + rd->rpl[i].last_power_limit); } cpus_read_unlock(); }