Re: ACPI sleep: check error values and disable it on SMP

Pavel Machek
2003-06-10T19:14:38Z

Hi!

> > > > +#ifdef CONFIG_SMP
> > > > + /* Suspend is hard to get right on SMP. */
> > > > + return AE_ERROR;
> > > > +#endif
>
> This part shouldn't be an #ifdef it should be a runtime check of
> num_online_cpus().

Okay, that makes sense.

Here's updated patch, please apply.
Pavel

--- /usr/src/tmp/linux/drivers/acpi/sleep/main.c 2003-06-10 21:10:18.000000000 +0200
+++ /usr/src/linux/drivers/acpi/sleep/main.c 2003-06-10 21:08:32.000000000 +0200
@@ -220,6 +220,10 @@
{
acpi_status status;

+ /* Suspend is hard to get right on SMP. */
+ if (num_online_cpus() != 1)
+ return AE_ERROR;
+
/* get out if state is invalid */
if (state < ACPI_STATE_S1 || state > ACPI_STATE_S5)
return AE_ERROR;
@@ -232,7 +236,10 @@
* TBD: S1 can be done without device_suspend. Make a CONFIG_XX
* to handle however when S1 failed without device_suspend.
*/
- freeze_processes(); /* device_suspend needs processes to be stopped */
+ if (freeze_processes()) {
+ thaw_processes();
+ return AE_ERROR; /* device_suspend needs processes to be stopped */
+ }

/* do we have a wakeup address for S2 and S3? */
/* Here, we support only S4BIOS, those we set the wakeup address */