Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: nikhil.rao@amd.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, brett.creeley@amd.com,
	eric.joyner@amd.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com
Subject: Re: [PATCH net v2] pds_core: keep the health thread stopped during reset
Date: Thu, 23 Jul 2026 07:17:20 -0700	[thread overview]
Message-ID: <20260723141720.623532-1-kuba@kernel.org> (raw)
In-Reply-To: <20260722001621.22527-1-nikhil.rao@amd.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
--- Patch [1]: [PATCH net v2] pds_core: keep the health thread stopped during reset ---
commit 253bc338bd6e7dd7e1be6b7664ab1b26f176624e
Author: Nikhil P. Rao <nikhil.rao@amd.com>

pds_core: keep the health thread stopped during reset

This commit replaces cancel_work_sync() with disable_work_sync() for the
health thread to ensure it doesn't get re-queued by a timeout during reset.
It then restarts the thread using enable_work().

Link: https://sashiko.dev/#/patchset/20260629200358.2626129-1-nikhil.rao%40amd.com?part=2

> diff --git a/drivers/net/ethernet/amd/pds_core/main.c b/drivers/net/ethernet/amd/pds_core/main.c
> index 8d94a4d70395e..ccb8aa7b95f7e 100644
> --- a/drivers/net/ethernet/amd/pds_core/main.c
> +++ b/drivers/net/ethernet/amd/pds_core/main.c
> @@ -471,7 +471,7 @@ static void pdsc_stop_health_thread(struct pdsc *pdsc)
>  
>  	timer_shutdown_sync(&pdsc->wdtimer);
>  	if (pdsc->health_work.func)
> -		cancel_work_sync(&pdsc->health_work);
> +		disable_work_sync(&pdsc->health_work);

[Severity: High]
Could this lead to an unbalanced disable count during an Advanced Error
Reporting (AER) reset?

Unlike cancel_work_sync(), disable_work_sync() increments a depth counter.
During an AER fatal error, pdsc_pci_error_detected() manually invokes
pdsc_reset_prepare(), which calls pdsc_stop_health_thread(), setting the
disable count to 1.

Later, the AER resume path in pdsc_pci_error_resume() calls
pci_reset_function_locked(), which internally calls the driver's
.reset_prepare callback a second time:

drivers/pci/pci.c:pci_reset_function_locked() {
	pci_dev_save_and_disable(dev);
	rc = __pci_reset_function_locked(dev);
	pci_dev_restore(dev);
}

Because pci_dev_save_and_disable() invokes the driver's .reset_prepare,
the disable count increments to 2. However, pci_dev_restore() only triggers
.reset_done once, which means enable_work() is only called once.

Will this leave the health work item permanently disabled (with a count of 1),
preventing the driver from monitoring firmware health or triggering future
recoveries?
-- 
pw-bot: cr

      parent reply	other threads:[~2026-07-23 14:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  0:16 [PATCH net v2] pds_core: keep the health thread stopped during reset Nikhil P. Rao
2026-07-22 20:03 ` Jacob Keller
2026-07-23 14:17 ` Jakub Kicinski [this message]

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=20260723141720.623532-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.joyner@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikhil.rao@amd.com \
    --cc=pabeni@redhat.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