From: Julius Bairaktaris <julius@bairaktaris.de>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Willem de Bruijn <willemb@google.com>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
Qingfang Deng <qingfang.deng@linux.dev>,
Guillaume Nault <gnault@redhat.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Haoli Zhang <26031212468@stu.xidian.edu.cn>,
linux-ppp@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH net-next 2/3] pppoe: transmit without the PPP channel lock
Date: Sun, 29 Nov 2026 15:43:18 +0100 [thread overview]
Message-ID: <20261129144319.1489366-3-julius@bairaktaris.de> (raw)
In-Reply-To: <20261129144319.1489366-1-julius@bairaktaris.de>
pppoe_xmit() reads the session's device, session ID and peer address,
which are set before the channel is registered and stay valid until
pppox_unbind_sock() has unregistered it, and hands the frame to
dev_queue_xmit(). It never refuses a frame. Set lockless_xmit, so that
ppp_generic calls it from several CPUs at once without the channel lock.
pppoe_release() and pppoe_unbind_sock_work() clear pppoe_dev before
they unbind the socket, while frames may still be sent, so annotate
those stores and load the pointer once with READ_ONCE().
With one iperf3 TCP stream per CPU over PPPoE on a veth in a 4-CPU KVM
guest with lock_stat, ppp->wlock was contended in 805475 of 3245131 and
in 530957 of 2517080 acquisitions before this series (two boots, three
10 s runs each). With it, a kprobe on ppp_push() counted no call while
pppoe_xmit() sent 2684816 and 2316508 frames, and lock_stat lists no
acquisition of ppp->wlock or of the channel's downl.
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
---
drivers/net/ppp/pppoe.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index de6edc31790f..f14ed72eb9d5 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -400,7 +400,7 @@ static void pppoe_unbind_sock_work(struct work_struct *work)
lock_sock(sk);
if (po->pppoe_dev) {
dev_put(po->pppoe_dev);
- po->pppoe_dev = NULL;
+ WRITE_ONCE(po->pppoe_dev, NULL);
}
pppox_unbind_sock(sk);
release_sock(sk);
@@ -523,7 +523,7 @@ static int pppoe_release(struct socket *sock)
if (po->pppoe_dev) {
dev_put(po->pppoe_dev);
- po->pppoe_dev = NULL;
+ WRITE_ONCE(po->pppoe_dev, NULL);
}
pppox_unbind_sock(sk);
@@ -639,6 +639,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr_unsized *uservaddr
po->chan.ops = &pppoe_chan_ops;
po->chan.direct_xmit = true;
po->chan.xmit_offload = true;
+ po->chan.lockless_xmit = true;
error = ppp_register_net_channel(dev_net(dev), &po->chan);
if (error) {
@@ -814,7 +815,7 @@ static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb)
{
struct sock *sk = chan->private;
struct pppox_sock *po = pppox_sk(sk);
- struct net_device *dev = po->pppoe_dev;
+ struct net_device *dev = READ_ONCE(po->pppoe_dev);
struct pppoe_hdr *ph;
int data_len = skb->len;
--
2.53.0
next prev parent reply other threads:[~2026-11-29 14:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 14:43 [PATCH net-next 0/3] ppp: transmit data frames without the unit and channel locks Julius Bairaktaris
2026-11-29 14:43 ` [PATCH net-next 1/3] " Julius Bairaktaris
2026-11-29 14:43 ` Julius Bairaktaris [this message]
2026-11-29 14:43 ` [PATCH net-next 3/3] selftests: net: ppp: send on PPPoE from every CPU at once Julius Bairaktaris
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=20261129144319.1489366-3-julius@bairaktaris.de \
--to=julius@bairaktaris.de \
--cc=26031212468@stu.xidian.edu.cn \
--cc=andrew+netdev@lunn.ch \
--cc=bigeasy@linutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gnault@redhat.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-ppp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=qingfang.deng@linux.dev \
--cc=shuah@kernel.org \
--cc=willemb@google.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®