so_rcv_sx, deadlkres, SIGSTOP

Jilles Tjoelker jilles at stack.nl
Fri Apr 9 23:09:46 UTC 2010


On Mon, Apr 05, 2010 at 11:13:31PM +0100, Robert Watson wrote:
> On Sun, 4 Apr 2010, Jilles Tjoelker wrote:

> > The SX locks so_snd_sx and so_rcv_sx can be legitimately held for arbitrary 
> > amounts of time, while waiting until a send or recv is possible. Any other 
> > threads wanting to send/recv on the socket will sleep interruptibly on the 
> > corresponding SX. If deadlkres is activated, it may detect a deadlock even 
> > though there is no problem.

> Actually, on the whole, socket buffer sx lock acquisition is interruptible. 
> There are a few exceptions, such as during socket shutdown, and in an RPC 
> layer or two, but in the general case we want Ctrl-C to interrupt recv() and 
> send(), so use interruptible sleeps.

The exceptions are:
* portalfs uses SB_NOINTR to make both sblock() and sbwait() 
  uninterruptible, for connections to a daemon on the local machine
* sorflush() (part of shutdown) uses SBL_NOINTR to wait for socket 
  buffer activity to terminate after calling socantrcvmore(); this seems
  OK because it will not wait for the network, and must be because 
  shutdown(2) should not return EINTR
* kern_sendfile() uses SBL_NOINTR with sblock() but then sbwait()s 
  interruptibly; this doesn't make sense to me because sblock() waits 
  for the network just like sbwait() except that another thread happens
  to be waiting already

-- 
Jilles Tjoelker


More information about the freebsd-arch mailing list