Bug 51731

Summary: Kernel Panic on backlight brightness hotkey usage (Fujitsu Siemens Amilo Pi 2550)
Product: ACPI Reporter: i-tek
Component: Power-VideoAssignee: Aaron Lu (aaron.lu)
Status: CLOSED CODE_FIX    
Severity: normal CC: aaron.lu, alan, lacky111, rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: >= 3.4 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: acpidump
lspci -vxxx:
Before pressing the key
After pressing the key
Logfile of git bisect
Kernel 3.8.2 - Part of the visible call trace on kernel panic
Debug statement for acpi_video_bus_add
Deal with failure cases when acpi_video_bus_get_devices failed

Description i-tek 2012-12-15 09:27:09 UTC
Created attachment 89281 [details]
acpidump

I am refering to an error that occurs since I have moved to Lubuntu 12.04.
Everytime I try to vary the backlight brightness the complete system freezes
on a kernel panic screen (No SysReq-Commands are available).

I would have reported this bug to the Ubuntu launchpad but apport advised me to report Upstream kernel errors directly to kernel.org.

Furthermore I have tested various kernels from the Ubuntu kernel repo
(http://kernel.ubuntu.com/~kernel-ppa/mainline/) to specify in which kernel revision the bug occured at first.


Last working version: 3.3.8 (folder: v3.3.8-quantal/)

/proc/version:
Linux version 3.3.8-030308-generic (apw@gomeisa) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #201206041356 SMP Mon Jun 4 17:57:29 UTC 2012


First non working version: 3.4.0 (folder: v3.4-quantal/)
/proc/version:
Linux version 3.4.0-030400-generic (apw@gomeisa) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #201205221131 SMP Tue May 22 15:32:22 UTC 2012

Several kernels above 3.4.0 up to 3.7.x showed the same behaviour.
The same kernel problems occured in Fedora 18 Beta.

Please ask for further needed information.
Comment 1 i-tek 2012-12-15 09:28:15 UTC
Created attachment 89291 [details]
lspci -vxxx:
Comment 2 Zhang Rui 2012-12-24 01:39:35 UTC
does acpi_backlight=vendor help?
Comment 3 i-tek 2012-12-30 14:58:32 UTC
I have added acpi_backlight=vendor and acpi_osi=Linux but it still doesn't work.
Comment 4 Zhang Rui 2013-01-09 06:41:53 UTC
please do the following test in a working kernel.
"grep . /sys/firmware/acpi/interrupts/*" both before and after pressing the hotkey.

And please verify if changing the value in /sys/class/backlight/acpi_video0/ manually can actually change the backlight, in both working and failing kernels.
Comment 5 Nikolay 2013-01-31 18:11:43 UTC
acpi_osi=""

should work for your laptop.
Comment 6 Aaron Lu 2013-03-07 04:01:15 UTC
Hi i-tek@web.de,

Any update on this? Did you try Rui and Nikolay's suggestion?
Thanks.
Comment 7 i-tek 2013-03-11 22:48:15 UTC
Hi,

sorry I was a bit busy recently.
I tried to change the backlight by using "echo 1 >
/sys/class/backlight/acpi_video0/brightness" and it worked in all tested
kernels.

The appended files concern the requested output of "grep .
/sys/firmware/acpi/interrupts/*"; if it matters: there were 3 not
related keystrokes between the hotkey's usage and the postkey.txt file
output.

At last:
Setting "acpi_osi=" in grub's kernel boot arguments did the trick.

However, how should a normal enduser figure this out? Is this a grub,
kernel or distribution related problem?

Thank You Sirs
Comment 8 i-tek 2013-03-11 22:49:34 UTC
Created attachment 95181 [details]
Before pressing the key
Comment 9 i-tek 2013-03-11 22:50:08 UTC
Created attachment 95191 [details]
After pressing the key
Comment 10 Aaron Lu 2013-03-14 03:48:59 UTC
Looks like an EC problem to me, Rui, what do you think?

The _BQC and _BCM is straightforward, they just return/store a value in EC space, and this works well according to i-tek. The broken part is the notification, which is related to EC. I've no idea what happened here.

Setting acpi_osi= here means to set OS version to windows 2000 in this table I think, and it would affect XSEC, which is a variable defined in EC space. Bud I don't know how it is related.

Hi Nikolay,
May I know how did you get the conclusion setting acpi_osi= would work? Thanks.
Comment 11 Aaron Lu 2013-03-14 04:06:03 UTC
(In reply to comment #7)
> Hi,
> 
> At last:
> Setting "acpi_osi=" in grub's kernel boot arguments did the trick.
> 
> However, how should a normal enduser figure this out? Is this a grub,
> kernel or distribution related problem?

Perhaps a kernel problem.

Can you please verify the following two commits?
5c7dd710f691d1b44c39e32d2f05b4286ff51f99 (should be bad)
9061e0e16700ef228837e96987ff51794c956197 (should be good)

And do a git bisect to find the offending commit? Thanks.

A quick guide on git bisect:
http://git-scm.com/book/en/Git-Tools-Debugging-with-Git#Binary-Search
Comment 12 Nikolay 2013-03-17 21:00:38 UTC
(In reply to comment #10)

Please, pay attention to the old bug:
https://bugzilla.kernel.org/show_bug.cgi?id=9902

Amilo Pi 2515 is a similar notebook. BTW, users of Pi 2515 report that
brightness keys work fine on Opensuse 11.3 and Fedora 13 ("acpi_osi" not needed).
Comment 13 Aaron Lu 2013-03-21 07:08:33 UTC
(In reply to comment #7)
> Hi,
> 
> sorry I was a bit busy recently.
> I tried to change the backlight by using "echo 1 >
> /sys/class/backlight/acpi_video0/brightness" and it worked in all tested
> kernels.

When you test this, do you have acpi_osi= kernel command line param?

> 
> The appended files concern the requested output of "grep .
> /sys/firmware/acpi/interrupts/*"; if it matters: there were 3 not
> related keystrokes between the hotkey's usage and the postkey.txt file
> output.

Same here, do you use acpi_osi= kernel command line param when doing these tests?

> 
> At last:
> Setting "acpi_osi=" in grub's kernel boot arguments did the trick.
> 
> However, how should a normal enduser figure this out? Is this a grub,
> kernel or distribution related problem?
> 
> Thank You Sirs
Comment 14 Aaron Lu 2013-03-21 08:25:35 UTC
(In reply to comment #12)
> (In reply to comment #10)
> 
> Please, pay attention to the old bug:
> https://bugzilla.kernel.org/show_bug.cgi?id=9902

This looks different: in bug 9902, the asl code will do some test before sending out notification, and the test may fail. But here, the asl code does nothing, it simply send the notification:

                    Method (_Q11, 0, NotSerialized)
                    {
                        Notify (^^^PEGP.VGA.LCD, 0x87)
                    }

                    Method (_Q12, 0, NotSerialized)
                    {
                        Notify (^^^PEGP.VGA.LCD, 0x86)
                    }

> 
> Amilo Pi 2515 is a similar notebook. BTW, users of Pi 2515 report that
> brightness keys work fine on Opensuse 11.3 and Fedora 13 ("acpi_osi" not
> needed).

Where can I find information about this? Thanks.
Comment 15 Nikolay 2013-03-21 17:05:14 UTC
(In reply to comment #14)
> > Amilo Pi 2515 is a similar notebook. BTW, users of Pi 2515 report that
> > brightness keys work fine on Opensuse 11.3 and Fedora 13 ("acpi_osi" not
> > needed).
> 
> Where can I find information about this? Thanks.

For example, in the German forum: 
http://www.amilo-forum.de/topic,23195,-AMILO-Pi-2515-Linux.html

Maybe acpi_osi="!Windows 2006" works for Amilo Pi 2550 too.
Comment 16 i-tek 2013-03-27 13:34:09 UTC
(In reply to comment #11)
> Can you please verify the following two commits?
> 5c7dd710f691d1b44c39e32d2f05b4286ff51f99 (should be bad)
> 9061e0e16700ef228837e96987ff51794c956197 (should be good)
> And do a git bisect to find the offending commit? Thanks.

I have built 5c7dd710f691d1b44c39e32d2f05b4286ff51f99 which was bad
indeed but I ran into problems trying to compile
9061e0e16700ef228837e96987ff51794c956197 which look this way:
  CC [M]  drivers/net/wireless/mac80211_hwsim.o
  LD      drivers/net/wireless/built-in.o
  LD      drivers/net/built-in.o
make[2]: *** [drivers] Error 2
make[1]: *** [deb-pkg] Error 2
make: *** [deb-pkg] Error 2


(In reply to comment #13)
> When you test this, do you have acpi_osi= kernel command line param?

I am pretty sure I hadn't set the acpi_osi= param when I tested those
things.
Comment 17 i-tek 2013-03-27 13:49:43 UTC
(In reply to comment #15)
> For example, in the German forum:
> http://www.amilo-forum.de/topic,23195,-AMILO-Pi-2515-Linux.html
> Maybe acpi_osi="!Windows 2006" works for Amilo Pi 2550 too.

Yes, it does work like "acpi_osi="
Comment 18 Aaron Lu 2013-03-28 03:28:27 UTC
(In reply to comment #16)
> I have built 5c7dd710f691d1b44c39e32d2f05b4286ff51f99 which was bad
> indeed but I ran into problems trying to compile
> 9061e0e16700ef228837e96987ff51794c956197 which look this way:
>   CC [M]  drivers/net/wireless/mac80211_hwsim.o
>   LD      drivers/net/wireless/built-in.o
>   LD      drivers/net/built-in.o
> make[2]: *** [drivers] Error 2
> make[1]: *** [deb-pkg] Error 2
> make: *** [deb-pkg] Error 2

Please try this one instead: ed283e9f0a2cc0541870828c76c6c6997c51a318, see if it is good, thanks.
Comment 19 i-tek 2013-03-30 03:24:02 UTC
I still had problems with compiling but after struggling with different
configs I finally got the Revision.

git bisect: [ea9f8856bd6d4ed45885b06a338f7362cd6c60e5] ACPI video:
Harden video bus adding.

And indeed the compromising code provided changes in the Backlight handling.
While the newer kernel releases were able to show a kernel panic screen
the elder ones resulted in a frozen screen.
I'll attach the bisect log as well...

I hope that spending my whole night was worth it :)
Comment 20 i-tek 2013-03-30 03:25:43 UTC
Created attachment 96661 [details]
Logfile of git bisect
Comment 21 i-tek 2013-03-30 11:04:06 UTC
Created attachment 96671 [details]
Kernel 3.8.2 - Part of the visible call trace on kernel panic
Comment 22 Aaron Lu 2013-04-01 07:07:38 UTC
(In reply to comment #19)
> I still had problems with compiling but after struggling with different
> configs I finally got the Revision.
> 
> git bisect: [ea9f8856bd6d4ed45885b06a338f7362cd6c60e5] ACPI video:
> Harden video bus adding.
> 
> And indeed the compromising code provided changes in the Backlight handling.
> While the newer kernel releases were able to show a kernel panic screen
> the elder ones resulted in a frozen screen.
> I'll attach the bisect log as well...
> 
> I hope that spending my whole night was worth it :)

Yes, I'm sure it's worth it :-)
Thanks for your test.
Comment 23 Aaron Lu 2013-04-01 07:42:48 UTC
Created attachment 96891 [details]
Debug statement for acpi_video_bus_add

Hi i-tek,

Please apply this debug patch on top of Linus' git tree(v3.9-rc5 as of today), and then attach the full dmesg here, thanks.
Comment 24 Aaron Lu 2013-04-01 09:22:47 UTC
In your DSDT table, there is a device under the vga controller that doesn't provide _ADR:

Device (AMW0)

And it would make acpi_video_bus_get_devices fail, but the problem is, when it failed, it didn't handle correctly: the notification handler is added, but the input device is not set yet. So each time a notification comes, the handler will try to send out the event through the input device, it will panic.
Comment 25 Aaron Lu 2013-04-01 09:24:26 UTC
Created attachment 96901 [details]
Deal with failure cases when acpi_video_bus_get_devices failed

Please test this patch, apply directly on top of v3.9-rc5. I think it can fix your problem, thanks.
Comment 26 i-tek 2013-04-02 21:37:44 UTC
(In reply to comment #25)
> Please test this patch, apply directly on top of v3.9-rc5. I think it
can fix your problem, thanks.

The patch works very well on the bleeding edge kernel. No more panics
for me!

Thank you very much
(Is further testing etc. required?)
Comment 27 Aaron Lu 2013-04-03 00:56:20 UTC
(In reply to comment #26)
> (In reply to comment #25)
> > Please test this patch, apply directly on top of v3.9-rc5. I think it
> can fix your problem, thanks.
> 
> The patch works very well on the bleeding edge kernel. No more panics
> for me!
> 
> Thank you very much
> (Is further testing etc. required?)

No more, thanks a lot for the test.

I'll propose this patch to upstream, and with your Reported-bisected-and-tested-by tag if you don't object. BTW, what's your real name? I need to put it like this:

Reported-bisected-and-tested-by: Your Real Name <i-tek@web.de>

Thanks.
Comment 28 Aaron Lu 2013-05-03 06:03:44 UTC
commit 91e13aa37023437c260c85a3f17308052bbfbfa2
Author: Aaron Lu <aaron.lu@intel.com>
Date:   Thu Apr 25 02:47:49 2013 +0000

    ACPI: video: correct acpi_video_bus_add error processing