Re: [PATCH] powerpc: add kernel parameter iommu_alloc_quiet

2016-09-01 Thread Mauricio Faria de Oliveira

On 09/01/2016 10:39 AM, Torsten Duwe wrote:

JFYI, my strongly preferred solution would still be to just dev_dbg() the whole 
thing.
Which group of people would be interested in these messages, after all?


Certainly understandable.

Ben didn't like the idea to convert the messages to dynamic debug [1],
(with which I agree/understand nowadays) and suggested us to look for
a different approach.

[1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2016-June/144196.html

--
Mauricio Faria de Oliveira
IBM Linux Technology Center



Re: [PATCH] powerpc: add kernel parameter iommu_alloc_quiet

2016-09-01 Thread Torsten Duwe
On Thu, Sep 01, 2016 at 09:56:42AM -0300, Mauricio Faria de Oliveira wrote:
> This patch introduces the 'iommu_alloc_quiet=driver_name' parameter
> to suppress the 'iommu_alloc failures' messages for that one driver.
> 
> This is an additional approach for this 'problem' of flooding logs,
> not as fine-grained and not enabled by default as DMA_ATTR_NO_WARN,
> but it has the advantage that it doesn't introduce any ABI changes.
> 
> That is important/requirement for the distribution kernels - where
> the DMA_ATTR_NO_WARN changes to 'enum dma_attr' are not acceptable
> because it breaks the kernel ABI.
> 
[...]
> @@ -479,8 +496,8 @@ int ppc_iommu_map_sg(struct device *dev, struct 
> iommu_table *tbl,
>  
>   /* Handle failure */
>   if (unlikely(entry == DMA_ERROR_CODE)) {
> - if (!(attrs & DMA_ATTR_NO_WARN) &&
> - printk_ratelimit())
> + if (strncmp(iommu_alloc_quiet, dev->driver->name, 
> IOMMU_ALLOC_QUIET_LEN) &&
> + !(attrs & DMA_ATTR_NO_WARN) && printk_ratelimit())
>   dev_info(dev, "iommu_alloc failed, tbl %p "
>"vaddr %lx npages %lu\n", tbl, vaddr,
>npages);
> @@ -777,8 +794,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 (!(attrs & DMA_ATTR_NO_WARN) &&
> - printk_ratelimit())  {
> + if (strncmp(iommu_alloc_quiet, dev->driver->name, 
> IOMMU_ALLOC_QUIET_LEN) &&
> + !(attrs & DMA_ATTR_NO_WARN) && printk_ratelimit()) {
>   dev_info(dev, "iommu_alloc failed, tbl %p "
>"vaddr %p npages %d\n", tbl, vaddr,
>npages);

JFYI, my strongly preferred solution would still be to just dev_dbg() the whole 
thing.
Which group of people would be interested in these messages, after all?

Torsten



Re: [PATCH] powerpc: add kernel parameter iommu_alloc_quiet

2016-09-01 Thread Mauricio Faria de Oliveira

Michael / Ben,

On 09/01/2016 09:56 AM, Mauricio Faria de Oliveira wrote:

+#define IOMMU_ALLOC_QUIET_LEN  16 /* includes '\0' */


Guilherme suggested MAX_PARAM_PREFIX_LEN for this, which looks
better (a few extra bytes).

Would you mind to s/16/MAX_PARAM_PREFIX_LEN/ if you like that?
I can send a v2 too; just let me know.

Thanks,

--
Mauricio Faria de Oliveira
IBM Linux Technology Center