Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation

2018-05-18 Thread h...@lst.de
On Fri, May 18, 2018 at 10:05:51PM +0200, Helge Deller wrote: > This patch seems to fix the dma issues I faced on my 32bit B160L parisc box. > > So it leaves only one open issue on parisc: > Now every 32 bit parisc system is unnecessarily non-coherent. I diagree with those comments, let me resend

Re: arc dma mapping cleanups/fixes and generic noncohernt dma code

2018-05-18 Thread Vineet Gupta
On 05/18/2018 06:45 AM, Christoph Hellwig wrote: Hi all, this series continues consolidating the dma-mapping code, with a focus on architectures that do not (always) provide cache coherence for DMA. Three architectures (arm, mips and powerpc) are still left to be converted later due to complexit

Re: dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation)

2018-05-18 Thread Russell King - ARM Linux
On Fri, May 18, 2018 at 01:35:08PM -0700, Vineet Gupta wrote: > On 05/18/2018 10:50 AM, Russell King - ARM Linux wrote: > >On Fri, May 18, 2018 at 10:20:02AM -0700, Vineet Gupta wrote: > >>I never understood the need for this direction. And if memory serves me > >>right, at that time I was seeing t

Re: dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation)

2018-05-18 Thread Russell King - ARM Linux
On Fri, May 18, 2018 at 07:57:34PM +, Alexey Brodkin wrote: > Hi Russel, That's Russell. > On Fri, 2018-05-18 at 18:50 +0100, Russell King - ARM Linux wrote: > > It's necessary. Take a moment to think carefully about this: > > > > dma_map_single(, dir) > > > > dma_sync_sing

Re: dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation)

2018-05-18 Thread Vineet Gupta
On 05/18/2018 10:50 AM, Russell King - ARM Linux wrote: On Fri, May 18, 2018 at 10:20:02AM -0700, Vineet Gupta wrote: I never understood the need for this direction. And if memory serves me right, at that time I was seeing twice the amount of cache flushing ! It's necessary. Take a moment to t

Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation

2018-05-18 Thread Helge Deller
On 18.05.2018 15:03, Alexey Brodkin wrote: > But the real fix of my problem is: > >8 > --- a/lib/dma-noncoherent.c > +++ b/lib/dma-noncoherent.c > @@ -35,7 +35,7 @@ static dma_addr_t dma_noncoherent_map_page(struct device

Re: dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation)

2018-05-18 Thread Alexey Brodkin
Hi Russel, On Fri, 2018-05-18 at 18:50 +0100, Russell King - ARM Linux wrote: > It's necessary. Take a moment to think carefully about this: > > dma_map_single(, dir) > > dma_sync_single_for_cpu(, dir) > > dma_sync_single_for_device(, dir) > > dma_unmap_single(

Re: dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation)

2018-05-18 Thread Russell King - ARM Linux
On Fri, May 18, 2018 at 10:20:02AM -0700, Vineet Gupta wrote: > I never understood the need for this direction. And if memory serves me > right, at that time I was seeing twice the amount of cache flushing ! It's necessary. Take a moment to think carefully about this: dma_map_single(, di

Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation

2018-05-18 Thread Vineet Gupta
On 05/18/2018 06:23 AM, h...@lst.de wrote: Fri, May 18, 2018 at 01:03:46PM +, Alexey Brodkin wrote: Note mmc_get_dma_dir() is just "data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE". I.e. if we're preparing for sending data dma_noncoherent_map_sg() will have DMA_TO_DEVICE w

dma_sync_*_for_cpu and direction=TO_DEVICE (was Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation)

2018-05-18 Thread Vineet Gupta
On 05/18/2018 06:11 AM, Alexey Brodkin wrote: void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, size_t size, enum dma_data_direction dir) { + if (dir != DMA_TO_DEVICE){ + dump_stack(); + printk(" *** %s@%d: DMA direction is

Re: arc dma mapping cleanups/fixes and generic noncohernt dma code

2018-05-18 Thread h...@lst.de
On Fri, May 18, 2018 at 02:49:36PM +, Alexey Brodkin wrote: > So if we set aside my complaints about direction in > arch_sync_dma_for_{device|cpu}()... Many other architectures use the argument. Various of those look bogus, but for now I want to be able to do straight forward conversions. I

Re: arc dma mapping cleanups/fixes and generic noncohernt dma code

2018-05-18 Thread Alexey Brodkin
Hi Christoph, On Fri, 2018-05-18 at 15:45 +0200, Christoph Hellwig wrote: > Hi all, > > this series continues consolidating the dma-mapping code, with a focus > on architectures that do not (always) provide cache coherence for DMA. > Three architectures (arm, mips and powerpc) are still left to b

Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation

2018-05-18 Thread Alexey Brodkin
Hi Christoph, On Fri, 2018-05-18 at 15:27 +0200, h...@lst.de wrote: > On Fri, May 18, 2018 at 01:03:46PM +, Alexey Brodkin wrote: > > Note mmc_get_dma_dir() is just "data->flags & MMC_DATA_WRITE ? > > DMA_TO_DEVICE : DMA_FROM_DEVICE". > > I.e. if we're preparing for sending data dma_noncohere

[PATCH 6/6] arc: use generic dma_noncoherent_ops

2018-05-18 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. Signed-off-by: Christoph Hellwig --- arch/arc/Kconfig | 4 + arch/arc/include/asm/Kbuild| 1 + arch/arc/include/asm/dma-mapping.h | 21 - arch/arc/mm/dma.c | 140 +++--

[PATCH 1/6] dma-mapping: simplify Kconfig dependencies

2018-05-18 Thread Christoph Hellwig
ARCH_DMA_ADDR_T_64BIT is always true for 64-bit architectures now, so we can skip the clause requiring it. 'n' is the default default, so no need to explicitly state it. Signed-off-by: Christoph Hellwig --- lib/Kconfig | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/li

[PATCH 5/6] arc: fix arc_dma_{map,unmap}_page

2018-05-18 Thread Christoph Hellwig
These functions should perform the same cache synchronoization as calling arc_dma_sync_single_for_{cpu,device} in addition to doing any required address translation or mapping [1]. Ensure they actually do that by calling arc_dma_sync_single_for_{cpu,device} instead of passing the dir argument alon

[PATCH 4/6] arc: fix arc_dma_sync_sg_for_{cpu,device}

2018-05-18 Thread Christoph Hellwig
These functions should perform the same functionality as calling arc_dma_sync_single_for_{cpu,device} on each S/G list element. Ensure they actually do that by calling arc_dma_sync_single_for_{cpu,device}. Otherwise we could be passing a different dir argument. Signed-off-by: Christoph Hellwig -

[PATCH 3/6] arc: simplify arc_dma_sync_single_for_{cpu,device}

2018-05-18 Thread Christoph Hellwig
Remove the indirection through _dma_cache_sync. Also move the functions up a bit in the source file as we'll need them in more places soon. Signed-off-by: Christoph Hellwig --- arch/arc/mm/dma.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/

[PATCH 2/6] dma-mapping: provide a generic dma-noncoherent implementation

2018-05-18 Thread Christoph Hellwig
Add a new dma_map_ops implementation that uses dma-direct for the address mapping of streaming mappings, and which requires arch-specific implemenations of coherent allocate/free. Architectures have to provide flushing helpers to ownership trasnfers to the device and/or CPU, and can provide option

arc dma mapping cleanups/fixes and generic noncohernt dma code

2018-05-18 Thread Christoph Hellwig
Hi all, this series continues consolidating the dma-mapping code, with a focus on architectures that do not (always) provide cache coherence for DMA. Three architectures (arm, mips and powerpc) are still left to be converted later due to complexity of their dma ops selection. The dma-noncoherent

Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation

2018-05-18 Thread h...@lst.de
On Fri, May 18, 2018 at 01:03:46PM +, Alexey Brodkin wrote: > Note mmc_get_dma_dir() is just "data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE > : DMA_FROM_DEVICE". > I.e. if we're preparing for sending data dma_noncoherent_map_sg() will have > DMA_TO_DEVICE which > is quite OK for passing to dma

Re: [PATCH 02/20] dma-mapping: provide a generic dma-noncoherent implementation

2018-05-18 Thread Alexey Brodkin
Hi Christoph, On Fri, 2018-05-11 at 09:59 +0200, Christoph Hellwig wrote: [snip] There seems to be one subtle issue with map/unmap code. While investigating problems on ARC I added instrumentation as below: >8 --- a/arch

Re: [PATCH 4.9 27/33] futex: Remove duplicated code and fix undefined behaviour

2018-05-18 Thread Greg Kroah-Hartman
On Fri, May 18, 2018 at 10:30:24AM +0200, Jiri Slaby wrote: > On 05/18/2018, 10:16 AM, Greg Kroah-Hartman wrote: > > 4.9-stable review patch. If anyone has any objections, please let me know. > > > > -- > > > > From: Jiri Slaby > > > > commit 30d6e0a4190d37740e9447e4e4815f06992

[PATCH 4.9 27/33] futex: Remove duplicated code and fix undefined behaviour

2018-05-18 Thread Greg Kroah-Hartman
4.9-stable review patch. If anyone has any objections, please let me know. -- From: Jiri Slaby commit 30d6e0a4190d37740e9447e4e4815f06992dd8c3 upstream. There is code duplicated over all architecture's headers for futex_atomic_op_inuser. Namely op decoding, access_ok check for

Re: [PATCH 4.9 27/33] futex: Remove duplicated code and fix undefined behaviour

2018-05-18 Thread Jiri Slaby
On 05/18/2018, 10:16 AM, Greg Kroah-Hartman wrote: > 4.9-stable review patch. If anyone has any objections, please let me know. > > -- > > From: Jiri Slaby > > commit 30d6e0a4190d37740e9447e4e4815f06992dd8c3 upstream. ... > --- a/kernel/futex.c > +++ b/kernel/futex.c > @@ -1458