All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Konstantin Sinyuk" <ksinyuk@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH 09/12] drm/fabric: implement mutation netlink operations
Date: Tue, 25 Aug 2026 08:10:37 +0000	[thread overview]
Message-ID: <20260825081037.D57D91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <5b008798364477a2740ebb18544bddfa16f7d512.1787552412.git.ksinyuk@kernel.org>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] Mutation operations (NEW/ADD/SET) only return an ACK instead of replying with a full message.
- [Medium] Notifications emitted in response to mutation requests do not honor the NLM_F_ECHO flag.
- [Medium] Extraneous wrapping nest used for FABRIC_NEW parameters.
- [Low] Missing extended ACK coverage when required nested attributes in peer descriptors are absent.
--

--- Patch [9]: [RFC PATCH 09/12] drm/fabric: implement mutation netlink operations ---
commit 7000874bd5559d10291fdcd411ac9f167a4334c9
Author: Konstantin Sinyuk <ksinyuk@kernel.org>

    drm/fabric: implement mutation netlink operations
    
    Connect the six provisioning operations to the core mutation helpers and
    add the generated operation and policy source that dispatches to them.
    
    Resolve and pin mutation targets in pre_doit, run each transaction under
    drm_fabric_mutation_lock, call the provider without drm_fabric_lock held,
    and release references in post_doit. All six require GENL_ADMIN_PERM and
    are confined to init_net.
    
    A failed provider callback returns its error with core state unchanged.
    Successful mutations emit notifications after commit, carrying the
    resulting topology generation.

> diff --git a/drivers/gpu/drm/fabric/drm_fabric_netlink.c b/drivers/gpu/drm/fabric/drm_fabric_netlink.c
> index fef2d4c8f5bb9..1a0f293723e95 100644
> --- a/drivers/gpu/drm/fabric/drm_fabric_netlink.c
> +++ b/drivers/gpu/drm/fabric/drm_fabric_netlink.c
[ ... ]
> +/* A nested policy cannot mark members required; check type and instance-id here. */
> +static int drm_fabric_parse_new_params(struct genl_info *info,
> +					enum drm_fabric_type *type,
> +					const char **name, u64 *instance_id)
> +{
> +	struct nlattr *pa[DRM_FABRIC_A_FABRIC_NEW_PARAMS_MAX + 1];
> +	struct nlattr *nest;
> +	int ret;
> +
> +	if (GENL_REQ_ATTR_CHECK(info, DRM_FABRIC_A_FABRIC_NEW_PARAMS))
> +		return -EINVAL;
> +
> +	nest = info->attrs[DRM_FABRIC_A_FABRIC_NEW_PARAMS];
> +	ret = nla_parse_nested(pa, DRM_FABRIC_A_FABRIC_NEW_PARAMS_MAX, nest,
> +			       drm_fabric_fabric_new_params_nl_policy,
> +			       info->extack);

[Severity: Medium]
Does this create an extra wrapping nest for the new parameters?

Netlink uAPI guidelines for new families prefer flat attributes over wrapping
nests. Is it possible to avoid using DRM_FABRIC_A_FABRIC_NEW_PARAMS and instead
place these parameters directly in the main attribute set?

[ ... ]
> +int drm_fabric_nl_endpoint_set_doit(struct sk_buff *skb,
> +				    struct genl_info *info)
> +{
[ ... ]
> +	if (!change.valid)
> +		return -EINVAL;
> +
> +	return drm_fabric_endpoint_set(ep, &change);
> +}

[Severity: Medium]
Should this function reply with a full message rather than just an ACK?

New netlink families should reply to mutation operations (like SET and NEW)
with a full message carrying the object state, rather than just relying on
a generic ACK. This applies here as well as to drm_fabric_nl_port_set_doit()
and drm_fabric_nl_port_peer_new_doit().

[ ... ]
> +int drm_fabric_nl_port_peer_new_doit(struct sk_buff *skb,
> +				     struct genl_info *info)
> +{
> +	struct drm_fabric_port *port = info->user_ptr[0];
> +	struct nlattr *pa[DRM_FABRIC_A_PEER_ATTRS_MAX + 1];
> +	struct drm_fabric_peer peer = {};
> +	int ret;
> +
> +	if (GENL_REQ_ATTR_CHECK(info, DRM_FABRIC_A_PEER))
> +		return -EINVAL;
> +
> +	ret = nla_parse_nested(pa, DRM_FABRIC_A_PEER_ATTRS_MAX,
> +			       info->attrs[DRM_FABRIC_A_PEER],
> +			       drm_fabric_peer_nl_policy, info->extack);
> +	if (ret)
> +		return ret;
> +
> +	/*
> +	 * A nested policy cannot require members; require the complete peer
> +	 * descriptor here.
> +	 */
> +	if (!pa[DRM_FABRIC_A_PEER_ATTRS_PEER_ID] ||
> +	    !pa[DRM_FABRIC_A_PEER_ATTRS_TYPE] ||
> +	    !pa[DRM_FABRIC_A_PEER_ATTRS_PORT_INDEX])
> +		return -EINVAL;

[Severity: Low]
Could this manual check use NL_REQ_ATTR_CHECK() to provide extended ACK
information?

Currently, this returns a bare -EINVAL without populating the extack to inform
userspace which specific nested attribute was missing from the peer descriptor.

> +
> +	peer.peer_id = nla_get_u64(pa[DRM_FABRIC_A_PEER_ATTRS_PEER_ID]);
> +	peer.peer_type = nla_get_u32(pa[DRM_FABRIC_A_PEER_ATTRS_TYPE]);
> +	peer.port_index = nla_get_u32(pa[DRM_FABRIC_A_PEER_ATTRS_PORT_INDEX]);
> +
> +	return drm_fabric_port_peer_new(port, &peer);
> +}
[ ... ]
> +void drm_fabric_emit_endpoint_change(struct drm_fabric_endpoint *ep, u32 generation)
> +{
> +	drm_fabric_endpoint_event_send(DRM_FABRIC_CMD_ENDPOINT_CHANGE_NTF, ep,
> +				       generation);
> +}

[Severity: Medium]
Will these notifications honor the NLM_F_ECHO flag?

The event send functions (such as drm_fabric_endpoint_event_send() called here,
and drm_fabric_emit_port_change()) use genlmsg_multicast() directly without
the originating request context.

When emitting a notification in response to a request, passing the request info
to genl_notify() ensures that userspace applications setting NLM_F_ECHO will
correctly receive their own mutations back.

> diff --git a/drivers/gpu/drm/fabric/drm_fabric_nl.c b/drivers/gpu/drm/fabric/drm_fabric_nl.c
> index 0325484051466..20b277f27ae9b 100644
> --- a/drivers/gpu/drm/fabric/drm_fabric_nl.c
> +++ b/drivers/gpu/drm/fabric/drm_fabric_nl.c
[ ... ]
> +/* DRM_FABRIC_CMD_FABRIC_NEW - do */
> +static const struct nla_policy drm_fabric_fabric_new_nl_policy[DRM_FABRIC_A_FABRIC_NEW_PARAMS + 1] = {
> +	[DRM_FABRIC_A_FABRIC_NEW_PARAMS] = NLA_POLICY_NESTED(drm_fabric_fabric_new_params_nl_policy),
> +};

[Severity: Medium]
Does this policy enforce an extraneous wrapping nest?

As mentioned earlier, Netlink uAPI guidelines discourage wrapping nests for
new families. Can these parameters be flattened into the main attribute set?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787552412.git.ksinyuk@kernel.org?part=9

  reply	other threads:[~2026-08-25  8:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  8:09 [RFC PATCH 0/12] drm/fabric: vendor-neutral topology infrastructure for scale-up accelerator interconnects Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 01/12] drm/fabric: add core object model and provider API Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 02/12] drm/fabric: add query uAPI and generated headers Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 03/12] drm/fabric: implement query netlink operations Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 04/12] drm/fabric: add read-only synthetic provider Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 05/12] drm/fabric: add object-model KUnit tests Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 06/12] drm/fabric: add YNL query and policy selftests Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 07/12] drm/fabric: add topology-provisioning core Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 08/12] drm/fabric: add provisioning netlink uAPI Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 09/12] drm/fabric: implement mutation netlink operations Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot [this message]
2026-08-24  8:09 ` [RFC PATCH 10/12] drm/fabric: make the synthetic provider writable Konstantin Sinyuk
2026-08-24  8:09 ` [RFC PATCH 11/12] drm/fabric: add mutation KUnit tests Konstantin Sinyuk
2026-08-25  8:10   ` sashiko-bot
2026-08-24  8:09 ` [RFC PATCH 12/12] drm/fabric: add mutation netlink selftests Konstantin Sinyuk
2026-08-26  9:32 ` [RFC PATCH 0/12] drm/fabric: vendor-neutral topology infrastructure for scale-up accelerator interconnects Leon Romanovsky
2026-08-26 15:38   ` Konstantin Sinyuk
2026-08-27 17:09     ` Leon Romanovsky
2026-08-28 16:13       ` Rodrigo Vivi
2026-09-01 11:01         ` Leon Romanovsky
2026-09-01 15:25           ` Rodrigo Vivi
2026-09-02  7:10             ` Leon Romanovsky
2026-08-31 11:45       ` Konstantin Sinyuk
2026-08-27 12:35 ` Jiri Pirko
2026-08-28 16:28   ` Rodrigo Vivi
2026-08-28 17:03     ` Jason Gunthorpe
2026-08-31 11:45       ` Konstantin Sinyuk
2026-08-31 12:23         ` Jason Gunthorpe
2026-08-31 11:45   ` Konstantin Sinyuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260825081037.D57D91F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ksinyuk@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.