Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2479116rwl; Thu, 30 Mar 2023 10:52:04 -0700 (PDT) X-Google-Smtp-Source: AKy350YgcJ2J91aY5dS9Wrtv5YGD4bpXN6ski6Q06J+KP4MiftC9Ne7ZxBHpa/W3wbw+/JnEkfmQ X-Received: by 2002:a05:6402:524e:b0:4fd:298d:4f26 with SMTP id t14-20020a056402524e00b004fd298d4f26mr2983547edd.3.1680198724283; Thu, 30 Mar 2023 10:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680198724; cv=none; d=google.com; s=arc-20160816; b=uxaqbpL5sQ8j3rvwnhGxGnKPWQCz2WyqpZ1RZeXB7eDY1rXRYYHdFAwWMHr7Lzgyqg amG2A7c2wf0G5qaV3837ZeKp/XuMpTFBbh+3lA1frCjOeY3XefaLPLbbtC5yUwaA8Vj0 EWJcury/KlDfynBB0kHsN0yf1lxqHfqezruEFuH2+TkSNX554p7yzEte3DRjln+fXfNM Jhc9Ir0HZjkmIcjl6pooi8VxAzZDv9fXWzB0bbL2Lfww6hKog15xbE7VUxZBXfDljVj9 gqL7CEDwcZfcofyUJrHkLtwlgILHL3N7V1f1t7zf2MAOpXpY4yxrLGx9VprzF85y6rhR UXKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=RBvzdW7pSSpZoGr/lhLmsN5VnHXIMJICoUqPvQK2N5Q=; b=C+w63zoQ7Kf37Gdl0nQmdvhlWFRiSwvuEfiF+aYuLRyDp1/lojR0EmjETqOETtGQpK 3hly8ZyS0SVu+5Cnnw0ttt/iYibVapw0cCPBdsECSmglTdW3kExCOwRQR6YpLikMGlM+ c4gNIyF7L97YF0QQpXud9T/Ri16LT/3rXaeXXOkthQBJkkuPMNrKPXC/2agtHh/b/FAM mbVzU+gVO/QwBoNcqgYT4NWGhPu/864W87n7WCd2frqnbQ1ccgIMLC33gHWmiDa32wsx LzPtLnpM3wD3c1hq6j/dvpwxuQpzrEVjJMuN4BqZpwNRj7rfmTSYvynZ51U4suutSEkP 2I0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DLeQPrAS; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a056402054500b005022100f550si254687edx.686.2023.03.30.10.51.38; Thu, 30 Mar 2023 10:52:04 -0700 (PDT) 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=DLeQPrAS; 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 S232564AbjC3Rgk (ORCPT + 99 others); Thu, 30 Mar 2023 13:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232554AbjC3Rgi (ORCPT ); Thu, 30 Mar 2023 13:36:38 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9B2B6A47; Thu, 30 Mar 2023 10:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680197797; x=1711733797; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=RBvzdW7pSSpZoGr/lhLmsN5VnHXIMJICoUqPvQK2N5Q=; b=DLeQPrASHVmaxAqKK9uD5xx4gmQBbCVnK3MqduChJqHDNvUszkwXDaf2 snwReF1wD1JaLXm93RZHAhUA40ZOEapl+BOi6wf9PHVOihi+hj2RS34Yd RVGDfId3WNFMPN/kwPi0TJKMe84picJN8RpxZmPG9M9KS8+ULd/SVVeMP 3s7L2irvS42FYA9brDYXkcF/3XeK4HKQWceF9K+yT2bTbZdMePk9WKD74 0bNomyailRjP4J+ZLxZiKWnfsLTKo2E8mfxvMhrA31k87qyLXWFwxvGkC dlEEkMjHTZaUrfcZ2dOSYzeHOkMlRHUJiYFjNn/YXzVUF57xGQSwJwXS0 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="342883002" X-IronPort-AV: E=Sophos;i="5.98,305,1673942400"; d="scan'208";a="342883002" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 10:36:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="678277381" X-IronPort-AV: E=Sophos;i="5.98,305,1673942400"; d="scan'208";a="678277381" Received: from pabbey-mobl.amr.corp.intel.com ([10.212.62.67]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 10:36:35 -0700 Message-ID: <9e65a37b8220943a540cc3aaf660a79cef4041dc.camel@linux.intel.com> Subject: Re: [PATCH] thermal: intel: powerclamp: Fix cpumask and max_idle module parameters From: srinivas pandruvada To: David Arcari , linux-pm@vger.kernel.org Cc: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Chen Yu , linux-kernel@vger.kernel.org, stable@vger.kernel.org Date: Thu, 30 Mar 2023 10:36:33 -0700 In-Reply-To: <20230330134218.1897786-1-darcari@redhat.com> References: <20230330134218.1897786-1-darcari@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2023-03-30 at 09:42 -0400, David Arcari wrote: Reviewed-by: Srinivas Pandruvada <>> When cpumask is specified as a module = parameter the value is > overwritten by the module init routine.=C2=A0 This can easily be fixed > by checking to see if the mask has already been allocated in the > init routine. >=20 > When max_idle is specified as a module parameter a panic will occur. > The problem is that the idle_injection_cpu_mask is not allocated > until > the module init routine executes. This can easily be fixed by > allocating > the cpumask if it's not already allocated. >=20 > Fixes: ebf519710218 ("thermal: intel: powerclamp: Add two module > parameters") >=20 > Signed-off-by: David Arcari Reviewed-by: Srinivas Pandruvada >=20 > Cc: "Rafael J. Wysocki" > Cc: Daniel Lezcano > Cc: Amit Kucheria > Cc: Zhang Rui > Cc: Srinivas Pandruvada > Cc: David Arcari > Cc: Chen Yu > Cc: linux-kernel@vger.kernel.org > Cc: stable@vger.kernel.org >=20 > --- > =C2=A0drivers/thermal/intel/intel_powerclamp.c | 9 ++++++++- > =C2=A01 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/thermal/intel/intel_powerclamp.c > b/drivers/thermal/intel/intel_powerclamp.c > index c7ba5680cd48..91fc7e239497 100644 > --- a/drivers/thermal/intel/intel_powerclamp.c > +++ b/drivers/thermal/intel/intel_powerclamp.c > @@ -235,6 +235,12 @@ static int max_idle_set(const char *arg, const > struct kernel_param *kp) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0goto skip_limit_set; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > =C2=A0 > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!cpumask_available(idle_in= jection_cpu_mask)) { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0ret =3D > allocate_copy_idle_injection_mask(cpu_present_mask); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0if (ret) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0goto skip= _limit_set; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > + > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (check_invalid(idle_in= jection_cpu_mask, new_max_idle)) { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0ret =3D -EINVAL; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0goto skip_limit_set; > @@ -791,7 +797,8 @@ static int __init powerclamp_init(void) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0return retval; > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mutex_lock(&powerclamp_lo= ck); > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0retval =3D allocate_copy_idle_= injection_mask(cpu_present_mask); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!cpumask_available(idle_in= jection_cpu_mask)) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0retval =3D > allocate_copy_idle_injection_mask(cpu_present_mask); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mutex_unlock(&powerclamp_= lock); > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (retval)