Re: [PATCH 1/3] KVM: PPC: Book3S HV: Fix race in reading change bit when removing HPTE

2015-04-27 Thread Aneesh Kumar K.V
Paul Mackerras writes: > The reference (R) and change (C) bits in a HPT entry can be set by > hardware at any time up until the HPTE is invalidated and the TLB > invalidation sequence has completed. This means that when removing > a HPTE, we need to read the HPTE after the invalidation sequence

[PATCH 1/2] KVM: PPC: Use READ_ONCE when dereferencing pte_t pointer

2015-03-29 Thread Aneesh Kumar K.V
pte can get updated from other CPUs as part of multiple activities like THP split, huge page collapse, unmap. We need to make sure we don't reload the pte value again and again for different checks. Signed-off-by: Aneesh Kumar K.V --- Note: This is posted previously as part of

[PATCH 2/2] KVM: PPC: Remove page table walk helpers

2015-03-29 Thread Aneesh Kumar K.V
This patch remove helpers which we had used only once in the code. Limiting page table walk variants help in ensuring that we won't end up with code walking page table with wrong assumptions. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pgtable.h | 21 -

[PATCH] KVM: PPC: BOOK3S: HV: remove rma related variables from code.

2015-02-22 Thread Aneesh Kumar K.V
We don't support real-mode areas now that 970 support is removed. Remove the remaining details of rma from the code. Also rename rma_setup_done to hpte_setup_done to better reflect the changes. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_host.h | 3 +-- arch/powerp

[PATCH V2 2/2] KVM: PPC: BOOK3S: HV: Use unlock variant with memory barrier

2015-01-26 Thread Aneesh Kumar K.V
later with code movements. We also document why a non-barrier variant is ok in performance critical path. Signed-off-by: Aneesh Kumar K.V --- Changes from V1: * Rebase to latest upstream arch/powerpc/kvm/book3s_64_mmu_hv.c | 10 +- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 15 ++

[PATCH V2 1/2] KVM: PPC: BOOK3S: HV: Add helpers for lock/unlock hpte

2015-01-26 Thread Aneesh Kumar K.V
neesh Kumar K.V --- Changes from V1: * Rebase to latest upstream arch/powerpc/include/asm/kvm_book3s_64.h | 14 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c | 25 ++--- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 25 + 3 files changed, 33 inser

Re: [PATCH 1/3] KVM: PPC: BOOK3S: HV: Add helpers for lock/unlock hpte

2015-01-12 Thread Aneesh Kumar K.V
Hi, Any update on this patch. We could drop patch 3. Any feedback on 1 and 2 ?. -aneesh "Aneesh Kumar K.V" writes: > This patch adds helper routine for lock and unlock hpte and use > the same for rest of the code. We don't change any locking rules in this > patch. In

Re: [PATCH] KVM: PPC: Book3S HV: Tracepoints for KVM HV guest interactions

2014-11-20 Thread Aneesh Kumar K.V
"Suresh E. Warrier" writes: > This patch adds trace points in the guest entry and exit code and also > for exceptions handled by the host in kernel mode - hypercalls and page > faults. The new events are added to /sys/kernel/debug/tracing/events > under a new subsystem called kvm_hv. >

Re: [PATCH 1/5] KVM: PPC: Book3S HV: Fix computation of tlbie operand

2014-11-02 Thread Aneesh Kumar K.V
"Aneesh Kumar K.V" writes: > Paul Mackerras writes: > >> The B (segment size) field in the RB operand for the tlbie >> instruction is two bits, which we get from the top two bits of >> the first doubleword of the HPT entry to be invalidated. These >> b

Re: [PATCH 1/5] KVM: PPC: Book3S HV: Fix computation of tlbie operand

2014-11-02 Thread Aneesh Kumar K.V
not rely on guests doing > this. > > Cc: Aneesh Kumar K.V > Signed-off-by: Paul Mackerras Reviewed-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/kvm_book3s_64.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/include/

[PATCH 1/3] KVM: PPC: BOOK3S: HV: Add helpers for lock/unlock hpte

2014-10-20 Thread Aneesh Kumar K.V
neesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s_64.h | 14 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c | 25 ++--- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 27 ++- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/arch/po

[PATCH 3/3] KVM: PPC: BOOK3S: HV: Rename variable for better readability

2014-10-20 Thread Aneesh Kumar K.V
Minor cleanup Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c index 78e689b066f1..2922f8d127ff

[PATCH 2/3] KVM: PPC: BOOK3S: HV: Use unlock variant with memory barrier

2014-10-20 Thread Aneesh Kumar K.V
later with code movements. We also document why a non-barrier variant is ok in performance critical path. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 10 +- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 15 ++- 2 files changed, 15 insertions(+), 10 deletion

[PATCH] KVM: PPC: Book3S HV: Add missing HPTE unlock

2014-10-20 Thread Aneesh Kumar K.V
Herrenschmidt Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index d40770248b6a..cebb86bc4a37 100644 --- a/arch/powerpc/kvm

[PATCH] KVM: PPC: BOOK3S: HV: CMA: Reserve cma region only in hypervisor mode

2014-09-29 Thread Aneesh Kumar K.V
We use cma reserved area for creating guest hash page table. Don't do the reservation in non-hypervisor mode. This avoids unnecessary CMA reservation when booting with limited memory configs like fadump and kdump. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_hv_builtin.

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

2014-08-13 Thread Aneesh Kumar K.V
s get_order() with order_base_2() (round-up version of ilog2). > > Suggested-by: Paul Mackerras > Cc: Alexander Graf > Cc: Aneesh Kumar K.V > Cc: Joonsoo Kim > Cc: Benjamin Herrenschmidt > Signed-off-by: Alexey Kardashevskiy Reviewed-by: Aneesh Kumar K.V > --- &

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

2014-08-13 Thread Aneesh Kumar K.V
s get_order() with ilog2(). Should we round it up ? ie, ilog2(kvm_rma_pages - 1) + 1 ? > > Suggested-by: Paul Mackerras > Cc: Alexander Graf > Cc: Aneesh Kumar K.V > Cc: Joonsoo Kim > Cc: Benjamin Herrenschmidt > Cc: Why stable ? We merged it this merge window.

Re: [PATCH 2/6] KVM: PPC: BOOK3S: HV: Deny virtual page class key update via h_protect

2014-07-02 Thread Aneesh Kumar K.V
Paul Mackerras writes: > On Sun, Jun 29, 2014 at 04:47:31PM +0530, Aneesh Kumar K.V wrote: >> This makes it consistent with h_enter where we clear the key >> bits. We also want to use virtual page class key protection mechanism >> for indicating host page fault. For that

Re: [PATCH 5/6] KVM: PPC: BOOK3S: Use hpte_update_in_progress to track invalid hpte during an hpte update

2014-07-02 Thread Aneesh Kumar K.V
Paul Mackerras writes: > On Sun, Jun 29, 2014 at 04:47:34PM +0530, Aneesh Kumar K.V wrote: >> As per ISA, we first need to mark hpte invalid (V=0) before we update >> the hpte lower half bits. With virtual page class key protection mechanism >> we want >> to send any

Re: [PATCH 4/6] KVM: PPC: BOOK3S: HV: Use new functions for mapping/unmapping hpte in host

2014-07-02 Thread Aneesh Kumar K.V
Paul Mackerras writes: > On Sun, Jun 29, 2014 at 04:47:33PM +0530, Aneesh Kumar K.V wrote: >> We want to use virtual page class key protection mechanism for >> indicating a MMIO mapped hpte entry or a guest hpte entry that is swapped out >> in the host. Those hptes will be m

Re: [PATCH 0/6] Use virtual page class key protection mechanism for speeding up guest page fault

2014-06-29 Thread Aneesh Kumar K.V
Benjamin Herrenschmidt writes: > On Sun, 2014-06-29 at 16:47 +0530, Aneesh Kumar K.V wrote: > >> To achieve the above we use virtual page calss protection mechanism for >> covering (2) and (3). For both the above case we mark the hpte >> valid, but associate the page

[PATCH] KVM: PPC: BOOK3S: HV: Update compute_tlbie_rb to handle 16MB base page

2014-06-29 Thread Aneesh Kumar K.V
When calculating the lower bits of AVA field, use the shift count based on the base page size. Also add the missing segment size and remove stale comment. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s_64.h | 6 -- arch/powerpc/kvm/book3s_hv.c | 6

[PATCH 5/6] KVM: PPC: BOOK3S: Use hpte_update_in_progress to track invalid hpte during an hpte update

2014-06-29 Thread Aneesh Kumar K.V
updating the hpte. To track that add a vm specific atomic variable that we check in the fault path to always send the fault to host. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s_64.h | 1 + arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/kernel/asm

[PATCH 6/6] KVM: PPC: BOOK3S: HV: Use virtual page class protection mechanism for host fault and mmio

2014-06-29 Thread Aneesh Kumar K.V
y. We mark those HPTEs invalid and use the software defined bit, HPTE_V_VRMA, to differentiate them. NOTE: We still need to handle protection fault in host so that a write to KSM shared page is handled in the host. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s_64.h

[PATCH 3/6] KVM: PPC: BOOK3S: HV: Remove dead code

2014-06-29 Thread Aneesh Kumar K.V
Since we do don't support virtual page class key protection mechanism in the guest, we should not find a keyfault that needs to be forwarded to the guest. So remove the dead code. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 9 - arch/powerp

[PATCH 4/6] KVM: PPC: BOOK3S: HV: Use new functions for mapping/unmapping hpte in host

2014-06-29 Thread Aneesh Kumar K.V
VALID with places where we want to check whether the hpte is host mapped. This patch enables a closer review for such a change. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s_64.h | 36 arch/powerpc/kvm/book3s_64_mmu_hv.c

[PATCH 0/6] Use virtual page class key protection mechanism for speeding up guest page fault

2014-06-29 Thread Aneesh Kumar K.V
munmap(c, length); } } Without Fix: -- [root@qemu-pr-host ~]# time ./pfault real0m8.438s user0m0.855s sys 0m7.540s [root@qemu-pr-host ~]# With Fix: [root@qemu-pr-host ~]# time ./pfault real0m7.833s user0m0.782s sys 0m7.038s [root@qemu-pr-host ~]#

[PATCH 2/6] KVM: PPC: BOOK3S: HV: Deny virtual page class key update via h_protect

2014-06-29 Thread Aneesh Kumar K.V
virtual page class protection mechanism for the guest. This will not have any impact for PAPR linux guest because Linux guest currently don't use virtual page class key protection model Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 12 1 file chang

[PATCH 1/6] KVM: PPC: BOOK3S: HV: Clear hash pte bits from do_h_enter callers

2014-06-29 Thread Aneesh Kumar K.V
We will use this to set HPTE_V_VRMA bit in the later patch. This also make sure we clear the hpte bits only when called via hcall. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 15 +-- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 8 ++-- 2 files changed, 19

[PATCH] KVM: PPC: BOOK3S: HV: Update compute_tlbie_rb to handle 16MB base page

2014-06-27 Thread Aneesh Kumar K.V
When calculating the lower bits of AVA field, use the shift count based on the base page size. Also add the missing segment size and remove stale comment. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s_64.h | 6 -- arch/powerpc/kvm/book3s_hv.c | 6

Re: [PATCH 6/7] KVM: PPC: Book3S HV: Fix ABIv2 on LE

2014-06-18 Thread Aneesh Kumar K.V
Alexander Graf writes: > We use ABIv2 on Little Endian systems which gets rid of the dotted function > names. Branch to the actual functions when we see such a system. > > Signed-off-by: Alexander Graf As per patches sent by anton we don't need this. We can branch to the function rathen than th

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

2014-06-16 Thread Aneesh Kumar K.V
Joonsoo Kim writes: > On Sat, Jun 14, 2014 at 12:55:39PM +0530, Aneesh Kumar K.V wrote: >> Joonsoo Kim 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

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

2014-06-16 Thread Aneesh Kumar K.V
Joonsoo Kim writes: > On Sat, Jun 14, 2014 at 02:23:59PM +0530, Aneesh Kumar K.V wrote: >> Joonsoo Kim writes: >> >> > Now, we have general CMA reserved area management framework, >> > so use it for future maintainabilty. There is no functional change. >

Re: [PATCH 0/6] KVM: PPC: Book3S HV: Enable on little endian hosts

2014-06-15 Thread Aneesh Kumar K.V
Alexander Graf writes: > So far we've been able to successfully run HV KVM on big endian hosts, but > once you dive into little endian land things start to fall apart. > > This patch set enables HV KVM for little endian hosts. This should be the > final piece left missing to get little endian sys

[PATCH V2] KVM: PPC: BOOK3S: HV: Use base page size when comparing against slb value

2014-06-15 Thread Aneesh Kumar K.V
page size in kvmppc_hv_find_lock_hpte. Signed-off-by: Aneesh Kumar K.V --- Changes from V1: * Remove obsolete comment from the code * Update commit message arch/powerpc/include/asm/kvm_book3s_64.h | 19 +-- arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +- arch/powerpc/kvm

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

2014-06-14 Thread Aneesh Kumar K.V
Joonsoo Kim 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 if they looks really similar. > From my guess, it is caused by some needs on bitmap management. Kv

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

2014-06-14 Thread Aneesh Kumar K.V
ity for following generalization. > > Signed-off-by: Joonsoo Kim Reviewed-by: Aneesh Kumar K.V > > 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-conti

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

2014-06-14 Thread Aneesh Kumar K.V
; > v2: There is no big change from v1 in mm/cma.c. Mostly renaming. > > Acked-by: Michal Nazarewicz > Signed-off-by: Joonsoo Kim Reviewed-by: Aneesh Kumar K.V > > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig > index 00e13ce..4eac559 100644 > --- a/driver

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

2014-06-14 Thread Aneesh Kumar K.V
; > v2: There is no big change from v1 in mm/cma.c. Mostly renaming. > > Acked-by: Michal Nazarewicz > Signed-off-by: Joonsoo Kim Reviewed-by: Aneesh Kumar K.V > > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig > index 00e13ce..4eac559 100644 > --- a/driver

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

2014-06-14 Thread Aneesh Kumar K.V
c/kvm/book3s_hv_cma.c > deleted file mode 100644 > index d9d3d85..000 > --- a/arch/powerpc/kvm/book3s_hv_cma.c > +++ /dev/null > @@ -1,240 +0,0 @@ > -/* > - * Contiguous Memory Allocator for ppc KVM hash pagetable based on CMA > - * for DMA mapping framework > - * > -

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

2014-06-14 Thread Aneesh Kumar K.V
Joonsoo Kim 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 > Acked-by: Paolo Bonzini > Signed-off-by: Joonsoo Kim Need this. We may want to keep the VM_BUG_ON by movin

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

2014-06-14 Thread Aneesh Kumar K.V
Joonsoo Kim 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 if they looks really similar. > From my guess, it is caused by some needs on bitmap management. Kv

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

2014-06-14 Thread Aneesh Kumar K.V
Joonsoo Kim Reviewed-by: Aneesh Kumar K.V > > diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c > b/arch/powerpc/kvm/book3s_hv_builtin.c > index 28ec226..97613ea 100644 > --- a/arch/powerpc/kvm/book3s_hv_builtin.c > +++ b/arch/powerpc/kvm/book3s_hv_builtin.c > @@ -1

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

2014-06-14 Thread Aneesh Kumar K.V
Joonsoo Kim writes: > 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: Aneesh Kumar K.V > > diff --git a/mm/cma.c b/mm/cma.c > index 1e1b017..01a0713 100644 > --- a/m

Re: [PATCH] KVM: PPC: BOOK3S: HV: Use base page size when comparing against slb value

2014-06-13 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 13.06.14 16:28, Aneesh Kumar K.V wrote: >> Alexander Graf writes: >> >>> On 13.06.14 09:23, Aneesh Kumar K.V wrote: >>>> With guest supporting Multiple page size per segment (MPSS), >>>> hpte_page_size returns actual p

Re: [PATCH] KVM: PPC: BOOK3S: HV: Use base page size when comparing against slb value

2014-06-13 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 13.06.14 09:23, Aneesh Kumar K.V wrote: >> With guest supporting Multiple page size per segment (MPSS), >> hpte_page_size returns actual page size used. Add a new function to >> return base page size and use that to compare against the the page si

[PATCH] KVM: PPC: BOOK3S: HV: Use base page size when comparing against slb value

2014-06-13 Thread Aneesh Kumar K.V
With guest supporting Multiple page size per segment (MPSS), hpte_page_size returns actual page size used. Add a new function to return base page size and use that to compare against the the page size calculated from SLB Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s_64

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

2014-06-11 Thread Aneesh Kumar K.V
gion. > > Signed-off-by: Joonsoo Kim Reviewed-by: Aneesh Kumar K.V > > diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c > index 8a44c82..bc4c171 100644 > --- a/drivers/base/dma-contiguous.c > +++ b/drivers/base/dma-contiguous.c > @@ -32,6

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

2014-06-11 Thread Aneesh Kumar K.V
g patches. > This separation helps us not to touch DMA APIs while extending > core functions. > > Signed-off-by: Joonsoo Kim Reviewed-by: Aneesh Kumar K.V > > diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c > index fb0cdce..8a44c82 100644 > --- a/driv

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

2014-06-11 Thread Aneesh Kumar K.V
Joonsoo Kim writes: > 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 Rev

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

2014-06-11 Thread Aneesh Kumar K.V
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. > > Lastly, I add one more deb

Re: [PATCH 1/4] KVM: PPC: BOOK3S: PR: Emulate virtual timebase register

2014-06-06 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05.06.14 14:08, Aneesh Kumar K.V wrote: >> virtual time base register is a per VM, per cpu register that needs >> to be saved and restored on vm exit and entry. Writing to VTB is not >> allowed in the privileged mode. >> >> Signed-

Re: [PATCH 2/4] KVM: PPC: BOOK3S: PR: Doorbell support

2014-06-06 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05.06.14 14:08, Aneesh Kumar K.V wrote: >> We don't have SMT support yet, hence we should not find a doorbell >> message generated >> >> Signed-off-by: Aneesh Kumar K.V >> --- >> arch/powerpc/kvm/book3s_emulate.c | 1

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

2014-06-05 Thread Aneesh Kumar K.V
o > obj-$(CONFIG_ZBUD) += zbud.o > obj-$(CONFIG_ZSMALLOC) += zsmalloc.o > obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o > +obj-$(CONFIG_CMA)+= cma.o > diff --git a/mm/cma.c b/mm/cma.c > new file mode 100644 > index 000..0dae88d > --- /dev/null

Re: [PATCH 1/4] KVM: PPC: BOOK3S: PR: Emulate virtual timebase register

2014-06-05 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05.06.14 17:50, Aneesh Kumar K.V wrote: >> Alexander Graf writes: >> >>> On 05.06.14 14:08, Aneesh Kumar K.V wrote: >>>> virtual time base register is a per VM, per cpu register that needs >>>> to be saved and rest

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

2014-06-05 Thread Aneesh Kumar K.V
Paolo Bonzini writes: > Il 03/06/2014 09:02, Michal Nazarewicz ha scritto: >> 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 >> >>

Re: [PATCH 2/4] KVM: PPC: BOOK3S: PR: Doorbell support

2014-06-05 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05.06.14 14:21, Alexander Graf wrote: >> >> On 05.06.14 14:08, Aneesh Kumar K.V wrote: >>> We don't have SMT support yet, hence we should not find a doorbell >>> message generated >>> >>> Signed-off-by: Aneesh Ku

Re: [PATCH 1/4] KVM: PPC: BOOK3S: PR: Emulate virtual timebase register

2014-06-05 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05.06.14 14:08, Aneesh Kumar K.V wrote: >> virtual time base register is a per VM, per cpu register that needs >> to be saved and restored on vm exit and entry. Writing to VTB is not >> allowed in the privileged mode. >> >>

[PATCH 3/4] KVM: PPC: BOOK3S: PR: Emulate DPDES register

2014-06-05 Thread Aneesh Kumar K.V
Since we don't support SMT yet, we should always find zero in Directed privileged doorbell exception state register. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_emulate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerp

[PATCH 4/4] KVM: PPC: BOOK3S: PR: Emulate instruction counter

2014-06-05 Thread Aneesh Kumar K.V
Writing to IC is not allowed in the privileged mode. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/kvm/book3s.c | 6 ++ arch/powerpc/kvm/book3s_emulate.c | 3 +++ arch/powerpc/kvm/book3s_hv.c| 6 -- arch/powerpc/kvm

[PATCH 1/4] KVM: PPC: BOOK3S: PR: Emulate virtual timebase register

2014-06-05 Thread Aneesh Kumar K.V
virtual time base register is a per VM, per cpu register that needs to be saved and restored on vm exit and entry. Writing to VTB is not allowed in the privileged mode. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/include/asm/reg.h | 15

[PATCH 2/4] KVM: PPC: BOOK3S: PR: Doorbell support

2014-06-05 Thread Aneesh Kumar K.V
We don't have SMT support yet, hence we should not find a doorbell message generated Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_emulate.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerp

KVM: PPC: BOOK3S: PR: P8 Support

2014-06-05 Thread Aneesh Kumar K.V
This patchset adds support for emulating VTB, IC and Doorbell features in P8. Doorbell support is dummy since we don't support SMT cores with PR-KVM. -aneesh -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo in

Re: [PATCH] KVM: PPC: BOOK3S: PR: Fix PURR and SPURR emulation

2014-06-04 Thread Aneesh Kumar K.V
"Aneesh Kumar K.V" writes: > Paul Mackerras writes: > >> On Tue, Jun 03, 2014 at 05:46:11PM +0530, Aneesh Kumar K.V wrote: >>> We use time base for PURR and SPURR emulation with PR KVM since we >>> are emulating a single threaded core. When using time bas

[PATCH V2] KVM: PPC: BOOK3S: PR: Fix PURR and SPURR emulation

2014-06-04 Thread Aneesh Kumar K.V
hypervisor resource. Signed-off-by: Aneesh Kumar K.V --- Changes from V1: Move the purr/spurr update to happen only once in case of exit with preemption enabled. arch/powerpc/include/asm/kvm_book3s.h | 2 -- arch/powerpc/include/asm/kvm_host.h | 4 ++-- arch/powerpc/kvm/book3s_emulate.

Re: [PATCH] KVM: PPC: BOOK3S: PR: Fix PURR and SPURR emulation

2014-06-04 Thread Aneesh Kumar K.V
Paul Mackerras writes: > On Tue, Jun 03, 2014 at 05:46:11PM +0530, Aneesh Kumar K.V wrote: >> We use time base for PURR and SPURR emulation with PR KVM since we >> are emulating a single threaded core. When using time base >> we need to make sure that we don't accumul

[PATCH] KVM: PPC: BOOK3S: PR: Fix PURR and SPURR emulation

2014-06-03 Thread Aneesh Kumar K.V
hypervisor resource. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s.h | 2 -- arch/powerpc/include/asm/kvm_host.h | 4 ++-- arch/powerpc/kvm/book3s_emulate.c | 16 arch/powerpc/kvm/book3s_pr.c | 10 ++ 4 files changed, 20 inserti

[PATCH V6 2/2] KVM: PPC: BOOK3S: Remove open coded make_dsisr in alignment handler

2014-05-12 Thread Aneesh Kumar K.V
Use make_dsisr instead of open coding it. This also have the added benefit of handling alignment interrupt on additional instructions. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/disassemble.h | 34 + arch/powerpc/kernel/align.c| 34

[PATCH V6 1/2] KVM: PPC: BOOK3S: Always use the saved DAR value

2014-05-12 Thread Aneesh Kumar K.V
Although it's optional, IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values. Signed-off-by: Aneesh Kumar K.V --- Changes from V5: * Split the patch to two and also update commit message arch/powerpc/kvm/book3s_emulate.c | 7 +

Re: [PATCH] KVM: PPC: BOOK3S: PR: Fix WARN_ON with debug options on

2014-05-07 Thread Aneesh Kumar K.V
Paul Mackerras writes: > On Sun, May 04, 2014 at 10:56:08PM +0530, Aneesh Kumar K.V wrote: >> With debug option "sleep inside atomic section checking" enabled we get >> the below WARN_ON during a PR KVM boot. This is because upstream now >> have PREEMPT_COUNT

[PATCH V2] KVM: PPC: BOOK3S: HV: Add mixed page-size support for guest

2014-05-06 Thread Aneesh Kumar K.V
nd the actual page size correctly from the HPTE entry. Signed-off-by: Aneesh Kumar K.V --- Changes from V1: * Update commit message * Rename variables as per review feedback arch/powerpc/include/asm/kvm_book3s_64.h | 146 ++- arch/powerpc/kvm/book3s_hv.c | 7 +

Re: [RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest

2014-05-06 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05/06/2014 05:06 PM, Aneesh Kumar K.V wrote: >> Alexander Graf writes: >> >>> On 05/06/2014 11:26 AM, Benjamin Herrenschmidt wrote: >>>> On Tue, 2014-05-06 at 11:12 +0200, Alexander Graf wrote: >>>> >> . >&

[PATCH V2] KVM: PPC: BOOK3S: HV: Prefer CMA region for hash page table allocation

2014-05-06 Thread Aneesh Kumar K.V
le we still have plenty of space available in CMA. This patch addresses this issue by first trying hash page table allocation from CMA's reserved region before falling back to the normal page allocator. So if we run out of memory, we really are out of memory. Signed-off-by: Aneesh

Re: [RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest

2014-05-06 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05/06/2014 11:26 AM, Benjamin Herrenschmidt wrote: >> On Tue, 2014-05-06 at 11:12 +0200, Alexander Graf wrote: >> . I updated the commit message as below. Let me know if this is ok. KVM: PPC: BOOK3S: HV: THP support for guest On recent IBM Power CP

[PATCH V5] KVM: PPC: BOOK3S: Use the saved dar value and generic make_dsisr

2014-05-06 Thread Aneesh Kumar K.V
Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values. Signed-off-by: Aneesh Kumar K.V --- * Changes from V4 * Update comments around using fault_dar arch/powerpc/include/asm/disassem

Re: [RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest

2014-05-06 Thread Aneesh Kumar K.V
Paul Mackerras writes: > On Mon, May 05, 2014 at 08:17:00PM +0530, Aneesh Kumar K.V wrote: >> Alexander Graf writes: >> >> > On 05/04/2014 07:30 PM, Aneesh Kumar K.V wrote: >> >> Signed-off-by: Aneesh Kumar K.V >> > >> > No patch descrip

Re: [RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest

2014-05-06 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05/04/2014 07:30 PM, Aneesh Kumar K.V wrote: >> Signed-off-by: Aneesh Kumar K.V >> static inline unsigned long hpte_page_size(unsigned long h, unsigned long >> l) >> { >> +int size, a_size; >

Re: [PATCH] KVM: PPC: BOOK3S: HV: Don't try to allocate from kernel page allocator for hash page table.

2014-05-06 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 06.05.14 09:19, Benjamin Herrenschmidt wrote: >> On Tue, 2014-05-06 at 09:05 +0200, Alexander Graf wrote: >>> On 06.05.14 02:06, Benjamin Herrenschmidt wrote: On Mon, 2014-05-05 at 17:16 +0200, Alexander Graf wrote: > Isn't this a greater problem? We should st

Re: [PATCH V4] POWERPC: BOOK3S: KVM: Use the saved dar value and generic make_dsisr

2014-05-06 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 06.05.14 02:41, Paul Mackerras wrote: >> On Mon, May 05, 2014 at 01:19:30PM +0200, Alexander Graf wrote: >>> On 05/04/2014 07:21 PM, Aneesh Kumar K.V wrote: >>>> +#ifdef CONFIG_PPC_BOOK3S_64 >>>> + return vcpu->arch.faul

Re: [PATCH V4] POWERPC: BOOK3S: KVM: Use the saved dar value and generic make_dsisr

2014-05-06 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 06.05.14 02:41, Paul Mackerras wrote: >> On Mon, May 05, 2014 at 01:19:30PM +0200, Alexander Graf wrote: >>> On 05/04/2014 07:21 PM, Aneesh Kumar K.V wrote: >>>> +#ifdef CONFIG_PPC_BOOK3S_64 >>>> + return vcpu->arch.faul

Re: [PATCH] KVM: PPC: BOOK3S: HV: Don't try to allocate from kernel page allocator for hash page table.

2014-05-05 Thread Aneesh Kumar K.V
Alexander Graf writes: >> Am 05.05.2014 um 16:35 schrieb "Aneesh Kumar K.V" >> : >> >> Alexander Graf writes: >> >>>> On 05/04/2014 07:25 PM, Aneesh Kumar K.V wrote: >>>> We reserve 5% of total ram for CMA allocation and not

Re: [PATCH V4] POWERPC: BOOK3S: KVM: Use the saved dar value and generic make_dsisr

2014-05-05 Thread Aneesh Kumar K.V
Olof Johansson writes: > 2014-05-05 7:43 GMT-07:00 Alexander Graf : > >> On 05/05/2014 04:26 PM, Aneesh Kumar K.V wrote: >> >>> Alexander Graf writes: >>> >>> On 05/04/2014 07:21 PM, Aneesh Kumar K.V wrote: >>>> >>>&g

Re: [PATCH V4] POWERPC: BOOK3S: KVM: Use the saved dar value and generic make_dsisr

2014-05-05 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05/05/2014 04:26 PM, Aneesh Kumar K.V wrote: >> Alexander Graf writes: >> >>> On 05/04/2014 07:21 PM, Aneesh Kumar K.V wrote: >>>> Although it's optional IBM POWER cpus always had DAR value set on >>>> alig

Re: [PATCH 0/6] KVM: PPC: Book3S PR: Add POWER8 support

2014-05-05 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05/05/2014 04:38 PM, Aneesh Kumar K.V wrote: >> Alexander Graf writes: >> >>> On 05/04/2014 06:36 PM, Aneesh Kumar K.V wrote: >>>> Alexander Graf writes: >>>> >>>>> When running on a POWER8 host, we get

Re: [RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest

2014-05-05 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05/04/2014 07:30 PM, Aneesh Kumar K.V wrote: >> Signed-off-by: Aneesh Kumar K.V > > No patch description, no proper explanations anywhere why you're doing > what. All of that in a pretty sensitive piece of code. There's no way > th

Re: [PATCH 0/6] KVM: PPC: Book3S PR: Add POWER8 support

2014-05-05 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05/04/2014 06:36 PM, Aneesh Kumar K.V wrote: >> Alexander Graf writes: >> >>> When running on a POWER8 host, we get away with running the guest as POWER7 >>> and nothing falls apart. >>> >>> However, when we start ex

Re: [PATCH] KVM: PPC: BOOK3S: HV: Don't try to allocate from kernel page allocator for hash page table.

2014-05-05 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05/04/2014 07:25 PM, Aneesh Kumar K.V wrote: >> We reserve 5% of total ram for CMA allocation and not using that can >> result in us running out of numa node memory with specific >> configuration. One caveat is we may not have node local hp

Re: [PATCH V4] POWERPC: BOOK3S: KVM: Use the saved dar value and generic make_dsisr

2014-05-05 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 05/04/2014 07:21 PM, Aneesh Kumar K.V wrote: >> Although it's optional IBM POWER cpus always had DAR value set on >> alignment interrupt. So don't try to compute these values. >> >> Signed-off-by: Aneesh Kumar K.V >>

[PATCH V5] KVM: PPC: BOOK3S: PR: Enable Little Endian PR guest

2014-05-04 Thread Aneesh Kumar K.V
This patch make sure we inherit the LE bit correctly in different case so that we can run Little Endian distro in PR mode Signed-off-by: Aneesh Kumar K.V --- Changes from V4: * Don't check for MSR_LE bit while setting LPCR. arch/powerpc/include/asm/kvm_host.h | 2 +- arch/powerpc/kerne

Re: [RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest

2014-05-04 Thread Aneesh Kumar K.V
"Aneesh Kumar K.V" writes: > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/kvm_book3s_64.h | 146 > ++- > arch/powerpc/kvm/book3s_hv.c | 7 ++ > 2 files changed, 130 insertions(+), 23 deletions(-) &

[RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest

2014-05-04 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s_64.h | 146 ++- arch/powerpc/kvm/book3s_hv.c | 7 ++ 2 files changed, 130 insertions(+), 23 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc

[PATCH] KVM: PPC: BOOK3S: PR: Fix WARN_ON with debug options on

2014-05-04 Thread Aneesh Kumar K.V
00ec59fd90] [c0225148] .SyS_ioctl+0x58/0xb0 [c000ec59fe30] [c000a1e4] syscall_exit+0x0/0x98 Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_pr.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index c5

[PATCH] KVM: PPC: BOOK3S: HV: Don't try to allocate from kernel page allocator for hash page table.

2014-05-04 Thread Aneesh Kumar K.V
table. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index fb25ebc0af0c..f32896ffd784 100644 --- a/arch

[PATCH V4] POWERPC: BOOK3S: KVM: Use the saved dar value and generic make_dsisr

2014-05-04 Thread Aneesh Kumar K.V
Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values. Signed-off-by: Aneesh Kumar K.V --- Changes from V3: * Use make_dsisr instead of checking feature flag to decide whether to use saved dsisr or not arch/power

[PATCH V4] KVM: PPC: BOOK3S: PR: Enable Little Endian PR guest

2014-05-04 Thread Aneesh Kumar K.V
This patch make sure we inherit the LE bit correctly in different case so that we can run Little Endian distro in PR mode Signed-off-by: Aneesh Kumar K.V --- Changes from V3: * Address review comments. * rebase to new kernel so that intr_msr is moved instead of adding a new variable * Drop

Re: [PATCH 0/6] KVM: PPC: Book3S PR: Add POWER8 support

2014-05-04 Thread Aneesh Kumar K.V
Alexander Graf writes: > When running on a POWER8 host, we get away with running the guest as POWER7 > and nothing falls apart. > > However, when we start exposing POWER8 as guest CPU, guests will start using > new abilities on POWER8 which we need to handle. > > This patch set does a minimalisti

Re: [PATCH v2] powernv: kvm: make _PAGE_NUMA take effect

2014-04-07 Thread Aneesh Kumar K.V
Alexander Graf writes: > On 03.04.14 04:36, Liu ping fan wrote: >> Hi Alex, could you help to pick up this patch? since v3.14 kernel can >> enable numa fault for powerpc. > > What bad happens without this patch? We map a page even though it was > declared to get NUMA migrated? What happens next

Re: [PATCH] KVM: PPC: Book3S: ifdef on CONFIG_KVM_BOOK3S_32_HANDLER for 32bit

2014-04-06 Thread Aneesh Kumar K.V
> > This fixes running book3s_32 kvm as a module for me. > > Signed-off-by: Alexander Graf I thought Greg Kurz had sent a patch for this. Remember discussing this on irc. Reviewed-by: Aneesh Kumar K.V > --- > arch/powerpc/kvm/book3s.c| 6 +++--- > arch/powerpc/kvm/boo

Re: [PATCH 1/2] Revert "KVM: PPC: Book3S HV: Add new state for transactional memory"

2014-03-06 Thread Aneesh Kumar K.V
Paul Mackerras writes: > On Thu, Mar 06, 2014 at 04:06:09PM +0530, Aneesh Kumar K.V wrote: >> From: "Aneesh Kumar K.V" >> >> This reverts commit 7b490411c37f7ab7965cbdfe5e3ec28eadb6db5b which cause >> the below crash in the host. >> >> U

[PATCH 2/2] KVM: PPC: Book3S HV: Fix register usage when loading/saving VRSAVE

2014-03-06 Thread Aneesh Kumar K.V
f-by: Paul Mackerras Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 557a47800ca1..6962d38c76f5 100644 --- a/arch/p

  1   2   3   >