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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250428172225.GG5848@unreal>
Date: Mon, 28 Apr 2025 20:22:25 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Keith Busch <kbusch@...nel.org>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
	Jens Axboe <axboe@...nel.dk>, Christoph Hellwig <hch@....de>,
	Jake Edge <jake@....net>, Jonathan Corbet <corbet@....net>,
	Jason Gunthorpe <jgg@...pe.ca>, Zhu Yanjun <zyjzyj2000@...il.com>,
	Robin Murphy <robin.murphy@....com>, Joerg Roedel <joro@...tes.org>,
	Will Deacon <will@...nel.org>, Sagi Grimberg <sagi@...mberg.me>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Logan Gunthorpe <logang@...tatee.com>,
	Yishai Hadas <yishaih@...dia.com>,
	Shameer Kolothum <shameerali.kolothum.thodi@...wei.com>,
	Kevin Tian <kevin.tian@...el.com>,
	Alex Williamson <alex.williamson@...hat.com>,
	Jérôme Glisse <jglisse@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-block@...r.kernel.org, linux-rdma@...r.kernel.org,
	iommu@...ts.linux.dev, linux-nvme@...ts.infradead.org,
	linux-pci@...r.kernel.org, kvm@...r.kernel.org, linux-mm@...ck.org,
	Niklas Schnelle <schnelle@...ux.ibm.com>,
	Chuck Lever <chuck.lever@...cle.com>,
	Luis Chamberlain <mcgrof@...nel.org>,
	Matthew Wilcox <willy@...radead.org>,
	Dan Williams <dan.j.williams@...el.com>,
	Kanchan Joshi <joshi.k@...sung.com>,
	Chaitanya Kulkarni <kch@...dia.com>,
	Nitesh Shetty <nj.shetty@...sung.com>
Subject: Re: [PATCH v10 23/24] nvme-pci: convert to blk_rq_dma_map

On Mon, Apr 28, 2025 at 10:46:19AM -0600, Keith Busch wrote:
> On Mon, Apr 28, 2025 at 12:22:29PM +0300, Leon Romanovsky wrote:
> > +	do {
> > +		if (WARN_ON_ONCE(mapped == entries)) {
> > +			iter.status = BLK_STS_IOERR;
> > +			break;
> > +		}
> > +		nvme_pci_sgl_set_data(&sg_list[mapped++], &iter);
> 
> I think this should say "++mapped" so that the data blocks start at
> index 1 (continued below...)
> 
> > +		iod->total_len += iter.len;
> > +	} while (blk_rq_dma_map_iter_next(req, dev->dev, &iod->dma_meta_state,
> > +				 &iter));
> >  
> > -out_unmap_sg:
> > -	dma_unmap_sgtable(dev->dev, &iod->meta_sgt, rq_dma_dir(req), 0);
> > -out_free_sg:
> > -	mempool_free(iod->meta_sgt.sgl, dev->iod_meta_mempool);
> > -	return BLK_STS_RESOURCE;
> > +	nvme_pci_sgl_set_seg(sg_list, sgl_dma, mapped);
> 
> because this here is setting sg_list index 0 to be the segment
> descriptor.
> 
> And you also need to increment sgl_dma to point to the element after
> sg_list, otherwise it's pointing right back to itself, creating a looped
> list.

Thanks for pointing to the difference between data_map and metadata_map,
I see it now:
        sgl_dma += sizeof(*sg_list);
	nvme_pci_sgl_set_seg(sg_list, sgl_dma, entries);
	for_each_sg(sgl, sg, entries, i)
	        nvme_pci_sgl_set_data(&sg_list[i + 1], sg);

Thanks

> 
> > +	if (unlikely(iter.status))
> > +		nvme_unmap_metadata(dev, req);
> > +	return iter.status;
> >  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ