issue linking pthread/OSSpinLock-related libraries for kext

Questions and Answers about all things *OS (macOS, iOS, tvOS, watchOS)

Re: issue linking pthread/OSSpinLock-related libraries for k

Postby broly » Mon Apr 30, 2018 4:24 pm


It turns out our attempt to use wait_assert_timeout causes a panic:

Anonymous UUID: 9DD1C300-68BB-0152-2C74-E8415A6CC86C

Mon Apr 30 10:04:35 2018

*** Panic Report ***
panic(cpu 2 caller 0xffffff800f96446d): "wait_queue_assert_wait64_locked"@/SourceCache/xnu/xnu-2782.70.3/osfmk/kern/wait_queue.c:1193
Backtrace (CPU 2), Frame : Return Address
0xffffff8e2b673c10 : 0xffffff800f92ae01
0xffffff8e2b673c90 : 0xffffff800f96446d
0xffffff8e2b673cf0 : 0xffffff800f93f53a
0xffffff8e2b673d60 : 0xffffff7f9204c64f
0xffffff8e2b673d90 : 0xffffff7f9204c5b8
0xffffff8e2b673de0 : 0xffffff7f9204d4c3
0xffffff8e2b673e10 : 0xffffff7f92049645
0xffffff8e2b673e40 : 0xffffff7f9185a089
0xffffff8e2b673e70 : 0xffffff800feb3cfd
0xffffff8e2b673eb0 : 0xffffff800feb37ef
0xffffff8e2b673f30 : 0xffffff800feae583
0xffffff8e2b673f70 : 0xffffff800feb4493
0xffffff8e2b673fb0 : 0xffffff800fa11867
Kernel Extensions in backtrace:[76E5591A-B495-3994-82C9-D4AFE7248ACD]@0xffffff7f91856000->0xffffff7f91885fff

BSD process name corresponding to current thread: kernel_task
Boot args: kext-dev-mode=1 nvda_drv=1

Mac OS version:

Kernel version:
Darwin Kernel Version 14.5.0: Sun Jun 4 21:40:08 PDT 2017; root:xnu-2782.70.3~1/RELEASE_X86_64
Kernel UUID: <snip>
Kernel slide: 0x000000000f600000
Kernel text base: 0xffffff800f800000
__HIB text base: 0xffffff800f700000
System model name: MacPro5,1 <snip>

System uptime in nanoseconds: 774610884354
last loaded kext at 774586084507: com.CMedia.CMI8788.PCIAudioDriver 1337 (addr 0xffffff7f92046000, size 167936)
last unloaded kext at 585502114270: com.CMedia.CMI8788.PCIAudioDriver 1337 (addr 0xffffff7f92046000, size 73728)
loaded kexts:
com.CMedia.CMI8788.PCIAudioDriver 1337
com.nvidia.CUDA 1.1.0
com.rim.driver.BlackBerryVirtualPrivateNetwork 1.0.18
com.paragon-software.filesystems.extfs 616.1.11
com.FTDI.driver.FTDIUSBSerialDriver 2.3
com.orderedbytes.driver.ControllerMateFamily 4.4.3
com.nvidia.web.GeForceWeb 10.0.5
com.nvidia.web.NVDAGF100HalWeb 10.0.5
com.nvidia.web.NVDAResmanWeb 10.0.5
com.nvidia.NVDAStartup 10.0.5
com.paragon-software.lvm-for-mac 1
com.orderedbytes.driver.CMUSBDevices 4.4.3
com.rim.driver.BlackBerryUSBDriverInt 2.2.7

of course i have accepted that there is no pthread_cond_timedwait available, but i was hoping maybe we can get back to the drawing board as to how i can wait on this specific condition.
gonna comment the wait-related fns out and see if the driver is stable.
Posts: 13
Joined: Wed Apr 25, 2018 4:30 pm

Re: issue linking pthread/OSSpinLock-related libraries for k

Postby broly » Tue Dec 04, 2018 1:32 am


sorry for resurrecting this post, but after having worked on other parts of the driver, it seems the timed condition stuff is still a chore.

i tried to encapsulate the condition a kern_return_t function for event_t, but that did not help ( ... 8f2e469afc)

is there anything weaker than assert_wait to timeout on a condition? it seems this function is predominantly used by the kernel's innards, and while a PCIAudioDevice is definitely in that category when it's operating, i just think i'm not using it right or something.

it seems this pitch/catch scenario is one of the larger remaining hurdles before i can start playing with the ioaudiocontrol/stream stuff.
Posts: 13
Joined: Wed Apr 25, 2018 4:30 pm

Re: issue linking pthread/OSSpinLock-related libraries for k

Postby broly » Wed Dec 05, 2018 12:57 am

sorry for the additonal post, but i was going to ask if the wait_queue API exists in 10.10.

i know for older OSX versions it does, but i cannot find the header at all for 10.10.

it seems wait_queue_assert_wait would be something worth trying. unfortunately the only SDK i can find with this header is 10.3.9: ... it_queue.h

i tried shoehorning that code into my stuff before, which was obviously a bad idea, so yeah i've tried to add it manually :/
Posts: 13
Joined: Wed Apr 25, 2018 4:30 pm


Return to Questions and Answers

Who is online

Users browsing this forum: No registered users and 3 guests