From robert@fledge.watson.org  Tue Aug 29 14:22:37 2000
Return-Path: <robert@fledge.watson.org>
Received: from fledge.watson.org (fledge.watson.org [204.156.12.50])
	by hub.freebsd.org (Postfix) with ESMTP id 704A937B423
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 Aug 2000 14:22:36 -0700 (PDT)
Received: (from robert@localhost)
	by fledge.watson.org (8.9.3/8.9.3) id RAA02996;
	Tue, 29 Aug 2000 17:22:35 -0400 (EDT)
	(envelope-from robert)
Message-Id: <200008292122.RAA02996@fledge.watson.org>
Date: Tue, 29 Aug 2000 17:22:35 -0400 (EDT)
From: rwatson@freebsd.org
Sender: robert@fledge.watson.org
Reply-To: rwatson@freebsd.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: looutput: mbuf allocation failed
X-Send-Pr-Version: 3.2

>Number:         20927
>Category:       kern
>Synopsis:       dmesg output: looutput: mbuf allocation failed
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    silby
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 29 14:30:00 PDT 2000
>Closed-Date:    Mon Jun 02 14:57:38 PDT 2003
>Last-Modified:  Mon Jun 02 14:57:38 PDT 2003
>Originator:     Robert Watson
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
>Environment:

fledge:/data/fbsd-stable/src/sys/net> uname -a
FreeBSD fledge.watson.org 4.1-STABLE FreeBSD 4.1-STABLE #2: Fri Jul 28 01:08:28 EDT 2000     root@fledge.watson.org:/data/fbsd-stable/src/sys/compile/FLEDGE  i386

>Description:

Found a weird message in my dmesg.  Exploration below; don't know what
prompted it, but the exploration suggests some possibilities.

% dmesg | grep looutput
looutput: mbuf allocation failed
looutput: mbuf allocation failed
looutput: mbuf allocation failed
looutput: mbuf allocation failed
looutput: mbuf allocation failed
looutput: mbuf allocation failed

from src/sys/net/if_loop.c:
        if (0) {
contiguousfail:
                printf("looutput: mbuf allocation failed\n");
        }

So apparently contiguousfail is being jumped to.  One of the following
conditions:

        /*
         * KAME requires that the packet to be contiguous on the
         * mbuf.  We need to make that sure.
         * this kind of code should be avoided.
         * XXX: fails to join if interface MTU > MCLBYTES.  jumbogram?
         */
        if (m && m->m_next != NULL && m->m_pkthdr.len < MCLBYTES) {
                struct mbuf *n;

                MGETHDR(n, M_DONTWAIT, MT_HEADER);
                if (!n)
                        goto contiguousfail;
                MCLGET(n, M_DONTWAIT);
                if (! (n->m_flags & M_EXT)) {
                        m_freem(n);
                        goto contiguousfail;
                }

                m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t));
                n->m_pkthdr = m->m_pkthdr;
                n->m_len = m->m_pkthdr.len;
                m_freem(m);
                m = n;
        }

From src/sys/i386/include/param.h:

#define MCLSHIFT        11              /* convert bytes to m_buf clusters */
#endif  /* MCLSHIFT */
#define MCLBYTES        (1 << MCLSHIFT) /* size of an m_buf cluster */

For reference, MTU on lo0 is 16k, and MCLBYTES is 2048 on i386.  I'm guessing
this means that lo0 has problems with packets over 2k in size.  I could be
wrong.

>How-To-Repeat:

Unfortunately, have no idea.  Don't know what was going on on the system
at the time, and it's a multi-user machine with an average of 10 - 20
people logged in at any moment.

>Fix:

Not available.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->ume 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Wed Aug 30 00:57:36 PDT 2000 
Responsible-Changed-Why:  
Over to a KAME maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20927 
State-Changed-From-To: open->feedback 
State-Changed-By: itojun 
State-Changed-When: Wed Aug 30 17:59:07 PDT 2000 
State-Changed-Why:  
this is because you are out of mbuf on the system. 
try increasing max # of mbuf clusters in the kernel, if you care. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20927 
State-Changed-From-To: feedback->closed 
State-Changed-By: ume 
State-Changed-When: Tue Mar 13 05:04:33 PST 2001 
State-Changed-Why:  
No response from originator for a long time. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20927 
State-Changed-From-To: closed->open 
State-Changed-By: silby 
State-Changed-When: Thu Jan 10 10:40:21 PST 2002 
State-Changed-Why:  
If not a bug, this certainly looks like a problem waiting to happen 
to me.  If the comment is true that KAME needs mcls to be contiguous, 
something needs to be done to the allocator, or loopback needs to use 
a smaller MTU.  If the comment is no longer true, then the code 
added in rev 1.44 should be removed.  Either way, this issue isn't 
quite closed. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=20927 
Responsible-Changed-From-To: ume->silby 
Responsible-Changed-By: silby 
Responsible-Changed-When: Thu May 22 23:00:02 PDT 2003 
Responsible-Changed-Why:  
I shall fix this in an upcoming commit. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20927 
State-Changed-From-To: open->closed 
State-Changed-By: silby 
State-Changed-When: Mon Jun 2 14:56:18 PDT 2003 
State-Changed-Why:  
I've committed a good fix to this problem to both -current 
and -stable. 

(In the long run, I hope for the KAME code to be fixed as 
to not need it so that all of this can be removed.) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20927 
>Unformatted:
