Linux-HyperV List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Long Li" <longli@microsoft.com>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH net v2] net: mana: Clear RDMA teardown and suspend state in mana_rdma_probe()
Date: Sat, 29 Aug 2026 00:12:47 +0000	[thread overview]
Message-ID: <20260829001247.A56A71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828001202.2110938-1-longli@microsoft.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Lockless gate reopening in `mana_rdma_probe()` exposes a race window that can silently drop hardware service events.
--

commit 92507b04de784a341e9ea7d0275d9b3dbe00e839
Author: Long Li <longli@microsoft.com>

net: mana: Clear RDMA teardown and suspend state in mana_rdma_probe()

This commit clears the rdma_teardown and is_suspended flags during probe
to ensure hardware service events are handled correctly after a reset cycle.

Link: https://lore.kernel.org/all/20260826235940.1869565-1-longli@microsoft.com/

> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 7a1ac853e3abc..56f426da72864 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c

[ ... ]

> @@ -4279,6 +4280,17 @@ int mana_rdma_probe(struct gdma_dev *gd)
>  	if (err)
>  		return err;
>  
> +	/* Clear the state left by a previous mana_rdma_remove() so servicing
> +	 * events are handled again after a reset cycle.
> +	 */
> +	gd->is_suspended = false;
> +
> +	/* Publish is_suspended before re-opening the gate, so the handler
> +	 * cannot act on a stale value.  Pairs with the smp_load_acquire()
> +	 * in mana_rdma_service_handle().
> +	 */
> +	smp_store_release(&gd->rdma_teardown, false);
> +
>  	err = add_adev(gd, "rdma");

[Severity: High]
Does opening the rdma_teardown gate here create a race window where hardware
service events can be silently dropped?

Because mana_gd_register_device(gd) was called earlier in this function,
the hardware can now generate events. If an event like
GDMA_SERVICE_TYPE_RDMA_SUSPEND fires immediately after smp_store_release()
clears rdma_teardown, the ordered workqueue will run mana_rdma_service_handle().

The handler will pass the rdma_teardown check but evaluate !gd->adev as true
because add_adev() hasn't completed yet:

drivers/net/ethernet/microsoft/mana/mana_en.c:mana_rdma_service_handle() {
	...
	case GDMA_SERVICE_TYPE_RDMA_SUSPEND:
		if (!gd->adev || gd->is_suspended)
			break;
	...
}

This causes the event to be dropped, which could create a permanent state
inconsistency between the OS and the hardware. Should the gate be opened
after add_adev() successfully assigns gd->adev?

>  	if (err)
>  		mana_gd_deregister_device(gd);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260828001202.2110938-1-longli@microsoft.com?part=1

  reply	other threads:[~2026-08-29  0:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  0:12 [PATCH net v2] net: mana: Clear RDMA teardown and suspend state in mana_rdma_probe() Long Li
2026-08-29  0:12 ` sashiko-bot [this message]
2026-08-29  1:34   ` [EXTERNAL] " Long Li
2026-09-02 16:44 ` Simon Horman
2026-09-02 17:42   ` [EXTERNAL] " Long Li

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=20260829001247.A56A71F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=longli@microsoft.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox