DragonFly submit List (threaded) for 2006-11
DragonFly BSD
DragonFly submit List (threaded) for 2006-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ACPI-CA update patch for review


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Thu, 30 Nov 2006 14:57:31 +0100

YONETANI Tomokazu wrote:
:- hand-rolled locking code in AcpiOs{Acquire,Release}Lock() functions:
:  ACPI-CA code has been rewritten in 20060623 to make these functions
:  to be used as spinlock functions, and called from many places where
:  they weren't before.  Since our implementation of these locking functions
:  used lockmgr lock, which cannot be called from cpu_idle(), this led to
:  a panic(mainly when my laptop wakes up from sleep state).  After struggling
:  with other locking primitives, I ended up with critical section and
:  special-cased the idlethread.  I believed this shouldn't make the situation
:  worse, as ACPI functions called from cpu_idle_hook code in acpi_cpu did
:  not using locking before.  But I'm open to a better implementation,
:  especially how to deal with locking when called from idlethread.
    You could probably use tokens here, but a critical section ought to
    work as well since ACPI functions are only called from cpu #0.
Does that apply to ioctl or sysctl support code, too?  Can you shed
some light on me to find how it's guaranteed?

First, why don't you use spinlocks then (note: I didn't read the code)?


To just use a critical section, you'd have to migrate the calling thread to cpu0, or have a acpi thread running on cpu0, and send a synchronous message to this thread, processing your request.

How are the guarantees the ACPI code gives? Will it ever call a blocking function (kmalloc M_WAITOK, etc) while holding the lock? Does it expect the lock to persist? If yes, that's ugly and you'd have to use lockmgr locks and an own thread.

Why are the ACPI functions called from the idle thread, anyways?

cheers
 simon

--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \

Attachment: signature.asc
Description: OpenPGP digital signature



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]