On Wed, Jan 25, 2017 at 11:11:03AM -0500, David Hill wrote:
> On Wed, Jan 25, 2017 at 04:32:25PM +1000, Martin Pieuchot wrote:
> > I just enabled the NET_LOCK() again and I'm looking for test reports.
> > Please go build a kernel from sources or wait for the next snapshot,
> > run it and report back.
> >
> > If you're looking for some small coding tasks related to the NET_LOCK()
> > just do:
> >
> > # sysctl kern.splassert=2
> > # sysctl kern.pool_debug=2
> >
> > Then watch for the traces on your console.
> >
> > You'll see something like:
> >
> > Starting stack trace...
> > yield(0,1,d09dac52,f5549dbc,d94e9378) at yield+0xa4
> > yield(d0bc8f40,1,f5549e18,80,14) at yield+0xa4
> > pool_get(d0bc8f40,1,f5549ec8,d03ecbfb,d97815f4) at pool_get+0x1ba
> > m_get(1,3,f5549ec0,d03a9362,d0bc22e0) at m_get+0x30
> > doaccept(d977e6c4,3,cf7ee4f8,cf7ee4ec,2000) at doaccept+0x193
> > sys_accept(d977e6c4,f5549f5c,f5549f7c,0,f5549fa8) at sys_accept+0x37
> > syscall() at syscall+0x250
> >
> > This means accept(2) is doing a memory allocation that can sleep, here
> > with m_get(9), while holding the NET_LOCK(). Even if these should be
> > ok, it is easy to avoid them. In the case of doaccept() a mbuf could
> > be allocated beforehand or simply use the stack for that.
> >
> > Cheers,
> > Martin
> >
>
> splassert: yield: want 0 have 1
> Starting stack trace...
> yield() at yield+0xac
> malloc() at malloc+0x406
> ip6_setmoptions() at ip6_setmoptions+0x65
> ip6_ctloutput() at ip6_ctloutput+0x6d9
> sosetopt() at sosetopt+0x8e
> sys_setsockopt() at sys_setsockopt+0x12d
> syscall() at syscall+0x27b
> --- syscall (number 105) ---
> end of kernel
> end trace frame: 0x1b1987be0028, count: 250
> 0x1b197d24b80a:
> End of stack trace.
>
>
Switch to NOWAIT? Check is already there...
Index: netinet6/ip6_output.c
===================================================================
RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
retrieving revision 1.221
diff -u -p -r1.221 ip6_output.c
--- netinet6/ip6_output.c 19 Jan 2017 14:49:19 -0000 1.221
+++ netinet6/ip6_output.c 26 Jan 2017 01:10:58 -0000
@@ -1902,7 +1902,7 @@ ip6_setmoptions(int optname, struct ip6_
* allocate one and initialize to default values.
*/
im6o = (struct ip6_moptions *)
- malloc(sizeof(*im6o), M_IPMOPTS, M_WAITOK);
+ malloc(sizeof(*im6o), M_IPMOPTS, M_NOWAIT);
if (im6o == NULL)
return (ENOBUFS);