Bug 25612

Summary: kernel panic when removing battery
Product: ACPI Reporter: matthias (matthias.behrens)
Component: Power-BatteryAssignee: acpi_power-battery
Status: CLOSED CODE_FIX    
Severity: high CC: acpi-bugzilla, florian, maciej.rutecki, rjw, rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.37-rc6.25.1 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 21782    

Description matthias 2010-12-24 19:27:20 UTC
hi, this is my first kernel.org bug report so please forgive me if its not perfect.

when i remove one of the 2 batteries in my laptop the system crashes with a lot of error info. i remember the last line being about "unable to handle pageing request" i would love to give you the hole errormsg but i dont know how to access it. i have to restart my pc in order to continue working.

this does not depend on the ac adapter being plugged in or not.
i believe this was working on one of the earlier release candidates. it definetly works with the 2.6.36...

hope this helps you.
thx and happy holidays

matthias


my system:
panasonic toughbook cf-30k (mk3); 4gb ram; 2 batteries; ssd; 8gb swap; gobi modem
opensuse 11.3; kde; head kernel 2.6.37-rc6.25.1; smeegol packages installed
Comment 1 Zhang Rui 2010-12-27 02:39:13 UTC
please revert this patch,
commit 3138b32d5e0998ba3cbd1c74bdc1887d74c5279b
Author: Zhang Rui <rui.zhang@intel.com>
Date:   Wed Dec 8 10:40:49 2010 +0800

    ACPI battery: update status upon sysfs query
    
    Sometimes the Battery driver doesn't get notifications when it's
    plugged/unplugged. And this results in the incorrect Battery
    status reported by the power supply sysfs I/F.
    
    Update Battery status first when querying from sysfs.
    http://marc.info/?l=linux-acpi&m=128855015826728&w=2
    
    Tested_by: Seblu <seblu@seblu.net>
    Signed-off-by: Zhang Rui <rui.zhang@intel.com>
    Signed-off-by: Len Brown <len.brown@intel.com>

If you don't know how to revert it, please just download 2.6.37-rc7 kernel, remove line 189 and 190 of drivers/acpi/battery.c, which are
	if (acpi_battery_update(battery))
		return -ENODEV;
rebuild your kernel and see if the problem still exists.

Please re-open it if reverting the patch doesn't help.
Comment 2 matthias 2010-12-28 23:32:44 UTC
yay it works again. i can remove any battery without the system crashing.
funny: the behaviour described above happens now on my laptop. sometimes the system shows 2 batteries when only one is present. kde shows an empty loading percentage. not zero but empty meaning ""
thx for the help
that was really great.
i will make sure to report any kernel related bug in the future.

matthias
Comment 3 Zhang Rui 2010-12-29 01:05:46 UTC
(In reply to comment #2)
> yay it works again. i can remove any battery without the system crashing.
> funny: the behaviour described above happens now on my laptop. sometimes the
> system shows 2 batteries when only one is present.

Yes, we noticed this issue, but as the patch above causes regression.
I'm about to rewrite the battery driver, maybe sometime in the next quarter. :)

> i will make sure to report any kernel related bug in the future.
> 
good to know. :)
please feel free to file new bug reports here if you think it's kernel related.