Theo Buehler wrote: > On Fri, May 25, 2018 at 10:35:35AM +0200, Martin Pieuchot wrote: > > On 22/05/18(Tue) 15:39, Martin Pieuchot wrote: > > > By assuming that `f_data' is immutable, which AFAIK is true for sockets, > > > we can remove the KERNEL_LOCK() from the following syscalls iff files are > > > refcounted in an MP-safe way. > > > > > > This diff includes the EBUSY check in dup2(2) which is currently required > > > to avoid races with accept(2) and will later make our life easier wrt > > > open(2). > > > > > > It also includes the fdinsert() diff I sent earlier. > > > > > > On top of that I'm introducing a global mutex, `fhdlk', that protects > > > `f_count' and the implicit reference in `filehead'. > > > > > > A socket stays alive as long as its associated file has a positive > > > refcount. When this refcount drops, fdrop() will be called and soclose() > > > will free/clean `f_data'. That's the only place where `f_data' is > > > changed during the life of a socket. That's why it is safe to dereference > > > `f_data' when getsock() returned a valid & refcounted `fp'. > > > > > > Many ktrace(2) internals now need to grab the KERNEL_LOCK(), just like > > > ptsignal(). > > > > > > Note that for unix, routing and pfkey sockets, solock() still grabs the > > > KERNEL_LOCK(). So even if syscalls are marked as SY_NOLOCK that doesn't > > > mean they won't grab it. In fact some network functions like > > > ifa_ifwithaddr() below now need to grab the KERNEL_LOCK(). That's good > > > that means we're pushing the lock down. > > > > > > Tests? Comments? > > > > Updated diff that should prevent reported hangs, as analyzed by tb@ and > > visa@. > > I've been running this on my main laptop since Visa figured out the > problem on Wednesday and saw no more issues since then. I've completed > a make build with a WITNESS kernel while letting youtube play videos. >
Hello, Same here, been running with this since last night and I can't reproduce the hang despite hitting hard on it. (The hang would happen in 10 seconds after starting chrome on my machine). Mathieu-