All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jianxiong Gao via iommu <iommu@lists.linux-foundation.org>
To: Keith Busch <kbusch@kernel.org>
Cc: heikki.krogerus@linux.intel.com, sagi@grimberg.me,
	Saravana Kannan <saravanak@google.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Marc Orr <marcorr@google.com>,
	gregkh@linuxfoundation.org, rafael.j.wysocki@intel.com,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org,
	axboe@fb.com, bgolaszewski@baylibre.com,
	iommu@lists.linux-foundation.org, jroedel@suse.de,
	dan.j.williams@intel.com,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.
Date: Mon, 1 Feb 2021 13:16:48 -0800	[thread overview]
Message-ID: <CAMGD6P2Gz9nWELMdsAhwQvXx3PXv2aXet=Tn9Rca61obZawfgw@mail.gmail.com> (raw)
In-Reply-To: <20210201205759.GA2128135@dhcp-10-100-145-180.wdc.com>


[-- Attachment #1.1: Type: text/plain, Size: 1819 bytes --]

>
> 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, NVME_CTRL_PAGE_SIZE
> - 1);
> > +     if (offset_ret) {
> > +             dev_warn(dev->dev, "dma_set_min_align_mask failed to set
> offset\n");
> > +             goto out_free_sg;
> > +     }
> > +
> >       if (is_pci_p2pdma_page(sg_page(iod->sg)))
> >               nr_mapped = pci_p2pdma_map_sg_attrs(dev->dev, iod->sg,
> >                               iod->nents, rq_dma_dir(req),
> DMA_ATTR_NO_WARN);
> >       else
> >               nr_mapped = dma_map_sg_attrs(dev->dev, iod->sg, iod->nents,
> >                                            rq_dma_dir(req),
> DMA_ATTR_NO_WARN);
> > +
> > +     offset_ret = dma_set_min_align_mask(dev->dev, 0);
> > +     if (offset_ret) {
> > +             dev_warn(dev->dev, "dma_set_min_align_mask failed to reset
> offset\n");
> > +             goto out_free_sg;
> > +     }
> >       if (!nr_mapped)
> >               goto out_free_sg;
>
> 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
> NVME_CTRL_PAGE_SIZE - 1.
>

I was having trouble getting the OS booted when setting it once during
initialization. However when I rebased to the latest rc6 this morning it
seems to be working with setting the mask on probe. I am still testing out
and will appreciate any idea what may cause the nvme driver to fail
with a single mask.

-- 
Jianxiong Gao

[-- Attachment #1.2: Type: text/html, Size: 2517 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-02-01 21:17 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 18:30 [PATCH V2 0/3] SWIOTLB: Preserve swiotlb map offset when needed Jianxiong Gao
2021-02-01 18:30 ` Jianxiong Gao via iommu
2021-02-01 18:30 ` Jianxiong Gao
2021-02-01 18:30 ` [PATCH V2 1/3] Adding page_offset_mask to device_dma_parameters Jianxiong Gao
2021-02-01 18:30   ` Jianxiong Gao via iommu
2021-02-01 18:30   ` Jianxiong Gao
2021-02-01 18:30 ` [PATCH V2 2/3] Add swiotlb offset preserving mapping when dma_dma_parameters->page_offset_mask is non zero Jianxiong Gao
2021-02-01 18:30   ` Jianxiong Gao via iommu
2021-02-01 18:30   ` Jianxiong Gao
2021-02-01 18:30 ` [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver Jianxiong Gao
2021-02-01 18:30   ` Jianxiong Gao via iommu
2021-02-01 18:30   ` Jianxiong Gao
2021-02-01 18:55   ` Andy Shevchenko
2021-02-01 18:55     ` Andy Shevchenko
2021-02-01 18:55     ` Andy Shevchenko
2021-02-01 19:35     ` Jianxiong Gao
2021-02-01 19:35       ` Jianxiong Gao via iommu
2021-02-01 19:35       ` Jianxiong Gao
2021-02-01 20:57   ` Keith Busch
2021-02-01 20:57     ` Keith Busch
2021-02-01 20:57     ` Keith Busch
2021-02-01 21:16     ` Jianxiong Gao via iommu [this message]
2021-02-01 21:22       ` Jianxiong Gao
2021-02-01 21:22         ` Jianxiong Gao via iommu
2021-02-01 21:22         ` Jianxiong Gao
2021-02-01 23:59         ` Chaitanya Kulkarni
2021-02-01 23:59           ` Chaitanya Kulkarni
2021-02-01 23:59           ` Chaitanya Kulkarni
2021-02-02  0:25         ` Jianxiong Gao
2021-02-02  0:25           ` Jianxiong Gao via iommu
2021-02-02  0:25           ` Jianxiong Gao
2021-02-02 11:21           ` Andy Shevchenko
2021-02-02 11:21             ` Andy Shevchenko
2021-02-02 11:21             ` Andy Shevchenko
2021-02-02 12:07             ` Robin Murphy
2021-02-02 12:07               ` Robin Murphy
2021-02-02 12:07               ` Robin Murphy
2021-02-03 13:37         ` Christoph Hellwig
2021-02-03 13:37           ` Christoph Hellwig
2021-02-03 13:37           ` Christoph Hellwig
2021-02-03 16:47           ` Jianxiong Gao
2021-02-03 16:47             ` Jianxiong Gao via iommu
2021-02-03 16:47             ` Jianxiong Gao
2021-02-02 11:53 ` [PATCH V2 0/3] SWIOTLB: Preserve swiotlb map offset when needed Greg KH
2021-02-02 11:53   ` Greg KH
2021-02-02 11:53   ` Greg KH

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='CAMGD6P2Gz9nWELMdsAhwQvXx3PXv2aXet=Tn9Rca61obZawfgw@mail.gmail.com' \
    --to=iommu@lists.linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=axboe@fb.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=dan.j.williams@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jroedel@suse.de \
    --cc=jxgao@google.com \
    --cc=kbusch@kernel.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=marcorr@google.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robin.murphy@arm.com \
    --cc=sagi@grimberg.me \
    --cc=saravanak@google.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 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.