public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>,
	netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [RFC PATCH net] net: dsa: flush switchdev workqueue before tearing down CPU/DSA ports
Date: Mon, 13 Sep 2021 14:31:26 +0300	[thread overview]
Message-ID: <20210913113126.34th7ubolxwngi3c@skbuf> (raw)
In-Reply-To: <37a4bef7-68de-f618-f741-d0de49c88e82@gmail.com>

On Sun, Sep 12, 2021 at 07:20:23PM -0700, Florian Fainelli wrote:
> On 9/12/2021 7:12 PM, Vladimir Oltean wrote:
> > On Sun, Sep 12, 2021 at 07:06:25PM -0700, Florian Fainelli wrote:
> > > On 9/12/2021 9:33 AM, Vladimir Oltean wrote:
> > > > On Sun, Sep 12, 2021 at 09:24:53AM -0700, Florian Fainelli wrote:
> > > > > On 9/12/2021 9:19 AM, Vladimir Oltean wrote:
> > > > > > On Sun, Sep 12, 2021 at 09:13:36AM -0700, Florian Fainelli wrote:
> > > > > > > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> > > > > > >
> > > > > > > Did you post this as a RFC for a particular reason, or just to give
> > > > > > > reviewers some time?
> > > > > >
> > > > > > Both.
> > > > > >
> > > > > > In principle there's nothing wrong with what this patch does, only
> > > > > > perhaps maybe something with what it doesn't do.
> > > > > >
> > > > > > We keep saying that a network interface should be ready to pass traffic
> > > > > > as soon as it's registered, but that "walk dst->ports linearly when
> > > > > > calling dsa_port_setup" might not really live up to that promise.
> > > > >
> > > > > That promise most definitively existed back when Lennert wrote this code and
> > > > > we had an array of ports and the switch drivers brought up their port in
> > > > > their ->setup() method, nowadays, not so sure anymore because of the
> > > > > .port_enable() as much as the list.
> > > > >
> > > > > This is making me wonder whether the occasional messages I am seeing on
> > > > > system suspend from __dev_queue_xmit: Virtual device %s asks to queue
> > > > > packet! might have something to do with that and/or the inappropriate
> > > > > ordering between suspending the switch and the DSA master.
> > > >
> > > > Sorry, I have never tested the suspend/resume code path, mostly because
> > > > I don't know what would the easiest way be to wake up my systems from
> > > > suspend. If you could give me some pointers there I would be glad to
> > > > look into it.
> > >
> > > If your systems support suspend/resume just do:
> > >
> > > echo mem > /sys/power/state
> > > or
> > > echo standby > /sys/power/state
> > >
> > > if they don't, then maybe a x86 VM with dsa_loop may precipitate the
> > > problem, but since it uses DSA_TAG_PROTO_NONE, I doubt it, we would need to
> > > pass traffic on the DSA devices for this warning to show up.
> >
> > I figured out a working combination in the meanwhile, I even found a bug
> > in the process:
> > https://patchwork.kernel.org/project/netdevbpf/patch/20210912192805.1394305-1-vladimir.oltean@nxp.com/
> >
> > However I did not see those messages getting printed while pinging after
> > system resume (note that none of the DSA switch drivers I tested with
> > did implement .suspend or .resume), with net-next or with linux-stable/linux-5.14.y.
> >
> > Is there more to your setup to reproduce this issue?
>
> All switch ports are brought up with a DHCP client, the issue is
> definitively intermittent and not frequent, I don't have suspend/resume
> working on 5.14.y yet, but going as far back as 5.10.y should let you see
> the same kind of messages.

Nope, I don't see the message on linux-5.10.y either, but even if I look
at the code I don't understand what goes on.

Here are some facts:

- __dev_queue_xmit only prints "Virtual device %s asks to queue packet!"
  for devices which have a NULL dev->qdisc->enqueue, but return
  NETDEV_TX_BUSY in dev_hard_start_xmit

- only the noqueue qdisc manages that performance, normally register_qdisc
  sets up a default of ->enqueue pointer of noop_qdisc_ops.enqueue, but
  there is a hack in noqueue_init which subverts that.

- The default qdiscs are assigned by attach_default_qdiscs(). There are
  two ways in which an interface can get the noqueue_qdisc_ops by default:
  (a) it declares the IFF_NO_QUEUE feature
  (b) the init of its other default qdisc (for example mq) failed for
      some reason, the kernel prints a warning and falls back to noqueue.

- DSA declares IFF_NO_QUEUE, so it uses the noqueue qdisc by default

- DSA never returns anything other than NETDEV_TX_OK in ndo_start_xmit.

So my conclusion is:
you have the noqueue qdisc on the DSA master, which got there either by
accident due to a failure of the mq qdisc initialization, or
intentionally by:

tc qdisc add dev eth0 root noqueue

When you use the noqueue qdisc and your DSA master device driver returns
NETDEV_TX_BUSY, the packet won't get queued => the system pretty much is
in its own right to complain.

      reply	other threads:[~2021-09-13 11:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-12 16:00 [RFC PATCH net] net: dsa: flush switchdev workqueue before tearing down CPU/DSA ports Vladimir Oltean
2021-09-12 16:13 ` Florian Fainelli
2021-09-12 16:19   ` Vladimir Oltean
2021-09-12 16:24     ` Florian Fainelli
2021-09-12 16:33       ` Vladimir Oltean
2021-09-13  2:06         ` Florian Fainelli
2021-09-13  2:12           ` Vladimir Oltean
2021-09-13  2:20             ` Florian Fainelli
2021-09-13 11:31               ` Vladimir Oltean [this message]

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=20210913113126.34th7ubolxwngi3c@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.com \
    --cc=vladimir.oltean@nxp.com \
    /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