Date: Fri, 25 Apr 2025 22:08:45 -0700 From: Adrian Chadd <adrian.chadd@gmail.com> To: Nuno Teixeira <eduardo@freebsd.org> Cc: freebsd-wireless@freebsd.org Subject: Re: rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf Message-ID: <CAJ-VmomfB-CES1KfxZ9OJTEN7iWVnb1AjouqLS-WYywDVjCQJg@mail.gmail.com> In-Reply-To: <CAFDf7ULVhh=9=UBJpujJSjU2Nt5nW_cGWLmo0484FMFd9=90eA@mail.gmail.com> References: <CAFDf7UJdhwnDj8V9944TYLJ4PtFOdr6SDqY-6nGK6XSijd4Esw@mail.gmail.com> <CAJ-Vmo=BbY5kZT8tEhAUE3C1wMKBErCbNDqB7PR6rV3v%2BrP-Qg@mail.gmail.com> <CAFDf7ULNQFex8swiDdKhfqQvm5ziNmk1hyxnEYz_wfRUq6YRNQ@mail.gmail.com> <CAJ-VmokoQ4fm6dapZ6pouhqXOumgj2QjBV9M%2BJYz3MjQ2QNqTA@mail.gmail.com> <CAFDf7UJtn9_chV-Yy9o=nWrMx0siHPhieAw08EiemU406%2Bwk9Q@mail.gmail.com> <CAFDf7UKRVTiVQtVHShVZRZ8fSsTnUdCDNPR5sJ3-_rpiG56Rdw@mail.gmail.com> <CAJ-Vmo=V_hAd4H%2BCv9zNDoaxrVW3_8K9zh6X%2B3SawUxM3JCdEg@mail.gmail.com> <CAFDf7UKaL%2BxNuD2S08MPSMat22O=k=aASoWTtok3P-AODJhH0g@mail.gmail.com> <CAFDf7UKCRa_f3KdJaW8ZACwLSDX5x17rPQLN9-ODUe0LCkJkvA@mail.gmail.com> <CAJ-VmomoUWEaPM0rQC%2BCnkVJeaDt5BEv5DvgQnpxQJWboCNW0Q@mail.gmail.com> <CAFDf7U%2B2Jb4R5iWn55iQeKfzVkDbksjeS0y=k2C01Gy34x_Xhg@mail.gmail.com> <CAJ-Vmo=9rXDeTYt%2BSWGH%2BMOfYcOga6qOLvXavxQbrpqzjs7f_Q@mail.gmail.com> <CAFDf7U%2Bc87jNgQ-4i4CZPKS4PLUROPai4Y0F0PqHazRoQ-8_Yg@mail.gmail.com> <CAJ-VmokSVeF-aW48nkYDaPJK1Pvt=hS6RPMhmUebFC7bdsVd_A@mail.gmail.com> <CAFDf7U%2BcZYEOGYqFU6owG-1F-KHM8H27EO7HTq%2BBF9u%2BFTAc5A@mail.gmail.com> <CAJ-VmonmUvQMtJPjvFVd07UrW_6gPN%2Bk7qPgRNqv%2BSiRvAP5Kw@mail.gmail.com> <CAFDf7UJv5wWbwV9qdjn5H=wTXBy5e6r7OXq-bHAiZok4_KwffQ@mail.gmail.com> <CAJ-Vmo=krAT2jfCn_zprGU8WZS=3DLpMqF212CznWRnHg00qTA@mail.gmail.com> <CAFDf7UKcyiXut3m6WvPQTGtf5ohD-Op-Xpi-Bi9hdV%2BZkiCSsQ@mail.gmail.com> <CAFDf7U%2B9rHSOQogcGasfcBLe3XbKzpDF0PkPQHDnL8EJMdA5MA@mail.gmail.com> <CAFDf7ULTfVRCY9zc71m4p7FkFHrsgm_g3AZXbFNY3jyLdaSG9w@mail.gmail.com> <CAJ-Vmonz=UAvmUAJ4HpJbgL4LB5s3P9NbMRCqzCg_oiF-Qf_cQ@mail.gmail.com> <CAFDf7ULVhh=9=UBJpujJSjU2Nt5nW_cGWLmo0484FMFd9=90eA@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Fri, 25 Apr 2025 at 17:03, Nuno Teixeira <eduardo@freebsd.org> wrote:
> Directly from console:
>
> % iperf3 -c hp -R
> Connecting to host hp, port 5201
> Reverse mode, remote host hp is sending
> [ 5] local 192.168.1.82 port 35544 connected to 192.168.1.100 port 5201
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> [ ID] Interval Transfer Bitrate
> [ 5] 0.00-1.06 sec 0.00 Bytes 0.00 bits/sec
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)
> [ 5] 1.06-2.00 sec 0.00 Bytes 0.00 bits/sec
> [ 5] 2.00-3.03 sec 0.00 Bytes 0.00 bits/sec
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> [ 5] 3.03-4.01 sec 0.00 Bytes 0.00 bits/sec
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> [ 5] 4.01-5.05 sec 0.00 Bytes 0.00 bits/sec
> [ 5] 5.05-6.06 sec 0.00 Bytes 0.00 bits/sec
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)
> [ 5] 6.06-7.06 sec 128 KBytes 1.05 Mbits/sec
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)
> [ 5] 7.06-8.06 sec 256 KBytes 2.10 Mbits/sec
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)
> rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf
>
Ok, that is interesting. We're not keeping counters in m_get2() for when
the buffer requested is too large; it only returns NULL.
I guess it's bailing if it's above a page size (4kbytes.)
Try changing the m_get2() call there to m_get3(); let's see if that
improves things.
(m_get3() will fail above 16kbytes; and if it can't allocate a buffer <
16kbytes then we should get some UMA error counted somehwere.)
-adrian
> Adrian Chadd <adrian.chadd@gmail.com> escreveu (sábado, 26/04/2025 à(s)
> 00:51):
> >
> > change
> >
> > __func__);
> >
> > to
> >
> > __func__, totlen);
> >
> >
> > On Fri, 25 Apr 2025 at 16:30, Nuno Teixeira <eduardo@freebsd.org> wrote:
> >>
> >> (...)
> >>
> >> kk, it builds fine without patch.
> >>
> >> Sending logs of the patch (as gmail ruins formating) and kernel.log
> attached.
> >>
> >> Nuno Teixeira <eduardo@freebsd.org> escreveu (sábado, 26/04/2025 à(s)
> 00:18):
> >> >
> >> > Hum build kernel is failing with:
> >> >
> >> > diff --git a/sys/dev/rtwn/usb/rtwn_usb_rx.c
> b/sys/dev/rtwn/usb/rtwn_usb_rx.c
> >> > index 657d6bdeb9e4..15e7da2b1968 100644
> >> > --- a/sys/dev/rtwn/usb/rtwn_usb_rx.c
> >> > +++ b/sys/dev/rtwn/usb/rtwn_usb_rx.c
> >> > @@ -126,7 +126,7 @@ rtwn_rx_copy_to_mbuf(struct rtwn_softc *sc, struct
> >> > rtwn_rx_stat_common *stat,
> >> >
> >> > m = m_get2(totlen, M_NOWAIT, MT_DATA, M_PKTHDR);
> >> > if (__predict_false(m == NULL)) {
> >> > - device_printf(sc->sc_dev, "%s: could not allocate RX
> mbuf\n",
> >> > + device_printf(sc->sc_dev, "%s: could not allocate RX
> >> > mbuf (%d bytes)\n",
> >> > __func__);
> >> > goto fail;
> >> > }
> >> >
> >> > I will rebuild it again without patch and check what is the problem
> >> >
> >> > Nuno Teixeira <eduardo@freebsd.org> escreveu (sábado, 26/04/2025
> à(s) 00:12):
> >> > >
> >> > > I'm compiling and soon I will reboot.
> >> > > Do the tests the same way and previous email or just trigger error
> and
> >> > > capture logs?
> >> > >
> >> > > Adrian Chadd <adrian.chadd@gmail.com> escreveu (sábado, 26/04/2025
> à(s) 00:04):
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Fri, 25 Apr 2025 at 16:03, Nuno Teixeira <eduardo@freebsd.org>
> wrote:
> >> > > >>
> >> > > >> > edit sys/dev/rtwn/usb/usb_rtwn_rx.c ,around line 129. Change
> that device_printf() line to
> >> > > >> >
> >> > > >> > device_printf(sc->sc_dev, "%s: could not allocate RX mbuf (%d
> bytes)\n",
> >> > > >> > __func__, totlen);
> >> > > >>
> >> > > >> # cd /usr/src
> >> > > >> # find . -name "*rtwn_rx.c"
> >> > > >> ./sys/dev/rtwn/if_rtwn_rx.c
> >> > > >>
> >> > > >> Where is sys/dev/rtwn/usb/usb_rtwn_rx.c ?
> >> > > >>
> >> > > >
> >> > > > /usr/src/sys/dev/rtwn/usb/rtwn_usb_rx.c
> >> > > >
> >> > > > sorry, typo. :-0
> >> > > >
> >> > > >
> >> > > >
> >> > > > -adrian
> >> > > >
> >> > > >>
> >> > > >> --
> >> > > >> Nuno Teixeira
> >> > > >> FreeBSD UNIX: <eduardo@FreeBSD.org> Web: https://FreeBSD.org
> >> > >
> >> > >
> >> > >
> >> > > --
> >> > > Nuno Teixeira
> >> > > FreeBSD UNIX: <eduardo@FreeBSD.org> Web: https://FreeBSD.org
> >> >
> >> >
> >> >
> >> > --
> >> > Nuno Teixeira
> >> > FreeBSD UNIX: <eduardo@FreeBSD.org> Web: https://FreeBSD.org
> >>
> >>
> >>
> >> --
> >> Nuno Teixeira
> >> FreeBSD UNIX: <eduardo@FreeBSD.org> Web: https://FreeBSD.org
>
>
>
> --
> Nuno Teixeira
> FreeBSD UNIX: <eduardo@FreeBSD.org> Web: https://FreeBSD.org
>
[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, 25 Apr 2025 at 17:03, Nuno Teixeira <<a href="mailto:eduardo@freebsd.org">eduardo@freebsd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Directly from console:<br>
<br>
% iperf3 -c hp -R<br>
Connecting to host hp, port 5201<br>
Reverse mode, remote host hp is sending<br>
[ 5] local 192.168.1.82 port 35544 connected to 192.168.1.100 port 5201<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
[ ID] Interval Transfer Bitrate<br>
[ 5] 0.00-1.06 sec 0.00 Bytes 0.00 bits/sec<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)<br>
[ 5] 1.06-2.00 sec 0.00 Bytes 0.00 bits/sec<br>
[ 5] 2.00-3.03 sec 0.00 Bytes 0.00 bits/sec<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
[ 5] 3.03-4.01 sec 0.00 Bytes 0.00 bits/sec<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
[ 5] 4.01-5.05 sec 0.00 Bytes 0.00 bits/sec<br>
[ 5] 5.05-6.06 sec 0.00 Bytes 0.00 bits/sec<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)<br>
[ 5] 6.06-7.06 sec 128 KBytes 1.05 Mbits/sec<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (4672 bytes)<br>
[ 5] 7.06-8.06 sec 256 KBytes 2.10 Mbits/sec<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf (6196 bytes)<br>
rtwn0: rtwn_rx_copy_to_mbuf: could not allocate RX mbuf<br></blockquote><div><br></div><div>Ok, that is interesting. We're not keeping counters in m_get2() for when the buffer requested is too large; it only returns NULL.</div><div>I guess it's bailing if it's above a page size (4kbytes.)</div><div> </div><div>Try changing the m_get2() call there to m_get3(); let's see if that improves things.</div><div>(m_get3() will fail above 16kbytes; and if it can't allocate a buffer < 16kbytes then we should get some UMA error counted somehwere.)</div><div><br></div><div><br></div><div><br></div><div>-adrian</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Adrian Chadd <<a href="mailto:adrian.chadd@gmail.com" target="_blank">adrian.chadd@gmail.com</a>> escreveu (sábado, 26/04/2025 à(s) 00:51):<br>
><br>
> change<br>
><br>
> __func__);<br>
><br>
> to<br>
><br>
> __func__, totlen);<br>
><br>
><br>
> On Fri, 25 Apr 2025 at 16:30, Nuno Teixeira <<a href="mailto:eduardo@freebsd.org" target="_blank">eduardo@freebsd.org</a>> wrote:<br>
>><br>
>> (...)<br>
>><br>
>> kk, it builds fine without patch.<br>
>><br>
>> Sending logs of the patch (as gmail ruins formating) and kernel.log attached.<br>
>><br>
>> Nuno Teixeira <<a href="mailto:eduardo@freebsd.org" target="_blank">eduardo@freebsd.org</a>> escreveu (sábado, 26/04/2025 à(s) 00:18):<br>
>> ><br>
>> > Hum build kernel is failing with:<br>
>> ><br>
>> > diff --git a/sys/dev/rtwn/usb/rtwn_usb_rx.c b/sys/dev/rtwn/usb/rtwn_usb_rx.c<br>
>> > index 657d6bdeb9e4..15e7da2b1968 100644<br>
>> > --- a/sys/dev/rtwn/usb/rtwn_usb_rx.c<br>
>> > +++ b/sys/dev/rtwn/usb/rtwn_usb_rx.c<br>
>> > @@ -126,7 +126,7 @@ rtwn_rx_copy_to_mbuf(struct rtwn_softc *sc, struct<br>
>> > rtwn_rx_stat_common *stat,<br>
>> ><br>
>> > m = m_get2(totlen, M_NOWAIT, MT_DATA, M_PKTHDR);<br>
>> > if (__predict_false(m == NULL)) {<br>
>> > - device_printf(sc->sc_dev, "%s: could not allocate RX mbuf\n",<br>
>> > + device_printf(sc->sc_dev, "%s: could not allocate RX<br>
>> > mbuf (%d bytes)\n",<br>
>> > __func__);<br>
>> > goto fail;<br>
>> > }<br>
>> ><br>
>> > I will rebuild it again without patch and check what is the problem<br>
>> ><br>
>> > Nuno Teixeira <<a href="mailto:eduardo@freebsd.org" target="_blank">eduardo@freebsd.org</a>> escreveu (sábado, 26/04/2025 à(s) 00:12):<br>
>> > ><br>
>> > > I'm compiling and soon I will reboot.<br>
>> > > Do the tests the same way and previous email or just trigger error and<br>
>> > > capture logs?<br>
>> > ><br>
>> > > Adrian Chadd <<a href="mailto:adrian.chadd@gmail.com" target="_blank">adrian.chadd@gmail.com</a>> escreveu (sábado, 26/04/2025 à(s) 00:04):<br>
>> > > ><br>
>> > > ><br>
>> > > ><br>
>> > > > On Fri, 25 Apr 2025 at 16:03, Nuno Teixeira <<a href="mailto:eduardo@freebsd.org" target="_blank">eduardo@freebsd.org</a>> wrote:<br>
>> > > >><br>
>> > > >> > edit sys/dev/rtwn/usb/usb_rtwn_rx.c ,around line 129. Change that device_printf() line to<br>
>> > > >> ><br>
>> > > >> > device_printf(sc->sc_dev, "%s: could not allocate RX mbuf (%d bytes)\n",<br>
>> > > >> > __func__, totlen);<br>
>> > > >><br>
>> > > >> # cd /usr/src<br>
>> > > >> # find . -name "*rtwn_rx.c"<br>
>> > > >> ./sys/dev/rtwn/if_rtwn_rx.c<br>
>> > > >><br>
>> > > >> Where is sys/dev/rtwn/usb/usb_rtwn_rx.c ?<br>
>> > > >><br>
>> > > ><br>
>> > > > /usr/src/sys/dev/rtwn/usb/rtwn_usb_rx.c<br>
>> > > ><br>
>> > > > sorry, typo. :-0<br>
>> > > ><br>
>> > > ><br>
>> > > ><br>
>> > > > -adrian<br>
>> > > ><br>
>> > > >><br>
>> > > >> --<br>
>> > > >> Nuno Teixeira<br>
>> > > >> FreeBSD UNIX: <eduardo@FreeBSD.org> Web: <a href="https://FreeBSD.org" rel="noreferrer" target="_blank">https://FreeBSD.org</a><br>
>> > ><br>
>> > ><br>
>> > ><br>
>> > > --<br>
>> > > Nuno Teixeira<br>
>> > > FreeBSD UNIX: <eduardo@FreeBSD.org> Web: <a href="https://FreeBSD.org" rel="noreferrer" target="_blank">https://FreeBSD.org</a><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Nuno Teixeira<br>
>> > FreeBSD UNIX: <eduardo@FreeBSD.org> Web: <a href="https://FreeBSD.org" rel="noreferrer" target="_blank">https://FreeBSD.org</a><br>
>><br>
>><br>
>><br>
>> --<br>
>> Nuno Teixeira<br>
>> FreeBSD UNIX: <eduardo@FreeBSD.org> Web: <a href="https://FreeBSD.org" rel="noreferrer" target="_blank">https://FreeBSD.org</a><br>
<br>
<br>
<br>
-- <br>
Nuno Teixeira<br>
FreeBSD UNIX: <eduardo@FreeBSD.org> Web: <a href="https://FreeBSD.org" rel="noreferrer" target="_blank">https://FreeBSD.org</a><br>
</blockquote></div></div>
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmomfB-CES1KfxZ9OJTEN7iWVnb1AjouqLS-WYywDVjCQJg>
