Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

why no IOSimpleLockSleep()?



Why is there no spin-lock variant of IOLockSleep()?  Is it by design?
(perhaps because what I want to do is frowned upon?).  Or is it just an
accidental omission from the API and I should file an enhancement
request?

Here is some background:

Many of my device interrupts are done to deliver latency critical
wakeups to a blocked userspace thread.  The sleep/interrupt/wakeup
process currently add over 10us of end-to-end latency over a simple
polling approach (which itself is 3.5us).  If possible, I'd like to
issue these wakeups from a filter interrupt, rather than from my
workloop, so as to avoid the extra context switch into my workloop.

I currently use IOLockSleep() to block the userspace thread.  This
boils down to the Mach lck_mtx_sleep() function.  Unfortunately,
to avoid missed wakeup races, it requires that the wakeup be
issued while holding the lock.  Since this is a sleep lock,
that means the wakeup can not be issued from a hardware interrupt
context.

The good news is that there is a corresponding Mach variant of
lck_mtx_sleep() called lck_spin_sleep() that I could use.  If
I understand things correctly, it is OK to grab a spinlock
(IOSimpleLock) from a hardware interrupt context.  It would
have to be OK to be able to schedule workloops...

My worry is that there is no IOSimpleLockSleep(), and I would have to
call a Mach function directly.  Since I've been burned by going around
IOKit in the past,  I thought should I ask why the IOKit wrapper is not
there..

Thanks,

Drew

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.