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

2014-06-12 Thread Minchan Kim
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 for several pages to reduce management overheads. > So support arbit

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

2014-06-12 Thread Minchan Kim
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 even if they looks really similar. > >From my guess, it is cause

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

2014-06-12 Thread Minchan Kim
On Thu, Jun 12, 2014 at 12:21:45PM +0900, Joonsoo Kim wrote: > We can remove one call sites for clear_cma_bitmap() if we first > call it before checking error number. > > Signed-off-by: Joonsoo Kim Acked-by: Minchan Kim -- Kind regards, Minchan Kim -- To unsubscribe from this list: send the li

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

2014-06-12 Thread Minchan Kim
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 to suggest one more thing. Conventionally, we put 'base' ahead 'size'

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

2014-06-12 Thread Zhang Yanfei
On 06/12/2014 03:08 PM, 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 for several pages to

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

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 lik

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

2014-06-12 Thread Minchan Kim
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. I'm not sure it would be good always. Maybe you remember we di

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 spin

[PATCH 1/4] KVM: PPC: Book3S PR: Fix ABIv2 issues

2014-06-12 Thread Anton Blanchard
binutils knows that a branch to a function descriptor is actually a branch to the function text. By removing the explicit branch to dot symbols, we maintain both ABIv1 and ABIv2 compatibility. Signed-off-by: Anton Blanchard --- Index: b/arch/powerpc/kvm/book3s_interrupts.S ==

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

2014-06-12 Thread Zhang Yanfei
On 06/12/2014 11:21 AM, 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 doesn't. This looks > bad to me, so I unify log format to print function name consistently. > > Las

[PATCH 2/4] KVM: PPC: Book3S HV: Fix ABIv2 issues

2014-06-12 Thread Anton Blanchard
binutils knows that a branch to a function descriptor is actually a branch to the function text. By removing the explicit branch to dot symbols, we maintain both ABIv1 and ABIv2 compatibility. Signed-off-by: Anton Blanchard --- Index: b/arch/powerpc/kvm/book3s_hv_rmhandlers.S ===

[PATCH 3/4] KVM: PPC: Book3S HV: Fix ABIv2 indirect branch issue

2014-06-12 Thread Anton Blanchard
To establish addressability quickly, ABIv2 requires the target address of the function being called to be in r12. Signed-off-by: Anton Blanchard --- Index: b/arch/powerpc/kvm/book3s_hv_rmhandlers.S === --- a/arch/powerpc/kvm/book3s_

[PATCH 4/4] KVM: PPC: Assembly functions exported to modules need _GLOBAL_TOC()

2014-06-12 Thread Anton Blanchard
Both kvmppc_hv_entry_trampoline and kvmppc_entry_trampoline are assembly functions that are exported to modules and also require a valid r2. As such we need to use _GLOBAL_TOC so we provide a global entry point that establishes the TOC (r2). Signed-off-by: Anton Blanchard --- Index: b/arch/powe

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

2014-06-12 Thread Zhang Yanfei
On 06/12/2014 02:02 PM, Joonsoo Kim wrote: > 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?

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

2014-06-12 Thread Zhang Yanfei
On 06/12/2014 11:21 AM, 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 for several pages to reduce management overheads. > So support arbitrary bitmap granul

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

2014-06-12 Thread Zhang Yanfei
On 06/12/2014 11:21 AM, 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 if they looks really similar. >>From my guess, it is caused by some needs on

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

2014-06-12 Thread Zhang Yanfei
On 06/12/2014 11:21 AM, Joonsoo Kim wrote: > We can remove one call sites for clear_cma_bitmap() if we first > call it before checking error number. > > Signed-off-by: Joonsoo Kim Reviewed-by: Zhang Yanfei > > diff --git a/mm/cma.c b/mm/cma.c > index 1e1b017..01a0713 100644 > --- a/mm/cma.c >

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

2014-06-12 Thread Michal Nazarewicz
>> Joonsoo Kim 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, so I unify log format to print function name consistently. >> > >> >

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

2014-06-12 Thread Michal Nazarewicz
On Thu, Jun 12 2014, 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 doesn't. This looks > bad to me, so I unify log format to print function name consistently. > > Lastly,

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

2014-06-12 Thread Michal Nazarewicz
On Thu, Jun 12 2014, 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 code to notify > why we need to check zone mis-match. > > Signed-off-by: Joonsoo Kim Reviewed-by: Mi

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

2014-06-12 Thread Michal Nazarewicz
On Thu, Jun 12 2014, Michal Nazarewicz 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 left it at just “function:” (or just no additional > prefix). IMO that's a reasonable

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

2014-06-12 Thread Michal Nazarewicz
On Thu, Jun 12 2014, 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 to cover requirements of > ppc kvm's cma area management functionality in following patc

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

2014-06-12 Thread Michal Nazarewicz
On Thu, Jun 12 2014, Joonsoo Kim 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 since those are acronyms. But if you have strong feelings, it's not a big issue. > cma regi

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

2014-06-12 Thread Michal Nazarewicz
On Thu, Jun 12 2014, 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 for several pages to reduce management overheads. > So support arbitrary bitmap granular

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

2014-06-12 Thread Michal Nazarewicz
On Thu, Jun 12 2014, Joonsoo Kim wrote: > We can remove one call sites for clear_cma_bitmap() if we first > call it before checking error number. > > Signed-off-by: Joonsoo Kim Reviewed-by: Michal Nazarewicz > diff --git a/mm/cma.c b/mm/cma.c > index 1e1b017..01a0713 100644 > --- a/mm/cma.c >

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

2014-06-12 Thread Michal Nazarewicz
On Thu, Jun 12 2014, 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. Perhaps the function should be changed to return an error-pointer? > Additionally, move down cma_areas reference code to the po

[PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule

2014-06-12 Thread Mihai Caraman
On vcpu schedule, the condition checked for tlb pollution is too tight. The tlb entries of one vcpu are polluted when a different vcpu from the same partition runs in-between. Relax the current tlb invalidation condition taking into account the lpid. Signed-off-by: Mihai Caraman freescale.com> Cc

Re: [PATCH 3/4 v3] KVM: PPC: Alow kvmppc_get_last_inst() to fail

2014-06-12 Thread Alexander Graf
On 06/02/2014 05:50 PM, Mihai Caraman wrote: On book3e, guest last instruction is read on the exit path using load external pid (lwepx) dedicated instruction. This load operation may fail due to TLB eviction and execute-but-not-read entries. This patch lay down the path for an alternative soluti

Re: [PATCH 4/4 v3] KVM: PPC: Bookehv: Get vcpu's last instruction for emulation

2014-06-12 Thread Alexander Graf
On 06/02/2014 05:50 PM, Mihai Caraman wrote: On book3e, KVM uses load external pid (lwepx) dedicated instruction to read guest last instruction on the exit path. lwepx exceptions (DTLB_MISS, DSI and LRAT), generated by loading a guest address, needs to be handled by KVM. These exceptions are gene

Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule

2014-06-12 Thread Alexander Graf
On 06/12/2014 04:00 PM, Mihai Caraman wrote: On vcpu schedule, the condition checked for tlb pollution is too tight. The tlb entries of one vcpu are polluted when a different vcpu from the same partition runs in-between. Relax the current tlb invalidation condition taking into account the lpid.