tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Locking confusion

I have a socket address family I'm trying to put into 5.2.  When I put
it into 4.0.1, I asked about locking and was told, basically, not to
worry because the kernel was still giantlocked.  This appears to not be
true of 5.2, so I was trying to get the locking code right.

But there are some things which confuse me.  For example, udp_usrreq's
PRU_DETACH calls in_pcdetach, which ends with a mutex_enter on
softnet_lock.  This is commented as "reacquire the softnet_lock"; I
didn't see where it was first acquired or where it was dropped in that
code path, but there's a lot of code there.  Instead, I looked at the
code following it, to see where the lock was released, and I can't see
any, looking at (for exmaple) the close(2) path.  And udp_usrreq does
splsoftnet(), which seems moderately useless to me in a MP world.

And, just to keep things interesting, unp_detach, which is all the
AF_LOCAL PRU_DETACH handler calls, doesn't do this as far as I can see.

So I clearly am missing something.  But what?  What locking do I need
here, beyond of course the locking my AF code needs internally?

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML      
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index