[PATCH 2/3] nvme: implement DMA_ATTR_NO_WARN

2016-07-06 Thread Mauricio Faria de Oliveira
Use the DMA_ATTR_NO_WARN attribute on dma_map_sg() calls of nvme driver.

Signed-off-by: Mauricio Faria de Oliveira 
---
 drivers/nvme/host/pci.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index d1a8259..c3c3348 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -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,7 @@ 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, 
_dma_attrs))
goto out;
 
if (!nvme_setup_prps(dev, req, size))
@@ -516,7 +519,7 @@ 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, >meta_sg, 1, dma_dir))
+   if (!dma_map_sg_attrs(dev->dev, >meta_sg, 1, dma_dir, 
_dma_attrs))
goto out_unmap;
}
 
@@ -2118,6 +2121,9 @@ static int __init nvme_init(void)
result = pci_register_driver(_driver);
if (result)
destroy_workqueue(nvme_workq);
+
+   dma_set_attr(DMA_ATTR_NO_WARN, _dma_attrs);
+
return result;
 }
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] dma: introduce DMA_ATTR_NO_WARN

2016-07-06 Thread Mauricio Faria de Oliveira
Introduce the DMA_ATTR_NO_WARN attribute, and document it.

Signed-off-by: Mauricio Faria de Oliveira 
---
 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..841e771 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 supress 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

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] powerpc: implement DMA_ATTR_NO_WARN

2016-07-06 Thread Mauricio Faria de Oliveira
Add support for the DMA_ATTR_NO_WARN attribute on powerpc iommu code.

Signed-off-by: Mauricio Faria de Oliveira 
---
 arch/powerpc/kernel/iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index a8e3490..69bb17f 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -479,7 +479,7 @@ 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 +776,7 @@ 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

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] dma, nvme, powerpc: introduce and implement DMA_ATTR_NO_WARN

2016-07-06 Thread Mauricio Faria de Oliveira
This patchset introduces dma_attr DMA_ATTR_NO_WARN (just like __GFP_NOWARN),
which tells the DMA-mapping subsystem to supress 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).

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  |  4 ++--
 drivers/nvme/host/pci.c  | 10 --
 include/linux/dma-attrs.h|  1 +
 4 files changed, 28 insertions(+), 4 deletions(-)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: core: Extend sysfs with OCR register

2016-07-06 Thread Ulf Hansson
On 4 July 2016 at 13:56, Bojan Prtvar  wrote:
> Make operation conditions register (OCR) easily accessible from user space.
>
> Signed-off-by: Bojan Prtvar 

Thanks, applied for next! Amended the changelog with the explanation
why this change is wanted.

Kind regards
Uffe

> ---
>  Documentation/mmc/mmc-dev-attrs.txt | 1 +
>  drivers/mmc/core/mmc.c  | 2 ++
>  2 files changed, 3 insertions(+)
>
> diff --git a/Documentation/mmc/mmc-dev-attrs.txt 
> b/Documentation/mmc/mmc-dev-attrs.txt
> index caa5557..8163eca 100644
> --- a/Documentation/mmc/mmc-dev-attrs.txt
> +++ b/Documentation/mmc/mmc-dev-attrs.txt
> @@ -28,6 +28,7 @@ All attributes are read-only.
> preferred_erase_sizePreferred erase size
> raw_rpmb_size_mult  RPMB partition size
> rel_sectors Reliable write sector count
> +   ocr Operation Conditions Register
>
>  Note on Erase Size and Preferred Erase Size:
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 5d438ad..1848334 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -727,6 +727,7 @@ MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
>  MMC_DEV_ATTR(enhanced_area_size, "%u\n", card->ext_csd.enhanced_area_size);
>  MMC_DEV_ATTR(raw_rpmb_size_mult, "%#x\n", card->ext_csd.raw_rpmb_size_mult);
>  MMC_DEV_ATTR(rel_sectors, "%#x\n", card->ext_csd.rel_sectors);
> +MMC_DEV_ATTR(ocr, "%08x\n", card->ocr);
>
>  static ssize_t mmc_fwrev_show(struct device *dev,
>   struct device_attribute *attr,
> @@ -762,6 +763,7 @@ static struct attribute *mmc_std_attrs[] = {
> _attr_enhanced_area_size.attr,
> _attr_raw_rpmb_size_mult.attr,
> _attr_rel_sectors.attr,
> +   _attr_ocr.attr,
> NULL,
>  };
>  ATTRIBUTE_GROUPS(mmc_std);
> --
> 2.8.0.GIT
>
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3] Add kernel parameter to blacklist modules

2016-07-06 Thread Prarit Bhargava
Rusty?  Didn't see anything from you on this ... resending.

P.


8<

Blacklisting a module in linux has long been a problem.  The current
procedure is to use rd.blacklist=module_name, however, that doesn't
cover the case after the initramfs and before a boot prompt (where one
is supposed to use /etc/modprobe.d/blacklist.conf to blacklist
runtime loading). Using rd.shell to get an early prompt is hit-or-miss,
and doesn't cover all situations AFAICT.

This patch adds this functionality of permanently blacklisting a module
by its name via the kernel parameter module_blacklist=module_name.

[v2]: Rusty, use core_param() instead of __setup() which simplifies
things.

[v3]: Rusty, undo wreckage from strsep()

Signed-off-by: Prarit Bhargava 
Cc: Jonathan Corbet 
Cc: Rusty Russell 
Cc: linux-doc@vger.kernel.org
---
 Documentation/kernel-parameters.txt |3 +++
 kernel/module.c |   29 +
 2 files changed, 32 insertions(+)

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index 82b42c958d1c..c720b96f2efc 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2295,6 +2295,9 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
Note that if CONFIG_MODULE_SIG_FORCE is set, that
is always true, so this option does nothing.
 
+   module_blacklist=  [KNL] Do not load a comma-separated list of
+   modules.  Useful for debugging problem modules.
+
mousedev.tap_time=
[MOUSE] Maximum time between finger touching and
leaving touchpad surface for touch to be considered
diff --git a/kernel/module.c b/kernel/module.c
index 5f71aa63ed2a..5240da88af79 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3155,6 +3155,32 @@ int __weak module_frob_arch_sections(Elf_Ehdr *hdr,
return 0;
 }
 
+/* module_blacklist is a comma-separated list of module names */
+static char *module_blacklist;
+static bool blacklisted(char *module_name)
+{
+   char *str, *entry;
+
+   if (!module_blacklist)
+   return false;
+
+   str = module_blacklist;
+   do {
+   if (str != module_blacklist)
+   module_blacklist[strlen(str) - 1] = ',';
+   entry = strsep(, ",");
+   if (!strcmp(module_name, entry)) {
+   pr_info("module %s is blacklisted\n", module_name);
+   if (str != module_blacklist)
+   module_blacklist[strlen(str) - 1] = ',';
+   return true;
+   }
+   } while (str);
+
+   return false;
+}
+core_param(module_blacklist, module_blacklist, charp, 0400);
+
 static struct module *layout_and_allocate(struct load_info *info, int flags)
 {
/* Module within temporary copy. */
@@ -3165,6 +3191,9 @@ static struct module *layout_and_allocate(struct 
load_info *info, int flags)
if (IS_ERR(mod))
return mod;
 
+   if (blacklisted(mod->name))
+   return ERR_PTR(-EPERM);
+
err = check_modinfo(mod, info, flags);
if (err)
return ERR_PTR(err);
-- 
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[linux-next] Errors while "make htmldocs" in linux-next.

2016-07-06 Thread Masanari Iida
On linux-next ( next-2160706),  following errors happen these days
while running "make htmldocs"

  HTMLDocumentation/DocBook/device-drivers.html
/home/iida/Repo/linux-next/Documentation/DocBook/device-drivers.aux.xml:28799:
element refentry: validity error : ID
API-reservation-object-reserve-shared already defined

^
/home/iida/Repo/linux-next/Documentation/DocBook/device-drivers.aux.xml:28849:
element refentry: validity error : ID
API-reservation-object-add-shared-fence already defined


As I bisect the issue,  the first bad commit is following.

commit 2cca45574007b4a77fa5f63ea45d664510cec22a
Merge: bb4cec0222f9 e83950816367
Author: Dave Airlie 
Date:   Thu Jun 9 11:19:28 2016 +1000

Merge tag 'topic/drm-misc-2016-06-07' of
git://anongit.freedesktop.org/drm-intel into drm-next

The actual change which cause this warning came from following.

commit eae1760fc838d5f569a80939f72483f02ac049c5
Author: Rob Clark 
Date:   Thu Mar 31 16:26:52 2016 -0400

doc: update/fixup dma-buf related DocBook

Split out dma-buf related parts into their own section, add missing
files, and write a bit of overview about how it all fits together.

Signed-off-by: Rob Clark 
Signed-off-by: Sumit Semwal 

FYI, This issue does not exist on 4.7-rc6.

Masanari Iida
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html