lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fc57af3d-f2e0-2479-435b-b70f68cd5f67@amd.com>
Date: Thu, 28 Aug 2025 15:06:28 +0530
From: Abhijit Gangurde <abhijit.gangurde@....com>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: brett.creeley@....com, davem@...emloft.net, edumazet@...gle.com,
 kuba@...nel.org, pabeni@...hat.com, corbet@....net, leon@...nel.org,
 andrew+netdev@...n.ch, sln@...main.com, allen.hubbe@....com,
 nikhil.agarwal@....com, linux-rdma@...r.kernel.org, netdev@...r.kernel.org,
 linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
 Andrew Boyer <andrew.boyer@....com>
Subject: Re: [PATCH v5 11/14] RDMA/ionic: Register device ops for datapath


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



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ