Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1438568 > unrolled thread
| Started by | Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> |
|---|---|
| First post | 2016-07-07 14:50 +0200 |
| Last post | 2016-07-08 14:30 +0200 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2 0/3] dma, nvme, powerpc: introduce and implement DMA_ATTR_NO_WARN Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> - 2016-07-07 14:50 +0200
[PATCH v2 1/3] dma: introduce DMA_ATTR_NO_WARN Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> - 2016-07-07 14:50 +0200
[PATCH v2 3/3] powerpc: implement DMA_ATTR_NO_WARN Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> - 2016-07-07 14:50 +0200
[PATCH v2 2/3] nvme: implement DMA_ATTR_NO_WARN Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> - 2016-07-07 14:50 +0200
Re: [PATCH v2 2/3] nvme: implement DMA_ATTR_NO_WARN Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> - 2016-07-08 10:00 +0200
Re: [PATCH v2 2/3] nvme: implement DMA_ATTR_NO_WARN Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> - 2016-07-08 14:30 +0200
| From | Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-07-07 14:50 +0200 |
| Subject | [PATCH v2 0/3] dma, nvme, powerpc: introduce and implement DMA_ATTR_NO_WARN |
| Message-ID | <rSgUF-6Xx-3@gated-at.bofh.it> |
This patchset introduces dma_attr DMA_ATTR_NO_WARN (just like __GFP_NOWARN),
which tells the DMA-mapping subsystem to suppress allocation failure reports.
On some architectures allocation failures are reported with error messages
to the system logs. Although this can help to identify and debug problems,
drivers which handle failures (eg, retry later) have no problems with them,
and can actually flood the system logs with error messages that aren't any
problem at all, depending on the implementation of the retry mechanism.
So, this provides a way for drivers to avoid those error messages on calls
where allocation failures are not a problem, and shouldn't bother the logs.
- Patch 1/3 introduces and documents the new dma_attr.
- Patch 2/3 implements it on the nvme driver (which might repeatedly trip
on allocation failures due to high load, flooding system logs
with error messages at least on powerpc: "iommu_alloc failed")
- Patch 3/3 implements support for it on powerpc arch (where this problem
was observed. It's possible to extend support for more archs
if the patchset is welcome).
Changelog:
v2:
- address warnings from checkpatch.pl (line wrapping and typos)
Mauricio Faria de Oliveira (3):
dma: introduce DMA_ATTR_NO_WARN
nvme: implement DMA_ATTR_NO_WARN
powerpc: implement DMA_ATTR_NO_WARN
Documentation/DMA-attributes.txt | 17 +++++++++++++++++
arch/powerpc/kernel/iommu.c | 6 ++++--
drivers/nvme/host/pci.c | 12 ++++++++++--
include/linux/dma-attrs.h | 1 +
4 files changed, 32 insertions(+), 4 deletions(-)
--
1.8.3.1
[toc] | [next] | [standalone]
| From | Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-07-07 14:50 +0200 |
| Subject | [PATCH v2 1/3] dma: introduce DMA_ATTR_NO_WARN |
| Message-ID | <rSgUG-6Xx-33@gated-at.bofh.it> |
| In reply to | #1438568 |
Introduce the DMA_ATTR_NO_WARN attribute, and document it.
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
Changelog:
v2:
- address warnings from checkpatch.pl (line wrapping and typos)
Documentation/DMA-attributes.txt | 17 +++++++++++++++++
include/linux/dma-attrs.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt
index e8cf9cf..48150c6 100644
--- a/Documentation/DMA-attributes.txt
+++ b/Documentation/DMA-attributes.txt
@@ -126,3 +126,20 @@ means that we won't try quite as hard to get them.
NOTE: At the moment DMA_ATTR_ALLOC_SINGLE_PAGES is only implemented on ARM,
though ARM64 patches will likely be posted soon.
+
+DMA_ATTR_NO_WARN
+----------------
+
+This tells the DMA-mapping subsystem to suppress allocation failure reports
+(similarly to __GFP_NOWARN).
+
+On some architectures allocation failures are reported with error messages
+to the system logs. Although this can help to identify and debug problems,
+drivers which handle failures (eg, retry later) have no problems with them,
+and can actually flood the system logs with error messages that aren't any
+problem at all, depending on the implementation of the retry mechanism.
+
+So, this provides a way for drivers to avoid those error messages on calls
+where allocation failures are not a problem, and shouldn't bother the logs.
+
+NOTE: At the moment DMA_ATTR_NO_WARN is only implemented on PowerPC.
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
index f3c5aea..0577389 100644
--- a/include/linux/dma-attrs.h
+++ b/include/linux/dma-attrs.h
@@ -19,6 +19,7 @@ enum dma_attr {
DMA_ATTR_SKIP_CPU_SYNC,
DMA_ATTR_FORCE_CONTIGUOUS,
DMA_ATTR_ALLOC_SINGLE_PAGES,
+ DMA_ATTR_NO_WARN,
DMA_ATTR_MAX,
};
--
1.8.3.1
[toc] | [prev] | [next] | [standalone]
| From | Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-07-07 14:50 +0200 |
| Subject | [PATCH v2 3/3] powerpc: implement DMA_ATTR_NO_WARN |
| Message-ID | <rSgUF-6Xx-19@gated-at.bofh.it> |
| In reply to | #1438568 |
Add support for the DMA_ATTR_NO_WARN attribute on powerpc iommu code.
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
Changelog:
v2:
- address warnings from checkpatch.pl (line wrapping and typos)
arch/powerpc/kernel/iommu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index a8e3490..f1e20ea 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -479,7 +479,8 @@ int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
/* Handle failure */
if (unlikely(entry == DMA_ERROR_CODE)) {
- if (printk_ratelimit())
+ if (unlikely(!dma_get_attr(DMA_ATTR_NO_WARN, attrs)) &&
+ printk_ratelimit())
dev_info(dev, "iommu_alloc failed, tbl %p "
"vaddr %lx npages %lu\n", tbl, vaddr,
npages);
@@ -776,7 +777,8 @@ dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl,
mask >> tbl->it_page_shift, align,
attrs);
if (dma_handle == DMA_ERROR_CODE) {
- if (printk_ratelimit()) {
+ if (unlikely(!dma_get_attr(DMA_ATTR_NO_WARN, attrs)) &&
+ printk_ratelimit()) {
dev_info(dev, "iommu_alloc failed, tbl %p "
"vaddr %p npages %d\n", tbl, vaddr,
npages);
--
1.8.3.1
[toc] | [prev] | [next] | [standalone]
| From | Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-07-07 14:50 +0200 |
| Subject | [PATCH v2 2/3] nvme: implement DMA_ATTR_NO_WARN |
| Message-ID | <rSgUG-6Xx-45@gated-at.bofh.it> |
| In reply to | #1438568 |
Use the DMA_ATTR_NO_WARN attribute on dma_map_sg() calls of nvme driver. Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> Reviewed-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com> --- Changelog: v2: - address warnings from checkpatch.pl (line wrapping and typos) drivers/nvme/host/pci.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index d1a8259..a7ccad8 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -18,6 +18,7 @@ #include <linux/blk-mq.h> #include <linux/cpu.h> #include <linux/delay.h> +#include <linux/dma-attrs.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/genhd.h> @@ -65,6 +66,8 @@ MODULE_PARM_DESC(use_cmb_sqes, "use controller's memory buffer for I/O SQes"); static struct workqueue_struct *nvme_workq; +static DEFINE_DMA_ATTRS(nvme_dma_attrs); + struct nvme_dev; struct nvme_queue; @@ -498,7 +501,8 @@ static int nvme_map_data(struct nvme_dev *dev, struct request *req, goto out; ret = BLK_MQ_RQ_QUEUE_BUSY; - if (!dma_map_sg(dev->dev, iod->sg, iod->nents, dma_dir)) + if (!dma_map_sg_attrs(dev->dev, iod->sg, iod->nents, dma_dir, + &nvme_dma_attrs)) goto out; if (!nvme_setup_prps(dev, req, size)) @@ -516,7 +520,8 @@ static int nvme_map_data(struct nvme_dev *dev, struct request *req, if (rq_data_dir(req)) nvme_dif_remap(req, nvme_dif_prep); - if (!dma_map_sg(dev->dev, &iod->meta_sg, 1, dma_dir)) + if (!dma_map_sg_attrs(dev->dev, &iod->meta_sg, 1, dma_dir, + &nvme_dma_attrs)) goto out_unmap; } @@ -2118,6 +2123,9 @@ static int __init nvme_init(void) result = pci_register_driver(&nvme_driver); if (result) destroy_workqueue(nvme_workq); + + dma_set_attr(DMA_ATTR_NO_WARN, &nvme_dma_attrs); + return result; } -- 1.8.3.1
[toc] | [prev] | [next] | [standalone]
| From | Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> |
|---|---|
| Date | 2016-07-08 10:00 +0200 |
| Subject | Re: [PATCH v2 2/3] nvme: implement DMA_ATTR_NO_WARN |
| Message-ID | <rSyRz-1NP-9@gated-at.bofh.it> |
| In reply to | #1438588 |
On Thu, 7 Jul 2016 09:45:08 -0300 Mauricio Faria De Oliveira wrote: > Use the DMA_ATTR_NO_WARN attribute on dma_map_sg() calls of nvme driver. > > Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> > Reviewed-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com> > --- > Changelog: > v2: > - address warnings from checkpatch.pl (line wrapping and typos) > > drivers/nvme/host/pci.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index d1a8259..a7ccad8 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -18,6 +18,7 @@ > #include <linux/blk-mq.h> > #include <linux/cpu.h> > #include <linux/delay.h> > +#include <linux/dma-attrs.h> > #include <linux/errno.h> > #include <linux/fs.h> > #include <linux/genhd.h> > @@ -65,6 +66,8 @@ MODULE_PARM_DESC(use_cmb_sqes, "use controller's memory buffer for I/O SQes"); > > static struct workqueue_struct *nvme_workq; > > +static DEFINE_DMA_ATTRS(nvme_dma_attrs); > + > struct nvme_dev; > struct nvme_queue; > > @@ -498,7 +501,8 @@ static int nvme_map_data(struct nvme_dev *dev, struct request *req, > goto out; > > ret = BLK_MQ_RQ_QUEUE_BUSY; > - if (!dma_map_sg(dev->dev, iod->sg, iod->nents, dma_dir)) > + if (!dma_map_sg_attrs(dev->dev, iod->sg, iod->nents, dma_dir, > + &nvme_dma_attrs)) This change is OK because the return value of nvme_map_data() is BLK_MQ_RQ_QUEUE_BUSY, so the IO will be requeued. > goto out; > > if (!nvme_setup_prps(dev, req, size)) > @@ -516,7 +520,8 @@ static int nvme_map_data(struct nvme_dev *dev, struct request *req, > if (rq_data_dir(req)) > nvme_dif_remap(req, nvme_dif_prep); > > - if (!dma_map_sg(dev->dev, &iod->meta_sg, 1, dma_dir)) > + if (!dma_map_sg_attrs(dev->dev, &iod->meta_sg, 1, dma_dir, > + &nvme_dma_attrs)) Here, I think the error messages should not be suppressed because the return value of nvme_map_data() is BLK_MQ_RQ_QUEUE_ERROR, so the IO returns as -EIO. - Masayoshi Mizuma > goto out_unmap; > } > > @@ -2118,6 +2123,9 @@ static int __init nvme_init(void) > result = pci_register_driver(&nvme_driver); > if (result) > destroy_workqueue(nvme_workq); > + > + dma_set_attr(DMA_ATTR_NO_WARN, &nvme_dma_attrs); > + > return result; > } > >
[toc] | [prev] | [next] | [standalone]
| From | Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-07-08 14:30 +0200 |
| Subject | Re: [PATCH v2 2/3] nvme: implement DMA_ATTR_NO_WARN |
| Message-ID | <rSD4S-4Jb-29@gated-at.bofh.it> |
| In reply to | #1439158 |
On 07/08/2016 04:54 AM, Masayoshi Mizuma wrote: > Here, I think the error messages should not be suppressed because > the return value of nvme_map_data() is BLK_MQ_RQ_QUEUE_ERROR, so > the IO returns as -EIO. Agree; good point. fixed in v3. Thanks for reviewing. -- Mauricio Faria de Oliveira IBM Linux Technology Center
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web