netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Abhijit Gangurde <abhijit.gangurde@amd.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: brett.creeley@amd.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, corbet@lwn.net,
	leon@kernel.org, andrew+netdev@lunn.ch, sln@onemain.com,
	allen.hubbe@amd.com, nikhil.agarwal@amd.com,
	linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew Boyer <andrew.boyer@amd.com>
Subject: Re: [PATCH v5 11/14] RDMA/ionic: Register device ops for datapath
Date: Thu, 28 Aug 2025 15:06:28 +0530	[thread overview]
Message-ID: <fc57af3d-f2e0-2479-435b-b70f68cd5f67@amd.com> (raw)
In-Reply-To: <20250826155124.GA2134666@nvidia.com>


On 8/26/25 21:21, Jason Gunthorpe wrote:
> On Thu, Aug 14, 2025 at 11:08:57AM +0530, Abhijit Gangurde wrote:
>> +static int ionic_poll_vcq_cq(struct ionic_ibdev *dev,
>> +			     struct ionic_cq *cq,
>> +			     int nwc, struct ib_wc *wc)
>> +{
>> +	struct ionic_qp *qp, *qp_next;
>> +	struct ionic_v1_cqe *cqe;
>> +	int rc = 0, npolled = 0;
>> +	unsigned long irqflags;
>> +	u32 qtf, qid;
>> +	bool peek;
>> +	u8 type;
>> +
>> +	if (nwc < 1)
>> +		return 0;
>> +
>> +	spin_lock_irqsave(&cq->lock, irqflags);
>> +
>> +	/* poll already indicated work completions for send queue */
>> +	list_for_each_entry_safe(qp, qp_next, &cq->poll_sq, cq_poll_sq) {
>> +		if (npolled == nwc)
>> +			goto out;
>> +
>> +		spin_lock(&qp->sq_lock);
>> +		rc = ionic_poll_send_many(dev, cq, qp, wc + npolled,
>> +					  nwc - npolled);
>> +		spin_unlock(&qp->sq_lock);
>> +
>> +		if (rc > 0)
>> +			npolled += rc;
>> +
>> +		if (npolled < nwc)
>> +			list_del_init(&qp->cq_poll_sq);
>> +	}
>> +
>> +	/* poll for more work completions */
>> +	while (likely(ionic_next_cqe(dev, cq, &cqe))) {
>> +		if (npolled == nwc)
>> +			goto out;
>> +
>> +		qtf = ionic_v1_cqe_qtf(cqe);
>> +		qid = ionic_v1_cqe_qtf_qid(qtf);
>> +		type = ionic_v1_cqe_qtf_type(qtf);
>> +
>> +		qp = xa_load(&dev->qp_tbl, qid);
> Why is this safe? Should have a comment explaining it or add the
> missing locking.
>
> Jason

This is safe because both the polling and ionic_destroy_qp() paths 
synchronize on the same cq->lock. The destroy path ensures the CQ is 
cleaned before its associated resources are freed. I will add a comment 
to clarify this.

Thanks,
Abhijit



  reply	other threads:[~2025-08-28  9:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14  5:38 [PATCH v5 00/14] Introduce AMD Pensando RDMA driver Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 01/14] net: ionic: Create an auxiliary device for rdma driver Abhijit Gangurde
2025-08-14  6:00   ` Randy Dunlap
2025-08-16  9:25   ` Markus Elfring
2025-08-14  5:38 ` [PATCH v5 02/14] net: ionic: Update LIF identity with additional RDMA capabilities Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 03/14] net: ionic: Export the APIs from net driver to support device commands Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 04/14] net: ionic: Provide RDMA reset support for the RDMA driver Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 05/14] net: ionic: Provide interrupt allocation " Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 06/14] net: ionic: Provide doorbell and CMB region information Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 07/14] RDMA: Add IONIC to rdma_driver_id definition Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 08/14] RDMA/ionic: Register auxiliary module for ionic ethernet adapter Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 09/14] RDMA/ionic: Create device queues to support admin operations Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 10/14] RDMA/ionic: Register device ops for control path Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 11/14] RDMA/ionic: Register device ops for datapath Abhijit Gangurde
2025-08-26 15:51   ` Jason Gunthorpe
2025-08-28  9:36     ` Abhijit Gangurde [this message]
2025-08-14  5:38 ` [PATCH v5 12/14] RDMA/ionic: Register device ops for miscellaneous functionality Abhijit Gangurde
2025-08-14 11:32   ` Shay Drori
2025-08-16  8:11     ` Abhijit Gangurde
2025-08-14  5:38 ` [PATCH v5 13/14] RDMA/ionic: Implement device stats ops Abhijit Gangurde
2025-08-14  5:39 ` [PATCH v5 14/14] RDMA/ionic: Add Makefile/Kconfig to kernel build environment Abhijit Gangurde
2025-08-14  6:03   ` Randy Dunlap
2025-08-16  7:48     ` Abhijit Gangurde
2025-08-26 15:52 ` [PATCH v5 00/14] Introduce AMD Pensando RDMA driver Jason Gunthorpe
2025-09-01  6:27   ` Abhijit Gangurde
2025-09-01 17:08     ` Jakub Kicinski
2025-09-02 13:56     ` Jason Gunthorpe
2025-09-02 14:18       ` Abhijit Gangurde

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=fc57af3d-f2e0-2479-435b-b70f68cd5f67@amd.com \
    --to=abhijit.gangurde@amd.com \
    --cc=allen.hubbe@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew.boyer@amd.com \
    --cc=brett.creeley@amd.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jgg@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikhil.agarwal@amd.com \
    --cc=pabeni@redhat.com \
    --cc=sln@onemain.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;
as well as URLs for NNTP newsgroup(s).