public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Damato <joe@dama.to>
To: Shannon Nelson <shannon.nelson@amd.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, brett.creeley@amd.com
Subject: Re: [PATCH net-next 2/3] ionic: clean dbpage in de-init
Date: Thu, 12 Jun 2025 16:42:56 +0300	[thread overview]
Message-ID: <aErZYDQsHPbvfpqZ@MacBook-Air.local> (raw)
In-Reply-To: <20250609214644.64851-3-shannon.nelson@amd.com>

On Mon, Jun 09, 2025 at 02:46:43PM -0700, Shannon Nelson wrote:
> Since the kern_dbpage gets set up in ionic_lif_init() and that
> function's error path will clean it if needed, the kern_dbpage
> on teardown should be cleaned in ionic_lif_deinit(), not in
> ionic_lif_free().  As it is currently we get a double call
> to iounmap() on kern_dbpage if the PCI ionic fails setting up
> the lif.  One example of this is when firmware isn't responding
> to AdminQ requests and ionic's first AdminQ call fails to
> setup the NotifyQ.
> 
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
> ---
>  drivers/net/ethernet/pensando/ionic/ionic_lif.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 7707a9e53c43..48cb5d30b5f6 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -3526,10 +3526,6 @@ void ionic_lif_free(struct ionic_lif *lif)
>  	lif->info = NULL;
>  	lif->info_pa = 0;
>  
> -	/* unmap doorbell page */
> -	ionic_bus_unmap_dbpage(lif->ionic, lif->kern_dbpage);
> -	lif->kern_dbpage = NULL;
> -
>  	mutex_destroy(&lif->config_lock);
>  	mutex_destroy(&lif->queue_lock);
>  
> @@ -3555,6 +3551,9 @@ void ionic_lif_deinit(struct ionic_lif *lif)
>  	ionic_lif_qcq_deinit(lif, lif->notifyqcq);
>  	ionic_lif_qcq_deinit(lif, lif->adminqcq);
>  
> +	ionic_bus_unmap_dbpage(lif->ionic, lif->kern_dbpage);
> +	lif->kern_dbpage = NULL;
> +

Seems fine to me; my only minor nit that you can probably ignore is that the
code to unmap the page and set kern_dbpage to NULL is repeated, as you
mentioned, in ionic_lif_init's error path. Not sure if it's worth adding a
wrapper to avoid the repetition.

In either case:

Reviewed-by: Joe Damato <joe@dama.to>

  parent reply	other threads:[~2025-06-12 13:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-09 21:46 [PATCH net-next 0/3] ionic: three little changes Shannon Nelson
2025-06-09 21:46 ` [PATCH net-next 1/3] ionic: print firmware heartbeat as unsigned Shannon Nelson
2025-06-12 13:14   ` Simon Horman
2025-06-12 13:31   ` Joe Damato
2025-06-09 21:46 ` [PATCH net-next 2/3] ionic: clean dbpage in de-init Shannon Nelson
2025-06-12 13:15   ` Simon Horman
2025-06-12 13:42   ` Joe Damato [this message]
2025-06-09 21:46 ` [PATCH net-next 3/3] ionic: cancel delayed work earlier in remove Shannon Nelson
2025-06-12 13:15   ` Simon Horman
2025-06-12 14:01   ` Joe Damato
2025-06-13  9:40 ` [PATCH net-next 0/3] ionic: three little changes patchwork-bot+netdevbpf

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=aErZYDQsHPbvfpqZ@MacBook-Air.local \
    --to=joe@dama.to \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shannon.nelson@amd.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