2002-07-14 22:10:15

by Pozsar Balazs

[permalink] [raw]
Subject: apm power_off on smp


Hi all!

APM's poweroff function is explicitly turned off on smp systems by
default. Could someone tell me please what is the reason for that?

In other words: what are the objections against the below patch? :)

diff -Naur a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
--- a/arch/i386/kernel/apm.c Mon Feb 25 19:37:53 2002
+++ b/arch/i386/kernel/apm.c Sun Jul 14 23:05:14 2002
@@ -393,11 +393,7 @@
#endif
static int debug;
static int apm_disabled = -1;
-#ifdef CONFIG_SMP
-static int power_off;
-#else
static int power_off = 1;
-#endif
#ifdef CONFIG_APM_REAL_MODE_POWER_OFF
static int realmode_power_off = 1;
#else

--
pozsy


2002-07-14 22:27:09

by Kelledin

[permalink] [raw]
Subject: Re: apm power_off on smp

> APM's poweroff function is explicitly turned off on smp systems by
> default. Could someone tell me please what is the reason for that?

(as of kernel 2.4.18) pretty much *all* APM functions are disabled on SMP
kernels--the simple reason being that APM isn't SMP safe, and making it SMP
safe is not a trivial task.

If all you want is a soft power-off, you're better off using ACPI (assuming
your system supports it). Since this is probably a desktop (and not a
laptop), I doubt there's much else you want in the way of power management...

--
Kelledin
"If a server crashes in a server farm and no one pings it, does it still cost
four figures to fix?"

2002-07-14 22:52:59

by Xavier Bestel

[permalink] [raw]
Subject: Re: apm power_off on smp

Le lun 15/07/2002 ? 00:30, Kelledin a ?crit :
> > APM's poweroff function is explicitly turned off on smp systems by
> > default. Could someone tell me please what is the reason for that?
>
> (as of kernel 2.4.18) pretty much *all* APM functions are disabled on SMP
> kernels--the simple reason being that APM isn't SMP safe, and making it SMP
> safe is not a trivial task.
>
> If all you want is a soft power-off, you're better off using ACPI (assuming
> your system supports it). Since this is probably a desktop (and not a
> laptop), I doubt there's much else you want in the way of power management...

ACPI is still very broken for some chipsets (VIA 686b), while apm works
well for this task (powering off a machine doesn't need much SMP
protection).

2002-07-14 23:01:21

by Pozsar Balazs

[permalink] [raw]
Subject: Re: apm power_off on smp


Yes, all I want is poweroff.
I understand that apm is not smp safe, and pretty much all of it is
disabled in smp mode.

What i do not understand is why the poweroff functionality is disabled by
default.


On 15 Jul 2002, Xavier Bestel wrote:

> Le lun 15/07/2002 ? 00:30, Kelledin a ?crit :
> > > APM's poweroff function is explicitly turned off on smp systems by
> > > default. Could someone tell me please what is the reason for that?
> >
> > (as of kernel 2.4.18) pretty much *all* APM functions are disabled on SMP
> > kernels--the simple reason being that APM isn't SMP safe, and making it SMP
> > safe is not a trivial task.
> >
> > If all you want is a soft power-off, you're better off using ACPI (assuming
> > your system supports it). Since this is probably a desktop (and not a
> > laptop), I doubt there's much else you want in the way of power management...
>
> ACPI is still very broken for some chipsets (VIA 686b), while apm works
> well for this task (powering off a machine doesn't need much SMP
> protection).
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

--
pozsy

2002-07-14 23:26:47

by Alan

[permalink] [raw]
Subject: Re: apm power_off on smp

On Mon, 2002-07-15 at 00:03, Pozsar Balazs wrote:
>
> Yes, all I want is poweroff.
> I understand that apm is not smp safe, and pretty much all of it is
> disabled in smp mode.
>
> What i do not understand is why the poweroff functionality is disabled by
> default.

Because it too is unsafe on some machines

2002-07-14 23:31:51

by Xavier Bestel

[permalink] [raw]
Subject: Re: apm power_off on smp

Le lun 15/07/2002 ? 02:39, Alan Cox a ?crit :
> On Mon, 2002-07-15 at 00:03, Pozsar Balazs wrote:
> >
> > Yes, all I want is poweroff.
> > I understand that apm is not smp safe, and pretty much all of it is
> > disabled in smp mode.
> >
> > What i do not understand is why the poweroff functionality is disabled by
> > default.
>
> Because it too is unsafe on some machines

Would it be possible to use the CPU-hotplug patch to unplug all CPUs
except the one entering apm power-off ?

2002-07-14 23:45:06

by Alan

[permalink] [raw]
Subject: Re: apm power_off on smp

On Mon, 2002-07-15 at 00:34, Xavier Bestel wrote:
> > > What i do not understand is why the poweroff functionality is disabled by
> > > default.
> >
> > Because it too is unsafe on some machines
>
> Would it be possible to use the CPU-hotplug patch to unplug all CPUs
> except the one entering apm power-off ?

Only if your hardware supports true CPU unplugging and your BIOS
supports APM for it. That is wildly improbable at best

2002-07-15 00:02:53

by Xavier Bestel

[permalink] [raw]
Subject: Re: apm power_off on smp

Le lun 15/07/2002 ? 02:57, Alan Cox a ?crit :
> > Would it be possible to use the CPU-hotplug patch to unplug all CPUs
> > except the one entering apm power-off ?
>
> Only if your hardware supports true CPU unplugging and your BIOS
> supports APM for it. That is wildly improbable at best

Err .. my mobo's BIOS is SMP specific and implements APM, so I guess
there is a case where it's useful. It must be something like when
running Win95, which is UP only. Isn't Linux able to return to a UP-like
state (? la Win95) just before entering poweroff ?

Or perhaps my first assumption is false: the APM implementation in my
BIOS just wastes some flash and never intended to be utilized.

2002-07-15 00:10:52

by Alan

[permalink] [raw]
Subject: Re: apm power_off on smp

On Mon, 2002-07-15 at 01:05, Xavier Bestel wrote:
> Err .. my mobo's BIOS is SMP specific and implements APM, so I guess
> there is a case where it's useful. It must be something like when

Don't bet on that. I've seen quad Xeon servers with single CPU only APM

> running Win95, which is UP only. Isn't Linux able to return to a UP-like
> state (? la Win95) just before entering poweroff ?

We can flush the caches and pray, but what the BIOS does is an
interesting question. On the theory thats its your data you have to
select the chances you wish to take. (Indeed on -ac you can enable APM
on SMP in full)