Message ID | 20230204042902.2555347-1-srinivas.pandruvada@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1210227wrn; Fri, 3 Feb 2023 21:30:53 -0800 (PST) X-Google-Smtp-Source: AK7set/3MyjxNQ21jlOVJ5BpUFly6+J8uavmWUNeqJ/HM3U4mEbC8KUFJjxY3XC4nnIc/U27mIa0 X-Received: by 2002:aa7:dac6:0:b0:46f:a6ea:202 with SMTP id x6-20020aa7dac6000000b0046fa6ea0202mr14828001eds.37.1675488653386; Fri, 03 Feb 2023 21:30:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675488653; cv=none; d=google.com; s=arc-20160816; b=UvNxplq+/h+ODerKZO3kaGw6J/rggDDf1UOGnq5mYhxgEdyoIuz3Qb0i6YQt+cfnpy 5CXYPLgRVTZJGvrvjxk6PVtpqe4P4oLH08TxmIAoda5k/EPzl9/CjOVAYGkr6O0DY5/9 /tqd7ojNjBXeuKI6JanAmYzlp37vRBkGUYO4Nlw4LtTbV66B6ySpUWKyoyQSR9P8YnU2 UnvGuTBG4uLbb/hOuu6kiba+hLW5tNgnqwov4f2dBAo5XTqsRUjH2iN15ZJZl61yDCcn 6PsFtUdWFfqiXCNEmuTw+f3aieakH+Do12zyeYX9ObrHVrwJM3zv91jX/5Qz5XOAnzaR Ej6Q== 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=Y+EDEIbvd5BgMkEBH72JRPcWeJrsKLmYBOaBzQM6TEw=; b=0QvEvq5pWkPByAn7/FsJzsr1BVgd4y3KrsQjX1UBjvRGZLdiitUbMesIhBHDdbmzov NxVX0GrKifbayZnYrknga/9c49F0uYJKWUwnlnT1gRmPE0p0OzKFa5jxd9u3GAsJbYZO Smtr4Eu0A3+hBehoS1Z6WAxz3t2mqdE1b4H6OgUEVa8p3l1phY+ZnyeSfw+jM7MLP+1Q zOHVtUjmDQxtpudUr1s4PF/mMmgnbXX1dsLENgnlIaqTsdsScJ5pq3noO0/DCQfGHLiQ T4MrtdedTvuJ8IwowBQ/MkUzH66UasTxEMZ1SXTLgrSE/1mZ81TMmt8yfMh2QAal/XqF vfsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j09chemj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m3-20020a056402430300b004a22ce03f86si6184879edc.134.2023.02.03.21.30.12; Fri, 03 Feb 2023 21:30:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j09chemj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233133AbjBDE3n (ORCPT <rfc822;il.mystafa@gmail.com> + 99 others); Fri, 3 Feb 2023 23:29:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232463AbjBDE3l (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Feb 2023 23:29:41 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A7824940C; Fri, 3 Feb 2023 20:29:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675484980; x=1707020980; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=H3qJvq+FzGAE9XTRUCeAHJMizsLeIwMpWifCW4lw7W4=; b=j09chemjD7BoNzpLU5CqjspeAKl+0MhjRYgLNy+QO3acSukR2QXFMmjf zrCip6CYktbJyztiCrL5XuFgHYlXRzj6mo1L/kdbvl/cRJYs8z5JjWNFa KTozxY+CinGYmUFOLsHdFNQvYpEDsdyanLNj/giQk8fI725oHuIlCqrwu 4pjhjKpQWuE1ky8FlHSsdG1m2mxfWlEGE1mBV4T73KYN9bB6tIScW/T/W sk9ItMrHRtlQC0Lybn2auzDR925F/+DJcZv4MH9WFAO8JFowQ595Lu095 efvVCzAPk7/7+N10N+i+mu/5Ikt+F8wYWIPjIiaViQ14auswY1+42HtGb A==; X-IronPort-AV: E=McAfee;i="6500,9779,10610"; a="391310591" X-IronPort-AV: E=Sophos;i="5.97,272,1669104000"; d="scan'208";a="391310591" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2023 20:29:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10610"; a="734577007" X-IronPort-AV: E=Sophos;i="5.97,272,1669104000"; d="scan'208";a="734577007" Received: from spandruv-desk.jf.intel.com ([10.54.75.8]) by fmsmga004.fm.intel.com with ESMTP; 03 Feb 2023 20:29:28 -0800 From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> To: rafael@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org, rui.zhang@intel.com, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Subject: [PATCH v2] thermal: intel_powerclamp: Return last requested state as cur_state Date: Fri, 3 Feb 2023 20:29:02 -0800 Message-Id: <20230204042902.2555347-1-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756877190492422703?= X-GMAIL-MSGID: =?utf-8?q?1756877190492422703?= |
Series |
[v2] thermal: intel_powerclamp: Return last requested state as cur_state
|
|
Commit Message
srinivas pandruvada
Feb. 4, 2023, 4:29 a.m. UTC
When the user is reading cur_state from the thermal cooling device for
Intel powerclamp device:
- It returns the idle ratio from Package C-state counters when
there is active idle injection session.
- -1, when there is no active idle injection session.
This information is not very useful as the package C-state counters vary
a lot from read to read. Instead just return the last requested cur_state.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
v2:
Fixed setting of *state
drivers/thermal/intel/intel_powerclamp.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
Comments
On Sat, Feb 4, 2023 at 5:29 AM Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> wrote: > > When the user is reading cur_state from the thermal cooling device for > Intel powerclamp device: > - It returns the idle ratio from Package C-state counters when > there is active idle injection session. > - -1, when there is no active idle injection session. > > This information is not very useful as the package C-state counters vary > a lot from read to read. Instead just return the last requested cur_state. > > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> > --- > v2: > Fixed setting of *state > > drivers/thermal/intel/intel_powerclamp.c | 12 +----------- > 1 file changed, 1 insertion(+), 11 deletions(-) > > diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c > index 5f54c88b1977..0282503ecaaf 100644 > --- a/drivers/thermal/intel/intel_powerclamp.c > +++ b/drivers/thermal/intel/intel_powerclamp.c > @@ -539,17 +539,7 @@ static int powerclamp_get_cur_state(struct thermal_cooling_device *cdev, > unsigned long *state) > { > mutex_lock(&powerclamp_lock); > - > - if (powerclamp_data.clamping) { > - if (poll_pkg_cstate_enable) > - *state = pkg_cstate_ratio_cur; > - else > - *state = powerclamp_data.target_ratio; > - } else { > - /* to save power, do not poll idle ratio while not clamping */ > - *state = -1; /* indicates invalid state */ > - } > - > + *state = powerclamp_data.target_ratio; > mutex_unlock(&powerclamp_lock); > > return 0; > -- Applied as 6.3 material, thanks!
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c index 5f54c88b1977..0282503ecaaf 100644 --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c @@ -539,17 +539,7 @@ static int powerclamp_get_cur_state(struct thermal_cooling_device *cdev, unsigned long *state) { mutex_lock(&powerclamp_lock); - - if (powerclamp_data.clamping) { - if (poll_pkg_cstate_enable) - *state = pkg_cstate_ratio_cur; - else - *state = powerclamp_data.target_ratio; - } else { - /* to save power, do not poll idle ratio while not clamping */ - *state = -1; /* indicates invalid state */ - } - + *state = powerclamp_data.target_ratio; mutex_unlock(&powerclamp_lock); return 0;