Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Thorsten Glaser <t.glaser@tarent.de>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Dave Taht <dave.taht@gmail.com>,
	netdev@vger.kernel.org
Subject: Re: RFH, where did I go wrong?
Date: Thu, 13 Oct 2022 10:38:12 +0300	[thread overview]
Message-ID: <20221013073812.mvbs6wo64b4yr5cc@skbuf> (raw)
In-Reply-To: <93ce7034-a26f-b68d-f27f-ef90b6b01bf8@tarent.de>

On Wed, Oct 12, 2022 at 11:56:11PM +0200, Thorsten Glaser wrote:
> The thing I did first was to add ASSERT_RTNL(); directly before the
> rtnl_* call, just like it was in the other place. That, of course,
> crashed immediately. Now *this* could be done systematically.
> 
> In OpenBSD, things like that are often hidden behind #if DIAGNOSTIC
> which is a global option, disabled in “prod” or space-constrained
> (installer) kernels but enabled for the “generic” one for wide testing.
> Something to think about?
> 
> I’m sure there’s lots of things like flow analysis around in the
> Linux world, however that wouldn’t help out-of-tree code being
> developed, whereas extra checks like that would. Just some thoughts,
> as said earlier this is basically¹ my start in Linux kernel dev.

Not trying to defend the Qdisc framework which has poor to non-existing
documentation, but with some minimal level of experience you'd kind of
expect that a function named rtnl_kfree_skbs() expects a calling context
where the rtnl_mutex is held. It is even more clear that this is the
case when you notice that in its implementation, there is a single
defer_kfree_skb_list global to the kernel, which is processed in
__rtnl_unlock().

I think as a takeaway from your debugging journey, you can add an
ASSERT_RTNL() to rtnl_kfree_skbs() and add a comment documenting the
function. You can use the commit message of 1b5c5493e3e6 ("net_sched:
add the ability to defer skb freeing") as inspiration for the function
description.

  reply	other threads:[~2022-10-13  7:38 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
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 [this message]
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=20221013073812.mvbs6wo64b4yr5cc@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=dave.taht@gmail.com \
    --cc=eric.dumazet@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