[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221025082040.GA9520@duo.ucw.cz>
Date: Tue, 25 Oct 2022 10:20:40 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Chen Yu <yu.c.chen@...el.com>
Subject: Re: [PATCH 4.9 158/159] thermal: intel_powerclamp: Use first online
CPU as control_cpu
Hi!
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> 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.
While this is nice cleanup (and I complained about original code being
interesting) original code still looks okay and we don't really need this in
stable.
Thanks and best regards,
Pavel
> +++ b/drivers/thermal/intel_powerclamp.c
> @@ -518,11 +518,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);
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists