Re: [lm-sensors] [PATCH 1/1] HWMON: coretemp, suspend fix
From: Rafael J. Wysocki
Date: Fri Nov 30 2007 - 18:28:00 EST
On Friday, 30 of November 2007, Jiri Slaby wrote:
> On 11/30/2007 11:15 PM, Jean Delvare wrote:
> > Hi Jiri,
>
> Hi.
>
> > On Fri, 30 Nov 2007 15:12:46 +0100, Jiri Slaby wrote:
> >> Ok, I don't see it merged in the latest -mm (mmotm). Could you, Mark, Rafael,
> >> sign off this version of the patch (Mark's + Rafael's fix)?
> >>
> >> --
> >>
> >> From: Mark M. Hoffman <mhoffman@xxxxxxxxxxxxx>
> >>
> >> coretemp, suspend fix
> >>
> >> It's not permitted to unregister device/cpu if frozen and going to sleep.
> >> It causes deadlock on systems, where coretemp hwmon is loaded. Do it only
> >> in non-freezed states instead.
> >>
> >> Cc: Rafael J. Wysocki <rjw@xxxxxxx> (frozen fix)
> >> Cc: Mark M. Hoffman <mhoffman@xxxxxxxxxxxxx>
> >> Signed-off-by: Jiri Slaby <jirislaby@xxxxxxxxx>
> >>
> >> ---
> >> commit 4f0e19b172ed18fb29e8006c4470fd37aa245a7a
> >> tree bec1cc4f7a499efe94c5f9d2d208db325914f28e
> >> parent 877dcc2ef6c7c17a64155cf201886c49622250e9
> >> author Jiri Slaby <jirislaby@xxxxxxxxx> Tue, 27 Nov 2007 20:19:47 +0100
> >> committer Jiri Slaby <ku@xxxxxxxxxxxxxxxxxxx> Thu, 29 Nov 2007 23:41:11 +0100
> >>
> >> drivers/hwmon/coretemp.c | 6 ++++--
> >> 1 files changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> >> index 5c82ec7..ce7457d 100644
> >> --- a/drivers/hwmon/coretemp.c
> >> +++ b/drivers/hwmon/coretemp.c
> >> @@ -338,11 +338,13 @@ static int coretemp_cpu_callback(struct notifier_block *nfb,
> >> switch (action) {
> >> case CPU_ONLINE:
> >> case CPU_ONLINE_FROZEN:
> >> + case CPU_DOWN_FAILED:
> >> coretemp_device_add(cpu);
> >> + case CPU_DOWN_FAILED_FROZEN:
> >> break;
> >> - case CPU_DEAD:
> >> - case CPU_DEAD_FROZEN:
> >> + case CPU_DOWN_PREPARE:
> >> coretemp_device_remove(cpu);
> >> + case CPU_DOWN_PREPARE_FROZEN:
> >> break;
> >> }
> >> return NOTIFY_OK;
> >
> > Should this change go to the stable tree(s) as well?
>
> Sorry, I have no idea. Rafael?
Well, actually, having looked once again at the patch, I think that it's
slightly wrong. Namely, it looks like we just should drop all of the _FROZEN
actions from there.
Fixed patch follows and I think it's also a candidate for -stable.
---
Subject: HWMON: coretemp, suspend fix
It's not permitted to unregister a device after devices have been suspended.
It causes deadlocks to appear on systems with coretemp hwmon loaded. To avoid
this, we can make coretemp_cpu_callback() do nothing if the _FROZEN bit is set
in action.
Also, in other cases it's generally to late to unregister the coretemp device
if the CPU is already dead, so it should be unregistered on CPU_DOWN_PREPARE.
Cc: Rafael J. Wysocki <rjw@xxxxxxx> (frozen fix)
Cc: Mark M. Hoffman <mhoffman@xxxxxxxxxxxxx>
Signed-off-by: Jiri Slaby <jirislaby@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---
drivers/hwmon/coretemp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Index: linux-2.6/drivers/hwmon/coretemp.c
===================================================================
--- linux-2.6.orig/drivers/hwmon/coretemp.c
+++ linux-2.6/drivers/hwmon/coretemp.c
@@ -337,11 +337,10 @@ static int coretemp_cpu_callback(struct
switch (action) {
case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
+ case CPU_DOWN_FAILED:
coretemp_device_add(cpu);
break;
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
+ case CPU_DOWN_PREPARE:
coretemp_device_remove(cpu);
break;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/