From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796496938; b=Itf0QzOv/5c5Xf7I88pB33XVGzQVj8IEa2DQplxGocIYODSa2WXLJmPJsfPdv8XQtO+2 pB13GdoVVVKV8bPdqNae+0Zc142rXXrLqm1u1URTO+riuSbtmackC33mPj31FhrUT3pCc KagmNiJs/DA8frcnCr1mlIESMpGpqOTzOwOR4B140af/aoshZCZaYUPA6LjsY0MOcVSBl 0Mat1/jf8EQgeHWq7NGUta52F8TiyK0db0zna+BQbPK0qhYu6Fw3JvxIe3EHfBkPf1uZO /BISSL2SNs0l5anil9N768S9vcGbzzuRunSa8ni3VmttFuv2GnV1qDMfRQWL53xC3ww== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796496938; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=DgtjLnA2S1USZQeiop56C8gA6qwXSeZj58uKsWYows4=; b=DCldShcvWNHX4tU3q74a/p200wMzVdfmONXGziVz0HVEHzd1iNZENO1pQni1EFLtTcAo ovH0eVm0nLF3qPe1ftHXjiiyCDIEFcNK1wOU5tEGKWqRU9QEbzLh+MIDOmH6F3FU3CKUS mbuQB4Z2cNMnf7IX48N7hV6vJhP1BS/W2CqQPYn/zPHA4GrvA0IDb46NAOkLyYvFzU9V6 cFSTIMHIrTwccy78NKwEO1isSNsGUS8NVlkbAqNQNG3OR2+oL27WNxgxpxjlWcq/UdtNt kFPGjiteghnnOfUlTnagl5Gcq+z1yIrkA/0+fsKd2lnyzQ0XPFaH29dogzMvUAT77FA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=I2p41AZf; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F7B6606A31F; Sat, 5 Dec 2026 18:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=I2p41AZf Received: by smtp.kernel.org (Postfix) with ESMTPSA id 207EC1F0092B; Sat, 5 Dec 2026 18:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796496938; bh=DgtjLnA2S1USZQeiop56C8gA6qwXSeZj58uKsWYows4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=I2p41AZfr5B1P3fb7jNDfhjP8TQDMFCOBBUTYPlj5rZMRRgNx36HT0oGW/0eUBc1U pfG7n9yCZ7A6ID3C+Ai7FbAXwKOfgxwv2odGZJ7CMXbZ+XRge63qfm6PjwgC0JRlWG BbUrz2wXrt1tTN7UgwBjGusOsNbH+j6XPONiTTQhA21uKgtdNj8TTx4AWroTKKMj/C 7DQRHCPzfQoU2H09rbd+0Tv530YNHVdqq03T+3bxH3COKG61fyiurhP1OF485M4PQL RarFe7APRVtInfE+WOz0asBsLSntUdWA9OUn9J4k8F9YYj/GbdhRWMlszvYvc8Prgq GHKrKX+UfP/VA== Subject: Re: [PATCH v2] net/mlx5: Use generic power management 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 Date: Sat, 05 Dec 2026 18:55:36 +0000 Message-ID: <179649693664.3148.17485330191085387029@kernel.org> In-Reply-To: <20261204185308.6819-1-vaibhavgupta40@gmail.com> References: <20261204185308.6819-1-vaibhavgupta40@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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