Received: by 2002:a05:6359:2142:b0:e9:5335:9d2d with SMTP id lq2csp24032rwb; Thu, 30 Mar 2023 11:07:53 -0700 (PDT) X-Google-Smtp-Source: AKy350bnbPr5zyyuuxSiCB11i6a0U8Ibud97+ONsu7b4iqU6lZ8e9FAELYtuWA+E8k3oXgL/OBW1 X-Received: by 2002:a17:906:297:b0:93e:22e6:e7d3 with SMTP id 23-20020a170906029700b0093e22e6e7d3mr2367492ejf.0.1680199673398; Thu, 30 Mar 2023 11:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680199673; cv=none; d=google.com; s=arc-20160816; b=m8//ziZDmcjkqnMWqhJerFWLt5IvAQ5yt8Enz/VglVLQ+TBbkGqu/BH8uF01R3bX/O CJqc94B8NgPic9LiFalpmSgXRohv7xBnroB6RQN/VYo2ZX6T7bZiADu7wNNW3Kl4waCx 5StHW2GB+Wm5utSTCJvYM1dKTUXKkfK36FymlGK9Yei6SkVIMlKQDGt+HAgr68Kr3eD1 5bgQwPCjyY4lSPsB5wTaTOGoO1t/nM+Cofq/tp+dhrsxZP0WcjJdLHxD98cQF83X3u8f YIlGNN7ONYKj94SSg1OIgopoP9AzXWUk81/nNnm35RuqS2eWb70CuwvZ937FV7YNiycG kfZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=FWRfklK8gDryIO5ZIHacECwA1lqc19r96ZYP1560lkU=; b=BdCpX0ixOu2xpG+FjRLFVe2yTHH1ZQMSHsG54xNnpHpZZVugsOqArXfz1h/ovqe4aa 6SZXl+mlrudx0UOJCg+1/Y9TbTA0thI75fLFgcjxQJ12Eox9siE4iCNF7iAzUkStBJkk Mux+mpm1zjqJvdLKDOJY324acbMD9z5u4ZmU2Z5AaUTZn9pHaRAdLVKyTSxWvs0magyS lnSaapEUHXO4OYAB1xn6wg7LkMqciVKViOjLH7n+ldZzobjJrYyKulOJ0xw0yOtkTWj3 3uXJCBLM8/j6TfLGu7/mG+CSeXFUYn9kYfjh+6ILfqYqJrLT0tNuImHnrFr7MQ9hCXmp 9GEQ== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a170906249400b0093308b4f91fsi136662ejb.269.2023.03.30.11.07.27; Thu, 30 Mar 2023 11:07:53 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231533AbjC3SGd convert rfc822-to-8bit (ORCPT + 99 others); Thu, 30 Mar 2023 14:06:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229584AbjC3SGb (ORCPT ); Thu, 30 Mar 2023 14:06:31 -0400 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6E70EB45; Thu, 30 Mar 2023 11:06:30 -0700 (PDT) Received: by mail-ed1-f46.google.com with SMTP id i5so80063690eda.0; Thu, 30 Mar 2023 11:06:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680199589; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7F4u3rCMjafVAuTWZMNvDvBPl2JPGH003KSSvYrUvUA=; b=UaTfOSDXrA/5lIzXML9ibTHnR1S3VdmshOz/0WXAKL4YB2qU1DdorBoYUqLCPukXss ADFIsW4EAfVmOTVGG0KGJBAwV09SaKN3A42RkbD1yIWK3aMgH1q41VLZcL/Fzl4CYuVU LV0XDLnBMChve5S3Ow+PlXUW4Sv64WVbnp4sdCY2z+6tkQYbw2S1WItEY0EkkHc7Fpet 1L09ca1vyhyWTa6jTVCruzLCCcHXKdYZtZmRRyFXfmN0+weu3YwhIXLwII5NmuF4ji6Y eW6yyJo0t1sssP0W53Abbu5z1lai5yaQwoNzyb+SjL5oI5zEV5k5kz5uYERxVjGUguLz IWUg== X-Gm-Message-State: AAQBX9ftCoNmyTGeoudufNkh3xs0mVxND8CH/LWeZ6NprClBWXgfoP6Q t8EfCxh5ue2Oer/fdYyGF40zcJT8j6VTlB7n0yk= X-Received: by 2002:a17:906:9f0b:b0:8b1:38d6:9853 with SMTP id fy11-20020a1709069f0b00b008b138d69853mr10988057ejc.2.1680199589088; Thu, 30 Mar 2023 11:06:29 -0700 (PDT) MIME-Version: 1.0 References: <20230330134218.1897786-1-darcari@redhat.com> <9e65a37b8220943a540cc3aaf660a79cef4041dc.camel@linux.intel.com> In-Reply-To: <9e65a37b8220943a540cc3aaf660a79cef4041dc.camel@linux.intel.com> From: "Rafael J. Wysocki" Date: Thu, 30 Mar 2023 20:06:18 +0200 Message-ID: Subject: Re: [PATCH] thermal: intel: powerclamp: Fix cpumask and max_idle module parameters To: srinivas pandruvada , David Arcari Cc: linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Chen Yu , linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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, Mar 30, 2023 at 7:36 PM srinivas pandruvada wrote: > > 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. This can easily be fixed > > by checking to see if the mask has already been allocated in the > > init routine. > > > > 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. > > > > Fixes: ebf519710218 ("thermal: intel: powerclamp: Add two module > > parameters") > > > > Signed-off-by: David Arcari > Reviewed-by: Srinivas Pandruvada Applied as 6.3-rc material, thanks! > > 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 > > > > --- > > drivers/thermal/intel/intel_powerclamp.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > 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) > > goto skip_limit_set; > > } > > > > + if (!cpumask_available(idle_injection_cpu_mask)) { > > + ret = > > allocate_copy_idle_injection_mask(cpu_present_mask); > > + if (ret) > > + goto skip_limit_set; > > + } > > + > > if (check_invalid(idle_injection_cpu_mask, new_max_idle)) { > > ret = -EINVAL; > > goto skip_limit_set; > > @@ -791,7 +797,8 @@ static int __init powerclamp_init(void) > > return retval; > > > > mutex_lock(&powerclamp_lock); > > - retval = allocate_copy_idle_injection_mask(cpu_present_mask); > > + if (!cpumask_available(idle_injection_cpu_mask)) > > + retval = > > allocate_copy_idle_injection_mask(cpu_present_mask); > > mutex_unlock(&powerclamp_lock); > > > > if (retval) >