From: Breno Leitao <leitao@debian.org>
To: kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com
Cc: thepacketgeek@gmail.com, riel@surriel.com, horms@kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
paulmck@kernel.org, davej@codemonkey.org.uk
Subject: [PATCH net-next v2 1/5] net: netpoll: extract core of netpoll_cleanup
Date: Thu, 8 Aug 2024 05:25:07 -0700 [thread overview]
Message-ID: <20240808122518.498166-2-leitao@debian.org> (raw)
In-Reply-To: <20240808122518.498166-1-leitao@debian.org>
Extract the core part of netpoll_cleanup(), so, it could be called from
a caller that has the rtnl lock already.
Netconsole uses this in a weird way right now:
__netpoll_cleanup(&nt->np);
spin_lock_irqsave(&target_list_lock, flags);
netdev_put(nt->np.dev, &nt->np.dev_tracker);
nt->np.dev = NULL;
nt->enabled = false;
This will be replaced by do_netpoll_cleanup() as the locking situation
is overhauled.
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Rik van Riel <riel@surriel.com>
---
include/linux/netpoll.h | 1 +
net/core/netpoll.c | 12 +++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index bd19c4b91e31..cd4e28db0cbd 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -64,6 +64,7 @@ int netpoll_setup(struct netpoll *np);
void __netpoll_cleanup(struct netpoll *np);
void __netpoll_free(struct netpoll *np);
void netpoll_cleanup(struct netpoll *np);
+void do_netpoll_cleanup(struct netpoll *np);
netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
#ifdef CONFIG_NETPOLL
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 55bcacf67df3..a58ea724790c 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -853,14 +853,20 @@ void __netpoll_free(struct netpoll *np)
}
EXPORT_SYMBOL_GPL(__netpoll_free);
+void do_netpoll_cleanup(struct netpoll *np)
+{
+ __netpoll_cleanup(np);
+ netdev_put(np->dev, &np->dev_tracker);
+ np->dev = NULL;
+}
+EXPORT_SYMBOL(do_netpoll_cleanup);
+
void netpoll_cleanup(struct netpoll *np)
{
rtnl_lock();
if (!np->dev)
goto out;
- __netpoll_cleanup(np);
- netdev_put(np->dev, &np->dev_tracker);
- np->dev = NULL;
+ do_netpoll_cleanup(np);
out:
rtnl_unlock();
}
--
2.43.5
next prev parent reply other threads:[~2024-08-08 12:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 12:25 [PATCH net-next v2 0/5] net: netconsole: Fix netconsole unsafe locking Breno Leitao
2024-08-08 12:25 ` Breno Leitao [this message]
2024-08-08 12:25 ` [PATCH net-next v2 2/5] net: netconsole: Correct mismatched return types Breno Leitao
2024-08-08 12:25 ` [PATCH net-next v2 3/5] net: netconsole: Standardize variable naming Breno Leitao
2024-08-08 12:25 ` [PATCH net-next v2 4/5] net: netconsole: Unify Function Return Paths Breno Leitao
2024-08-08 12:25 ` [PATCH net-next v2 5/5] net: netconsole: Defer netpoll cleanup to avoid lock release during list traversal Breno Leitao
2024-08-13 9:10 ` [PATCH net-next v2 0/5] net: netconsole: Fix netconsole unsafe locking patchwork-bot+netdevbpf
-- strict thread matches above, loose matches on Subject: below --
2024-08-07 9:16 Breno Leitao
2024-08-07 9:16 ` [PATCH net-next v2 1/5] net: netpoll: extract core of netpoll_cleanup Breno Leitao
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=20240808122518.498166-2-leitao@debian.org \
--to=leitao@debian.org \
--cc=davej@codemonkey.org.uk \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paulmck@kernel.org \
--cc=riel@surriel.com \
--cc=thepacketgeek@gmail.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
all inboxes | Powered by JetHome®