Re: malloc(M_WAITOK) of "Mbuf", forcing M_NOWAIT with the following non-sleepable locks held

From: Willem Jan Withagen <wjw_at_withagen.nl>
Date: Mon, 5 Jul 2004 21:23:51 +0200
From: "Robert Watson" <rwatson_at_FreeBSD.org>
To: "Willem Jan Withagen" <wjw_at_withagen.nl>
Sent: Monday, July 05, 2004 8:41 PM
Subject: Re: malloc(M_WAITOK) of "Mbuf", forcing M_NOWAIT with the following
non-sleepable locks held


>
> On Mon, 5 Jul 2004, Willem Jan Withagen wrote:
>
> > __FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.191 2004/06/27 03:22:15
> > rwatson Exp $");
>
> Could you try this patch:
>
> Index: uipc_socket.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/kern/uipc_socket.c,v
> retrieving revision 1.191
> diff -u -r1.191 uipc_socket.c
> --- uipc_socket.c 27 Jun 2004 03:22:15 -0000 1.191
> +++ uipc_socket.c 5 Jul 2004 18:38:12 -0000
> _at__at_ -1148,8 +1148,11 _at__at_
>   if (flags & MSG_PEEK)
>   moff += len;
>   else {
> - if (mp != NULL)
> + if (mp != NULL) {
> + SOCKBUF_UNLOCK(&so->so_rcv);
>   *mp = m_copym(m, 0, len, M_TRYWAIT);
> + SOCKBUF_LOCK(&so->so_rcv);
> + }
>   m->m_data += len;
>   m->m_len -= len;
>   so->so_rcv.sb_cc -= len;
> Index: uipc_socket.c
> ===================================================================

Not shure if we are any further, or that this in the code supped between 2 juli
and this morning....

panic: mi_switch: called by old code
cpuid = 1;
Stack backtrace:
backtrace() at backtrace+0x17
panic() at panic+0x1d2
mi_switch() at mi_switch+0xcf
maybe_preempt() at maybe_preempt+0xd0
sched_add() at sched_add+0x2dd
kseq_assign() at kseq_assign+0x45
sched_choose() at sched_choose+0x5b
choosethread() at choosethread+0x3d
sched_switch() at sched_switch+0x126
mi_switch() at mi_switch+0x23b
ast() at ast+0x35f
Xfast_syscall() at Xfast_syscall+0xdd
--- syscall (0), rip = 0x20069afdc, rsp = 0x7fffffffe8a8, rbp =
0x7fffffffe8e0 ---
Debugger("panic")
timeout stopping cpus
Stopped at      Debugger+0x4d:  xchgl   %ebx,0x27d091

Writing a 2Gb dump now.....

--WjW
Received on Mon Jul 05 2004 - 17:31:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:00 UTC