Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7439163rwi; Mon, 24 Oct 2022 14:49:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM485pfnVMxnxCIS5Ysv/YdypGawdrzMwpZqU9LFqq6EDNVvhNP+rOFCO6uCs0quJInTWwoV X-Received: by 2002:a17:90b:3b4d:b0:20d:7844:64ba with SMTP id ot13-20020a17090b3b4d00b0020d784464bamr39993917pjb.136.1666648195571; Mon, 24 Oct 2022 14:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648195; cv=none; d=google.com; s=arc-20160816; b=h5wXhx95TzG72ZUKLuHBvNKt9ornqYb9512372LtcRts4+h1wWonVzmYkdCRXUidjl X95EqHFhbv18A1coKQUNgOeEyqp+ZYnQM/vfeevBVTyuYmUsfkZcI/QghnfN+8iesAvp OHFtzBSBdSpxgEt1Win4tyuX7/ysvdfM87HmF8aHSSt7QoZ5r9NhyuNHq35XGqX1YSre 9GSOwPPH7XhT5689Za+NzwP0AxwJsG2c1tKbtVuYWVY2TlzNHHFH+vUHa/h9yQcYCn5X P/dKNysSurO7ziFyBkEIR279XY3abZUU/EN4QgJT6F+iT5RjJ3ymp6piGPfK+wOt4Hwi MqFQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vs6CA6HZUEE4hdopd+3UrlFv4oKFlsugaK5trybsL7Q=; b=NK3cA1EUFrTyyRQi5AOpeKRg8WnAxG9wMyX7qQy92EXM0/MRjerCsfnhwH29qoh3Kk JI3M9Z6IcSp59dgrEa+A15QSpySM4UXdu9WP1J0iPBamoDTryoK7EdMUkgqThBszcrTK fVzsFO12htw2beM2PAN7+fuLFxb99uuO7aAXlS9h2HiyefzF9SSpW/Vx11ScYcbbPvuR aGRB6bp6W+MhnCe4TC9Jp+b8WkS1bLlVuGEaaibJ09oBi6H/es47/EEdXjmn/xr3XU+X 14DK7pawz6SZVRi2KwmvV5whPqR8cHHSB66ZS5dtVoRYrZjPfXMPh1wFU+NmtFa1Dc5O GGqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=esIBHyrf; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 6-20020a631946000000b00462566bfda3si587068pgz.643.2022.10.24.14.49.42; Mon, 24 Oct 2022 14:49:55 -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=@linuxfoundation.org header.s=korg header.b=esIBHyrf; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234216AbiJXUV0 (ORCPT + 99 others); Mon, 24 Oct 2022 16:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234193AbiJXUUx (ORCPT ); Mon, 24 Oct 2022 16:20:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 890C5127BC9; Mon, 24 Oct 2022 11:37:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 51ABDB81714; Mon, 24 Oct 2022 12:33:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8BCFC433D6; Mon, 24 Oct 2022 12:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614791; bh=AW2HmN9TqaQ00WLNTP/efmBXWbdmYViKnrGlcIbwwjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=esIBHyrfZld3/bmDjWGOPPjJel04SBoJ1mA5ByF31/LTD1AyYe/6AMrC2MQkCpBUT MPErjeOjNr8qxF2wBLFTBGirFcHqqD3dXsNcbc9J9BnASou68aB9arPrsQfxQHD0vm 7ZFW7HhL/6wN3gDne55bSGecWp+AzAEzTp35W2Ec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Chen Yu Subject: [PATCH 5.10 388/390] thermal: intel_powerclamp: Use first online CPU as control_cpu Date: Mon, 24 Oct 2022 13:33:05 +0200 Message-Id: <20221024113039.490974083@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki commit 4bb7f6c2781e46fc5bd00475a66df2ea30ef330d upstream. Commit 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") fixed an issue related to using smp_processor_id() in preemptible context by replacing it with a pair of get_cpu()/put_cpu(), but what is needed there really is any online CPU and not necessarily the one currently running the code. Arguably, getting the one that's running the code in there is confusing. For this reason, simply give the control CPU role to the first online one which automatically will be CPU0 if it is online, so one check can be dropped from the code for an added benefit. Link: https://lore.kernel.org/linux-pm/20221011113646.GA12080@duo.ucw.cz/ Fixes: 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") Signed-off-by: Rafael J. Wysocki Reviewed-by: Chen Yu Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/intel/intel_powerclamp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c @@ -531,11 +531,7 @@ static int start_power_clamp(void) get_online_cpus(); /* prefer BSP */ - control_cpu = 0; - if (!cpu_online(control_cpu)) { - control_cpu = get_cpu(); - put_cpu(); - } + control_cpu = cpumask_first(cpu_online_mask); clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0);