[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190923123418.22695-4-pasic@linux.ibm.com>
Date: Mon, 23 Sep 2019 14:34:18 +0200
From: Halil Pasic <pasic@...ux.ibm.com>
To: Christoph Hellwig <hch@....de>,
Gerald Schaefer <gerald.schaefer@...ibm.com>
Cc: Halil Pasic <pasic@...ux.ibm.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
Peter Oberparleiter <oberpar@...ux.ibm.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Cornelia Huck <cohuck@...hat.com>, linux-s390@...r.kernel.org,
linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org
Subject: [RFC PATCH 3/3] dma-mapping: warn on harmful GFP_* flags
The commit message of commit 57bf5a8963f8 ("dma-mapping: clear harmful
GFP_* flags in common code") says that probably warn when we encounter
harmful GFP_* flags which we clean -- because the client code is best
case silly if not buggy. I concur with that.
Let's warn once when we encounter silly GFP_* flags. The guys caring
about the respective client code will hopefully fix these soon.
Signed-off-by: Halil Pasic <pasic@...ux.ibm.com>
---
I'm not too happy with my warning message. Suggestions welcome!
---
include/linux/dma-mapping.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 5024bc863fa7..299f36ac8668 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -823,6 +823,9 @@ extern gfp_t dma_override_gfp_flags(struct device *dev, gfp_t flags);
static inline gfp_t dma_override_gfp_flags(struct device *dev, gfp_t flags)
{
/* let the implementation decide on the zone to allocate from: */
+ dev_WARN_ONCE(dev,
+ flags & (__GFP_DMA32 | __GFP_DMA | __GFP_HIGHMEM),
+ "fixme: don't dma_alloc with any of: __GFP_DMA32, __GFP_DMA, __GFP_HIGHMEM\n");
return flags & ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
}
#endif
--
2.17.1
Powered by blists - more mailing lists