All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<netdev@vger.kernel.org>
Cc: Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>,
	<mlxsw@nvidia.com>
Subject: [PATCH net-next 0/7] mlxsw: Avoid non-tracker helpers when holding and putting netdevices
Date: Thu, 27 Jul 2023 17:59:18 +0200	[thread overview]
Message-ID: <cover.1690471774.git.petrm@nvidia.com> (raw)

Using the tracking helpers, netdev_hold() and netdev_put(), makes it easier
to debug netdevice refcount imbalances when CONFIG_NET_DEV_REFCNT_TRACKER
is enabled. For example, the following traceback shows the callpath to the
point of an outstanding hold that was never put:

    unregister_netdevice: waiting for swp3 to become free. Usage count = 6
    ref_tracker: eth%d@ffff888123c9a580 has 1/5 users at
	mlxsw_sp_switchdev_event+0x6bd/0xcc0 [mlxsw_spectrum]
	notifier_call_chain+0xbf/0x3b0
	atomic_notifier_call_chain+0x78/0x200
	br_switchdev_fdb_notify+0x25f/0x2c0 [bridge]
	fdb_notify+0x16a/0x1a0 [bridge]
	[...]

In this patchset, get rid of all non-ref-tracking helpers in mlxsw.

- Patch #1 drops two functions that are not used anymore, but contain
  dev_hold() / dev_put() calls.

- Patch #2 avoids taking a reference in one function which is called
  under RTNL.

- The remaining patches convert individual hold/put sites one by one
  from trackerless to tracker-enabled.

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/netdev/4c056da27c19d95ffeaba5acf1427ecadfc3f94c.camel@redhat.com/

Petr Machata (7):
  mlxsw: spectrum: Drop unused functions
    mlxsw_sp_port_lower_dev_hold/_put()
  mlxsw: spectrum_nve: Do not take reference when looking up netdevice
  mlxsw: spectrum_switchdev: Use tracker helpers to hold & put
    netdevices
  mlxsw: spectrum_router: FIB: Use tracker helpers to hold & put
    netdevices
  mlxsw: spectrum_router: hw_stats: Use tracker helpers to hold & put
    netdevices
  mlxsw: spectrum_router: RIF: Use tracker helpers to hold & put
    netdevices
  mlxsw: spectrum_router: IPv6 events: Use tracker helpers to hold & put
    netdevices

 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 17 -------------
 .../net/ethernet/mellanox/mlxsw/spectrum.h    |  2 --
 .../ethernet/mellanox/mlxsw/spectrum_nve.c    |  7 +++---
 .../ethernet/mellanox/mlxsw/spectrum_router.c | 25 +++++++++++--------
 .../mellanox/mlxsw/spectrum_switchdev.c       |  9 ++++---
 5 files changed, 24 insertions(+), 36 deletions(-)

-- 
2.41.0


             reply	other threads:[~2023-07-27 16:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 15:59 Petr Machata [this message]
2023-07-27 15:59 ` [PATCH net-next 1/7] mlxsw: spectrum: Drop unused functions mlxsw_sp_port_lower_dev_hold/_put() Petr Machata
2023-07-27 15:59 ` [PATCH net-next 2/7] mlxsw: spectrum_nve: Do not take reference when looking up netdevice Petr Machata
2023-07-27 15:59 ` [PATCH net-next 3/7] mlxsw: spectrum_switchdev: Use tracker helpers to hold & put netdevices Petr Machata
2023-07-27 15:59 ` [PATCH net-next 4/7] mlxsw: spectrum_router: FIB: " Petr Machata
2023-07-27 15:59 ` [PATCH net-next 5/7] mlxsw: spectrum_router: hw_stats: " Petr Machata
2023-07-27 15:59 ` [PATCH net-next 6/7] mlxsw: spectrum_router: RIF: " Petr Machata
2023-07-27 15:59 ` [PATCH net-next 7/7] mlxsw: spectrum_router: IPv6 events: " Petr Machata
2023-07-27 17:02 ` [PATCH net-next 0/7] mlxsw: Avoid non-tracker helpers when holding and putting netdevices Eric Dumazet
2023-07-28 20:50 ` patchwork-bot+netdevbpf

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=cover.1690471774.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.