Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: vaibhavgupta40@gmail.com
Cc: helgaas@kernel.org, bhelgaas@google.com, bjorn@helgaas.com,
	saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com,
	mbloch@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	cjubran@nvidia.com, netdev@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net/mlx5: Use generic power management
Date: Sat, 05 Dec 2026 18:55:36 +0000	[thread overview]
Message-ID: <179649693664.3148.17485330191085387029@kernel.org> (raw)
In-Reply-To: <20261204185308.6819-1-vaibhavgupta40@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit says it only swaps the legacy pci_driver
  .suspend/.resume hooks for dev_pm_ops ("Switch to the generic power…

--

net/mlx5: Use generic power management

This moves mlx5_core off the legacy pci_driver .suspend/.resume
callbacks and onto dev_pm_ops built with DEFINE_SIMPLE_DEV_PM_OPS.
mlx5_suspend() and mlx5_resume() now take a struct device. The ops are
attached through .driver.pm with pm_sleep_ptr().

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> index 0439fcfb9ce57..faa6f16fad9b4 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c

[ ... ]

> +static DEFINE_SIMPLE_DEV_PM_OPS(mlx5_pm_ops, mlx5_suspend, mlx5_resume);
> +

[ ... ]

> @@ -2286,8 +2290,7 @@ static struct pci_driver mlx5_core_driver = {
>  	.id_table       = mlx5_core_pci_table,
>  	.probe          = probe_one,
>  	.remove         = remove_one,
> -	.suspend        = mlx5_suspend,
> -	.resume         = mlx5_resume,
> +	.driver.pm      = pm_sleep_ptr(&mlx5_pm_ops),

[Severity: Medium]
Does this conversion keep the PCI power state of the device the same
across system sleep?

With the legacy hooks, pci_has_legacy_pm_support() was true. Both
pci_pm_suspend_noirq() and pci_pm_poweroff_noirq() ended up in
pci_legacy_suspend_late():

drivers/pci/pci-driver.c:pci_legacy_suspend_late() {
	if (!pci_dev->state_saved)
		pci_save_state(pci_dev);

	pci_pm_set_unknown_state(pci_dev);
	...
}

pci_pm_set_unknown_state() only changes current_state from PCI_D0 to
PCI_UNKNOWN. Nothing is written to PMCSR, so the function stayed in D0.

With .driver.pm set, both noirq phases now go through
pci_pm_suspend_noirq_common(). mlx5_suspend() never calls
pci_save_state(), so state_saved is false and the core takes this path:

drivers/pci/pci-driver.c:pci_pm_suspend_noirq_common() {
	if (!pci_dev->state_saved) {
		pci_save_state(pci_dev);
		...
		if (!pci_dev->skip_bus_pm && pci_power_manageable(pci_dev))
			pci_prepare_to_sleep(pci_dev);
	}
	...
}

pci_prepare_to_sleep() calls pci_set_power_state(dev, pci_target_state()).
That puts the function into D3hot, or into D3cold when the platform
controls power.

DEFINE_SIMPLE_DEV_PM_OPS also uses mlx5_suspend() as the .poweroff
callback. So the poweroff_noirq phase of hibernation now does the same
thing, which the legacy path never did.

On resume, this path now runs after a real D3->D0 transition:

mlx5_resume()
  mlx5_load_one()
    mlx5_load_one_devl_locked()
      mlx5_function_setup()
        mlx5_function_enable()

After D3cold the firmware may also have to cold boot. If it doesn't
finish within FW_PRE_INIT_TIMEOUT in wait_fw_init(), mlx5_load_one()
fails. The device is then left in MLX5_DEVICE_STATE_INTERNAL_ERROR.

Nothing under mlx5/core seems to put these functions into D3 across
system sleep today. There are no users of pci_set_power_state(), PCI_D3
or pci_choose_state() there. So this looks like a new hardware path.

Has it been tested on ConnectX/BlueField hardware for S3, s2idle and S4?
That includes multi-PF, Socket Direct and BlueField ECPF setups, where
several functions share firmware. The v2 notes only mention compile
testing.

If the move to D3 is intended, could the commit message mention it? The
commit message currently only says:

  "Switch to the generic power management and remove the usage of
  legacy (pci_driver) hooks."

>  	.shutdown	= shutdown,
>  	.err_handler	= &mlx5_err_handler,
>  	.sriov_configure   = mlx5_core_sriov_configure,

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204185308.6819-1-vaibhavgupta40%40gmail.com

  parent reply	other threads:[~2026-12-05 18:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-17 19:41 [PATCH v1] net/mlx5: Use generic power management Vaibhav Gupta
2026-10-17 19:45 ` sashiko-bot
2026-10-18 19:41 ` netdev-bot+sashiko
2026-10-28  6:29   ` Carolina Jubran
     [not found]     ` <CAP+cEOMaiHDRW+YAdPdj795pntKLUCQDB1E=vM4cjNfvPqTWvA@mail.gmail.com>
2026-11-25  6:45       ` Carolina Jubran
2026-12-04 18:52         ` [PATCH v2] " Vaibhav Gupta
2026-12-04 19:21           ` sashiko-bot
2026-12-05 18:55           ` netdev-bot+sashiko [this message]
2026-10-22 19:41 ` [PATCH v1] " Tariq Toukan

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=179649693664.3148.17485330191085387029@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bhelgaas@google.com \
    --cc=bjorn@helgaas.com \
    --cc=cjubran@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=helgaas@kernel.org \
    --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=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vaibhavgupta40@gmail.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