Re: Is socket buffer locking as questionable as it seems?

From: Robert Watson (rwatson_at_FreeBSD.org)
Date: 10/04/03

  • Next message: Sam Leffler: "Re: Is socket buffer locking as questionable as it seems?"
    Date: Sat, 4 Oct 2003 11:21:45 -0400 (EDT)
    To: Brian Fundakowski Feldman <green@FreeBSD.org>
    
    

    On Sat, 4 Oct 2003, Brian Fundakowski Feldman wrote:

    > I keep getting these panics on my SMP box (no backtrace or DDB or crash
    > dump of course, because panic() == hang to FreeBSD these days): panic:
    > receive: m == 0 so->so_rcv.sb_cc == 52 From what I can tell, all sorts
    > of socket-related calls are "MP-safe" and yet never even come close to
    > locking the socket buffer. From what I can tell, the easiest way for
    > this occur would be sbrelease() being called from somewhere that it's
    > supposed to, but doesn't, have sblock(). Has anyone seen these, or a
    > place to start looking? Maybe a way to get panics to stop hanging the
    > machine? TIA if anyone has some enlightenment.

    The system calls are marked MPSAFE in the case of the socket calls because
    the grabbing of Giant has been pushed down into the system call, as
    opposed to Giant being grabbed by the system call code itself. Giant
    should be held across all the relevant socket-related events -- if you
    find a place where it's not, send some details :-). As you observe, there
    is currently no socket locking in the source tree, although I'm hopeful
    that will be remedied in the next couple of months. The lower levels of
    the IP stack can be run Giant-free at this point, although my local
    patches to run multiple input paths in parallel runs into a panic due to
    insufficient locking in ip_forward() (bug report already filed with Sam).

    One of the conclusions from the recent developer summit was that a big
    focus needs to be placed on interrupt processing latency and device driver
    improvements so that we get the benefits of finger-grained locking.
    Peter's has picked up the task of doing a driver API sweep to provide
    better facilities for doing this.

    Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
    robert@fledge.watson.org Network Associates Laboratories

    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Sam Leffler: "Re: Is socket buffer locking as questionable as it seems?"

    Relevant Pages

    • Network Stack Locking
      ... things like locking strategies in this e-mail. ... "Network Stack Locking" task of SMPng. ... Additional work is taking place to explore socket locking issues in: ... acquire Giant without generating a lock order issue. ...
      (freebsd-arch)
    • Re: Locking Wheel Nut
      ... At a service today the garage asked where the key was for the locking ... wheel nuts. ... I now realise what the odd looking socket was for. ...
      (uk.rec.cars.maintenance)
    • HEADS UP: Starting socket locking merge
      ... Over the past few days, I've merged locking for the accept path, locking ... I'm now beginning a merge of socket locking itself. ... Because I'm breaking this out into a series of function commits and ... reporting new poor behavior in the network stack. ...
      (freebsd-current)
    • Re: Kernel threads and printf locking question
      ... Is locking Giant the only possible way to avoid problems on SMP ... Giant has nothing to do with printf. ...
      (freebsd-current)
    • [PATCH] pcn(4) locking fixes, please test!
      ... running with Giant, so I fixed up the locking in the driver so that it should ... be MP safe now. ...
      (freebsd-current)