Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-03 Thread Jianxiong Gao via iommu
> > Please try with this extra patch: > I have tried with the extra patch and it still fails to boot. I have attached dmesg output for the error: -dmesg starts here- [6.357755] XFS (nvme0n1p2): Mounting V5 Filesystem [6.430092] XFS (nvme0n1p2): Torn write (CRC

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-03 Thread Christoph Hellwig
Please try with this extra patch: --- >From 212764c3c15ce859e6f55d2146f450ea4ca6fdb9 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 3 Feb 2021 14:27:13 +0100 Subject: nvme-pci: fix 2nd PRP setup in nvme_setup_prp_simple Use the dma address instead of the bio_vec offset for the

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-02 Thread Robin Murphy
On 2021-02-02 11:21, Andy Shevchenko wrote: On Mon, Feb 01, 2021 at 04:25:55PM -0800, Jianxiong Gao wrote: + if (dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1)) Side note: we have DMA_BIT_MASK(), please use it. FWIW I'd actually disagree on that point. Conceptually, this

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-02 Thread Andy Shevchenko
On Mon, Feb 01, 2021 at 04:25:55PM -0800, Jianxiong Gao wrote: > + if (dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1)) Side note: we have DMA_BIT_MASK(), please use it. > + dev_warn(dev->dev, "dma_set_min_align_mask failed to > set offset\n"); -- With Best

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-01 Thread Chaitanya Kulkarni
On 2/1/21 13:27, Jianxiong Gao wrote: >> Why is this setting being done and undone on each IO? Wouldn't it be >> more efficient to set it once during device initialization? >> >> And more importantly, this isn't thread safe: one CPU may be setting the >> device's dma alignment mask to 0 while

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-01 Thread Jianxiong Gao via iommu
> Why is this setting being done and undone on each IO? Wouldn't it be > more efficient to set it once during device initialization? I agree that setting it once is the right way of doing it. So I have changed the patch to enable the mask once in nvme_probe. drivers/nvme/host/pci.c | 3 +++ 1

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-01 Thread Jianxiong Gao via iommu
> Why is this setting being done and undone on each IO? Wouldn't it be > more efficient to set it once during device initialization? > > And more importantly, this isn't thread safe: one CPU may be setting the > device's dma alignment mask to 0 while another CPU is expecting it to be >

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-01 Thread Jianxiong Gao via iommu
> > On Mon, Feb 01, 2021 at 10:30:17AM -0800, Jianxiong Gao wrote: > > @@ -868,12 +871,24 @@ static blk_status_t nvme_map_data(struct nvme_dev > *dev, struct request *req, > > if (!iod->nents) > > goto out_free_sg; > > > > + offset_ret = dma_set_min_align_mask(dev->dev,

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-01 Thread Keith Busch
On Mon, Feb 01, 2021 at 10:30:17AM -0800, Jianxiong Gao wrote: > @@ -868,12 +871,24 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, > struct request *req, > if (!iod->nents) > goto out_free_sg; > > + offset_ret = dma_set_min_align_mask(dev->dev,

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-01 Thread Jianxiong Gao via iommu
On Mon, Feb 1, 2021 at 10:56 AM Andy Shevchenko wrote: > > On Mon, Feb 01, 2021 at 10:30:17AM -0800, Jianxiong Gao wrote: > > NVMe driver relies on the address offset to function properly. > > This patch adds the offset preserve mask to NVMe driver when mapping > > via dma_map_sg_attrs and

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-01 Thread Andy Shevchenko
On Mon, Feb 01, 2021 at 10:30:17AM -0800, Jianxiong Gao wrote: > NVMe driver relies on the address offset to function properly. > This patch adds the offset preserve mask to NVMe driver when mapping > via dma_map_sg_attrs and unmapping via nvme_unmap_sg. The mask > depends on the page size defined