Bug 221667 - smp/default kernel does not power off apm machines by default
Summary: smp/default kernel does not power off apm machines by default
Status: RESOLVED FIXED
: 136742 220716 223623 227384 231216 233373 (view as bug list)
Alias: None
Product: openSUSE 10.2
Classification: openSUSE
Component: YaST2 (show other bugs)
Version: Beta 2 plus
Hardware: Other Other
: P5 - None : Normal with 2 votes (vote)
Target Milestone: ---
Assignee: Olaf Dabrunz
QA Contact: Jiri Srain
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-16 12:24 UTC by Ludwig Nussel
Modified: 2007-10-07 05:49 UTC (History)
10 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ludwig Nussel 2006-11-16 12:24:37 UTC
arch/i386/kernel/apm.c:
395-#ifdef CONFIG_SMP
396:static int                  power_off;
397-#else
398:static int                  power_off = 1;
399-#endif

So after upgrading to 10.2 some machines don't power off anymore. Is there any reason to keep the above differentiation? The connection between not powering off anymore and the new default of having an SMP kernel on UP machines is really not obvious.
Comment 1 Greg Kroah-Hartman 2006-11-29 23:49:46 UTC
*** Bug 220716 has been marked as a duplicate of this bug. ***
Comment 3 Pavel Machek 2006-11-30 00:19:58 UTC
Well... yes, this means power_off is disabled by default on CONFIG_SMP builds... that is because apm is often broken w.r.t. SMP. I guess it did not bite us before, because we used to avoid CONFIG_SMP kernels on UP machines.

What about sticking

power_off = (num_online_cpus() == 1); at begining of apm_setup()?

Or maybe teaching installer to add "power_off" on UP machines running without ACPI? Ludwig, can you confirm that power_off on command line fixes your problem?

...actually, given mess apm.c is, I'd prefer to fix it by command line options. It looks power_off parameter can enable/disable APM....
Comment 4 Greg Kroah-Hartman 2006-11-30 00:51:26 UTC
*** Bug 223623 has been marked as a duplicate of this bug. ***
Comment 5 Ludwig Nussel 2006-11-30 08:05:09 UTC
yes the command line parameter fixes the problem
Comment 6 Pavel Machek 2006-11-30 09:05:40 UTC
I'd really prefer installer people to add "power_off" to the command line on UP machines... Who should I ask to do that?
Comment 7 Pavel Machek 2006-12-01 10:06:17 UTC
Can you add power_off command line parameter to UP all uniprocessor kernels?
Comment 8 Ladislav Slezák 2006-12-04 15:33:30 UTC
reassigned to yast2-bootloader maintainer
Comment 9 Patrick Smith 2006-12-16 23:08:04 UTC
(In reply to comment #0)
> arch/i386/kernel/apm.c:
> 395-#ifdef CONFIG_SMP
> 396:static int                  power_off;
> 397-#else
> 398:static int                  power_off = 1;
> 399-#endif
> 
> So after upgrading to 10.2 some machines don't power off anymore. Is there any
> reason to keep the above differentiation? The connection between not powering
> off anymore and the new default of having an SMP kernel on UP machines is
> really not obvious.
> 

==========
This bug doesn't seem to be only with smp kernels, as I am using the default kernel with the same problem.  Changing the BIOS setting of the motherboard (ACPI Aware OS) to "yes" causes a proper power off.  First SuSE version ever that required a bios adjustment.
Comment 10 Pavel Machek 2006-12-19 20:12:35 UTC
Olaf, are you there? I'm getting duplicates of this one, already :-(.
Comment 11 Forgotten User Drfk9mafMw 2006-12-27 15:26:53 UTC
Hello, what is the status on this? I am experiencing the same annoying problem on a UP desktop computer. 

Would be nice to know what can be done -- I am fine with a command line option.
Comment 12 Olaf Hering 2007-01-03 13:54:51 UTC
booting with apm=power_off fixes it for me, on smirnow.suse.de.
Comment 13 Matej Horvath 2007-01-10 10:16:13 UTC
*** Bug 231216 has been marked as a duplicate of this bug. ***
Comment 14 Pavel Machek 2007-01-11 11:05:55 UTC
Yep, booting with apm=power_off fixes it, and it is the right fix => we need YaST or whatever component is responsible to add that parameter. I do not think that is hard to do, and I do not think it should take a month. Please someone take 5 minutes and add the parameter...

(Raising severity to get on radar; we are getting too many duplicates of this one).
Comment 15 Greg Kroah-Hartman 2007-01-12 04:27:55 UTC
*** Bug 227384 has been marked as a duplicate of this bug. ***
Comment 16 Greg Kroah-Hartman 2007-01-12 04:28:03 UTC
*** Bug 233373 has been marked as a duplicate of this bug. ***
Comment 17 macias - 2007-01-12 08:08:41 UTC
apm=power_off does not work for me:
ASUS P3B-F (ACPI BIOS rev. 1006) it is the ATX motherboard.

With acpi=force the power off button is dead (no reaction), without it the computer is turned off. So the apm=... does not make any difference.

The problem is introduced with 10.x series, with 9.x suse it worked ok.
Comment 18 Olaf Dabrunz 2007-01-12 18:46:27 UTC
I understand that you want to set a kernel parameter ("apm=power_off").

It also seems that you only want to set this on uniprocessor machines.

yast2-bootloader does not determine whether we are running on a UP or SMP
machine. So it cannot decide whether this parameter needs to be set.

The logic that decides when to set this parameter does not belong in
yast2-bootloader. It needs to be maintained in a module that "knows" how to
handle these parameters. Someone needs to take charge of this.

That module can use the yast2-bootloader interface to get & set these
parameters:

    Bootloader::getKernelParam (Bootloader::defaultSection(), "elevator");
    Bootloader::setKernelParam (Bootloader::defaultSection(), "elevator", "cfg");

It can be used from other YaST2 modules.

Please have a look at feature #110070 "Elevator Setting" for a related
problem and discussion.
Comment 19 macias - 2007-01-12 18:53:21 UTC
> I understand that you want to set a kernel parameter ("apm=power_off").

Me? No. I want to be able to use power off button (hardware) to shutdown the system. So I entered apm=power_off as a booting option (in grub) to check if this helps.

> Please have a look at feature #110070 "Elevator Setting"

I don't know where I should look -- I tried report with such number, but I cannot access it.
Comment 20 Pavel Machek 2007-01-12 23:28:36 UTC
Maciej: That's ok, that message was probably directed at me. Feature# is FATE, you probably do not have access to it.

Olaf: can we just set it unconditionaly (SMP or UP)? It is probably better than nothing...
Comment 21 Vlad Codrea 2007-01-13 00:56:30 UTC
I can report that booting with apm=power_off enables my computer to shut down completely (bug #233373).
Comment 23 Olaf Dabrunz 2007-01-15 15:18:00 UTC
Hmmm... need to put the default setup into a section that is run before the
__setup() stuff.

That means it should be something like this:

-----------------------------------------------------------------
#ifdef CONFIG_SMP
static __init apm_poweroff_init()
{       
        power_off = (num_online_cpus() == 1);
}
core_initcall(apm_poweroff);
#endif
-----------------------------------------------------------------

Checking...
Comment 24 m. bracher 2007-01-15 18:58:02 UTC
Why to have different default behavior for acpi and apm? 
I can't see the advantage to set a boot-option with apm to power-off and no boot-option with acpi. 
When there is a rare reason not to power-off (I think most people want to power-off with "init 0"), why not to introduce a parameter apm=no_power_off ?

The more boot-options we have to set, the more user-unfriendly grub will be to handle
Comment 25 Olaf Dabrunz 2007-01-15 19:19:45 UTC
mbra@gmx.ch, comment #24: yes, my current suggestion is to fix this in the
kernel. BTW, apm=no_power_off does exist already.
Comment 26 Olaf Dabrunz 2007-01-15 19:33:10 UTC
There is a new fix in patches.suse/apm_setup_UP.diff.

It seems there is no way to use num_online_cpus() earlier, because
boot_cpu_init() is also called when the other __init functions are called.

So, if necessary, we need to set the default value after all __init
functions have run. I introduced a new function apm_poweroff_init() that
is called later during the late_initcall phase. It will check if the kernel
parameter was found and otherwise initialize power_off to
(num_online_cpus() == 1).
Comment 27 Pavel Machek 2007-01-15 21:07:27 UTC
Olaf: yes, that should do the trick. I was aware of num_online_cpus() not running early enough, and did not want to hack already ugly apm.c. Thanks for your work.

Can interested parties checkout tommorow's kernel of the day? The problem should be fixed, even without adding command line parameter.

(If apm=power_off did not fix the problem for you... you are probably experiencing another problem... and that report should be reopened because it was not really a duplicate).
Comment 29 Olaf Dabrunz 2007-01-19 15:17:17 UTC
Tested and submitted to kernel CVS head and SL102_BRANCH. linux-kernel still
pending.
Comment 30 Thomas Renninger 2007-01-23 12:23:12 UTC
*** Bug 136742 has been marked as a duplicate of this bug. ***
Comment 31 macias - 2007-10-07 05:49:36 UTC
Maybe it will help some readers -- acpi=force in opensuse 10.3 does the trick, instead of ignoring power off button (opensuse 10.2) now it enables normal shutdown.