Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Nicolas Dichtel
Mon, 30 Nov 2026 10:16
[PATCH net v2] pppox: drop queued packets on channel handoff
Author: Nicolas Dichtel
Date: Mon, 30 Nov 2026 10:16
Date: Mon, 30 Nov 2026 10:16
85 lines
13425 bytes
13425 bytes
Commit 92c1bf630abf ("pppox: drain queued packets on channel handoff")
added a synchronize_net() call to PPPIOCGCHAN, so that the receive paths
that observed the old state finish queueing their packets before the queue
is drained.
PPPIOCGCHAN is issued once per session by PPP daemons, so each session
setup now waits for a full RCU grace period. With accel-ppp, the PPPoE
session setup rate drops from ~1100 to ~250 sessions per second, and the
latency of pppox_ioctl() goes from a few microseconds to 4-8 ms.
The regression was triggered in CI testing by a PPPoE performance test
(accel-ppp server in a VM using ConnectX-6 VFs, bngblaster client) on an
unmodified kernel. It was validated by reverting 92c1bf630abf, which
restores the v7.2 setup rate, and by measuring the latency of pppox_ioctl()
while PPPoE sessions are being set up:
bpftrace -e 'kprobe:pppox_ioctl { @s[tid] = nsecs }
kretprobe:pppox_ioctl /@s[tid]/ {
@us = hist((nsecs - @s[tid]) / 1000); delete(@s[tid]); }'
Waiting for a grace period only for the lockless receive paths is not an
option, as PPPoE is going to receive packets without serialization as well,
once its __sk_receive_skb() call is removed. Instead, drop the queued
packets rather than delivering them to generic PPP, so that no grace period
is needed. These packets are early PPP control frames, which the peer
retransmits. Before the faulty commit, they were not delivered either: they
stayed in the queue until the socket was destroyed.
A receive path that observed the old state may still queue a packet after
the purge. Such a packet stays in the queue until the socket is destroyed,
as it did before the faulty commit.
This fix was tested against the reproducer: the setup rate is back to ~1100
sessions per second, the same level as with the faulty commit reverted. The
pppoe.sh and pppol2tp.sh selftests also pass.
Fixes: 92c1bf630abf ("pppox: drain queued packets on channel handoff")
Cc: stable@vger.kernel.org
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
v2:
- drop the queued packets instead of waiting for a grace period
only for lockless receive paths (Qingfang)
v1: https://lore.kernel.org/netdev/20261127152822.2098330-1-nicolas.dichtel@6wind.com/
drivers/net/ppp/pppox.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ppp/pppox.c b/drivers/net/ppp/pppox.c
index a6f72c813bef..392320d01abf 100644
--- a/drivers/net/ppp/pppox.c
+++ b/drivers/net/ppp/pppox.c
@@ -74,7 +74,6 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
switch (cmd) {
case PPPIOCGCHAN: {
- struct sk_buff *skb;
int index;
rc = -ENOTCONN;
@@ -92,17 +91,10 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
* /dev/ppp.
*/
sk->sk_state |= PPPOX_BOUND;
- /* Let lockless receive paths finish queueing against the old
- * state.
+ /* A bound socket is no longer readable: drop the packets
+ * queued before the handoff.
*/
- synchronize_net();
- /* Drain packets queued before the handoff because a bound
- * socket is no longer readable.
- */
- while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
- skb_orphan(skb);
- ppp_input(&po->chan, skb);
- }
+ skb_queue_purge(&sk->sk_receive_queue);
break;
}
default:
--
2.47.3
Re: [PATCH net v2] pppox: drop queued packets on channel handoff
Author: Qingfang Deng
Date: Tue, 01 Dec 2026 03:18
Date: Tue, 01 Dec 2026 03:18
40 lines
9741 bytes
9741 bytes
Hi,
On 2026/11/30 18:16, Nicolas Dichtel wrote:
> diff --git a/drivers/net/ppp/pppox.c b/drivers/net/ppp/pppox.c
> index a6f72c813bef..392320d01abf 100644
> --- a/drivers/net/ppp/pppox.c
> +++ b/drivers/net/ppp/pppox.c
> @@ -74,7 +74,6 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
>
> switch (cmd) {
> case PPPIOCGCHAN: {
> - struct sk_buff *skb;
> int index;
>
> rc = -ENOTCONN;
> @@ -92,17 +91,10 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
> * /dev/ppp.
> */
> sk->sk_state |= PPPOX_BOUND;
> - /* Let lockless receive paths finish queueing against the old
> - * state.
> + /* A bound socket is no longer readable: drop the packets
> + * queued before the handoff.
> */
> - synchronize_net();
> - /* Drain packets queued before the handoff because a bound
> - * socket is no longer readable.
> - */
> - while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
> - skb_orphan(skb);
> - ppp_input(&po->chan, skb);
> - }
> + skb_queue_purge(&sk->sk_receive_queue);
pppoe_rcv() runs concurrently and may have observed the old state, and
can queue more packets to this queue after the purge, which was the
reason for the synchronize_net().
Therefore a non-blocking call_rcu() is still required.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads