Bug 6634
Summary: | semaphore/mutex/spinlock optimization | ||
---|---|---|---|
Product: | ACPI | Reporter: | Len Brown (lenb) |
Component: | ACPICA-Core | Assignee: | Robert Moore (Robert.Moore) |
Status: | CLOSED CODE_FIX | ||
Severity: | normal | CC: | acpi-bugzilla, matthew |
Priority: | P2 | ||
Hardware: | i386 | ||
OS: | Linux | ||
Kernel Version: | 2.6.17 | Subsystem: | |
Regression: | --- | Bisected commit-id: | |
Bug Depends on: | |||
Bug Blocks: | 6612 |
Description
Len Brown
2006-05-31 22:33:59 UTC
Specific example (from bug #6612): acpi_set_register() calls acpi_ut_acquire_mutex(ACPI_MTX_HARWARE) which calls acpi_os_wait_semaphore(). Not only is the semaphore over-kill for protecting a simple RMW to a register, but using it means that acpi_set_register() (and acpi_clear_event() which calls it) can not be called from interrupt context. Looks like ACPI_MTX_HARDWARE should be implemented with a spin-lock and accessed with spin_lock_irqsave()/spin_lock_irqrestore() -- the lowest overhead locking mechanism available in the kernel asside from atomic memory accesses themselves. We already have separate spin lock OSL interfaces: acpiosxf.h(215):AcpiOsCreateLock ( acpiosxf.h(219):AcpiOsDeleteLock ( acpiosxf.h(223):AcpiOsAcquireLock ( acpiosxf.h(227):AcpiOsReleaseLock ( And semaphores/mutexes are very similar since a mutex is essentially a special case semaphore. First step will be to use a spinlock instead of a mutex for the ACPI hardware lock. step mentioned in comment #3 shipped in ACPICA 20060608, which is integrated into the linux acpi-test tree. ACPI_MTX_HARDWARE (a semaphore) is replaced by acpi_gbl_hardware_lock (a spin-lock) For ACPICA 20060623, deployed the ACPI_SPINLOCK type for the OSL lock interfaces, and implemented the first pass at new Mutex OSL interfaces. These are defined as macros that map them to the existing semaphore interfaces for the time being, the macros will go away in a future release. Linux needs a timed-wait mutex acquire interface before ACPICA can use the Linux mutex object. Bob, what's the status of this bug? :) > Linux needs a timed-wait mutex acquire interface before ACPICA can use the > Linux mutex object. Matthew Wilcox has proposed a solution: [PATCH 5/6] Add down_timeout and change ACPI to use it http://lkml.org/lkml/2008/3/14/309 shipped in linux-2.6.26-rc1 -- closed. commit f1241c87a16c4fe9f4f51d6ed3589f031c505e8d Author: Matthew Wilcox <matthew@wil.cx> Date: Fri Mar 14 13:43:13 2008 -0400 Add down_timeout and change ACPI to use it |