linux/drivers/acpi
Lv Zheng 7b98447722 ACPI / IPMI: Add reference counting for ACPI IPMI transfers
This patch adds reference counting for ACPI IPMI transfers to tune the
locking granularity of tx_msg_lock.

This patch also makes the whole acpi_ipmi module's coding style consistent
by using reference counting for all its objects (i.e., acpi_ipmi_device and
acpi_ipmi_msg).

The acpi_ipmi_msg handling is re-designed using referece counting.
 1. tx_msg is always unlinked before complete(), so that it is safe to put
    complete() out side of tx_msg_lock.
 2. tx_msg reference counters are incremented before calling
    ipmi_request_settime() and tx_msg_lock protection is added to
    ipmi_cancel_tx_msg() so that a complete() can be safely called in
    parellel with tx_msg unlinking in failure cases.
 3. tx_msg holds a reference to acpi_ipmi_device so that it can be flushed
    and freed in the contexts other than acpi_ipmi_space_handler().

The lockdep_chains shows all acpi_ipmi locks are leaf locks after the
tuning:
 1. ipmi_lock is always leaf:
    irq_context: 0
    [ffffffff81a943f8] smi_watchers_mutex
    [ffffffffa06eca60] driver_data.ipmi_lock
    irq_context: 0
    [ffffffff82767b40] &buffer->mutex
    [ffffffffa00a6678] s_active#103
    [ffffffffa06eca60] driver_data.ipmi_lock
 2. without this patch applied, lock used by complete() is held after
    holding tx_msg_lock:
    irq_context: 0
    [ffffffff82767b40] &buffer->mutex
    [ffffffffa00a6678] s_active#103
    [ffffffffa06ecce8] &(&ipmi_device->tx_msg_lock)->rlock
    irq_context: 1
    [ffffffffa06ecce8] &(&ipmi_device->tx_msg_lock)->rlock
    irq_context: 1
    [ffffffffa06ecce8] &(&ipmi_device->tx_msg_lock)->rlock
    [ffffffffa06eccf0] &x->wait#25
    irq_context: 1
    [ffffffffa06ecce8] &(&ipmi_device->tx_msg_lock)->rlock
    [ffffffffa06eccf0] &x->wait#25
    [ffffffff81e36620] &p->pi_lock
    irq_context: 1
    [ffffffffa06ecce8] &(&ipmi_device->tx_msg_lock)->rlock
    [ffffffffa06eccf0] &x->wait#25
    [ffffffff81e36620] &p->pi_lock
    [ffffffff81e5d0a8] &rq->lock
 3. with this patch applied, tx_msg_lock is always leaf:
    irq_context: 0
    [ffffffff82767b40] &buffer->mutex
    [ffffffffa00a66d8] s_active#107
    [ffffffffa07ecdc8] &(&ipmi_device->tx_msg_lock)->rlock
    irq_context: 1
    [ffffffffa07ecdc8] &(&ipmi_device->tx_msg_lock)->rlock

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-30 19:46:12 +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: Add reference counting for ACPI IPMI transfers 2013-09-30 19:46:12 +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 The sweeping change is to make add_taint() explicitly indicate whether to disable 2013-02-25 15:41:43 -08:00
debugfs.c acpi: add export.h to files using THIS_MODULE/EXPORT_SYMBOL 2011-10-31 19:30:34 -04:00
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 ACPI: Remove useless type argument of driver .remove() operation 2013-01-26 00:37:24 +01:00
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 ACPI / PM: print physical addresses consistently with other parts of kernel 2012-03-30 02:46:57 -04:00
osl.c Merge branch 'acpi-assorted' 2013-08-27 01:29:04 +02:00
pci_irq.c PCI/ACPI: Don't cache _PRT, and don't associate them with bus numbers 2013-02-16 11:58:34 -07:00
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 Revert "ACPI: ignore FADT reset-reg-sup flag" 2012-04-20 11:19:35 -07:00
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 ACPI: Remove useless type argument of driver .remove() operation 2013-01-26 00:37:24 +01:00
sbshc.h
scan.c ACPI / scan: fix typo in comments of acpi_bus_unregister_driver() 2013-09-25 19:46:48 +02:00
sleep.c Merge branch 'acpi-assorted' 2013-08-27 01:29:04 +02:00
sleep.h ACPI: Drop power resources driver 2013-01-17 14:11:06 +01:00
sysfs.c Merge branch 'akpm' (updates from Andrew Morton) 2013-07-03 17:12:13 -07:00
tables.c ACPICA: Cleanup table handler naming conflicts. 2013-01-11 13:10:16 +01:00
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