Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Nov 2005 12:36:37 -0800
From:      Julian Elischer <julian@elischer.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: locking in a device driver
Message-ID:  <43692355.1080003@elischer.org>
In-Reply-To: <20051102.132709.101593999.imp@bsdimp.com>
References:  <20051027.205250.55834228.imp@bsdimp.com>	<43690424.1040904@alphaque.com>	<43690EED.10703@elischer.org> <20051102.132709.101593999.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
M. Warner Losh wrote:

>In message: <43690EED.10703@elischer.org>
>            Julian Elischer <julian@elischer.org> writes:
>: Dinesh Nair wrote:
>: 
>: >
>: >
>: > On 10/28/05 10:52 M. Warner Losh said the following:
>: >
>: >> libc_r will block all other threads in the application while an ioctl
>: >> executes.  libpthread and libthr won't.  I've had several bugs at work
>: >
>: >
>: > so if the userland thread does an ioctl, and the the driver goes to 
>: > tsleep() when the ioctl is received, all other threads are also 
>: > blocked from executing, i.e wont be context switched to run ?
>: 
>: in 4.x and earlier. a tsleep saves your spl level but re-enables the 
>: interrupts (from memory)
>: when you re-awaken you are given your spl level again.. 
>
>That's true, but irrelevant.
>  
>

yes I misread the question.

>: All other threads are allowed to run.
>
>That is not true.[*] *NO* other threads in your process run.  Period.
>None.  Zero.  Nada.  Zilch.  Your process is hung until the ioctl
>returns.  That's the fundamental problem with userland thread packages
>such as libc_r.
>  
>

the answer is in the misread context and should have read,
"while your process is doingthe tsleep other processes can run"

I missed the bit about him talking about libc_r
and was thinking about only in the kernel.

>I've had to work around this issue many times, and I'm 100% certain
>that this is the case: sleep in an ioctl, and the entire process hangs
>until the ioctl returns.
>
>Warner
>
>[*] Other processes on the system will run, true.  Interrutps will
>happen and run.  But that's not what was being ask.
>  
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43692355.1080003>