๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12081

Re: [PATCH] net/sched: reset sch_plug epoch state

#12081
From: netdev-bot+sashiko
Date: Fri, 06 Nov 2026 08:40
134 lines
12237 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] plug_reset() (net/sched/sch_plug.c:205-215) always sets
  `q->unplug_indefinite = false` and `q->throttled = true`.
- [Low] The commit log is a bug-report email pasted in as-is: - It opens
  with 'Hello,'.

--

net/sched: reset sch_plug epoch state

This patch replaces sch_plug's reset callback, qdisc_reset_queue, with a
new plug_reset(). The new function purges the queue, clears the epoch
counters, clears unplug_indefinite and sets throttled. The aim is to stop
a stale pkts_last_epoch from being used as release credit by a later
TCQ_PLUG_RELEASE_ONE after a link reset.

> Hello,

[Severity: Low]
This isn't a bug, but the commit log looks like a bug report email pasted
in as-is. It opens with a salutation and carries reporter environment
metadata:

> HEAD commit:    c03c1a14507dfaf8b856c2608f9ac216021fc222
> Git tree:       30fd2ef82912c26cf3a58ad0ba6afc375fa851ac
> Source version: Linux 7.3
> Compiler:       gcc 11.4.0, GNU ld 2.38

It also has five external Gist URLs and a multi-step clone/build/run
script. None of this describes the change itself, and the external links
may not stay available.

Could the log be cut down to a self-contained description of the problem
and the fix?

The log also doesn't mention that plug_reset() now clears
unplug_indefinite and forces throttled to true, which users can see (see
below).

> diff --git a/net/sched/sch_plug.c b/net/sched/sch_plug.c
> index b60ddfee6a68a..def95e8243ba9 100644
> --- a/net/sched/sch_plug.c
> +++ b/net/sched/sch_plug.c
> @@ -202,6 +202,18 @@ static int plug_change(struct Qdisc *sch, struct nlattr *opt,
>  	return 0;
>  }
>  
> +static void plug_reset(struct Qdisc *sch)
> +{
> +	struct plug_sched_data *q = qdisc_priv(sch);
> +
> +	qdisc_reset_queue(sch);
> +	q->pkts_current_epoch = 0;
> +	q->pkts_last_epoch = 0;
> +	q->pkts_to_release = 0;
> +	q->unplug_indefinite = false;
> +	q->throttled = true;

[Severity: Medium]
Is it intended that plug_reset() also takes the qdisc out of pass-through
mode? Fixing the stale epoch credit described in the commit message only
needs the three counters cleared.

After TCQ_PLUG_RELEASE_INDEFINITE, plug_change() already zeroes every
counter:

	case TCQ_PLUG_RELEASE_INDEFINITE:
		q->unplug_indefinite = true;
		q->pkts_to_release = 0;
		q->pkts_last_epoch = 0;
		q->pkts_current_epoch = 0;
		q->throttled = false;

plug_enqueue() doesn't count packets while unplug_indefinite is set, so
release credit can't go stale in that mode. With the old
qdisc_reset_queue callback, pass-through mode survived a reset.

With this change, a reset on carrier loss goes through this path:

linkwatch_do_dev()
  dev_deactivate(dev, true)
    dev_deactivate_many()
      dev_reset_queue()
        qdisc_reset()
          plug_reset()

The same happens on ifdown/up or a parent qdisc reset. In each case the
qdisc is left throttled with unplug_indefinite cleared. dev_activate()
reattaches the same qdisc instance and doesn't restore these fields.

>From then on plug_dequeue() returns nothing:

	if (q->throttled)
		return NULL;

plug_enqueue() counts new packets into pkts_current_epoch and buffers
them up to q->limit. After that, qdisc_drop() tail-drops the rest.

Doesn't this contradict the uAPI comment in
include/uapi/linux/pkt_sched.h?

	 * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue.
	 *   Stop buffering packets until the next TCQ_PLUG_BUFFER
	 *   command is received (just act as a pass-thru queue).

If the controller has only ever used TCQ_PLUG_RELEASE_INDEFINITE, or has
exited, would egress traffic stay stalled after a link flap until another
release command is sent?

Would it work to leave unplug_indefinite unchanged and set
q->throttled = !q->unplug_indefinite, or to leave both fields alone?
plug_dequeue() already re-throttles on its own when pkts_to_release is 0.

The reproducer described in the commit message only exercises
TCQ_PLUG_RELEASE_ONE epoch mode, so it wouldn't catch this.

> +}
> +

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/6AEA1C24.11E1A7.00008%40m16.mail.163.com
Technical Details
Message-ID: <179395444115.994134.1488731096234208258@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357844-linux-kernel-netdev=dewy.ru
References: <6AEA1C24.11E1A7.00008@m16.mail.163.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357844-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] net/sched: reset sch_plug epoch state
Date: Fri, 06 Nov 2026 08:40:41 +0000
Organization: Usenet Network
Message-ID: <179395444115.994134.1488731096234208258@kernel.org>
References: <6AEA1C24.11E1A7.00008@m16.mail.163.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3829448"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:fKx789DY7rbQHxPGDeBqZ4UJuAI= sha256:6HLJAl0bGFZ9kbZ2dacG5wlOsSyu6+QJbW8zVyQvgrU=
	sha1:Dg6FLciQSFZzPeUsz9mePKIjrDg= sha256:n4O62f+GP9nN5++nN+QfJ/7TJT732th4hd0AdvBSyIA=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 963A11131B6; Fri,  6 Nov 2026 11:41:11 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id VHLiQ-Q3pSPD;
	Fri,  6 Nov 2026 11:41:07 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-357844-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 510871131B9; Fri,  6 Nov 2026 11:40:58 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id AE6CD602BD6; Fri,  6 Nov 2026 08:40:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793954448;
	b=uFOFvVYf9OWTCBoNF3Jp4FwceusCugNQ34A1ecXOCfYA+BGMlN3gV/xEXjgxKC2fYlVv
	 GWjOsHFgE5Isf5VqLgfVnioVuOBx+rbnwvM3zPLlBIZu5QOAlWl6RgFC07vGpRhT+ULUu
	 VsW8ooart97XwaRsyABBiSQ5xE3EiIiJvNMAsQyH20LgBJkXWtDuepYlbWnQDMzA27zpK
	 7d6AZPQevskaNsjzHEyzNnIpxEOUFv6Gcx8u2e0oEN5XNwIEgYFlvyFpg/Ucen9ycCaME
	 p1beY3eXLYD4brYN7fmGLg8g4mDsLdMKXV4mIKBORFz+0vDQMN1TDzUA//KpYavfm6w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793954448;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=/55Dkn2zgwsP+rRdZdivaJ+Q4DO3a0dA94mr7obYiso=;
	b=B2gRrG0KicB5PsbDH/XDgbZkAmInk+zhvspQE3pebzSOEG934/GNxhGEXYeRaTvWsN1Z
	 c8kHDX/B+2PYkJtOkucPbfo6dshxY83SB5UVbYu8UG1kLa5J0r49El5t9hHEa6uBgIOQ/
	 CuCPZ7hvcqCaQI8qel4eK7Oj8J6NLgJFzFJU/rF6H/yl9VhOq2pXHphHJ8jOZ6vL6gnq0
	 ta5CHNVr0pjX4BCxwncyegGE2OwnGDr9QxAjyt6b6JnPBlPQZ5XLky3kzxfFFilXVdEb9
	 ZGY7Wgn9ad9IThavyyVIviI+yvgmH36OyAZDew4xfdbz2MXbhUMvtFkJgsp5iKJwYPg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ccTflIib;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 96073606A334;
	Fri,  6 Nov 2026 08:40:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ccTflIib
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793954442;
	b=BE9rx9OLlK6/W9s/96HmuIxw0vOyqA9+sZ2PbEeiaCxg7JIb8loX+7fAJ7alNlNXfPU3
	 0rAGDwHI/LiNh9I8z1vrPIomYgjwPICtnsC8lTPkzISH65MEkDvFpguFd/9x8WAc3w29o
	 rOW38U3FeamGL18b91VZUHBfgb5KM6YxUC/9z+ioPNwhZmrxqRKfTYMjU7DjnidqReMWX
	 7dbZVg7TCVqp5hg1tHne8ygR8vOpk2G5iw0OXJ8/YdHRXfMH9my7tSyD/9wOHmcg8OT7O
	 Xe3zORcnfko7p8d4mi4ikOiKlZulG4YtnzqvJoxMfS45bHTY+0mB+noDuXAv3TW3UDA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793954442;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=/55Dkn2zgwsP+rRdZdivaJ+Q4DO3a0dA94mr7obYiso=;
	b=ZZDG5EY0tFtl7oiYrp0zbtDw9j7QQfWtCPdVtdpjt52S4ViJiUypAoQiJ4C99arfrmtG
	 Np6fo8pbyWayGG0cblWc0t5opZb4zBHpuga/fNztPe/Njx41CVMY8bR+ziMUhsGrtNNC9
	 JpgmxTvjLMNTm2jcq4rO+KyLNLqeWwyglSBTYaAiC0NnoSzuRPnrGUwFT6vikPh0DYy+d
	 /anKjfKfUMcNTybiD8RiVYklJFu/5fai3UKfKUW1JxqLrZVT8cDCqpQVUgdCf45I+jTJx
	 6FDr1w41yiyYEXv8SSNvefr26XwgBNW8gmJUiPFlFiTdbaCkjTeRqSeGZNn91vWEo6A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ccTflIib;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EF99606A326;
	Fri,  6 Nov 2026 08:40:42 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A74D41F0089F;
	Fri,  6 Nov 2026 08:40:41 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793954442;
	bh=/55Dkn2zgwsP+rRdZdivaJ+Q4DO3a0dA94mr7obYiso=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=ccTflIibXrpGdVo7tJurhvDJ01Sq1lQfBhwS8mFsurogFtzNR91NFv2UlnJqYYZPS
	 Xx14iDYNyd1i6lH0WAPJ9lu6Vj6shM2lDcwtmZqV97dN4UB9neq8Jx4wm9zxnPm3Ds
	 ejE4+EdIWqz2NcZEEqGBiQhpYvp4/QJQqsB39A3C4qhF6ILqbtfpw7E7+Ex+IY7iNr
	 oJcko4KR9pkCLEBO5fWNlQD3NSZotNJy9cJPlTXPFFm2NuKXYlYhvxXlKyeL5Wsxga
	 sUC9Cl5+iAjmlFrn0vbm7DKvy+/lOO2YOKVxh+9RmShxdWhejFBt1mRjY/8YkJKIR/
	 hvgu4B/i/I7DQ==
X-Cc: jhs@mojatatu.com, jiri@resnulli.us, netdev@vger.kernel.org,
 linux-kernel@vger.kernel.org, kuba@kernel.org
X-In-Reply-To: <6AEA1C24.11E1A7.00008@m16.mail.163.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list