Re: [PATCH 3/5] thermal: x86_pkg_temp: Handle the FROZEN hot plug notifier actions.

From: Pandruvada, Srinivas
Date: Fri May 13 2016 - 20:59:25 EST


On Fri, 2016-03-18 at 22:26 +0100, Richard Cochran wrote:
> When performing a suspend operation, the kernel brings all of the
> non-boot CPUs offline, calling the hot plug notifiers with the flag,
> CPU_TASKS_FROZEN, set in the action code.ÂÂSimilarly, during resume,
> the CPUs are brought back online, but again the notifiers have the
> FROZEN flag set.
>
> While some very few drivers really need to treat suspend/resume
> specially, this driver unintentionally ignores the notifications.
>
> This patch changes the driver to cancel its work item when the CPU
> goes down, even during a suspend operation.ÂÂAs a result, the
> suspended state is no longer a special case.
>
> Cc: Zhang Rui <rui.zhang@xxxxxxxxx>
> Cc: Eduardo Valentin <edubezval@xxxxxxxxx>
> Cc: linux-pm@xxxxxxxxxxxxxxx
> Signed-off-by: Richard Cochran <rcochran@xxxxxxxxxxxxx>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>

> ---
> Âdrivers/thermal/x86_pkg_temp_thermal.c | 2 +-
> Â1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/x86_pkg_temp_thermal.c
> b/drivers/thermal/x86_pkg_temp_thermal.c
> index 7fc919f..97f0a2b 100644
> --- a/drivers/thermal/x86_pkg_temp_thermal.c
> +++ b/drivers/thermal/x86_pkg_temp_thermal.c
> @@ -555,7 +555,7 @@ static int pkg_temp_thermal_cpu_callback(struct
> notifier_block *nfb,
> Â{
> Â unsigned int cpu = (unsigned long) hcpu;
> Â
> - switch (action) {
> + switch (action & ~CPU_TASKS_FROZEN) {
> Â case CPU_ONLINE:
> Â case CPU_DOWN_FAILED:
> Â get_core_online(cpu);