Bug 12106

Summary: System crashes when setting backlight - Samsung R510 Laptop
Product: ACPI Reporter: Mike Lothian (mike)
Component: BIOSAssignee: acpi_bios
Status: CLOSED DOCUMENTED    
Severity: normal CC: acpi-bugzilla, lenb
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.28-rc Subsystem:
Regression: No Bisected commit-id:
Attachments: Dmesg Output after video modprobed
Backlight grep
Video grep 2 levels
Video grep 3 levels
customized DSDT: new _BCL package
Dmesg Output with DSDT
customized DSDT
Latest dmesg
Origional DSDT
Dmesg with IRQPOLL
Dmesg 40
Debug output of ACPI
customized DSDT: more debug info
Dmesg 10/12/08
customized DSDT: don't trap when changing backlight
customized DSDT

Description Mike Lothian 2008-11-26 11:48:27 UTC
Latest working kernel version: None
Earliest failing kernel version: All
Distribution: Gentoo
Hardware Environment: Samsung R510 Laptop
Problem Description: Laptop crashes if X is loaded whilst ACPI video module is loaded

Steps to reproduce: Load video module start X
Comment 1 Mike Lothian 2008-11-26 12:49:17 UTC
Created attachment 19035 [details]
Dmesg Output after video modprobed
Comment 2 Mike Lothian 2008-11-26 12:50:00 UTC
Created attachment 19036 [details]
Backlight grep
Comment 3 Mike Lothian 2008-11-26 12:50:31 UTC
Created attachment 19037 [details]
Video grep 2 levels
Comment 4 Mike Lothian 2008-11-26 12:51:11 UTC
Created attachment 19038 [details]
Video grep 3 levels
Comment 5 Mike Lothian 2008-11-26 12:53:41 UTC
When I tried changing the brighness level from 0 to 1 nothing happens when I changed it to 5 the laptop crashed

Nothing is shown on the screen when this happens it simply turns black and the laptop reboots

Is there any other pieces of info you would like to help diagnose this?
Comment 6 Zhang Rui 2008-11-26 17:27:30 UTC
so there are two problem here,
1. crashes when setting the brightness level, when X is not started
2. crashes when starting X, with ACPI video driver loaded, right?
Comment 7 Zhang Rui 2008-11-26 17:33:18 UTC
Created attachment 19042 [details]
customized DSDT: new _BCL package

the _BCL method on this laptop is buggy.
please try this new DSDT.
how to override a DSDT can be found at:
http://www.lesswatts.org/projects/acpi/overridingDSDT.php
Comment 8 Zhang Rui 2008-11-26 18:00:26 UTC
let's work on problem 1 first.

please do the following test after applying the customized DSDT,
1. cat /proc/acpi/video/GFX0/DD04/brightness
2. set it to a different but not maximum value
3. cat /proc/acpi/video/GFX0/DD04/brightness
4. echo 100 > /proc/acpi/video/GFX0/DD04/brightness
5, does the system still crash? if not, please run "cat /proc/acpi/video/GFX0/DD04/brightness"
6. attach the test result here.
Comment 9 Mike Lothian 2008-11-28 12:25:20 UTC
Created attachment 19067 [details]
Dmesg Output with DSDT

Attaching this just to make sure I overrode the DSDT properly
Comment 10 Mike Lothian 2008-11-28 12:28:26 UTC
tau fireburn # cat /proc/acpi/video/GFX0/DD04/brightness
levels:  100 25 35 45 60 70 80 90
current: 35

Trying to change this causes the laptop to crash still and Xorg loading with video module loaded crashes too

Is that definitely the right DSDT for my system?
Comment 11 Len Brown 2008-11-28 15:38:47 UTC
this bug is filed against 2.6.28-rc6
What was the most recent Linux release that did not show this problem?
Comment 12 Mike Lothian 2008-11-29 01:38:24 UTC
There aren't any that don't show this problem

This I believe is the first kernel that has both the video detection patch and the Reserve low 64K of RAM on AMI/Phoenix BIOSes

Without these patches the module cannot even be loaded with out causeing a crash and simply unpluggin the A/C causes the laptop to crash too. 

Please see bug 11658 for more details
Comment 13 Zhang Rui 2008-11-30 18:44:52 UTC
Created attachment 19083 [details]
customized DSDT

please try this one. :)
please set CONFIG_ACPI_DEBUG and boot with acpi.debug_level=0x03
Comment 14 Mike Lothian 2008-12-01 11:38:01 UTC
No change laptop still crashes changing values and starting X
Comment 15 Mike Lothian 2008-12-01 11:39:09 UTC
Created attachment 19093 [details]
Latest dmesg
Comment 16 Zhang Rui 2008-12-01 17:14:10 UTC
please attach the content of "/proc/acpi/video/GFX0/DD04/brightness" after applying the customized DSDT.
echoing any value to file results in a system crash?

irq 16: nobody cared (try booting with the "irqpoll" option)
Pid: 0, comm: swapper Tainted: G       A   2.6.28-rc6 #14
Call Trace:
 <IRQ>  [<ffffffff802729ce>] 0xffffffff802729ce
 [<ffffffff80272bc8>] 0xffffffff80272bc8
 [<ffffffff802734d5>] 0xffffffff802734d5
 [<ffffffff8020eae4>] 0xffffffff8020eae4
 [<ffffffff8020c066>] 0xffffffff8020c066
 <EOI>  [<ffffffff80513210>] 0xffffffff80513210
 [<ffffffff80415b6d>] 0xffffffff80415b6d
 [<ffffffff80415b63>] 0xffffffff80415b63
 [<ffffffff8051249a>] 0xffffffff8051249a
 [<ffffffff8020a2ce>] 0xffffffff8020a2ce
 [<ffffffff807abc3d>] 0xffffffff807abc3d
 [<ffffffff807ab36a>] 0xffffffff807ab36a
handlers:
[<ffffffff804d1540>]
Disabling IRQ #16

PCI device 0000:00:02.0 (vga) is routed to irq 16.
so, let's fix the irq problem first.
what if you boot with irqpoll?
does it still hang when starting X?
Comment 17 Mike Lothian 2008-12-02 10:09:59 UTC
Created attachment 19103 [details]
Origional DSDT

Thought this might be useful
Comment 18 Mike Lothian 2008-12-02 11:08:51 UTC
levels:  100 90 25 35 45 60 70 80 90 100
current: 25

Out put of /proc/acpi/video/GFX0/DD04/brightness lines 1-2/2 (END)

Still changes when I change /sys/class/backlight ... brighness

If I change the above proc to this:

levels:  100 90 25 35 45 60 70 80 90 100
current: 50


[ Error writing /proc/acpi/video/GFX0/DD04/brightness: Invalid argument ]

and 

echo 50 > /proc/acpi/video/GFX0/DD04/brightness

does nothing and

echo 100 > /proc/acpi/video/GFX0/DD04/brightness

crashes the laptop
Comment 19 Mike Lothian 2008-12-02 11:09:55 UTC
Created attachment 19105 [details]
Dmesg with IRQPOLL
Comment 20 Zhang Rui 2008-12-02 17:16:45 UTC
(In reply to comment #18)
> levels:  100 90 25 35 45 60 70 80 90 100
> current: 25
> 
> Out put of /proc/acpi/video/GFX0/DD04/brightness lines 1-2/2 (END)
> 
> Still changes when I change /sys/class/backlight ... brighness
that's right.
there is a 1v1 match between ACPI backlight procfs I/F and sysfs I/F.
in order to make the problem easier, please poking only one I/F during the test.

> 
> If I change the above proc to this:
> 
> levels:  100 90 25 35 45 60 70 80 90 100
> current: 50
> 
how can you change the current value to 50??
only the values listed in the "levels:" line are valid.

> 
> [ Error writing /proc/acpi/video/GFX0/DD04/brightness: Invalid argument ]
> 
> and 
> 
> echo 50 > /proc/acpi/video/GFX0/DD04/brightness
> 
> does nothing and
> 
> echo 100 > /proc/acpi/video/GFX0/DD04/brightness
> 
> crashes the laptop
> 
please run:
1.dmesg -c
2.echo 40 > /proc/acpi/video/GFX0/DD04/brightness
3.dmesg > dmesg-40
4.dmesg -c
5.echo 90 > /proc/acpi/video/GFX0/DD04/brightness
6.dmesg >dmesg-90
and attach these two dmesg outputs here.
Comment 21 Mike Lothian 2008-12-03 11:52:23 UTC
Created attachment 19131 [details]
Dmesg 40
Comment 22 Mike Lothian 2008-12-03 11:55:38 UTC
The laptop crashed with 90

I relised that I modprobed video after doing the dmesg -c but before the echo 40

So that dmesg.40 should be empty
Comment 23 Zhang Rui 2008-12-03 21:21:41 UTC
so, echoing 40 doesn't crash, right?
please attach the dmesg output after echoing 40.
Comment 24 Mike Lothian 2008-12-04 11:20:07 UTC
It's blank
Comment 25 Zhang Rui 2008-12-04 17:15:00 UTC
what does "blank" mean? is it the same like 90?
can the computer still work? or it crashes?
can you login via network? does the keyboard still work (can ctrl+atl+del restarts the computer)?
please give a more detailed description of the symptom after "echo 40 > /proc/acpi/.../brightness"
Comment 26 Mike Lothian 2008-12-05 02:23:59 UTC
When I do a dmesg-c echo 40 > brightness 

My computer carries on working and dmesg is then empty

Hope I've explained things better now

I'll try loggin on to my laptop from another PC
Comment 27 Mike Lothian 2008-12-07 16:09:04 UTC
OK I did a tail -f /var/log/messages and tried echoing different values to brightness

I echo'd 45 60 & 70 successfully and 80 caused the laptop to crash

Nothing appeared in the messages file during any of this testing and the brightness of the laptop's screen didn't change
Comment 28 Zhang Rui 2008-12-07 17:48:34 UTC
No dmesg output? weird.
please attach the content of 
/sys/module/acpi/parameters/{debug_level, debug_layer}
if these two files don't exist, which mean that CONFIG_ACPI_DEBUG is not set.
please set it and rebuild the kernel, then attach the dmesg output after "echoing 40" :).
Comment 29 Mike Lothian 2008-12-08 12:04:51 UTC
Created attachment 19219 [details]
Debug output of ACPI

cd /sys/module/acpi/parameters/

grep . * > ~fireburn/ACPI_Debug
Comment 30 Zhang Rui 2008-12-08 16:50:06 UTC
hah, I see.
please run "echo 0x03 > /sys/module/acpi/parameters/debug_level"
and then attach the dmesg output after "echo 40"
Comment 31 Mike Lothian 2008-12-08 17:04:03 UTC
I echo'd 0x03 as requested

then echod 45 (40 wasn't on the list of available levels)

Output is:

tau fireburn # dmesg
[ACPI Debug]  String [0x07] "In _BCM"
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000005

When I then tried to echo 60 the computer crashed

On a side related note Xorg now can start whilst the video module is loaded

I'm guessing this is due to updates in git mater of libdrm, mesa or xf86-video-intel or possibly the kernel itself

But the screen brightness still doesn't change
Comment 32 Zhang Rui 2008-12-08 17:33:07 UTC
then what about 60 and 70?
please attach the dmesg as well
Comment 33 Mike Lothian 2008-12-09 18:24:26 UTC
Every value that doesn't crash the machine produces the exact same output

[ACPI Debug]  String [0x07] "In _BCM"
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000005

Each time
Comment 34 Zhang Rui 2008-12-09 18:42:13 UTC
Created attachment 19234 [details]
customized DSDT: more debug info

that's weird.

this is the piece of AML code:
            Store ("In _BCM", Debug)
            Divide (Arg0, 0x0A, Local0, Local1)
            Store ("Local0", Debug)
            Store (Local0, Debug)
we can see that local0 = Arg0%0x0A
Arg0 is the brightness value we want to set, it's really weird if we always get local0 == 0x05 no matter what value we set.

please try this DSDT which can provide more debug info.
Comment 35 Mike Lothian 2008-12-09 18:45:26 UTC
Well maybe it's not so weird if you consider the screens actual brightness isn't changing I'll try the DSDT now
Comment 36 Mike Lothian 2008-12-09 19:04:55 UTC
The output for echo 35, 45 then 25 is:

[ACPI Debug]  String [0x07] "In _BCM"
[ACPI Debug]  String [0x04] "Arg0"
[ACPI Debug]  Integer 0x0000000000000023
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000005
[ACPI Debug]  String [0x07] "In _BCM"
[ACPI Debug]  String [0x04] "Arg0"
[ACPI Debug]  Integer 0x000000000000002D
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000005
[ACPI Debug]  String [0x07] "In _BCM"
[ACPI Debug]  String [0x04] "Arg0"
[ACPI Debug]  Integer 0x0000000000000019
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000005


I'm ataching the full dmesg
Comment 37 Mike Lothian 2008-12-09 19:05:53 UTC
Created attachment 19235 [details]
Dmesg 10/12/08
Comment 38 Mike Lothian 2008-12-09 19:06:25 UTC
Oh yes forgot to say echo 60 crashed the laptop
Comment 39 Zhang Rui 2008-12-09 19:29:26 UTC
all right, then I think
echoing {60, 70, 80, 90, 100} all crashes the system, while {25, 35, 45} doesn't, right?
Comment 40 Zhang Rui 2008-12-09 19:32:32 UTC
Created attachment 19236 [details]
customized DSDT: don't trap when changing backlight
Comment 41 Zhang Rui 2008-12-09 19:34:19 UTC
you can try this DSDT and see if it still crashes.
Comment 42 Mike Lothian 2008-12-09 19:42:47 UTC
all right, then I think
echoing {60, 70, 80, 90, 100} all crashes the system, while {25, 35, 45}
doesn't, right?

Yes that's correct
Comment 43 Mike Lothian 2008-12-10 11:40:11 UTC
Yes it stopped the crashing

Here is the output for 35 45 60 70 80 90 100

[ACPI Debug]  String [0x07] "In _BCM"                                           
[ACPI Debug]  String [0x04] "Arg0"                                              
[ACPI Debug]  Integer 0x0000000000000023                                        
[ACPI Debug]  String [0x06] "Local0"                                            
[ACPI Debug]  Integer 0x0000000000000005                                        
[ACPI Debug]  String [0x07] "In _BCM"                                           
[ACPI Debug]  String [0x04] "Arg0"                                              
[ACPI Debug]  Integer 0x000000000000002D                                        
[ACPI Debug]  String [0x06] "Local0"                                            
[ACPI Debug]  Integer 0x0000000000000005                                        
[ACPI Debug]  String [0x07] "In _BCM"                                           
[ACPI Debug]  String [0x04] "Arg0"                                              
[ACPI Debug]  Integer 0x000000000000003C                                        
[ACPI Debug]  String [0x06] "Local0"                                            
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x04] "Arg0"                                              
[ACPI Debug]  Integer 0x000000000000003C                                        
[ACPI Debug]  String [0x04] "ALSE"                                              
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x04] "ALAF"                                              
[ACPI Debug]  Integer 0x0000000000000064                                        
[ACPI Debug]  String [0x06] "Local0"                                            
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x06] "Local1"                                            
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x07] "In _BCM"                                           
[ACPI Debug]  String [0x04] "Arg0"                                              
[ACPI Debug]  Integer 0x0000000000000046                                        
[ACPI Debug]  String [0x06] "Local0"                                            
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x04] "Arg0"                                              
[ACPI Debug]  Integer 0x0000000000000046                                        
[ACPI Debug]  String [0x04] "ALSE"                                              
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x04] "ALAF"                                              
[ACPI Debug]  Integer 0x0000000000000064                                        
[ACPI Debug]  String [0x06] "Local0"                                            
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x06] "Local1"                                            
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x07] "In _BCM"                                           
[ACPI Debug]  String [0x04] "Arg0"                                              
[ACPI Debug]  Integer 0x0000000000000050                                        
[ACPI Debug]  String [0x06] "Local0"                                            
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x04] "Arg0"                                              
[ACPI Debug]  Integer 0x0000000000000050                                        
[ACPI Debug]  String [0x04] "ALSE"                                              
[ACPI Debug]  Integer 0x0000000000000000                                        
[ACPI Debug]  String [0x04] "ALAF"                                              
[ACPI Debug]  Integer 0x0000000000000064                                        
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000000
[ACPI Debug]  String [0x06] "Local1"
[ACPI Debug]  Integer 0x0000000000000000
[ACPI Debug]  String [0x07] "In _BCM"
[ACPI Debug]  String [0x04] "Arg0"
[ACPI Debug]  Integer 0x000000000000005A
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000000
[ACPI Debug]  String [0x04] "Arg0"
[ACPI Debug]  Integer 0x000000000000005A
[ACPI Debug]  String [0x04] "ALSE"
[ACPI Debug]  Integer 0x0000000000000000
[ACPI Debug]  String [0x04] "ALAF"
[ACPI Debug]  Integer 0x0000000000000064
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000000
[ACPI Debug]  String [0x06] "Local1"
[ACPI Debug]  Integer 0x0000000000000000
[ACPI Debug]  String [0x07] "In _BCM"
[ACPI Debug]  String [0x04] "Arg0"
[ACPI Debug]  Integer 0x0000000000000064
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000000
[ACPI Debug]  String [0x04] "Arg0"
[ACPI Debug]  Integer 0x0000000000000064
[ACPI Debug]  String [0x04] "ALSE"
[ACPI Debug]  Integer 0x0000000000000000
[ACPI Debug]  String [0x04] "ALAF"
[ACPI Debug]  Integer 0x0000000000000064
[ACPI Debug]  String [0x06] "Local0"
[ACPI Debug]  Integer 0x0000000000000000
[ACPI Debug]  String [0x06] "Local1"
[ACPI Debug]  Integer 0x0000000000000000
Comment 44 Zhang Rui 2008-12-10 18:17:45 UTC
it's a SMI call that causes the crash.
it's weird that it's an IGD OpRegion BIOS.
but the backlight control(_BCM) doesn't go via IGD OpRegion.

so first please check if there is any BIOS update.
if not, please try the customized DSDT attached and see if it can work for you.
Comment 45 Zhang Rui 2008-12-10 18:21:07 UTC
well, by re-reading your BIOS, it seems that the AML code is not well written, and there are too many places that need to be fixed.
let's try to upgrade your BIOS first. :p
Comment 46 Mike Lothian 2008-12-11 06:50:19 UTC
I have the lastest BIOS version

http://www.samsung.com/uk/support/download/supportDown.do?group=itbusiness&type=notebookcomputers&subtype=rseries&model_nm=NP-R510&disp_nm=R510&language=&cate_type=all&dType=D&mType=FM&vType=R&prd_ia_cd=05010400

I have messaged Samsung previously to let them know they have a BIOS problem but they weren't interested :-(
Comment 47 Mike Lothian 2008-12-15 17:38:11 UTC
Has there been any progress with this?
Comment 48 Zhang Rui 2008-12-15 22:49:21 UTC
no.
As we found that the crash is caused by a SMI call, while SMI is transparent to OS. I have no idea how to debug this any more.
Knowing if the SMI is invoked in windows would be help, but unfortunately we can not get this info.
Comment 49 Zhang Rui 2008-12-15 22:51:11 UTC
Created attachment 19323 [details]
customized DSDT

can you please try this customized DSDT file and see if the system still crashes?
Comment 50 Mike Lothian 2008-12-17 13:27:35 UTC
Values of 60 and above still crash the system and there is no change in brightness
Comment 51 Mike Lothian 2008-12-27 17:20:58 UTC
Is there any further progress with this?
Comment 52 Zhang Rui 2008-12-28 17:27:01 UTC
well,
IMO, this is a BIOS bug to me, and I'm afraid we can not fix it in Linux kernel.

please try boot option "acpi_backlight=vendor", and see if there is any backlight I/F available in /sys/class/backlight/
If it still doesn't work, please try a 2.6.26 stable kernel, there should be more than one backlight interfaces in /sys/class/backlight/. try all of them and see if anyone works.
Comment 53 Zhang Rui 2009-01-04 00:46:52 UTC
Mike, I'd prefer to close this bug as this is a BIOS bug to me.
could you please try the test I mentioned in comment #52 please?
Comment 54 Mike Lothian 2009-01-06 15:06:50 UTC
No backlights are listed with that acpi option

Unfortunately older kernels didn't work due to the other bug. I could try patching an older kernel to see if that makes a difference
Comment 55 Zhang Rui 2009-01-07 18:20:02 UTC
so 2.6.26 doesn't work on your laptop?
Comment 56 Zhang Rui 2009-02-02 21:27:46 UTC
ping Mike
Comment 57 Mike Lothian 2009-02-06 16:03:58 UTC
Apologies 

No anything before 2.6.28 doesn't work without ACPI=OFF at boot time
Comment 58 Zhang Rui 2009-02-08 18:09:16 UTC
> No anything before 2.6.28 doesn't work without ACPI=OFF at boot time

sorry, do you mean nothing or everything before 2.6.28 work with ACPI enabled?
Comment 59 Zhang Rui 2009-02-23 01:14:22 UTC
ping Mike.
Comment 60 Zhang Rui 2009-03-11 00:41:15 UTC
close this bug as there is no response from the bug reporter.
please re-open it if the problem still exists and you can provide the info requested in comment #58
Comment 61 Mike Lothian 2009-06-09 22:52:06 UTC
OK I have a work around for the crashing, adding mem=4096M to the boot parms gets my laptop working (as in not crashing) but I loose 1GB of RAM

Screen brightness control still doesn't work however but I'm hoping that may be fixable now the crashing has stopped
Comment 62 Mike Lothian 2009-06-09 22:52:23 UTC
Reopening
Comment 63 Zhang Rui 2009-06-22 08:49:24 UTC
hmm, could you answer the question in comment #58?
Comment 64 Mike Lothian 2009-06-23 00:11:18 UTC
There are quiet a lot of answers to #58

The laptop was never tested with anything prior to 2.6.28, it's likely to work with MEM=4096M being passed now or running a 32bit kernel but I didn't know this at the time, only passing ACPI=OFF would stop it from crashing

I'm still pestering samsung for a real bios fix (they fixed the issue in the R560)
Comment 65 Zhang Rui 2009-07-30 01:00:45 UTC
please try the patch at http://patchwork.kernel.org/patch/38246/ and see if it helps.
Comment 66 Zhang Rui 2009-08-18 08:32:12 UTC
Ping...
Comment 67 Mike Lothian 2009-08-19 00:02:46 UTC
Unfortunately the same bad behaviour can be observed
Comment 68 Zhang Rui 2009-09-28 03:17:16 UTC

*** This bug has been marked as a duplicate of bug 11658 ***
Comment 69 Mike Lothian 2009-09-28 04:04:03 UTC
Quite ironic that after all this time it is indeed the same bug
Comment 70 Mike Lothian 2009-11-16 01:03:19 UTC
Good news thanks to Windows 7 requiring 64bit to get the Win7 seal of approval Samsung has now put out an updated (and fixed) BIOS!!