From: Moshe Shemesh <moshe@nvidia.com>
To: Narcisa Vasile <narcisav.kernel@gmail.com>,
Tariq Toukan <tariqt@nvidia.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, <netdev@vger.kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Akiva Goldberger <agoldberger@nvidia.com>,
Gal Pressman <gal@nvidia.com>, Leon Romanovsky <leon@kernel.org>,
open list <linux-kernel@vger.kernel.org>,
<linux-rdma@vger.kernel.org>, Mark Bloch <mbloch@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: Re: [PATCH net-next] net/mlx5: Add reset_prepare and reset_done callbacks
Date: Wed, 14 Oct 2026 17:20:08 +0300 [thread overview]
Message-ID: <eef39aa1-8e84-4a8c-abf6-81555a38e1e1@nvidia.com> (raw)
In-Reply-To: <as8jYneJ32Hl++uj@gmail.com>
On 10/14/2026 9:38 AM, Narcisa Vasile wrote:
> On Sun, Oct 11, 2026 at 12:48:09PM +0300, Tariq Toukan wrote:
>> From: Akiva Goldberger <agoldberger@nvidia.com>
>>
>> Currently, the mlx5_core driver registers only the error_detected,
>> slot_reset and resume PCI error handlers. Add the reset_prepare and
>> reset_done callbacks, which are triggered by the PCI core before and
>> after a PCI reset, respectively. These callbacks let mlx5 quiesce and
>> restore device resources and commands around a PCI reset, so the driver
>> no longer relies on the reset happening while the device is otherwise
>> idle.
>>
>> Additionally, add a device flag to indicate when a PCI reset is in
>> progress to serialize PCI reset flows with other reset flows, namely FW
>> reset. This flag also indicates to the reset_prepare and reset_done
>> callbacks when to do a full unload/reload of the driver. When the
>> callbacks are triggered by the hot-reset FW reset method, they leave the
>> teardown and reload to the FW reset.
>>
>> Signed-off-by: Akiva Goldberger <agoldberger@nvidia.com>
>> Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
>> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
>> ---
>>
>> +static void mlx5_pci_reset_prepare(struct pci_dev *pdev)
>> +{
>> + mlx5_drain_health_wq(dev);
>> + mlx5_unload_one(dev, false);
>> + mlx5_pci_disable_device(dev);
> This disables bus-mastering, after which pci_save_state snapshots it in
> the disabled state. reset_done() re-enables it but the snapshot remains
> stale.
>
Good point, will send v2.
Thanks.
> If a FW error later triggers the sw recovery through mlx5_pci_slot_reset(),
> the stale snapshot is re-applied with pci_restore_state().
> Would this disable bus mastering again and block the driver recovery?
> Should pci_set_master(pdev); and pci_restore_state(pdev); be reordered
> in mlx5_pci_slot_reset()?
>> +}
>> +
>> +static void mlx5_pci_reset_done(struct pci_dev *pdev)
>> +{
>> + err = mlx5_pci_enable_device(dev);
>> + if (err) {
>> + mlx5_core_err(dev, "%s: mlx5_pci_enable_device failed, err = %d\n",
>> + __func__, err);
> nit: mlx5_core_err already prints __func__
>> + goto clear_pci_reset_flag;
>> + }
prev parent reply other threads:[~2026-10-14 14:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 9:48 Tariq Toukan
2026-10-12 10:46 ` netdev-bot+sashiko
2026-10-14 6:38 ` Narcisa Vasile
2026-10-14 14:20 ` Moshe Shemesh [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=eef39aa1-8e84-4a8c-abf6-81555a38e1e1@nvidia.com \
--to=moshe@nvidia.com \
--cc=agoldberger@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gal@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=narcisav.kernel@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@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
all inboxes | Powered by JetHome®