[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99edd3f0-5b58-4cdf-a421-b4f2cf2b4369@intel.com>
Date: Tue, 26 Aug 2025 13:46:16 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Alexander Duyck <alexander.duyck@...il.com>, <AlexanderDuyck@...il.com>
CC: <kuba@...nel.org>, <kernel-team@...a.com>, <andrew+netdev@...n.ch>,
<pabeni@...hat.com>, <davem@...emloft.net>, <netdev@...r.kernel.org>
Subject: Re: [net PATCH 1/2] fbnic: Fixup rtnl_lock and devl_lock handling
related to mailbox code
On 8/26/25 00:56, Alexander Duyck wrote:
> From: Alexander Duyck <alexanderduyck@...com>
>
> The exception handling path for the __fbnic_pm_resume function had a bug in
> that it was taking the devlink lock and then exiting to exception handling
> instead of waiting until after it released the lock to do so. In order to
> handle that I am swapping the placement of the unlock and the exception
> handling jump to label so that we don't trigger a deadlock by holding the
> lock longer than we need to.
>
> In addition this change applies the same ordering to the rtnl_lock/unlock
> calls in the same function as it should make the code easier to follow if
> it adheres to a consistent pattern.
it does indeed, with the added benefit of calling fbnic_fw_log_disable()
w/o rtnl
>
> Fixes: 82534f446daa ("eth: fbnic: Add devlink dev flash support")> Signed-off-by: Alexander Duyck <alexanderduyck@...com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
> ---
> drivers/net/ethernet/meta/fbnic/fbnic_pci.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
> index b70e4cadb37b..a7784deea88f 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
> @@ -443,11 +443,10 @@ static int __fbnic_pm_resume(struct device *dev)
>
> /* Re-enable mailbox */
> err = fbnic_fw_request_mbx(fbd);
> + devl_unlock(priv_to_devlink(fbd));
> if (err)
> goto err_free_irqs;
>
> - devl_unlock(priv_to_devlink(fbd));
> -
> /* Only send log history if log buffer is empty to prevent duplicate
> * log entries.
> */
> @@ -464,20 +463,20 @@ static int __fbnic_pm_resume(struct device *dev)
>
> rtnl_lock();
>
> - if (netif_running(netdev)) {
> + if (netif_running(netdev))
> err = __fbnic_open(fbn);
> - if (err)
> - goto err_free_mbx;
> - }
>
> rtnl_unlock();
> + if (err)
> + goto err_free_mbx;
>
> return 0;
> err_free_mbx:
> fbnic_fw_log_disable(fbd);
>
> - rtnl_unlock();
> + devl_lock(priv_to_devlink(fbd));
> fbnic_fw_free_mbx(fbd);
> + devl_unlock(priv_to_devlink(fbd));
> err_free_irqs:
> fbnic_free_irqs(fbd);
> err_invalidate_uc_addr:
>
>
>
Powered by blists - more mailing lists