🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14455

Re: [PATCH net-next v3 07/14] dpll: dpllsim: Add support to get/set priority on input pins

#14455
From: netdev-bot+sashiko
Date: Wed, 11 Nov 2026 09:37
142 lines
13311 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] One field, `pin->prio`, holds both the configfs setting and the
  live value.
- [Low] Documentation/driver-api/dpllsim.rst (line 39) describes the new
  `prio` attribute as 'Priority 0-255 used for automatic reference…

--

dpll: dpllsim: Add support to get/set priority on input pins

This commit adds prio_get and prio_set callbacks for dpllsim input pins
and advertises the priority-can-change capability. It also adds a prio
configfs attribute that sets the initial priority before the device goes
live. Going live is rejected when an output pin has a non-default
priority.

> diff --git a/Documentation/driver-api/dpllsim.rst b/Documentation/driver-api/dpllsim.rst
> index e7c5ee93392c2..5109d67325f14 100644
> --- a/Documentation/driver-api/dpllsim.rst
> +++ b/Documentation/driver-api/dpllsim.rst
> @@ -36,6 +36,9 @@ Pin directory ``/sys/kernel/config/dpllsim/<dev>/pins/<pin>/``:
>                 (default 0, which is rejected)
>  ``direction``  ``input`` or ``output`` (default ``input``), a ``mux`` pin
>                 must be an input
> +``prio``       Priority 0-255 used for automatic reference selection,
> +               input pins only, output pins must keep the default
> +               (default 128)

[Severity: Low]
Is "used for automatic reference selection" accurate for dpllsim at this
point?

As far as I can tell, only dpllsim_pin_prio_get(), dpllsim_pin_prio_valid()
and dpllsim_pin_prio_show() read pin->prio. The device ops have no
selection logic:

static const struct dpll_device_ops dpllsim_dpll_ops = {
	.mode_get = dpllsim_mode_get,
	.lock_status_get = dpllsim_lock_status_get,
};

sim->lock_status stays at the DPLL_LOCK_STATUS_UNLOCKED value set in
dpllsim_make_group(). Nothing changes a pin's state based on its priority.

The example further down sets gnss0 prio 0 and ext0 prio 1 as if that sets
up a reference order. The selftest library comment in
dpllsim_setup_standard_device() ("gnss0: ... prio 0 (active reference)")
gives the same impression.

The commit message says priorities "will drive the automatic reference
selection once the simulation loop exists". I couldn't find a later patch
in the series that adds that loop.

Could the documentation say that the priority is currently only stored and
reported back?

[ ... ]

> diff --git a/drivers/dpll/dpllsim/dpll.c b/drivers/dpll/dpllsim/dpll.c
> index 794020d0c112e..5e36059609761 100644
> --- a/drivers/dpll/dpllsim/dpll.c
> +++ b/drivers/dpll/dpllsim/dpll.c

[ ... ]

> +static int dpllsim_pin_prio_set(const struct dpll_pin *pin, void *pin_priv,
> +				const struct dpll_device *dpll,
> +				void *dpll_priv, u32 prio,
> +				struct netlink_ext_ack *extack)
> +{
> +	struct dpllsim_pin *sim_pin = pin_priv;
> +
> +	if (prio > DPLLSIM_PIN_PRIO_MAX) {
> +		NL_SET_ERR_MSG_FMT(extack, "Pin priority must be in range 0-%u",
> +				   DPLLSIM_PIN_PRIO_MAX);
> +		return -EINVAL;
> +	}
> +
> +	guard(mutex)(&sim_pin->dev->lock);
> +	sim_pin->prio = prio;

[Severity: Low]
Should the netlink setter write to the same field that holds the
priority configured through configfs?

dpllsim_pins_make_item() and dpllsim_pin_prio_store() set pin->prio, and
this function writes it at runtime. On each live=1, dpllsim_order_pins()
calls dpllsim_pin_reset(), which resets ops and state but not prio:

static void dpllsim_pin_reset(struct dpllsim_pin *pin)
{
	pin->ops = dpllsim_pin_select_ops(pin);
	pin->state = DPLL_PIN_STATE_DISCONNECTED;
}

dpllsim_dev_undeploy() doesn't restore the configured value either.

Consider this sequence:

  echo 1 > pins/ext0/prio
  echo 1 > live
  dpll pin set ... prio 200
  echo 0 > live
  echo 1 > live

The second deployment starts with prio 200. Reading pins/ext0/prio through
dpllsim_pin_prio_show() also returns 200, which was never written through
configfs.

There is a second case. Take an input pin whose prio was changed over
netlink to something other than 128. Then write 0 to live, write output
to direction, and write 1 to live. The live write fails with EINVAL from
dpllsim_order_pins(), because of a priority that was only set at runtime:

static bool dpllsim_pin_prio_valid(const struct dpllsim_pin *pin)
{
	return pin->direction == DPLL_PIN_DIRECTION_INPUT ||
	       pin->prio == DPLLSIM_DEFAULT_PIN_PRIO;
}

The commit message describes the attribute as setting the initial priority
"so that a test can lay out the reference order before the device goes
live". Neither the commit message nor dpllsim.rst says that netlink
changes carry into later deployments and replace that layout.

The later commit "dpll: dpllsim: Add support to set frequency on pins"
takes the same shared-field approach for frequency. No later patch in the
series separates the configured and runtime prio or resets it.

Would it make sense to keep the configured priority separate and copy it
into the runtime value in dpllsim_pin_reset()?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261109093523.931201-1-poros%40redhat.com
Technical Details
Message-ID: <179438986776.2199510.9356026341300258964@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360953-linux-kernel-netdev=dewy.ru
References: <20261109093523.931201-8-poros@redhat.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360953-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 07/14] dpll: dpllsim: Add support to get/set
 priority on input pins
Date: Wed, 11 Nov 2026 09:37:47 +0000
Organization: Usenet Network
Message-ID: <179438986776.2199510.9356026341300258964@kernel.org>
References: <20261109093523.931201-8-poros@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="820855"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:2vdootw+mDSlQ58HxRCg7ea5OZw= sha256:9JChiFV/WQOgW7zgENScR8gCiuSU2R3Iqr/TxJ3Nsww=
	sha1:DiE9oa1E3YKhgjZ4YCJLivfaoGI= sha256:UQloninP7uJ8YO4Y8UX2uMWFk3MGD63uRIdvLRxaHlY=
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 DC09C113E7D; Wed, 11 Nov 2026 12:39:42 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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, URIBL_BLOCKED=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 PPGyF9VPNV0q;
	Wed, 11 Nov 2026 12:39:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-360953-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 5B6AF113E7A; Wed, 11 Nov 2026 12:39:28 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 3478367180; Wed, 11 Nov 2026 09:38:06 +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=1794389870;
	b=F91EyHwHpeVyEvk3pbhE0Wl4IYiGcHNrHp3FWi5+q14LQpm7y/zmFJBGcHzA29odMPro
	 IbFrThzqeGhfkujEslB/RIK8iIf8PkgjQuDyA/XYDIq26w5frnhsYlVlrsfw5nvcaEtAS
	 B27yA8wHd+t6NlP3aA1DwoxaHMp6vtJAhSdO5QFpiXp9TnY9y1fawvpzk+GqSG3f9kz7o
	 qLlQ0NROGphRLJ0stXxkL5CxB7ALOZR1xIKYGXUVX/ZVB0T4DgpvZdQY/fi7cTG9Ot8BJ
	 kPt+TGOu/MPN1maulaEuFTAaEIJzMSdxislT6JcScxW88JJN6N0S0M/kQrKh5Ji1hZw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794389870;
	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=7cU38DoVjW3VyYZPHW4NAYGDfjUuJ2rdWA3h6vVFBbk=;
	b=MngyucnpJK65NCtPaAgnRuiI0CATHPYPdG5nlgtyC9xXzqerIywucuDT6AYS6C7A9Gv1
	 ErukbRENRCuJtXrNfYpBu03xSfI6rvx72IVstqyx+o5gaQAyYvfmVvhk5Qlnc8yZT+g73
	 Ne5+FRfehgMsGIOZ7DxkJ70NwwX6HK8yYzbM1T4ojAYJYnLpSPMQK/+FdScSlKHjq/LHi
	 kNYVEqfbZJAIoMKxMNByJRLi8THliZm0sAEcKpx8Ol6WyJoySpMFfkN+V9T8A6CtJmvP0
	 Ga21APRZ25EqU3ReaG/DdaJJidj2MLehsiI4Zdzc5FhtT4tGL7o5k36T5RUbGSYaoPw==
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=FC8vOu0a;
	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 9AE2C60A2620;
	Wed, 11 Nov 2026 09:37:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FC8vOu0a
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=1794389869;
	b=t8wo6TDEE5QV8h/0Wlu1Jg87RtTMRZ0KPtzQ1RU5X0xP1Oa4rcO8qsI/bEpsmnoSC19i
	 hNl/DLair4uVosti6/6OIfSVVQrFG0izdrGScwq7QfYLDFJj8ARALSE+77oxWD96Qhuhl
	 WrmtDhfy0QYFwY+ll8jc+DFTwsGAIG93R6aS3AZhMZyH3N2DftCFiKXbJsmW1vULnix+M
	 0VtrIsnSGed137/rzDP7Jlfup1Nl3QX01vj0IhNT6plcTfrswT0VDXhx50VheO8l3T+y0
	 RFyud8Eilr2tpZlje3iIWCRSWa+ZyaDfV5jmjJhLVPNNsqwTo4eoTsuhvTsw7cqwi+A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794389869;
	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=7cU38DoVjW3VyYZPHW4NAYGDfjUuJ2rdWA3h6vVFBbk=;
	b=mhYdyT8By3/LKRkEObzWNpK2IZJXTTreJxtOngHfqyRDWvAS15gmIjS862sisgce03vS
	 VNWKoUAbv7sIfGGvParvQ74/MpfsMyGNkUOvrs0KcKGwdS7xm6WtXyZdTRbZUtpXsbplg
	 nZ4jaTIvRt9pJgxe8RvK2uXVOuadbdCi8CdfUa9XqVqhyAbYjZ1C9KS5yLyyzwJ0IZrLl
	 Q6ZFiQVpLEID2lziYjcR455FARNvNvcoEF+n0CEXuhyaQpAmfNqLQdDLMVm6xKFkCY6iC
	 20mDccb0ySQt1Vv5o2DahlIcUD3fBSWJyB/HYUpzbtJXmfTxjL5j4odiKeQtuRExxuQ==
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=FC8vOu0a;
	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 BB366606A336;
	Wed, 11 Nov 2026 09:37:49 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DCB21F00A0D;
	Wed, 11 Nov 2026 09:37:48 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794389869;
	bh=7cU38DoVjW3VyYZPHW4NAYGDfjUuJ2rdWA3h6vVFBbk=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=FC8vOu0a+yZAK4AvhhIbauSPdakVlkaMBIR4gUH7DOdkQmIEz8q9q9EltXZkx7FLV
	 qvzMziGNJQOBSiAeo8BRehMxpX/6udZyrV9b2862WoWgJPyub6kmWvkc0pRYbkV+t4
	 41ZdZwSwyJm56w6dmr0d4Z8N3fHHXpP1CkL4wYClF4J+SiIFAu0HCTJBOyPth1PbG/
	 AmA4Og2tCWB605JXQd8RuIcjP58RnlKF/MxYRDKmdRYs/rBkBmBMb/tFEEM5XVeQgS
	 2HVJnXDwJFHNEPBX4ZWzeznoB93oK0lqO82E8izNymNnPLA6ZLqmHVEo3hJn1XBYqh
	 CHq8JIrb03j6g==
X-Cc: netdev@vger.kernel.org, ivecera@redhat.com, jiri@nvidia.com,
 corbet@lwn.net, skhan@linuxfoundation.org, shuah@kernel.org,
 rdunlap@infradead.org, jani.nikula@intel.com, vadim.fedorenko@linux.dev,
 arkadiusz.kubalewski@intel.com, jiri@resnulli.us, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org
X-In-Reply-To: <20261109093523.931201-8-poros@redhat.com>
X-sashiko-severity: Low
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