linux-kernel-test/drivers/acpi
Lv Zheng 06a8566bcf ACPI / IPMI: Fix atomic context requirement of ipmi_msg_handler()
This patch fixes the issues indicated by the test results that
ipmi_msg_handler() is invoked in atomic context.

BUG: scheduling while atomic: kipmi0/18933/0x10000100
Modules linked in: ipmi_si acpi_ipmi ...
CPU: 3 PID: 18933 Comm: kipmi0 Tainted: G       AW    3.10.0-rc7+ #2
Hardware name: QCI QSSC-S4R/QSSC-S4R, BIOS QSSC-S4R.QCI.01.00.0027.070120100606 07/01/2010
 ffff8838245eea00 ffff88103fc63c98 ffffffff814c4a1e ffff88103fc63ca8
 ffffffff814bfbab ffff88103fc63d28 ffffffff814c73e0 ffff88103933cbd4
 0000000000000096 ffff88103fc63ce8 ffff88102f618000 ffff881035c01fd8
Call Trace:
 <IRQ>  [<ffffffff814c4a1e>] dump_stack+0x19/0x1b
 [<ffffffff814bfbab>] __schedule_bug+0x46/0x54
 [<ffffffff814c73e0>] __schedule+0x83/0x59c
 [<ffffffff81058853>] __cond_resched+0x22/0x2d
 [<ffffffff814c794b>] _cond_resched+0x14/0x1d
 [<ffffffff814c6d82>] mutex_lock+0x11/0x32
 [<ffffffff8101e1e9>] ? __default_send_IPI_dest_field.constprop.0+0x53/0x58
 [<ffffffffa09e3f9c>] ipmi_msg_handler+0x23/0x166 [ipmi_si]
 [<ffffffff812bf6e4>] deliver_response+0x55/0x5a
 [<ffffffff812c0fd4>] handle_new_recv_msgs+0xb67/0xc65
 [<ffffffff81007ad1>] ? read_tsc+0x9/0x19
 [<ffffffff814c8620>] ? _raw_spin_lock_irq+0xa/0xc
 [<ffffffffa09e1128>] ipmi_thread+0x5c/0x146 [ipmi_si]
 ...

Also Tony Camuso says:

 We were getting occasional "Scheduling while atomic" call traces
 during boot on some systems. Problem was first seen on a Cisco C210
 but we were able to reproduce it on a Cisco c220m3. Setting
 CONFIG_LOCKDEP and LOCKDEP_SUPPORT to 'y' exposed a lockdep around
 tx_msg_lock in acpi_ipmi.c struct acpi_ipmi_device.

 =================================
 [ INFO: inconsistent lock state ]
 2.6.32-415.el6.x86_64-debug-splck #1
 ---------------------------------
 inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
 ksoftirqd/3/17 [HC0[0]:SC1[1]:HE1:SE0] takes:
  (&ipmi_device->tx_msg_lock){+.?...}, at: [<ffffffff81337a27>] ipmi_msg_handler+0x71/0x126
 {SOFTIRQ-ON-W} state was registered at:
   [<ffffffff810ba11c>] __lock_acquire+0x63c/0x1570
   [<ffffffff810bb0f4>] lock_acquire+0xa4/0x120
   [<ffffffff815581cc>] __mutex_lock_common+0x4c/0x400
   [<ffffffff815586ea>] mutex_lock_nested+0x4a/0x60
   [<ffffffff8133789d>] acpi_ipmi_space_handler+0x11b/0x234
   [<ffffffff81321c62>] acpi_ev_address_space_dispatch+0x170/0x1be

The fix implemented by this change has been tested by Tony:

 Tested the patch in a boot loop with lockdep debug enabled and never
 saw the problem in over 400 reboots.

Reported-and-tested-by: Tony Camuso <tcamuso@redhat.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Reviewed-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-09-25 03:12:05 +02:00
..
acpica ACPICA: Fix for a Store->ArgX when ArgX contains a reference to a field. 2013-09-06 15:39:59 +02:00
apei Merge branch 'x86-ras-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-09-04 11:07:04 -07:00
ac.c ACPI: Remove the old /proc/acpi/event interface 2013-07-15 13:56:36 +02:00
acpi_cmos_rtc.c ACPI: Add CMOS RTC Operation Region handler support 2013-06-27 21:35:37 +02:00
acpi_ipmi.c ACPI / IPMI: Fix atomic context requirement of ipmi_msg_handler() 2013-09-25 03:12:05 +02:00
acpi_lpss.c ACPI / LPSS: don't crash if a device has no MMIO resources 2013-09-02 12:59:40 +02:00
acpi_memhotplug.c ACPI / memhotplug: Fix a stale pointer in error path 2013-07-15 01:26:18 +02:00
acpi_pad.c PTR_RET() is a weird name, and led to some confusing usage. We ended 2013-09-04 17:31:11 -07:00
acpi_platform.c ACPI / scan: Drop unnecessary label from acpi_create_platform_device() 2013-08-07 01:11:33 +02:00
acpi_processor.c ACPI / processor: Acquire writer lock to update CPU maps 2013-08-13 12:20:16 +02:00
battery.c Merge branch 'acpi-assorted' 2013-08-27 01:29:04 +02:00
bgrt.c acpi: bgrt: fix build error due to attribute change 2013-08-22 08:34:39 -07:00
blacklist.c ACPI: blacklist win8 OSI for buggy laptops 2013-08-25 21:31:12 +02:00
bus.c Merge branch 'acpi-assorted' 2013-08-27 01:29:04 +02:00
button.c ACPI: Remove the old /proc/acpi/event interface 2013-07-15 13:56:36 +02:00
cm_sbs.c
container.c Merge branch 'acpi-assorted' 2013-04-28 01:54:08 +02:00
custom_method.c
debugfs.c
device_pm.c ACPI / PM: Add state information to error message in acpi_device_set_power() 2013-08-03 21:13:22 +02:00
dock.c Merge branch 'acpi-assorted' 2013-08-27 01:29:04 +02:00
ec_sys.c ACPI / EC: access user space with get_user()/put_user() 2013-06-19 23:29:20 +02:00
ec.c Merge branch 'acpi-assorted' 2013-08-30 14:13:50 +02:00
event.c ACPI: Remove the old /proc/acpi/event interface 2013-07-15 13:56:36 +02:00
fan.c ACPI / PM: Use ACPI_STATE_D3_COLD instead of ACPI_STATE_D3 everywhere 2013-07-30 14:36:20 +02:00
glue.c ACPI / bind: Prefer device objects with _STA to those without it 2013-09-09 23:07:47 +02:00
hed.c
internal.h Merge back earlier 'acpi-assorted' material 2013-08-14 23:22:45 +02:00
Kconfig Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2013-09-05 09:31:03 -07:00
Makefile i2c: move ACPI helpers into the core 2013-08-23 10:22:29 +02:00
numa.c ACPI / numa: Fix __init attribute location in slit_valid() 2013-08-13 12:35:42 +02:00
nvs.c
osl.c Merge branch 'acpi-assorted' 2013-08-27 01:29:04 +02:00
pci_irq.c
pci_link.c ACPI: Set length even for TYPE_END_TAG acpi resource 2013-03-24 01:00:38 +01:00
pci_root.c Merge branch 'pci/misc' into next 2013-08-29 17:23:33 -06:00
pci_slot.c ACPI / PCI: Make bus registration and unregistration symmetric 2013-07-23 03:58:42 +02:00
power.c Merge branch 'acpi-pm' 2013-08-27 01:28:17 +02:00
proc.c ACPI / PM: Walk physical_node_list under physical_node_lock 2013-08-06 02:26:22 +02:00
processor_core.c Merge back earlier 'acpi-assorted' material 2013-08-14 23:22:45 +02:00
processor_driver.c Merge branch 'acpi-processor' 2013-08-27 01:29:24 +02:00
processor_idle.c acpi: delete __cpuinit usage from all acpi files 2013-07-14 19:36:58 -04:00
processor_perflib.c ACPI: introduce helper function acpi_has_method() 2013-07-15 01:33:10 +02:00
processor_thermal.c ACPI / processor: Remove acpi_processor_get_limit_info() 2013-08-13 12:11:22 +02:00
processor_throttling.c ACPI: suppress compiler warnings in processor_throttling.c 2013-03-25 00:05:48 +01:00
reboot.c
resource.c ACPI: introduce helper function acpi_has_method() 2013-07-15 01:33:10 +02:00
sbs.c ACPI: Remove the old /proc/acpi/event interface 2013-07-15 13:56:36 +02:00
sbshc.c
sbshc.h
scan.c Merge branch 'acpi-hotplug' 2013-09-10 23:14:53 +02:00
sleep.c Merge branch 'acpi-assorted' 2013-08-27 01:29:04 +02:00
sleep.h
sysfs.c Merge branch 'akpm' (updates from Andrew Morton) 2013-07-03 17:12:13 -07:00
tables.c
thermal.c Merge branch 'acpi-assorted' 2013-08-30 14:13:50 +02:00
utils.c ACPI: introduce two helper functions for _EJ0 and _LCK 2013-07-15 01:33:10 +02:00
video_detect.c Merge branch 'acpi-cleanup' 2013-08-27 01:25:28 +02:00
video.c Merge branch 'acpi-video' 2013-08-27 01:40:40 +02:00
wakeup.c