Re: sysctl locking

From: Suleiman Souhlal (ssouhlal_at_FreeBSD.org)
Date: 12/13/04

  • Next message: Joe Kelsey: "Fixing Posix semaphores"
    Date: Mon, 13 Dec 2004 17:03:29 -0500
    To: Max Laier <max@love2party.net>
    
    

    Hi,

    On Dec 13, 2004, at 3:13 AM, Max Laier wrote:

    > You have identified two places where Giant is explicitly asserted, but
    > I am
    > afraid that there are much more handlers that don't assert Giant but
    > need it.
    > Moreover, the "simple" handler might also write to memory that is
    > implicitly
    > protected by Giant and should not be modified without it.

    Right.

    > As a transition step I suggest that we extend the API in the way the
    > callout
    > API works. So that you can ask for a Giant-free handler call by
    > setting an
    > MPSAFE flag.
    >
    > On a side note, I am not sure if I like the string copy thing - while I
    > understand the intention. Neither am I sure if it is a good idea to
    > introduce
    > "yet another sleep lock/reference count thingy"[tm] before sitting
    > down and
    > giving some attention to the existing sx(9) implementation. I haven't
    > fully
    > read/understand your ref-count there, hence I can not tell if sx(9)
    > will
    > really work - and I know (very well) that sx(9) isn't the optimal
    > answer
    > sometimes (most of the time). But I am suggesting that we give that a
    > closer
    > look before reinventing the wheel over and over again. Oh, and last but
    > *definitely* least, your patch could use some style(9) facelifting.
    > e.g. tab
    > after #define.

    The patch at http://people.freebsd.org/~ssouhlal/sysctl-sx-locking.diff
    fixes most of your concerns. It unconditionally acquires Giant just
    before calling the handler, but I'm hoping that we'll find another
    solution. It also uses sx(9), and requires the following patch to be
    applied: http://people.freebsd.org/~ssouhlal/sx_xlocked.diff .
    The latter creates a new function, int sx_xlocked(struct sx *sx), that
    returns non-zero when the exclusive lock is held by the current thread,
    and zero otherwise.

    Bye.

    --
    Suleiman Souhlal     | ssouhlal@vt.edu
    The FreeBSD Project  | ssouhlal@FreeBSD.org
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
    

  • Next message: Joe Kelsey: "Fixing Posix semaphores"

    Relevant Pages

    • Re: sysctl locking
      ... > removes Giant from the sysctl subsystem. ... you can't just assert that all sysctl handler are MPSAFE. ... afraid that there are much more handlers that don't assert Giant but need it. ... the "simple" handler might also write to memory that is implicitly ...
      (freebsd-current)
    • [PATCH] drivers/serial/sunzilog: Interrupt enable before ISR handler installed
      ... I have added a from line, comment and signed-off-by line to the attached patch file. ... The attached patch changes the interrupt enable sequence for the sunzilog ... handler has been installed. ... switch (cflag & CSIZE) { ...
      (Linux-Kernel)
    • Re: [PATCH 5/8] ide-cd: remove handler wrappers
      ... There should be no functionality change resulting from this patch. ... HANDLER is the routine ... Send a packet command to DRIVE described by CMD_BUF and CMD_LEN. ... nonzero if the request has been terminated. ...
      (Linux-Kernel)
    • Re: Giantless VFS.
      ... On Sat, 2004-11-20 at 00:24 -0500, Jeff Roberson wrote: ... > I have a patch that I would like people to test and review. ... > This patch removes Giant from the read, write, and fstatsyscalls, ... > number of lock operations for the common cases which resulted in a couple ...
      (freebsd-current)
    • Giantless VFS.
      ... I have a patch that I would like people to test and review. ... This patch removes Giant from the read, write, and fstatsyscalls, ... There is now a per mount-point mutex in struct ufsmount that covers ffs's ... number of lock operations for the common cases which resulted in a couple ...
      (freebsd-current)