🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6649

Re: [PATCH net v2] net: pse-pd: don't enable a PI again while disabling it

#6649
From: Ross Cawston
Date: Fri, 23 Oct 2026 02:03
62 lines
11580 bytes
On Thu, 22 Oct 2026 14:21:12 +0200, Kory Maincent wrote:
> On 10/22/26 12:08, netdev-bot+sashiko@kernel.org wrote:
>> - [High] The fix is incomplete: the PI being disabled is still enabled
>>   again, and the power budget still leaks, on the priority-eviction path.
>>
>> Pre-existing issues:
>> - [Medium] The priority cut-off in pse_pw_d_retry_power_delivery()
>>   (drivers/net/pse-pd/pse_core.c) never takes effect.
>
> Can you take a look at the above issues?
> The other ones are currently in discussion with Kyle due to similar
> report he faced on his series.

Yes, both are right.

The eviction path: v2 leaves it as it was, and its changelog undersold
what is wrong there. Besides powering the PI just turned off again, the
retry in pse_disable_pi_pol() can enable the PI that is making room,
from inside its own allocation, which then requests its budget a second
time; or it turns the other PI off again and recurses. That was already
so before v2, when _pse_pi_disable() retried the domain itself.

I have two patches for it on top of v2, build-tested only so far:

- "net: pse-pd: don't allocate the budget of a powered PI again": power
  delivery skips a PI that holds budget and is enabled, and a PI that
  holds budget while it is off has it freed and allocated again.
- "net: pse-pd: make room for a PI without recursing": it selects the
  PIs of lower priority to turn off before turning any off, turns them
  off without a retry, and requests the budget once. If that fails, they
  get their budget back and are enabled again. Only the PIs that stay
  off are notified as over budget, and the domain is retried once
  afterwards.

The prio_max cut-off: the second patch replaces it. The retry goes from
the highest priority (lowest value) to the lowest, the power-up order
that ethtool-netlink.rst documents, so a PI of lower priority no longer
takes the budget that one of higher priority waits for. It drops the
cut-off: with the PIs to turn off selected first, a PI of higher
priority only fails with -ERANGE when turning off all the PIs of lower
priority that hold budget wouldn't make room either. The budget left
over is then of no use to it, and once there is room, it can still turn
off a PI of lower priority that took some. If you'd rather keep the
cut-off as well, with prio_max declared outside the loop, I'll add it.

I'll send v3 as a series of the v2 fix and these two, once I've tested
it on the RTL8239 switch with a budget tight enough for the priorities
to matter. A test on a TPS23881 would be welcome too.

I'll leave the other three to the discussion with Kyle, Cc'd. One note
on the PSE_BUDGET_EVAL_STRAT_DYNAMIC test in pse_set_config_isr(): once
it no longer drops a classification reported with a detection, that
classification can reach the recursion above, so its fix should go in
after the eviction fix, or together with it.

Carlo's net v2 series changes the same functions; whichever goes in
first, the other rebases on it.

pw-bot: cr

Ross
Technical Details
Message-ID: <20261023020315.1159-1-ross@r-sc.ca>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350874-linux-kernel-netdev=dewy.ru
References: <20261019220835.613-1-ross@r-sc.ca> <179266373570.3135.5306089916848589884@kernel.org> <3a9f47f0-884a-49c0-a0a3-d68ea8bdf015@bootlin.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-350874-linux-kernel-netdev=dewy.ru
From: ross@r-sc.ca (Ross Cawston)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2] net: pse-pd: don't enable a PI again while disabling it
Date: Thu, 22 Oct 2026 19:03:14 -0700
Organization: Usenet Network
Message-ID: <20261023020315.1159-1-ross@r-sc.ca>
References: <20261019220835.613-1-ross@r-sc.ca> <179266373570.3135.5306089916848589884@kernel.org> <3a9f47f0-884a-49c0-a0a3-d68ea8bdf015@bootlin.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="388425"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wx+PrruXYZRzocKQ7Ma4exrPn08= sha256:bFFnwDGPq8/6u9d44zQgvhK4UtjYMj3ZUdkf9mma2b0=
	sha1:OMZTylZ+2rW7bmAmnh8/sYS4spI= sha256:cph6Pv/QrMfw1HpsEmRq1sqX6EI+Y2q8By85Rgo6Lf8=
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 E8F591113BD; Fri, 23 Oct 2026 05:05:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.3
X-Spam-Status: No, score=-3.3 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-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=r-sc.ca
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 b8rArnGUHEFl;
	Fri, 23 Oct 2026 05:05:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350874-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=r-sc.ca
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 309311113B4; Fri, 23 Oct 2026 05:05:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 9C6E1391A4; Fri, 23 Oct 2026 02:03:46 +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=1792721026;
	b=Spx0YN5uMEjvCQYgxiApKQ14H2E/KZnCPVQapUELprBTr0UulekYAMQVPOkszdCgmWk8
	 PV4m3wlNOl4eMP15vPr3w/ST2gjpUUu37Zuy0XZPTvm74OmZjWz+PZsqwOWNCylox1tyc
	 mVHDP0rQNSKeBvQZnA+YPwnT1m1msWBtL3CvDfi/yXyNbb7eMvF87FasmhpmQI+tJZK2L
	 OZ9nU/57hiBBUQn3EhFLcWqBC9HdNDM8rOqsnN4W8jzkuen6GVfjROtFFAErt3+5IP7PS
	 VR/5piqexVPggSa6hSC+qmKMZL6OktK2EDsWvzuw+D/S6TJfWLc7/bbKOqIlazlNz0A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792721026;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:X-Envelope-From;
	bh=FGftDvuYzWl4uIjT43BqY7IOLMOu3QmAP9RtQtt3iTo=;
	b=vOUr37G2YOm6qTVqLZ/7aWmScDHmwp56oRk7MaUb4WJ9dDbbVTKEol94u1mT6ixGb9SB
	 Ee2IroSEeIWSZrDxyMJyAg30cgc8nd64kMiTtF52UqwFFIzoBD8vVQYa8PnoMZBVSFBtu
	 N/pDaIPJhjd0+kD7905OEo/gFPP1lPug0oayr/LiOnfN0qFqGaUXVhyeF7dxNNTz6ZkGA
	 ctKS+ZJgurFPqjShKFzWcpFYjYBXM9saNkNfFID43GNpdEqh9kRml2jiQu+b0smz0KE2V
	 +I07wkwdKVb7fhKUso6uL7KLQBPKlwFdGx5hhIunngS5OMU9BdWi2M+8b+e8y+bLD/w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=r-sc.ca header.i=@r-sc.ca header.a=rsa-sha256 header.s=spacemail header.b=GgMYVep5;
	dmarc=none header.from=r-sc.ca;
	spf=pass smtp.mailfrom=r-sc.ca;
	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 7419B606A325;
	Fri, 23 Oct 2026 02:03:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=r-sc.ca header.i=@r-sc.ca header.a=rsa-sha256 header.s=spacemail header.b=GgMYVep5
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.54.127.153
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792721025;
	b=0tZrjVlSrNQqYpvPFNA1XWLsGcn7EdH2SZuLiVaVSMDHwWIRATJjE6wbCMPbRlZQWc/W
	 HKdJIeJc7SuTiBO0uaZjEFyEUYl7ZrynXfsJYvswhJM/zYpKZ27WXP/is7NiWByJFZZEU
	 cl/Wn45yvTGIfdQFPlDYHWgtjI8cGwcbKF7PiK2NDM9gvyDfJ+oJU21axyyIZ57QW4Ly4
	 qB22w60I9q8x8cnuONZVDJ36qe+NvYcTbtgl49v/pgoqdUteF+6sGRJMqc6k/UokbtJw1
	 xQr1jLpgVbEmvBDBWun7rnIF+1b/afMproWvO2Q6A15EIeOrdev3Uj3eq1nbtYF2LVw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792721025;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-Envelope-From;
	bh=FGftDvuYzWl4uIjT43BqY7IOLMOu3QmAP9RtQtt3iTo=;
	b=0vZOEi0ZoHEhl9TlMNsGUFvKqc/fyOkgWAnNzKAxmTa5YdV0n/HVw1Tp1lR4UVZNNSnx
	 LgYjQAzfSqt/eFW2qUoByrXcHb70T4aKTcvThRUWcuwyj+DBsKLuvYeIZUVAAwYpTy63Q
	 qF/oH0m6CWEsak3Su+S55j7n5W6fYEJ23gZPMYx4hYY9yWutJ2VVs6XDGXj09sNEXtigD
	 CnnTMOupWkBKQlX84NMYBpA36uFe+WUtRcuXy8SGDKaevlSSqPuO9qhi2buTK8hEH7LON
	 bGEGbE9g0wPnHng3Or+8bAFWQmUGdxYL93BG+4JT5/0Yj/IgJUB1H4unurZRmTVKD0A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=r-sc.ca;
	spf=pass smtp.mailfrom=r-sc.ca;
	dkim=pass header.d=r-sc.ca header.i=@r-sc.ca header.a=rsa-sha256 header.s=spacemail header.b=GgMYVep5;
	arc=none smtp.remote-ip=198.54.127.153
X-Received: from out-2z4y-a153.jellyfish.systems (out-2z4y-a153.jellyfish.systems [198.54.127.153])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5FAD606A31B
	for <netdev@vger.kernel.org>; Fri, 23 Oct 2026 02:03:39 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B5FAD606A31B
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=r-sc.ca
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=r-sc.ca
X-Received: from DESKTOP-290OH2S (d207-6-150-133.bchsia.telus.net [207.6.150.133])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by mail.spacemail.com (Postfix) with ESMTPSA id 4j9mWv5zRkz8sWN;
	Fri, 23 Oct 2026 02:03:23 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=r-sc.ca;
	s=spacemail; t=1792721004;
	bh=FGftDvuYzWl4uIjT43BqY7IOLMOu3QmAP9RtQtt3iTo=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
	b=GgMYVep5f2AQRKEPh3d1Tk2x0XM5ngKrM+W6JJ6/5BVuKKZxHedoaje9GIkVwCKW/
	 63quCcXp4SqWh0V2R9Ey+HFfOtTJa26lP5I+41s/dIC4Mfh+9mwSkQnGJXua+C9ZLB
	 VFTnxAVobOxxNEHJGMimBS2UX9Ikdd9LDUCIjP0dxGBCEjIKbLrkptOTl/CDvBnOif
	 pIvZlM6CG6pm8q+6Ez6a2Ykq9/mAJ0MijqFWdi1Xu9aYl/7xPmPXpPhQHMvmrN5oqM
	 gkO6Nxo24eUGEFk3sS2k+Nh+4+rgGQK+HBw+RpWNVhZR1g7nHbqNK/US37hEa1WNcj
	 z4XcJNt1GS/rA==
X-Cc: netdev@vger.kernel.org,
	kyle.swenson@est.tech,
	github@szelinsky.de,
	o.rempel@pengutronix.de,
	andrew+netdev@lunn.ch,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	linux-kernel@vger.kernel.org,
	Ross Cawston <ross@r-sc.ca>
X-Mailer: git-send-email 2.55.0.windows.5
X-In-Reply-To: <3a9f47f0-884a-49c0-a0a3-d68ea8bdf015@bootlin.com>
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
X-Envelope-From: ross@r-sc.ca