Re: [PATCH v2] PC, KVM, CMA: Fix regression caused by wrong get_order() use

2014-08-19 Thread Joonsoo Kim
(). This replaces get_order() with order_base_2() (round-up version of ilog2). Suggested-by: Paul Mackerras pau...@samba.org Cc: Alexander Graf ag...@suse.de Cc: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Cc: Joonsoo Kim iamjoonsoo@lge.com Cc: Benjamin Herrenschmidt b

Re: [PATCH v2] PC, KVM, CMA: Fix regression caused by wrong get_order() use

2014-08-19 Thread Joonsoo Kim
(). This replaces get_order() with order_base_2() (round-up version of ilog2). Suggested-by: Paul Mackerras pau...@samba.org Cc: Alexander Graf ag...@suse.de Cc: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Cc: Joonsoo Kim iamjoonsoo@lge.com Cc: Benjamin Herrenschmidt b

Re: [PATCH] powerpc/kvm: Fix build break with CONFIG_KVM_BOOK3S_64_HV=y

2014-06-24 Thread Joonsoo Kim
On Tue, Jun 24, 2014 at 04:36:47PM +1000, Michael Ellerman wrote: Commit e58e263 PPC, KVM, CMA: use general CMA reserved area management framework in next-20140624 removed arch/powerpc/kvm/book3s_hv_cma.c but neglected to update the Makefile, thus breaking the build. Signed-off-by: Michael

Re: [PATCH v3 -next 0/9] CMA: generalize CMA reserved area management code

2014-06-24 Thread Joonsoo Kim
On Wed, Jun 18, 2014 at 01:51:44PM -0700, Andrew Morton wrote: On Tue, 17 Jun 2014 10:25:07 +0900 Joonsoo Kim iamjoonsoo@lge.com wrote: v2: - Although this patchset looks very different with v1, the end result, that is, mm/cma.c is same with v1's one. So I carry Ack to patch

Re: [PATCH v3 -next 0/9] CMA: generalize CMA reserved area management code

2014-06-24 Thread Joonsoo Kim
On Wed, Jun 18, 2014 at 01:51:44PM -0700, Andrew Morton wrote: On Tue, 17 Jun 2014 10:25:07 +0900 Joonsoo Kim iamjoonsoo@lge.com wrote: v2: - Although this patchset looks very different with v1, the end result, that is, mm/cma.c is same with v1's one. So I carry Ack to patch

Re: [PATCH v3 -next 4/9] DMA, CMA: support arbitrary bitmap granularity

2014-06-19 Thread Joonsoo Kim
On Wed, Jun 18, 2014 at 01:48:15PM -0700, Andrew Morton wrote: On Mon, 16 Jun 2014 14:40:46 +0900 Joonsoo Kim iamjoonsoo@lge.com wrote: PPC KVM's CMA area management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap

Re: [PATCH v3 -next 4/9] DMA, CMA: support arbitrary bitmap granularity

2014-06-19 Thread Joonsoo Kim
On Wed, Jun 18, 2014 at 01:48:15PM -0700, Andrew Morton wrote: On Mon, 16 Jun 2014 14:40:46 +0900 Joonsoo Kim iamjoonsoo@lge.com wrote: PPC KVM's CMA area management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap

Re: [PATCH v3 -next 0/9] CMA: generalize CMA reserved area management code

2014-06-16 Thread Joonsoo Kim
On Mon, Jun 16, 2014 at 11:11:35AM +0200, Marek Szyprowski wrote: Hello, On 2014-06-16 07:40, Joonsoo Kim wrote: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the KVM on powerpc. They have their own code to manage CMA reserved area even

Re: [PATCH v3 -next 1/9] DMA, CMA: fix possible memory leak

2014-06-16 Thread Joonsoo Kim
On Mon, Jun 16, 2014 at 03:27:19PM +0900, Minchan Kim wrote: Hi, Joonsoo On Mon, Jun 16, 2014 at 02:40:43PM +0900, Joonsoo Kim wrote: We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Additionally, I copy code comment from PPC KVM's CMA

Re: [PATCH v3 -next 0/9] CMA: generalize CMA reserved area management code

2014-06-16 Thread Joonsoo Kim
On Mon, Jun 16, 2014 at 11:11:35AM +0200, Marek Szyprowski wrote: Hello, On 2014-06-16 07:40, Joonsoo Kim wrote: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the KVM on powerpc. They have their own code to manage CMA reserved area even

Re: [PATCH v3 -next 1/9] DMA, CMA: fix possible memory leak

2014-06-16 Thread Joonsoo Kim
On Mon, Jun 16, 2014 at 03:27:19PM +0900, Minchan Kim wrote: Hi, Joonsoo On Mon, Jun 16, 2014 at 02:40:43PM +0900, Joonsoo Kim wrote: We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Additionally, I copy code comment from PPC KVM's CMA

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-15 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 11:53:16AM +0200, Michal Nazarewicz wrote: On Thu, Jun 12 2014, Michal Nazarewicz min...@mina86.com wrote: I used “function(arg1, arg2, …)” at the *beginning* of functions when the arguments passed to the function were included in the message. In all other cases I

Re: [PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-15 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 12:02:38PM +0200, Michal Nazarewicz wrote: On Thu, Jun 12 2014, Joonsoo Kim iamjoonsoo@lge.com wrote: ppc kvm's cma area management needs alignment constraint on I've noticed it earlier and cannot seem to get to terms with this. It should IMO be PPC, KVM and CMA

Re: [PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-15 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 12:19:54PM +0200, Michal Nazarewicz wrote: On Thu, Jun 12 2014, Joonsoo Kim iamjoonsoo@lge.com wrote: ppc kvm's cma region management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap that one

Re: [PATCH v2 03/10] DMA, CMA: separate core cma management codes from DMA APIs

2014-06-15 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:37:43PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:40PM +0900, Joonsoo Kim wrote: To prepare future generalization work on cma area management code, we need to separate core cma management codes from DMA APIs. We will extend these core functions

Re: [PATCH v2 06/10] CMA: generalize CMA reserved area management functionality

2014-06-15 Thread Joonsoo Kim
On Sat, Jun 14, 2014 at 03:46:44PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even

Re: [PATCH v2 07/10] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-15 Thread Joonsoo Kim
On Sat, Jun 14, 2014 at 03:35:33PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Acked-by: Michal Nazarewicz min...@mina86.com

Re: [PATCH v2 00/10] CMA: generalize CMA reserved area management code

2014-06-15 Thread Joonsoo Kim
On Sat, Jun 14, 2014 at 12:55:39PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even

Re: [PATCH v2 07/10] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-15 Thread Joonsoo Kim
On Sat, Jun 14, 2014 at 02:23:59PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Acked-by: Michal Nazarewicz min...@mina86.com

[PATCH v3 -next 8/9] mm, CMA: change cma_declare_contiguous() to obey coding convention

2014-06-15 Thread Joonsoo Kim
) Acked-by: Michal Nazarewicz min...@mina86.com Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c index 3960e0b..6cf498a 100644 --- a/arch/powerpc

[PATCH v3 -next 2/9] DMA, CMA: separate core CMA management codes from DMA APIs

2014-06-15 Thread Joonsoo Kim
APIs while extending core functions. v3: move decriptions to exporeted APIs (Minchan) pass aligned base and size to dma_contiguous_early_fixup() (Minchan) Acked-by: Michal Nazarewicz min...@mina86.com Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim

[PATCH v3 -next 6/9] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-15 Thread Joonsoo Kim
Nazarewicz min...@mina86.com Acked-by: Paolo Bonzini pbonz...@redhat.com Tested-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 8056107..a41e625 100644

[PATCH v3 -next 7/9] mm, CMA: clean-up CMA allocation error path

2014-06-15 Thread Joonsoo Kim
...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 0cf50da..b442a13 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -285,11 +285,12 @@ struct page *cma_alloc(struct cma *cma, int count, unsigned int align) if (ret == 0

[PATCH v3 -next 5/9] CMA: generalize CMA reserved area management functionality

2014-06-15 Thread Joonsoo Kim
...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 4c88935..3116880 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -26,6 +26,7 @@ #include linux/io.h #include linux/vmalloc.h #include

[PATCH v3 -next 1/9] DMA, CMA: fix possible memory leak

2014-06-15 Thread Joonsoo Kim
this possibility during code-review and, IMO, this patch isn't suitable for stable tree. Acked-by: Zhang Yanfei zhangyan...@cn.fujitsu.com Reviewed-by: Michal Nazarewicz min...@mina86.com Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff

[PATCH v3 -next 0/9] CMA: generalize CMA reserved area management code

2014-06-15 Thread Joonsoo Kim
on linux-next 20140610. Patch 1-4 prepare some features to cover PPC KVM's requirements. Patch 5-6 generalize CMA reserved area management code and change users to use it. Patch 7-9 clean-up minor things. Joonsoo Kim (9): DMA, CMA: fix possible memory leak DMA, CMA: separate core CMA

[PATCH v3 -next 9/9] mm, CMA: clean-up log message

2014-06-15 Thread Joonsoo Kim
We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. Acked-by: Michal Nazarewicz min...@mina86.com Reviewed-by: Zhang Yanfei zhangyan...@cn.fujitsu.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 9961120

[PATCH v3 -next 4/9] DMA, CMA: support arbitrary bitmap granularity

2014-06-15 Thread Joonsoo Kim
...@cn.fujitsu.com Acked-by: Minchan Kim minc...@kernel.org Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 5f62c28..c6eeb2c 100644 --- a/drivers/base/dma

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-15 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 11:53:16AM +0200, Michal Nazarewicz wrote: On Thu, Jun 12 2014, Michal Nazarewicz min...@mina86.com wrote: I used “function(arg1, arg2, …)” at the *beginning* of functions when the arguments passed to the function were included in the message. In all other cases I

Re: [PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-15 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 12:02:38PM +0200, Michal Nazarewicz wrote: On Thu, Jun 12 2014, Joonsoo Kim iamjoonsoo@lge.com wrote: ppc kvm's cma area management needs alignment constraint on I've noticed it earlier and cannot seem to get to terms with this. It should IMO be PPC, KVM and CMA

Re: [PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-15 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 12:19:54PM +0200, Michal Nazarewicz wrote: On Thu, Jun 12 2014, Joonsoo Kim iamjoonsoo@lge.com wrote: ppc kvm's cma region management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap that one

Re: [PATCH v2 03/10] DMA, CMA: separate core cma management codes from DMA APIs

2014-06-15 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:37:43PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:40PM +0900, Joonsoo Kim wrote: To prepare future generalization work on cma area management code, we need to separate core cma management codes from DMA APIs. We will extend these core functions

Re: [PATCH v2 06/10] CMA: generalize CMA reserved area management functionality

2014-06-15 Thread Joonsoo Kim
On Sat, Jun 14, 2014 at 03:46:44PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even

Re: [PATCH v2 07/10] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-15 Thread Joonsoo Kim
On Sat, Jun 14, 2014 at 03:35:33PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Acked-by: Michal Nazarewicz min...@mina86.com

Re: [PATCH v2 00/10] CMA: generalize CMA reserved area management code

2014-06-15 Thread Joonsoo Kim
On Sat, Jun 14, 2014 at 12:55:39PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even

Re: [PATCH v2 07/10] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-15 Thread Joonsoo Kim
On Sat, Jun 14, 2014 at 02:23:59PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Acked-by: Michal Nazarewicz min...@mina86.com

[PATCH v3 -next 1/9] DMA, CMA: fix possible memory leak

2014-06-15 Thread Joonsoo Kim
this possibility during code-review and, IMO, this patch isn't suitable for stable tree. Acked-by: Zhang Yanfei zhangyan...@cn.fujitsu.com Reviewed-by: Michal Nazarewicz min...@mina86.com Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff

[PATCH v3 -next 6/9] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-15 Thread Joonsoo Kim
Nazarewicz min...@mina86.com Acked-by: Paolo Bonzini pbonz...@redhat.com Tested-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 8056107..a41e625 100644

[PATCH v3 -next 4/9] DMA, CMA: support arbitrary bitmap granularity

2014-06-15 Thread Joonsoo Kim
...@cn.fujitsu.com Acked-by: Minchan Kim minc...@kernel.org Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 5f62c28..c6eeb2c 100644 --- a/drivers/base/dma

[PATCH v3 -next 2/9] DMA, CMA: separate core CMA management codes from DMA APIs

2014-06-15 Thread Joonsoo Kim
APIs while extending core functions. v3: move decriptions to exporeted APIs (Minchan) pass aligned base and size to dma_contiguous_early_fixup() (Minchan) Acked-by: Michal Nazarewicz min...@mina86.com Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim

[PATCH v3 -next 8/9] mm, CMA: change cma_declare_contiguous() to obey coding convention

2014-06-15 Thread Joonsoo Kim
) Acked-by: Michal Nazarewicz min...@mina86.com Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c index 3960e0b..6cf498a 100644 --- a/arch/powerpc

[PATCH v3 -next 5/9] CMA: generalize CMA reserved area management functionality

2014-06-15 Thread Joonsoo Kim
...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 4c88935..3116880 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -26,6 +26,7 @@ #include linux/io.h #include linux/vmalloc.h #include

[PATCH v3 -next 9/9] mm, CMA: clean-up log message

2014-06-15 Thread Joonsoo Kim
We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. Acked-by: Michal Nazarewicz min...@mina86.com Reviewed-by: Zhang Yanfei zhangyan...@cn.fujitsu.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 9961120

[PATCH v3 -next 3/9] DMA, CMA: support alignment constraint on CMA region

2014-06-15 Thread Joonsoo Kim
-alignment (Minchan) clear code documentation by Minchan's comment (Minchan) Acked-by: Michal Nazarewicz min...@mina86.com Reviewed-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma

Re: [PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:52:20PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:41PM +0900, Joonsoo Kim wrote: ppc kvm's cma area management needs alignment constraint on cma region. So support it to prepare generalization of cma area management functionality. Additionally

Re: [PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 03:06:10PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:42PM +0900, Joonsoo Kim wrote: ppc kvm's cma region management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap that one bit

Re: [PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 04:08:11PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:42PM +0900, Joonsoo Kim wrote: ppc kvm's cma region management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap that one bit

Re: [PATCH v2 06/10] CMA: generalize CMA reserved area management functionality

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 04:13:11PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:43PM +0900, Joonsoo Kim wrote: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area

Re: [PATCH v2 09/10] mm, cma: move output param to the end of param list

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 04:19:31PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:46PM +0900, Joonsoo Kim wrote: Conventionally, we put output param to the end of param list. cma_declare_contiguous() doesn't look like that, so change it. If you says Conventionally, I'd like

Re: [PATCH v2 10/10] mm, cma: use spinlock instead of mutex

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 04:40:29PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:47PM +0900, Joonsoo Kim wrote: Currently, we should take the mutex for manipulating bitmap. This job may be really simple and short so we don't need to sleep if contended. So I change it to spinlock

Re: [PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:52:20PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:41PM +0900, Joonsoo Kim wrote: ppc kvm's cma area management needs alignment constraint on cma region. So support it to prepare generalization of cma area management functionality. Additionally

Re: [PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 03:06:10PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:42PM +0900, Joonsoo Kim wrote: ppc kvm's cma region management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap that one bit

Re: [PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 04:08:11PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:42PM +0900, Joonsoo Kim wrote: ppc kvm's cma region management requires arbitrary bitmap granularity, since they want to reserve very large memory and manage this region with bitmap that one bit

Re: [PATCH v2 06/10] CMA: generalize CMA reserved area management functionality

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 04:13:11PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:43PM +0900, Joonsoo Kim wrote: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area

Re: [PATCH v2 09/10] mm, cma: move output param to the end of param list

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 04:19:31PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:46PM +0900, Joonsoo Kim wrote: Conventionally, we put output param to the end of param list. cma_declare_contiguous() doesn't look like that, so change it. If you says Conventionally, I'd like

Re: [PATCH v2 10/10] mm, cma: use spinlock instead of mutex

2014-06-12 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 04:40:29PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:47PM +0900, Joonsoo Kim wrote: Currently, we should take the mutex for manipulating bitmap. This job may be really simple and short so we don't need to sleep if contended. So I change it to spinlock

[PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-11 Thread Joonsoo Kim
ppc kvm's cma area management needs alignment constraint on cma region. So support it to prepare generalization of cma area management functionality. Additionally, add some comments which tell us why alignment constraint is needed on cma region. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com

[PATCH v2 03/10] DMA, CMA: separate core cma management codes from DMA APIs

2014-06-11 Thread Joonsoo Kim
APIs while extending core functions. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index fb0cdce..8a44c82 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c @@ -231,9 +231,9 @@ core_initcall

[PATCH v2 06/10] CMA: generalize CMA reserved area management functionality

2014-06-11 Thread Joonsoo Kim
and now it's time to do it. This patch moves core functions to mm/cma.c and change DMA APIs to use these functions. There is no functional change in DMA APIs. v2: There is no big change from v1 in mm/cma.c. Mostly renaming. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Joonsoo Kim

[PATCH v2 08/10] mm, cma: clean-up cma allocation error path

2014-06-11 Thread Joonsoo Kim
We can remove one call sites for clear_cma_bitmap() if we first call it before checking error number. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 1e1b017..01a0713 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -282,11 +282,12 @@ struct page *cma_alloc(struct

[PATCH v2 10/10] mm, cma: use spinlock instead of mutex

2014-06-11 Thread Joonsoo Kim
Currently, we should take the mutex for manipulating bitmap. This job may be really simple and short so we don't need to sleep if contended. So I change it to spinlock. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 22a5b23..3085e8c 100644 --- a/mm/cma.c

[PATCH v2 09/10] mm, cma: move output param to the end of param list

2014-06-11 Thread Joonsoo Kim
Conventionally, we put output param to the end of param list. cma_declare_contiguous() doesn't look like that, so change it. Additionally, move down cma_areas reference code to the position where it is really needed. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc

[PATCH v2 07/10] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-11 Thread Joonsoo Kim
Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Acked-by: Michal Nazarewicz min...@mina86.com Acked-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc

[PATCH v2 00/10] CMA: generalize CMA reserved area management code

2014-06-11 Thread Joonsoo Kim
is same with v1's one. So I carry Ack to patch 6-7. Patch 1-5 prepare some features to cover ppc kvm's requirements. Patch 6-7 generalize CMA reserved area management code and change users to use it. Patch 8-10 clean-up minor things. Joonsoo Kim (10): DMA, CMA: clean-up log message DMA, CMA: fix

[PATCH v2 02/10] DMA, CMA: fix possible memory leak

2014-06-11 Thread Joonsoo Kim
We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Additionally, I copy code comment from ppc kvm's cma code to notify why we need to check zone mis-match. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b

[PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-11 Thread Joonsoo Kim
-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index bc4c171..9bc9340 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c @@ -38,6 +38,7 @@ struct cma { unsigned long base_pfn; unsigned

[PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
(). Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 83969f8..bd0bb81 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c @@ -144,7 +144,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 10:11:19AM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others doesn't. This looks bad to me

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:18:53PM +0900, Minchan Kim wrote: Hi Joonsoo, On Thu, Jun 12, 2014 at 12:21:38PM +0900, Joonsoo Kim wrote: We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others

Re: [PATCH v2 02/10] DMA, CMA: fix possible memory leak

2014-06-11 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:25:43PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:39PM +0900, Joonsoo Kim wrote: We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Then, -stable stuff? I don't think so. This is just possible leak

[PATCH v2 02/10] DMA, CMA: fix possible memory leak

2014-06-11 Thread Joonsoo Kim
We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Additionally, I copy code comment from ppc kvm's cma code to notify why we need to check zone mis-match. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b

[PATCH v2 06/10] CMA: generalize CMA reserved area management functionality

2014-06-11 Thread Joonsoo Kim
and now it's time to do it. This patch moves core functions to mm/cma.c and change DMA APIs to use these functions. There is no functional change in DMA APIs. v2: There is no big change from v1 in mm/cma.c. Mostly renaming. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Joonsoo Kim

[PATCH v2 05/10] DMA, CMA: support arbitrary bitmap granularity

2014-06-11 Thread Joonsoo Kim
-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index bc4c171..9bc9340 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c @@ -38,6 +38,7 @@ struct cma { unsigned long base_pfn; unsigned

[PATCH v2 10/10] mm, cma: use spinlock instead of mutex

2014-06-11 Thread Joonsoo Kim
Currently, we should take the mutex for manipulating bitmap. This job may be really simple and short so we don't need to sleep if contended. So I change it to spinlock. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 22a5b23..3085e8c 100644 --- a/mm/cma.c

[PATCH v2 04/10] DMA, CMA: support alignment constraint on cma region

2014-06-11 Thread Joonsoo Kim
ppc kvm's cma area management needs alignment constraint on cma region. So support it to prepare generalization of cma area management functionality. Additionally, add some comments which tell us why alignment constraint is needed on cma region. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com

[PATCH v2 08/10] mm, cma: clean-up cma allocation error path

2014-06-11 Thread Joonsoo Kim
We can remove one call sites for clear_cma_bitmap() if we first call it before checking error number. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/cma.c b/mm/cma.c index 1e1b017..01a0713 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -282,11 +282,12 @@ struct page *cma_alloc(struct

[PATCH v2 07/10] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-11 Thread Joonsoo Kim
Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Acked-by: Michal Nazarewicz min...@mina86.com Acked-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc

[PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
(). Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 83969f8..bd0bb81 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c @@ -144,7 +144,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit

[PATCH v2 09/10] mm, cma: move output param to the end of param list

2014-06-11 Thread Joonsoo Kim
Conventionally, we put output param to the end of param list. cma_declare_contiguous() doesn't look like that, so change it. Additionally, move down cma_areas reference code to the position where it is really needed. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc

[PATCH v2 03/10] DMA, CMA: separate core cma management codes from DMA APIs

2014-06-11 Thread Joonsoo Kim
APIs while extending core functions. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index fb0cdce..8a44c82 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c @@ -231,9 +231,9 @@ core_initcall

[PATCH v2 00/10] CMA: generalize CMA reserved area management code

2014-06-11 Thread Joonsoo Kim
is same with v1's one. So I carry Ack to patch 6-7. Patch 1-5 prepare some features to cover ppc kvm's requirements. Patch 6-7 generalize CMA reserved area management code and change users to use it. Patch 8-10 clean-up minor things. Joonsoo Kim (10): DMA, CMA: clean-up log message DMA, CMA: fix

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 10:11:19AM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others doesn't. This looks bad to me

Re: [PATCH v2 01/10] DMA, CMA: clean-up log message

2014-06-11 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:18:53PM +0900, Minchan Kim wrote: Hi Joonsoo, On Thu, Jun 12, 2014 at 12:21:38PM +0900, Joonsoo Kim wrote: We don't need explicit 'CMA:' prefix, since we already define prefix 'cma:' in pr_fmt. So remove it. And, some logs print function name and others

Re: [PATCH v2 02/10] DMA, CMA: fix possible memory leak

2014-06-11 Thread Joonsoo Kim
On Thu, Jun 12, 2014 at 02:25:43PM +0900, Minchan Kim wrote: On Thu, Jun 12, 2014 at 12:21:39PM +0900, Joonsoo Kim wrote: We should free memory for bitmap when we find zone mis-match, otherwise this memory will leak. Then, -stable stuff? I don't think so. This is just possible leak

Re: [RFC PATCH 1/3] CMA: generalize CMA reserved area management functionality

2014-06-09 Thread Joonsoo Kim
On Tue, Jun 03, 2014 at 08:56:00AM +0200, Michal Nazarewicz wrote: On Tue, Jun 03 2014, Joonsoo Kim wrote: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even

Re: [RFC PATCH 2/3] DMA, CMA: use general CMA reserved area management framework

2014-06-09 Thread Joonsoo Kim
On Tue, Jun 03, 2014 at 09:00:48AM +0200, Michal Nazarewicz wrote: On Tue, Jun 03 2014, Joonsoo Kim wrote: Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com

Re: [RFC PATCH 1/3] CMA: generalize CMA reserved area management functionality

2014-06-09 Thread Joonsoo Kim
On Thu, Jun 05, 2014 at 11:09:05PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even

Re: [RFC PATCH 1/3] CMA: generalize CMA reserved area management functionality

2014-06-09 Thread Joonsoo Kim
On Tue, Jun 03, 2014 at 08:56:00AM +0200, Michal Nazarewicz wrote: On Tue, Jun 03 2014, Joonsoo Kim wrote: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even

Re: [RFC PATCH 2/3] DMA, CMA: use general CMA reserved area management framework

2014-06-09 Thread Joonsoo Kim
On Tue, Jun 03, 2014 at 09:00:48AM +0200, Michal Nazarewicz wrote: On Tue, Jun 03 2014, Joonsoo Kim wrote: Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com

Re: [RFC PATCH 1/3] CMA: generalize CMA reserved area management functionality

2014-06-09 Thread Joonsoo Kim
On Thu, Jun 05, 2014 at 11:09:05PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the kvm on powerpc. They have their own code to manage CMA reserved area even

[RFC PATCH 3/3] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-02 Thread Joonsoo Kim
Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c index 8cd0dae..43c3f81

[RFC PATCH 2/3] DMA, CMA: use general CMA reserved area management framework

2014-06-02 Thread Joonsoo Kim
Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index b3fe1cc..4eac559 100644 --- a/drivers/base/Kconfig

[RFC PATCH 0/3] CMA: generalize CMA reserved area management code

2014-06-02 Thread Joonsoo Kim
who related to this stuff before actually trying to merge this patchset. If all agree with this change, I will resend it after rc1. Thanks. Joonsoo Kim (3): CMA: generalize CMA reserved area management functionality DMA, CMA: use general CMA reserved area management framework PPC, KVM, CMA

[RFC PATCH 1/3] CMA: generalize CMA reserved area management functionality

2014-06-02 Thread Joonsoo Kim
through this patch. This change could also help developer who want to use CMA in their new feature development, since they can use CMA easily without copying pasting this reserved area management code. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/Kconfig b/drivers

[RFC PATCH 2/3] DMA, CMA: use general CMA reserved area management framework

2014-06-02 Thread Joonsoo Kim
Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index b3fe1cc..4eac559 100644 --- a/drivers/base/Kconfig

[RFC PATCH 3/3] PPC, KVM, CMA: use general CMA reserved area management framework

2014-06-02 Thread Joonsoo Kim
Now, we have general CMA reserved area management framework, so use it for future maintainabilty. There is no functional change. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c index 8cd0dae..43c3f81

[RFC PATCH 0/3] CMA: generalize CMA reserved area management code

2014-06-02 Thread Joonsoo Kim
who related to this stuff before actually trying to merge this patchset. If all agree with this change, I will resend it after rc1. Thanks. Joonsoo Kim (3): CMA: generalize CMA reserved area management functionality DMA, CMA: use general CMA reserved area management framework PPC, KVM, CMA

[RFC PATCH 1/3] CMA: generalize CMA reserved area management functionality

2014-06-02 Thread Joonsoo Kim
through this patch. This change could also help developer who want to use CMA in their new feature development, since they can use CMA easily without copying pasting this reserved area management code. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/drivers/base/Kconfig b/drivers