Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Thorsten Glaser <t.glaser@tarent.de>, Dave Taht <dave.taht@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: RFH, where did I go wrong?
Date: Wed, 12 Oct 2022 13:41:38 -0700	[thread overview]
Message-ID: <3660fc5b-5cb3-61ee-a10c-0f541282eba4@gmail.com> (raw)
In-Reply-To: <8051fcd-4b5-7b32-887e-7df7a779be1b@tarent.de>


On 10/12/22 13:17, Thorsten Glaser wrote:
> Dixi quod…
>
>>> I'll take a harder look, but does it crash if you rip out debugfs?
> […]
>> And yes, it (commit dbb99579808dcf106264f28f3c8cf5ef2f2c05bf) still
>> crashes even if this time I get yet another message… all of those I
> I may have found the case by reducing further. Disabling the periodic
> dropping of too-old packets wasn’t it, but apparently, the code now
> guarded by JANZ_HEADDROP is it. Replacing it (dropping the oldest
> packet returning NET_XMIT_CN) with trivial code that rejects the new
> packet-to-be-enqueued with qdisc_drop() instead… seems to not crash.
>
> So, the code in question that seems to introduce the crash is:
>
>
> u32 prev_backlog = sch->qstats.backlog;
> //… normal code to add the passed skb (timestamp, etc.)
> // q->memusage += cb->truesz;
> if (unlikely(overlimit = (++sch->q.qlen > sch->limit))) {
> 	struct sk_buff *skbtodrop;
> 	/* skbtodrop = head of FIFO and remove it from the FIFO */
> 	skbtodrop = q->q[1].first;
> 	if (!(q->q[1].first = skbtodrop->next))
> 		q->q[1].last = NULL;
> 	--sch->q.qlen;
> 	/* accounting */
> 	q->memusage -= get_janz_skb(skbtodrop)->truesz;
> 	qdisc_qstats_backlog_dec(sch, skbtodrop);
> 	/* free the skb */
> 	rtnl_kfree_skbs(skbtodrop, skbtodrop)

This looks wrong (although I have not read your code)

I guess RTNL is not held at this point.

Use kfree_skb(skb) or __qdisc_drop(skb, to_free)


> }
> //… normal code to add:
> // line 879-885 enqueue into the FIFO
> // qdisc_qstats_backlog_inc(sch, skb);
> //… now code protected by the flag again:
> if (unlikely(overlimit)) {
> 	qdisc_qstats_overlimit(sch);
> 	qdisc_tree_reduce_backlog(sch, 0,
> 	    prev_backlog - sch->qstats.backlog);
> 	return (NET_XMIT_CN);
> }
> // normal code remaining: return (NET_XMIT_SUCCESS);
>
>
> This *seems* pretty straightforward to me, given similar code
> in other qdiscs, and what I could learn from their header and
> implementation.
>
> TIA,
> //mirabilos

  reply	other threads:[~2022-10-12 20:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <FR2P281MB2959684780DC911876D2465590419@FR2P281MB2959.DEUP281.PROD.OUTLOOK.COM>
     [not found] ` <FR2P281MB2959EBC7E6CE9A1A8D01A01F90419@FR2P281MB2959.DEUP281.PROD.OUTLOOK.COM>
2022-09-08 21:01   ` RFH, where did I go wrong? Thorsten Glaser
2022-09-10 23:38     ` Sergey Ryazanov
2022-09-10 23:43       ` Thorsten Glaser
2022-09-13  6:39         ` AW: " Haye.Haehne
2022-09-13 18:37           ` Thorsten Glaser
     [not found]             ` <FR2P281MB2959289F36EFC955105DD1DF90469@FR2P281MB2959.DEUP281.PROD.OUTLOOK.COM>
     [not found]               ` <bd8c8a7f-8a8e-3992-d631-d2f74d38483@tarent.de>
     [not found]                 ` <FR2P281MB2959185CA486AB5A5868C4D490529@FR2P281MB2959.DEUP281.PROD.OUTLOOK.COM>
     [not found]                   ` <1b62f51-a017-e21-31f3-2ccd72b6c8ad@tarent.de>
     [not found]                     ` <FR2P281MB29596B8EA9AC8940C5A95B7690559@FR2P281MB2959.DEUP281.PROD.OUTLOOK.COM>
2022-10-05 18:47                       ` Thorsten Glaser
2022-10-11 18:08                         ` Thorsten Glaser
     [not found]     ` <CAA93jw5J5XzhKb_L0C5uw1e3yz_4ithUnWO6nAmeeAEn7jyYiQ@mail.gmail.com>
     [not found]       ` <1a1214b6-fc29-1e11-ec21-682684188513@tarent.de>
     [not found]         ` <CAA93jw6ReJPD=5oQ8mvcDCMNV8px8pB4UBjq=PDJvfE=kwxCRg@mail.gmail.com>
2022-10-11 20:35           ` Thorsten Glaser
2022-10-11 20:38             ` Thorsten Glaser
2022-10-12 20:17             ` Thorsten Glaser
2022-10-12 20:41               ` Eric Dumazet [this message]
2022-10-12 20:48                 ` Thorsten Glaser
2022-10-12 21:40                   ` Andrew Lunn
2022-10-12 21:56                     ` Thorsten Glaser
2022-10-13  7:38                       ` Vladimir Oltean
2022-10-13 13:19                       ` Andrew Lunn
2022-10-12 21:05                 ` Thorsten Glaser
2022-10-12 21:08                   ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3660fc5b-5cb3-61ee-a10c-0f541282eba4@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=dave.taht@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=t.glaser@tarent.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox