Article View: linux.kernel.netdev
Article #27052Re: [PATCH net] dpll: do not overwrite extack messages set by drivers
From: Vadim Fedorenko
Date: Fri, 04 Dec 2026 17:47
Date: Fri, 04 Dec 2026 17:47
114 lines
13632 bytes
13632 bytes
On 04/12/2026 15:52, Ivan Vecera wrote:
> When the frequency_set(), esync_set(), ref_sync_set() or
> phase_adjust_set() pin callback fails, the DPLL core sets its own
> generic message like "frequency set failed for dpll_id:N" with
> NL_SET_ERR_MSG_FMT(). This replaces any message set by the driver, so
> userspace never sees why the driver rejected the request, e.g. the
> zl3073x reasons for an invalid output frequency or reference sync
> pair, or the ice admin queue status.
>
> Add NL_SET_ERR_MSG_FMT_WEAK(), a formatted variant of
> NL_SET_ERR_MSG_WEAK() that sets the message only if none is set yet,
> and use it for these generic messages. The other set callbacks already
> return the driver error without a message of their own.
>
> Discovered by an AI code review agent (Sashiko) and confirmed by code
> inspection. Tested on a GNR-D system with a ZL80132B DPLL by setting
> the P-pin of an N-div output to 1 Hz, which leaves no valid frequency
> for its N-pin: the reply carried "frequency set failed for dpll_id:12"
> before the fix and "OUT8N freq must be at most half of OUT8P freq"
> with it. The new macro was also checked in a userspace test built
> from the netlink.h macros: a message set before is kept, otherwise the
> generic one is set.
>
> Fixes: d7fbc0b7e846 ("dpll: netlink/core: add support for pin-dpll signal phase offset/adjust")
> Fixes: 20f6677234d8 ("dpll: netlink/core: change pin frequency set behavior")
> Fixes: cda1fba15cb2 ("dpll: add Embedded SYNC feature for a pin")
> Fixes: 58256a26bfb3 ("dpll: add reference sync get/set")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/bug/linux-06bba4c1-85c2-43b9-9d63-a2d615540f64
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
> ---
> drivers/dpll/dpll_netlink.c | 24 ++++++++++++------------
> include/linux/netlink.h | 7 +++++++
> 2 files changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c
> index e5380d95f238b3..422e3fa3a632a8 100644
> --- a/drivers/dpll/dpll_netlink.c
> +++ b/drivers/dpll/dpll_netlink.c
> @@ -1132,9 +1132,9 @@ dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a,
> ret = ops->frequency_set(pin, dpll_pin_on_dpll_priv(dpll, pin),
> dpll, dpll_priv(dpll), freq, extack);
> if (ret) {
> - NL_SET_ERR_MSG_FMT(extack,
> - "frequency set failed for dpll_id:%u",
> - dpll->id);
> + NL_SET_ERR_MSG_FMT_WEAK(extack,
> + "frequency set failed for dpll_id:%u",
> + dpll->id);
> return ret;
> }
> __dpll_pin_change_ntf(pin);
> @@ -1186,9 +1186,9 @@ dpll_pin_esync_set(struct dpll_pin *pin, struct nlattr *a,
> ret = ops->esync_set(pin, dpll_pin_on_dpll_priv(dpll, pin), dpll,
> dpll_priv(dpll), freq, extack);
> if (ret) {
> - NL_SET_ERR_MSG_FMT(extack,
> - "embedded sync frequency set failed for dpll_id: %u",
> - dpll->id);
> + NL_SET_ERR_MSG_FMT_WEAK(extack,
> + "embedded sync frequency set failed for dpll_id: %u",
> + dpll->id);
> return ret;
> }
> __dpll_pin_change_ntf(pin);
> @@ -1250,9 +1250,9 @@ dpll_pin_ref_sync_state_set(struct dpll_pin *pin,
> ret = ops->ref_sync_set(pin, pin_priv, ref_sync_pin, ref_sync_pin_priv,
> state, extack);
> if (ret) {
> - NL_SET_ERR_MSG_FMT(extack,
> - "reference sync set failed for dpll_id:%u",
> - dpll->id);
> + NL_SET_ERR_MSG_FMT_WEAK(extack,
> + "reference sync set failed for dpll_id:%u",
> + dpll->id);
> return ret;
> }
> __dpll_pin_change_ntf(pin);
> @@ -1462,9 +1462,9 @@ dpll_pin_phase_adj_set(struct dpll_pin *pin, struct nlattr *phase_adj_attr,
> ret = ops->phase_adjust_set(pin, dpll_pin_on_dpll_priv(dpll, pin),
> dpll, dpll_priv(dpll), phase_adj, extack);
> if (ret) {
> - NL_SET_ERR_MSG_FMT(extack,
> - "phase adjust set failed for dpll_id:%u",
> - dpll->id);
> + NL_SET_ERR_MSG_FMT_WEAK(extack,
> + "phase adjust set failed for dpll_id:%u",
> + dpll->id);
> return ret;
> }
> __dpll_pin_change_ntf(pin);
> diff --git a/include/linux/netlink.h b/include/linux/netlink.h
> index b4eb873850e752..18e05f81e33e0b 100644
> --- a/include/linux/netlink.h
> +++ b/include/linux/netlink.h
> @@ -143,6 +143,13 @@ struct netlink_ext_ack {
> NL_SET_ERR_MSG_MOD((extack), msg); \
> } while (0)
>
> +#define NL_SET_ERR_MSG_FMT_WEAK(extack, fmt, args...) do { \
> + struct netlink_ext_ack *__extack_weak = (extack); \
> + \
> + if (__extack_weak && !__extack_weak->_msg) \
> + NL_SET_ERR_MSG_FMT(__extack_weak, fmt, ##args); \
> +} while (0)
> +
> #define NL_SET_BAD_ATTR_POLICY(extack, attr, pol) do { \
> if ((extack)) { \
> (extack)->bad_attr = (attr); \
>
> base-commit: 3c8881ee98069d3c8a1a0ad1fd6efd726e466297
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Technical Details
Message-ID:
<860a764d-089c-4fda-919e-740d5b61f095@linux.dev>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377517-linux-kernel-netdev=dewy.ruReferences:
<20261204155246.425636-1-ivecera@redhat.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377517-linux-kernel-netdev=dewy.ru From: vadim.fedorenko@linux.dev (Vadim Fedorenko) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] dpll: do not overwrite extack messages set by drivers Date: Fri, 4 Dec 2026 17:47:26 +0000 Organization: Usenet Network Message-ID: <860a764d-089c-4fda-919e-740d5b61f095@linux.dev> References: <20261204155246.425636-1-ivecera@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2821737"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:AJx8ei52Gh6FfnNfRgKoU+pESwE= sha256:gCRrcSlkFzBRcccl+GhCsAYkNlx5VOr/GnqpSh8NIug= sha1:qDLKtkqHbFLF7Beuj4LBCRqavRw= sha256:itEwP9PndcqeGIbyubh4JX0W/+JjBecG/1e1t1Y0DDs= Content-Language: en-US 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 4DD1F117C84; Fri, 4 Dec 2026 20:47:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.298 X-Spam-Status: No, score=-3.298 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, HEADER_FROM_DIFFERENT_DOMAINS=0.001, 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 (1024-bit key) header.d=linux.dev 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 rLxF9gX6MDVw; Fri, 4 Dec 2026 20:47:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377517-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 60D77117C76; Fri, 4 Dec 2026 20:47:35 +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 6CB6764371; Fri, 4 Dec 2026 17:47:33 +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=1796406453; b=dolXMMPsUZrZpP58x6GMV0zsMyna8ZmyUspt9hk4TT3an9XDFwsixUdgGtI4V0N6IB8w Zk16dL6rMjooaoPwy7yhGfs06HS/XJzswH8+R6PtkomoUEzRwddiSgYRStNpWOU+BQKDW IAvvo2hbvGox+USdhK7gZ9huIkAzoKw2Z73hp06u8Gfx7h3rS0JTHUZHf9O/iyA6cqPHM nrHTpx1nweoqyDi+34Ut9Y6g0xarmMHnSpwpFOtnXsDQW/rwEEDqicdrDqVnyyCWv3h3R ljIUTA6T1x1m4Exc6GEi9RFfE+7aEosp2aFsH/O9zO7xIrjc+ZRlxzoWTZ2Yj9o5DiQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796406453; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=orQUvwarKzz78DPDTzByjjv3g6IwfuCgfe8HzK8jNq0=; b=A7xntp7/Qp9EJbJRgxCcOhyBGb4FKferZ5Ft8wNnVTXP+fKZiW4sALdwK6feZSeR+1JV SJCRowkKgt4P+yegBC2uO/k3D7jObLd6zctHv0fU8bPt2QUMw94PZOiWE3HwmewMDN6Rq EYKEVmRJ02s+Ea0j+uDpiuT4aq6eZS0O5B0zY8AlobfS0zB6WNiLUuCEECuPmrTtU066+ udnzbASitJgIzzhFWjXcCeWki0SX/iNq69ajopHAjZ5bUzLYGZ2YagB9h+aRdvJt5SHJs gspQqPGHc7SY+AGNDb9GoUpH5b+Sd0XLdtCEBGGAxwCSVRg3qLc3RFyol7nsSmelndQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Vvbi0tey; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; 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 4235B606A336; Fri, 4 Dec 2026 17:47:33 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Vvbi0tey X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.213 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796406452; b=GMQwr0k26MHFCEZmUJrGXZScISluEdWazj4ZrwdeCyXqc7rhdrom7FI+dL83Ngyf5NXc r9BtfP6z87dWmuCuU6L4FD5+lju0doPgWEMpZ7W15ju/Vvl3MLBgcsDiNSQzpN+jZ86C0 RUwQjPJ68MuuHLLtWhuYHF9SHi/XWi0OGzDl4U3Izm0u8sOWm2vp1FCSFaBXgnzcJqKyj ungrss5gyCu9+tNIf0pjOLpUWwgDVqGPdiagJS8t/X5Hh/mpCdlVbIOKoIvlgJ06lTYuy shxrMHzeqAhVd8Y+5jRHjZeMf9iI3RUhSCnlnIo9vmUGox+cSXusxDlaYvSuf0PxIOA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796406452; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=orQUvwarKzz78DPDTzByjjv3g6IwfuCgfe8HzK8jNq0=; b=QN/XOCCkj/qOUldCoUOHU89Ib+B1ETmdCOb9q6VXyQkLD+Lnl9htXaQW+quI6ZQvhFYb cQcGSonXSxUtqqQikgJIcJdflKBUtprkuuma0f9xapGnulFHNuqXWS5WsFnQ2R5ajdtN7 gVPwqQSEP+moOKKrNJdOa3T+pON/K+qSz5XU2GbbICt+fokrf1Jv2nkGvu3O6uKwno2vx BIhNsFYK2EGPriMNuG+gBbziNWN6HX0NGaK46RWorP30dOn04N5jcKrJ7OiM3458B2mF/ YYi5eGCOl0/WFYpMqvPGs5Ry5uRq1eGpgzCb3aQejBKLizOESlMCUCXUsKLxFJspHwA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Vvbi0tey; arc=none smtp.remote-ip=95.215.58.213 X-Received: from mta1.migadu.com (out-213.mta1.migadu.com [95.215.58.213]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF818606A322 for <netdev@vger.kernel.org>; Fri, 4 Dec 2026 17:47:30 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CF818606A322 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=HBlMQaM3B+N4dca+GxhTRIajappt7qn1wHlXKA2dfRU=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796406448; v=1; x=1797011248; b=Vvbi0teytnKjxu4vYpmcEDeFTs8RoCpkH9l73l5AFcgcuzrAddOQ5BNSgGFA9exRqNartR1A QUhQhCGHsP+ZP2JAryvXuVx3B250p5K0tzhemG3nsuSwQW5/C0092uBEmzDKzQZYcaeR2GSQ9/l nfZNuqqQAqgBTABkj+iELao0= X-Envelope-To: netdev@vger.kernel.org X-Received: by smtp.migadu.com with ESMTPS id 2148cb658fb1e13a; Fri, 04 Dec 2026 17:47:28 +0000 X-Mizu-Trace-ID: 2148cb658fb1e13a X-Migadu-Flow: FLOW_OUT 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-User-Agent: Mozilla Thunderbird X-Cc: Sashiko <sashiko-bot@kernel.org>, Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>, Jiri Pirko <jiri@resnulli.us>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Willem de Bruijn <willemb@google.com>, Simon Horman <horms@kernel.org>, Aleksandr Loktionov <aleksandr.loktionov@intel.com>, Przemek Kitszel <przemyslaw.kitszel@intel.com>, Milena Olech <milena.olech@intel.com> X-In-Reply-To: <20261204155246.425636-1-ivecera@redhat.com>