Re: [PATCH v3] sparc: use generic dma_noncoherent_ops

2018-08-03 Thread Christoph Hellwig
Dave, any chance you would consider reviewing and applying this patch, which already has an ACK from Sam? It would really help me with some core DMA API projects planned for the next merge window. On Tue, Jul 31, 2018 at 10:02:04AM +0200, Christoph Hellwig wrote: > Switch to the generic noncoher

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Andy Shevchenko
On Thu, Aug 2, 2018 at 10:57 PM, Tony Battersby wrote: > Remove code duplication in error messages. It is now safe to pas a NULL > dev to dev_err(), so the checks to avoid doing so are no longer > necessary. > > Example: > > Error message with dev != NULL: > mpt3sas :02:00.0: dma_pool_destr

Re: [PATCH v2 4/9] dmapool: improve scalability of dma_pool_alloc

2018-08-03 Thread Andy Shevchenko
On Thu, Aug 2, 2018 at 10:58 PM, Tony Battersby wrote: > dma_pool_alloc() scales poorly when allocating a large number of pages > because it does a linear scan of all previously-allocated pages before > allocating a new one. Improve its scalability by maintaining a separate > list of pages that h

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Tony Battersby
On 08/03/2018 04:56 AM, Andy Shevchenko wrote: > On Thu, Aug 2, 2018 at 10:57 PM, Tony Battersby wrote: >> Remove code duplication in error messages. It is now safe to pas a NULL >> dev to dev_err(), so the checks to avoid doing so are no longer >> necessary. >> >> Example: >> >> Error message wi

Re: [PATCH v2 4/9] dmapool: improve scalability of dma_pool_alloc

2018-08-03 Thread Tony Battersby
On 08/03/2018 05:02 AM, Andy Shevchenko wrote: > On Thu, Aug 2, 2018 at 10:58 PM, Tony Battersby wrote: >> dma_pool_alloc() scales poorly when allocating a large number of pages >> because it does a linear scan of all previously-allocated pages before >> allocating a new one. Improve its scalabil

Re: [PATCH v2 8/9] dmapool: reduce footprint in struct page

2018-08-03 Thread Tony Battersby
On 08/02/2018 07:56 PM, Matthew Wilcox wrote: > >> One of the nice things about this is that dma_pool_free() can do some >> additional sanity checks: >> *) Check that the offset of the passed-in address corresponds to a valid >> block offset. > Can't we do that already? Subtract the base address o

Re: powerpc: do not redefined NEED_DMA_MAP_STATE

2018-08-03 Thread Michael Ellerman
On Mon, 2018-07-30 at 07:37:21 UTC, Christoph Hellwig wrote: > kernel/dma/Kconfig already defines NEED_DMA_MAP_STATE, just select it > from PPC64 and NOT_COHERENT_CACHE instead. > > Signed-off-by: Christoph Hellwig Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/06832fc004815b

Re: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive

2018-08-03 Thread Alan Cox
> If we are going to have any kind of general purpose accelerator API then > > it has to be able to implement things like > > Why is the existing driver model not good enough ? So you want > a device with function X you look into /dev/X (for instance > for GPU you look in /dev/dri) Except when

Re: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive

2018-08-03 Thread Jerome Glisse
On Fri, Aug 03, 2018 at 11:47:21AM +0800, Kenneth Lee wrote: > On Thu, Aug 02, 2018 at 10:22:43AM -0400, Jerome Glisse wrote: > > Date: Thu, 2 Aug 2018 10:22:43 -0400 > > From: Jerome Glisse > > To: Kenneth Lee > > CC: "Tian, Kevin" , Hao Fang , > > Alex Williamson , Herbert Xu > > , "k...@vger

Re: [PATCH v2 8/9] dmapool: reduce footprint in struct page

2018-08-03 Thread Tony Battersby
On 08/02/2018 07:56 PM, Matthew Wilcox wrote: > >> struct dma_pool { /* the pool */ >> #define POOL_FULL_IDX 0 >> #define POOL_AVAIL_IDX 1 >> #define POOL_N_LISTS2 >> struct list_head page_list[POOL_N_LISTS]; >> spinlock_t lock; >> -size_t size; >> struct dev

Re: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive

2018-08-03 Thread Jerome Glisse
On Fri, Aug 03, 2018 at 03:20:43PM +0100, Alan Cox wrote: > > If we are going to have any kind of general purpose accelerator API then > > > it has to be able to implement things like > > > > Why is the existing driver model not good enough ? So you want > > a device with function X you look int

Re: [PATCH] arm64: remove dummy_dma_ops

2018-08-03 Thread Robin Murphy
On 02/08/18 13:43, Christoph Hellwig wrote: On Thu, Aug 02, 2018 at 01:32:17PM +0100, Robin Murphy wrote: On 02/08/18 13:13, Christoph Hellwig wrote: Returning NULL from get_arch_dma_ops makes all DMA mapping routines retourn sensible errors, so remove the dummy ops. Does it? AFAICS all of th

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Tony Battersby
On 08/03/2018 09:41 AM, Tony Battersby wrote: > On 08/03/2018 04:56 AM, Andy Shevchenko wrote: >> On Thu, Aug 2, 2018 at 10:57 PM, Tony Battersby >> wrote: >>> Remove code duplication in error messages. It is now safe to pas a NULL >>> dev to dev_err(), so the checks to avoid doing so are no lon

Re: [RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU

2018-08-03 Thread Robin Murphy
On 02/08/18 19:24, Dmitry Osipenko wrote: On Friday, 27 July 2018 20:16:53 MSK Dmitry Osipenko wrote: On Friday, 27 July 2018 20:03:26 MSK Jordan Crouse wrote: On Fri, Jul 27, 2018 at 05:02:37PM +0100, Robin Murphy wrote: On 27/07/18 15:10, Dmitry Osipenko wrote: On Friday, 27 July 2018 12:03

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Andy Shevchenko
On Fri, Aug 3, 2018 at 6:17 PM, Tony Battersby wrote: > On 08/03/2018 09:41 AM, Tony Battersby wrote: >> On 08/03/2018 04:56 AM, Andy Shevchenko wrote: >>> On Thu, Aug 2, 2018 at 10:57 PM, Tony Battersby >>> wrote: Remove code duplication in error messages. It is now safe to pas a NULL >>>

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Andy Shevchenko
On Fri, Aug 3, 2018 at 6:59 PM, Andy Shevchenko wrote: > On Fri, Aug 3, 2018 at 6:17 PM, Tony Battersby wrote: >> But then I decided to simplify it to just use dev_err(). I still have >> the old version. When I submit v3 of the patchset, which would you prefer? > > JFYI: git log --no-merges --

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Tony Battersby
On 08/03/2018 12:01 PM, Andy Shevchenko wrote: > On Fri, Aug 3, 2018 at 6:59 PM, Andy Shevchenko > wrote: >> On Fri, Aug 3, 2018 at 6:17 PM, Tony Battersby wrote: >>> But then I decided to simplify it to just use dev_err(). I still have >>> the old version. When I submit v3 of the patchset, whi

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Matthew Wilcox
On Fri, Aug 03, 2018 at 06:59:20PM +0300, Andy Shevchenko wrote: > >>> I'm pretty sure this was created in an order to avoid bad looking (and > >>> in some cases frightening) "NULL device *" part. > > JFYI: git log --no-merges --grep 'NULL device \*' I think those commits actually argue in favour

Re: [RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU

2018-08-03 Thread Jordan Crouse
On Fri, Aug 03, 2018 at 04:43:41PM +0100, Robin Murphy wrote: > On 02/08/18 19:24, Dmitry Osipenko wrote: > >On Friday, 27 July 2018 20:16:53 MSK Dmitry Osipenko wrote: > >>On Friday, 27 July 2018 20:03:26 MSK Jordan Crouse wrote: > >>>On Fri, Jul 27, 2018 at 05:02:37PM +0100, Robin Murphy wrote: >

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Tony Battersby
On 08/03/2018 12:22 PM, Matthew Wilcox wrote: > On Fri, Aug 03, 2018 at 06:59:20PM +0300, Andy Shevchenko wrote: > I'm pretty sure this was created in an order to avoid bad looking (and > in some cases frightening) "NULL device *" part. >> JFYI: git log --no-merges --grep 'NULL device \*' >

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Andy Shevchenko
On Fri, Aug 3, 2018 at 8:03 PM, Tony Battersby wrote: > On 08/03/2018 12:22 PM, Matthew Wilcox wrote: >> On Fri, Aug 03, 2018 at 06:59:20PM +0300, Andy Shevchenko wrote: >> I'm pretty sure this was created in an order to avoid bad looking (and >> in some cases frightening) "NULL device *"

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Tony Battersby
On 08/03/2018 01:03 PM, Tony Battersby wrote: > On 08/03/2018 12:22 PM, Matthew Wilcox wrote: >> On Fri, Aug 03, 2018 at 06:59:20PM +0300, Andy Shevchenko wrote: >> I'm pretty sure this was created in an order to avoid bad looking (and >> in some cases frightening) "NULL device *" part. >>>

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Tony Battersby
On 08/03/2018 02:38 PM, Andy Shevchenko wrote: > >> dma_alloc_coherent() does appear to support a NULL dev, so it might make >> sense in theory. But I can't find any in-tree callers that actually >> pass a NULL dev to dma_pool_create(). So for one of the dreaded (NULL >> device *) messages to sho

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Douglas Gilbert
On 2018-08-03 02:38 PM, Andy Shevchenko wrote: On Fri, Aug 3, 2018 at 8:03 PM, Tony Battersby wrote: On 08/03/2018 12:22 PM, Matthew Wilcox wrote: On Fri, Aug 03, 2018 at 06:59:20PM +0300, Andy Shevchenko wrote: I'm pretty sure this was created in an order to avoid bad looking (and in some ca

Re: [PATCH v2 6/9] dmapool: improve scalability of dma_pool_free

2018-08-03 Thread Tony Battersby
For v3 of the patchset, I was also considering to add a note to the kernel-doc comments for dma_pool_create() to use dma_alloc_coherent() directly instead of a dma pool if the driver intends to allow userspace to mmap() the returned pages, due to the new use of the _mapcount union in struct page. 

Re: [PATCH v2 6/9] dmapool: improve scalability of dma_pool_free

2018-08-03 Thread Matthew Wilcox
On Fri, Aug 03, 2018 at 04:05:35PM -0400, Tony Battersby wrote: > For v3 of the patchset, I was also considering to add a note to the > kernel-doc comments for dma_pool_create() to use dma_alloc_coherent() > directly instead of a dma pool if the driver intends to allow userspace > to mmap() the ret

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Matthew Wilcox
On Fri, Aug 03, 2018 at 02:43:07PM -0400, Tony Battersby wrote: > Out of curiosity, I just tried to create a dmapool with a NULL dev and > it crashed on this: > > static inline int dev_to_node(struct device *dev) > { > return dev->numa_node; > } > > struct dma_pool *dma_pool_create(const ch

Re: [PATCH v2 2/9] dmapool: cleanup error messages

2018-08-03 Thread Tony Battersby
On 08/03/2018 05:07 PM, Matthew Wilcox wrote: > On Fri, Aug 03, 2018 at 02:43:07PM -0400, Tony Battersby wrote: >> Out of curiosity, I just tried to create a dmapool with a NULL dev and >> it crashed on this: >> >> static inline int dev_to_node(struct device *dev) >> { >> return dev->numa_node