From: Shahar Shitrit <shshitrit@nvidia.com>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, mst@redhat.com, jasowang@redhat.com,
pabeni@redhat.com, virtualization@lists.linux.dev,
parav@nvidia.com, yohadt@nvidia.com, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com, jgg@ziepe.ca, kevin.tian@intel.com,
kuba@kernel.org, andrew+netdev@lunn.ch, edumazet@google.com,
danielj@nvidia.com
Subject: Re: [net-next,v23,07/14] virtio_net: Create a FF group for ethtool steering
Date: Tue, 1 Dec 2026 16:40:51 +0200 [thread overview]
Message-ID: <cf2bf097-363d-40a3-b29a-1bab252258da@nvidia.com> (raw)
In-Reply-To: <178835474446.3394541.12292421422984466705@kernel.org>
On 02/09/2026 16:12, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider:
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> - [Medium] virtnet_ff_cleanup() (drivers/net/virtio_net.c:5945-5962)
> issues the new…
>
> --
>
> virtio_net: Create a FF group for ethtool steering
>
> This adds a single flow filter group object, created during
> virtnet_ff_init() with a hard-coded object ID, and destroyed in
> virtnet_ff_cleanup(). A new uapi struct and object type define the
> group payload.
>
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index 4f78b881e493b..294cfd70662d3 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>
> [ ... ]
>
>> @@ -5897,6 +5907,19 @@ static int virtnet_ff_init(struct virtnet_ff *ff, struct virtio_device *vdev)
>> if (err)
>> goto err_ff_action;
>>
>> + ethtool_group.group_priority = cpu_to_le16(VIRTNET_FF_ETHTOOL_GROUP_PRIORITY);
>> +
>> + /* Use priority for the object ID. */
>> + err = virtio_admin_obj_create(vdev,
>> + VIRTIO_NET_RESOURCE_OBJ_FF_GROUP,
>> + VIRTNET_FF_ETHTOOL_GROUP_PRIORITY,
>> + VIRTIO_ADMIN_GROUP_TYPE_SELF,
>> + 0,
>> + ðtool_group,
>> + sizeof(ethtool_group));
>> + if (err)
>> + goto err_ff_action;
>> +
>> ff->vdev = vdev;
>> ff->ff_supported = true;
>>
>> @@ -5921,9 +5944,18 @@ static int virtnet_ff_init(struct virtnet_ff *ff, struct virtio_device *vdev)
>>
>> static void virtnet_ff_cleanup(struct virtnet_ff *ff)
>> {
>> + int err;
>> +
>> if (!ff->ff_supported)
>> return;
>>
>> + err = virtio_admin_obj_destroy(ff->vdev,
>> + VIRTIO_NET_RESOURCE_OBJ_FF_GROUP,
>> + VIRTNET_FF_ETHTOOL_GROUP_PRIORITY,
>> + VIRTIO_ADMIN_GROUP_TYPE_SELF,
>> + 0);
>> + WARN_ON_ONCE(err);
>> +
>> kfree(ff->ff_actions);
>> kfree(ff->ff_mask);
>> kfree(ff->ff_caps);
>
> [Severity: Medium]
>
> Is WARN_ON_ONCE() the right reporting mechanism for this error, given that
> err here is not a kernel invariant? Looking at virtio_admin_obj_destroy()
> in drivers/virtio/virtio_admin_commands.c, err comes from either an
> allocation failure or the device-supplied admin command status:
>
> data = kzalloc_obj(*data);
> if (!data)
> return -ENOMEM;
> ...
> err = vdev->config->admin_cmd_exec(vdev, &cmd);
> kfree(data);
>
> return err;
>
> virtnet_ff_cleanup() runs from virtnet_remove(), from the virtnet_probe()
> error path, and from virtnet_freeze_down() on suspend. An already reset or
> NEEDS_RESET device, a surprise removal, or a misbehaving backend would then
> produce a warning splat on an ordinary teardown path, and a guest panic when
> panic_on_warn is set. Would a rate-limited netdev_warn() or dev_warn()
> convey the same information here?
>
> The second part of the question is what happens to the device-side object
> when the destroy does fail. The error is discarded and the driver then
> unconditionally does:
>
> kfree(ff->ff_actions);
> kfree(ff->ff_mask);
> kfree(ff->ff_caps);
> ff->ff_supported = false;
>
> so no record of the group object is kept, while the device may still hold
> it. Since virtnet_ff_init() always re-creates the same hard-coded ID:
>
> err = virtio_admin_obj_create(vdev,
> VIRTIO_NET_RESOURCE_OBJ_FF_GROUP,
> VIRTNET_FF_ETHTOOL_GROUP_PRIORITY,
> ...);
> if (err)
> goto err_ff_action;
>
> can a group object left behind by a failed destroy make the next create of
> that same ID fail, and thereby turn an ignorable teardown error into a
> probe or resume failure on re-bind? There is no retry, no alternate ID, and
> no state retained that would allow either.
>
> Note that this depends on whether a device reset already releases admin
> resource objects, which is not something that can be determined from the
> tree. Would it be worth documenting that expectation alongside the destroy
> call?
>
> This code is unchanged at the end of the series.
WARN_ON_ONCE() was requested by MST during review. A failed destroy
means the driver and device disagree about the object's state, which is
what we want to flag. A reset follows teardown, which discards
device-side state, so a leftover object shouldn't affect the next probe.
>
next prev parent reply other threads:[~2026-12-01 14:41 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 16:10 [PATCH net-next v23 00/14] virtio_net: Add ethtool flow rules support Shahar Shitrit
2026-08-31 16:10 ` [PATCH net-next v23 01/14] virtio_pci: Remove supported_caps cache and build assert Shahar Shitrit
2026-08-31 16:10 ` [PATCH net-next v23 02/14] virtio_pci: Fix sleeping under spinlock in admin command path Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,02/14] " netdev-bot+sashiko
2026-09-03 9:25 ` Paolo Abeni
2026-12-01 14:27 ` Shahar Shitrit
2026-08-31 16:10 ` [PATCH net-next v23 03/14] virtio: Add config_op for admin commands Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,03/14] " netdev-bot+sashiko
2026-12-01 14:35 ` Shahar Shitrit
2026-08-31 16:10 ` [PATCH net-next v23 04/14] virtio: Expose generic device capability operations Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,04/14] " netdev-bot+sashiko
2026-08-31 16:11 ` [PATCH net-next v23 05/14] virtio: Expose object create and destroy API Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,05/14] " netdev-bot+sashiko
2026-08-31 16:11 ` [PATCH net-next v23 06/14] virtio_net: Query and set flow filter caps Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,06/14] " netdev-bot+sashiko
2026-12-01 14:39 ` Shahar Shitrit
2026-08-31 16:11 ` [PATCH net-next v23 07/14] virtio_net: Create a FF group for ethtool steering Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,07/14] " netdev-bot+sashiko
2026-12-01 14:40 ` Shahar Shitrit [this message]
2026-08-31 16:11 ` [PATCH net-next v23 08/14] ethtool: Introduce ethtool_flow_type_mask() Shahar Shitrit
2026-08-31 16:11 ` [PATCH net-next v23 09/14] virtio_net: Implement layer 2 ethtool flow rules Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,09/14] " netdev-bot+sashiko
2026-12-01 14:51 ` Shahar Shitrit
2026-08-31 16:11 ` [PATCH net-next v23 10/14] virtio_net: Use existing classifier if possible Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,10/14] " netdev-bot+sashiko
2026-12-01 14:56 ` Shahar Shitrit
2026-08-31 16:11 ` [PATCH net-next v23 11/14] virtio_net: Implement IPv4 ethtool flow rules Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,11/14] " netdev-bot+sashiko
2026-12-01 14:57 ` Shahar Shitrit
2026-08-31 16:11 ` [PATCH net-next v23 12/14] virtio_net: Add support for IPv6 ethtool steering Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,12/14] " netdev-bot+sashiko
2026-12-01 14:57 ` Shahar Shitrit
2026-08-31 16:11 ` [PATCH net-next v23 13/14] virtio_net: Add support for TCP and UDP ethtool rules Shahar Shitrit
2026-08-31 16:11 ` [PATCH net-next v23 14/14] virtio_net: Add get ethtool flow rules ops Shahar Shitrit
2026-09-02 13:12 ` [net-next,v23,14/14] " netdev-bot+sashiko
2026-12-01 14:58 ` Shahar Shitrit
2026-08-31 16:37 ` [PATCH net-next v23 00/14] virtio_net: Add ethtool flow rules support Michael S. Tsirkin
2026-08-31 19:45 ` Michael S. Tsirkin
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=cf2bf097-363d-40a3-b29a-1bab252258da@nvidia.com \
--to=shshitrit@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=danielj@nvidia.com \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kevin.tian@intel.com \
--cc=kuba@kernel.org \
--cc=mst@redhat.com \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=parav@nvidia.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
--cc=yohadt@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox