[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220921001625.jwpr5r5tneyoxect@skbuf>
Date: Wed, 21 Sep 2022 00:16:26 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: Jakub Kicinski <kuba@...nel.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Vinicius Costa Gomes <vinicius.gomes@...el.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Voon Weifeng <weifeng.voon@...el.com>,
Vladimir Oltean <olteanv@...il.com>,
Kurt Kanzenbach <kurt@...utronix.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 net-next 7/7] net/sched: taprio: replace safety
precautions with comments
On Tue, Sep 20, 2022 at 02:01:19PM -0700, Jakub Kicinski wrote:
> On Thu, 15 Sep 2022 13:50:46 +0300 Vladimir Oltean wrote:
> > The WARN_ON_ONCE() checks introduced in commit 13511704f8d7 ("net:
> > taprio offload: enforce qdisc to netdev queue mapping") take a small
> > toll on performance, but otherwise, the conditions are never expected to
> > happen. Replace them with comments, such that the information is still
> > conveyed to developers.
>
> Another option is DEBUG_NET_WARN_ON_ONCE() FWIW, you probably know..
Just for replacing WARN_ON_ONCE(), yes, maybe, but when you factor in
that the code also had calls to qdisc_drop(), I suppose you meant
replacing it with something like this?
if (DEBUG_NET_WARN_ON_ONCE(unlikely(FULL_OFFLOAD_IS_ENABLED(q->flags))))
return qdisc_drop(skb, sch, to_free);
This won't work because DEBUG_NET_WARN_ON_ONCE() force-casts WARN_ON_ONCE()
to void, discarding its evaluated value.
We'd be left with something custom like below:
if (IS_ENABLED(CONFIG_DEBUG_NET) && unlikely(FULL_OFFLOAD_IS_ENABLED(q->flags))) {
WARN_ONCE(1, "Trying to enqueue skb into the root of a taprio qdisc configured with full offload\n");
return qdisc_drop(skb, sch, to_free);
}
which may work, but it's so odd looking that it's just not worth the
trouble, I feel?
Powered by blists - more mailing lists