All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Konstantin Taranov <kotaranov@linux.microsoft.com>
Cc: kotaranov@microsoft.com, pabeni@redhat.com,
	haiyangz@microsoft.com, kys@microsoft.com, edumazet@google.com,
	kuba@kernel.org, davem@davemloft.net, decui@microsoft.com,
	wei.liu@kernel.org, longli@microsoft.com, jgg@ziepe.ca,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH rdma-next 4/4] net: mana: Add support for auxiliary device servicing events
Date: Sun, 20 Apr 2025 13:53:09 +0300	[thread overview]
Message-ID: <20250420105309.GC10635@unreal> (raw)
In-Reply-To: <1744655329-13601-5-git-send-email-kotaranov@linux.microsoft.com>

On Mon, Apr 14, 2025 at 11:28:49AM -0700, Konstantin Taranov wrote:
> From: Shiraz Saleem <shirazsaleem@microsoft.com>
> 
> Handle soc servcing events which require the rdma auxiliary device resources to
> be cleaned up during a suspend, and re-initialized during a resume.
> 
> Signed-off-by: Shiraz Saleem <shirazsaleem@microsoft.com>
> Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
> ---
>  .../net/ethernet/microsoft/mana/gdma_main.c   | 11 +++-
>  .../net/ethernet/microsoft/mana/hw_channel.c  | 19 ++++++
>  drivers/net/ethernet/microsoft/mana/mana_en.c | 60 +++++++++++++++++++
>  include/net/mana/gdma.h                       | 18 ++++++
>  include/net/mana/hw_channel.h                 |  9 +++
>  5 files changed, 116 insertions(+), 1 deletion(-)

<...>

> @@ -1474,6 +1481,8 @@ static void mana_gd_cleanup(struct pci_dev *pdev)
>  	mana_hwc_destroy_channel(gc);
>  
>  	mana_gd_remove_irqs(pdev);
> +
> +	destroy_workqueue(gc->service_wq);
>  }

<...>

> +static void mana_handle_rdma_servicing(struct work_struct *work)
> +{
> +	struct mana_service_work *serv_work =
> +		container_of(work, struct mana_service_work, work);
> +	struct gdma_dev *gd = serv_work->gdma_dev;
> +	struct device *dev = gd->gdma_context->dev;
> +	int ret;
> +
> +	switch (serv_work->event) {
> +	case GDMA_SERVICE_TYPE_RDMA_SUSPEND:
> +		if (!gd->adev || gd->is_suspended)
> +			break;
> +
> +		remove_adev(gd);
> +		gd->is_suspended = true;
> +		break;
> +
> +	case GDMA_SERVICE_TYPE_RDMA_RESUME:
> +		if (!gd->is_suspended)
> +			break;
> +
> +		ret = add_adev(gd, "rdma");
> +		if (ret)
> +			dev_err(dev, "Failed to add adev on resume: %d\n", ret);
> +		else
> +			gd->is_suspended = false;
> +		break;
> +
> +	default:
> +		dev_warn(dev, "unknown adev service event %u\n",
> +			 serv_work->event);
> +		break;
> +	}
> +
> +	kfree(serv_work);

The series looks ok to me, except one question. Are you sure that it is
safe to have not-connected and not-locked general work while add_adev/remove_adev
can be called in parallel from different thread? For example getting event
GDMA_SERVICE_TYPE_RDMA_SUSPEND while mana_gd_probe() fails or some other
intervention with PCI (GDMA_SERVICE_TYPE_RDMA_SUSPEND and PCI shutdown).

What type of protection do you have here?

Thanks

  reply	other threads:[~2025-04-20 10:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 18:28 [PATCH rdma-next 0/4] RDMA/mana_ib: allow separate mana_ib for each mana client Konstantin Taranov
2025-04-14 18:28 ` [PATCH rdma-next 1/4] net: mana: Probe rdma device in mana driver Konstantin Taranov
2025-04-14 18:28 ` [PATCH rdma-next 2/4] RDMA/mana_ib: Add support of mana_ib for RNIC and ETH nic Konstantin Taranov
2025-04-14 18:28 ` [PATCH rdma-next 3/4] RDMA/mana_ib: unify mana_ib functions to support any gdma device Konstantin Taranov
2025-04-14 18:28 ` [PATCH rdma-next 4/4] net: mana: Add support for auxiliary device servicing events Konstantin Taranov
2025-04-20 10:53   ` Leon Romanovsky [this message]
2025-04-24  2:33     ` Shiraz Saleem
2025-04-24 10:49       ` Leon Romanovsky

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=20250420105309.GC10635@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=jgg@ziepe.ca \
    --cc=kotaranov@linux.microsoft.com \
    --cc=kotaranov@microsoft.com \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wei.liu@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.