Re: [PATCH v5 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-03-01 Thread Bharata B Rao
On Tue, Mar 02, 2021 at 12:45:18PM +1100, David Gibson wrote: > > diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst > > index 45fd862ac128..38ce3f21b21f 100644 > > --- a/Documentation/virt/kvm/api.rst > > +++ b/Documentation/virt/kvm/api.rst > > @@ -6225,6 +6225,24 @@

Re: [PATCH v5 1/3] powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def

2021-03-01 Thread Bharata B Rao
On Tue, Mar 02, 2021 at 12:28:34PM +1100, David Gibson wrote: > On Wed, Feb 24, 2021 at 01:55:08PM +0530, Bharata B Rao wrote: > > Add a field to mmu_psize_def to store the page size encodings > > of H_RPT_INVALIDATE hcall. Initialize this while scanning the radix &

Re: [PATCH v5 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-03-01 Thread Bharata B Rao
On Wed, Feb 24, 2021 at 12:58:02PM -0300, Fabiano Rosas wrote: > > @@ -1590,6 +1662,24 @@ static int kvmppc_handle_nested_exit(struct kvm_vcpu > > *vcpu) > > if (!xics_on_xive()) > > kvmppc_xics_rm_complete(vcpu, 0); > > break; > > + case

[PATCH v5 3/3] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2021-02-24 Thread Bharata B Rao
In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall H_RPT_INVALIDATE if available. The availability of this hcall is determined from "hcall-rpt-invalidate" string in ibm,hypertas-functions DT property. Signed-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas --- arch/p

[PATCH v5 1/3] powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def

2021-02-24 Thread Bharata B Rao
Add a field to mmu_psize_def to store the page size encodings of H_RPT_INVALIDATE hcall. Initialize this while scanning the radix AP encodings. This will be used when invalidating with required page size encoding in the hcall. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/book3s/64

[PATCH v5 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-02-24 Thread Bharata B Rao
-by: Bharata B Rao --- Documentation/virt/kvm/api.rst| 18 +++ .../include/asm/book3s/64/tlbflush-radix.h| 4 + arch/powerpc/include/asm/kvm_book3s.h | 3 + arch/powerpc/include/asm/mmu_context.h| 11 ++ arch/powerpc/kvm/book3s_hv.c | 90

[PATCH v5 0/3] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-02-24 Thread Bharata B Rao
. - Redid nested exit changes as per Paul Mackerras' suggestion. - Folded the patch that added tlbie primitives into the hcall implementation patch. v4: https://lore.kernel.org/linuxppc-dev/20210215063542.3642366-1-bhar...@linux.ibm.com/T/#t Bharata B Rao (3): powerpc/book3s64/radix: Add

Re: [PATCH v4 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-02-21 Thread Bharata B Rao
On Wed, Feb 17, 2021 at 11:38:07AM +1100, David Gibson wrote: > On Mon, Feb 15, 2021 at 12:05:41PM +0530, Bharata B Rao wrote: > > Implement H_RPT_INVALIDATE hcall and add KVM capability > > KVM_CAP_PPC_RPT_INVALIDATE to indicate the support for the same. > > > > This

Re: [PATCH v4 1/3] powerpc/book3s64/radix/tlb: tlbie primitives for process-scoped invalidations from guests

2021-02-21 Thread Bharata B Rao
On Wed, Feb 17, 2021 at 11:24:48AM +1100, David Gibson wrote: > On Mon, Feb 15, 2021 at 12:05:40PM +0530, Bharata B Rao wrote: > > H_RPT_INVALIDATE hcall needs to perform process scoped tlbie > > invalidations of L1 and nested guests from L0. This needs RS register > >

[PATCH v4 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-02-14 Thread Bharata B Rao
H_TLB_INVALIDATE hcall. Signed-off-by: Bharata B Rao --- Documentation/virt/kvm/api.rst | 17 + arch/powerpc/include/asm/kvm_book3s.h | 3 + arch/powerpc/include/asm/mmu_context.h | 11 +++ arch/powerpc/kvm/book3s_hv.c | 91 arch/powerpc/kvm

[PATCH v4 1/3] powerpc/book3s64/radix/tlb: tlbie primitives for process-scoped invalidations from guests

2021-02-14 Thread Bharata B Rao
hcall. While we are here, move RIC_FLUSH definitions to header file and introduce helper rpti_pgsize_to_psize() that will be needed by the upcoming hcall. Signed-off-by: Bharata B Rao --- .../include/asm/book3s/64/tlbflush-radix.h| 18 +++ arch/powerpc/mm/book3s64/radix_tlb.c | 122

[PATCH v4 0/3] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-02-14 Thread Bharata B Rao
nested guest exit path. v3: https://lore.kernel.org/linuxppc-dev/20210105090557.2150104-1-bhar...@linux.ibm.com/T/#t Bharata B Rao (3): powerpc/book3s64/radix/tlb: tlbie primitives for process-scoped invalidations from guests KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE KVM

[PATCH v4 3/3] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2021-02-14 Thread Bharata B Rao
In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall H_RPT_INVALIDATE if available. The availability of this hcall is determined from "hcall-rpt-invalidate" string in ibm,hypertas-functions DT property. Signed-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas --- arch/p

Re: [PATCH v3 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-01-06 Thread Bharata B Rao
On Wed, Jan 06, 2021 at 05:27:27PM -0300, Fabiano Rosas wrote: > Bharata B Rao writes: > > + > > +long kvmhv_h_rpti_nested(struct kvm_vcpu *vcpu, unsigned long lpid, > > +unsigned long type, unsigned long pg_sizes, > > +unsigne

[PATCH v3 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2021-01-05 Thread Bharata B Rao
In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall H_RPT_INVALIDATE if available. The availability of this hcall is determined from "hcall-rpt-invalidate" string in ibm,hypertas-functions DT property. Signed-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas --- arch/p

[PATCH v3 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-01-05 Thread Bharata B Rao
disabled in KVM. 2. Partition-scoped invalidations that an L1 hypervisor does on behalf of an L2 guest. This replaces the uses of the existing hcall H_TLB_INVALIDATE. Signed-off-by: Bharata B Rao --- Documentation/virt/kvm/api.rst| 17 .../include/asm/book3s/64/tlbflush

[PATCH v3 0/2] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-01-05 Thread Bharata B Rao
ted.   Those which are partially covered are considered outside invalidation   range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Bharata B Rao (2): KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE KVM: PPC: Book3S

Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2020-12-17 Thread Bharata B Rao
On Thu, Dec 17, 2020 at 02:42:15PM +1100, David Gibson wrote: > On Wed, Dec 16, 2020 at 02:24:46PM +0530, Bharata B Rao wrote: > > +static void do_tlb_invalidate(unsigned long rs, unsigned long target, > > + unsigned long type, unsigned

Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2020-12-17 Thread Bharata B Rao
On Wed, Dec 16, 2020 at 07:47:29PM -0300, Fabiano Rosas wrote: > > +static void do_tlb_invalidate(unsigned long rs, unsigned long target, > > + unsigned long type, unsigned long page_size, > > + unsigned long ap, unsigned long start, > > +

[PATCH v2 0/2] Support for H_RPT_INVALIDATE in PowerPC KVM

2020-12-16 Thread Bharata B Rao
ich are fully covered by the range are to be invalidated.   Those which are partially covered are considered outside invalidation   range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Bharata B Rao (2): KVM: PPC: Book3S HV:

[PATCH v2 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-12-16 Thread Bharata B Rao
In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall H_RPT_INVALIDATE if available. The availability of this hcall is determined from "hcall-rpt-invalidate" string in ibm,hypertas-functions DT property. Signed-off-by: Bharata B Rao --- arch/powerpc/kvm/book3s_64_mmu_ra

[PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2020-12-16 Thread Bharata B Rao
disabled in KVM. 2. Partition-scoped invalidations that an L1 hypervisor does on behalf of an L2 guest. This replaces the uses of the existing hcall H_TLB_INVALIDATE. Signed-off-by: Bharata B Rao --- Documentation/virt/kvm/api.rst| 17 +++ .../include/asm/book3s/64/tlbflush

Re: [PATCH v1 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE (nested case only)

2020-12-11 Thread Bharata B Rao
On Mon, Oct 19, 2020 at 04:56:41PM +0530, Bharata B Rao wrote: > Implements H_RPT_INVALIDATE hcall and supports only nested case > currently. > > A KVM capability KVM_CAP_RPT_INVALIDATE is added to indicate the > support for this hcall. As Paul mentioned in the thread, this

Re: [PATCH v1 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE (nested case only)

2020-12-09 Thread Bharata B Rao
On Wed, Dec 09, 2020 at 03:15:42PM +1100, Paul Mackerras wrote: > On Mon, Oct 19, 2020 at 04:56:41PM +0530, Bharata B Rao wrote: > > Implements H_RPT_INVALIDATE hcall and supports only nested case > > currently. > > > > A KVM capability KVM_CAP_RPT_INVALIDATE is added

Re: [PATCH] powerpc/book3s_hv_uvmem: Check for failed page migration

2020-12-04 Thread Bharata B Rao
ge_in(struct vm_area_struct *vma, > } > } > > - *mig.dst = migrate_pfn(page_to_pfn(dpage)) | MIGRATE_PFN_LOCKED; > - migrate_vma_pages(); > out_finalize: > migrate_vma_finalize(); > return ret; Reviewed-by: Bharata B Rao Did you actually hit this scenario with secure VMs where a UV-paged-in page was later found to be not migratable? Regards, Bharata.

Re: [PATCH v1 0/2] Use H_RPT_INVALIDATE for nested guest

2020-11-24 Thread Bharata B Rao
Hi, Any comments on this patchset? Anything specific to be addressed before it could be considered for inclusion? Regards, Bharata. On Mon, Oct 19, 2020 at 04:56:40PM +0530, Bharata B Rao wrote: > This patchset adds support for the new hcall H_RPT_INVALIDATE > (currently handles neste

[PATCH v1 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE (nested case only)

2020-10-19 Thread Bharata B Rao
Implements H_RPT_INVALIDATE hcall and supports only nested case currently. A KVM capability KVM_CAP_RPT_INVALIDATE is added to indicate the support for this hcall. Signed-off-by: Bharata B Rao --- Documentation/virt/kvm/api.rst| 17 .../include/asm/book3s/64/tlbflush

[PATCH v1 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-10-19 Thread Bharata B Rao
In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall H_RPT_INVALIDATE if available. The availability of this hcall is determined from "hcall-rpt-invalidate" string in ibm,hypertas-functions DT property. Signed-off-by: Bharata B Rao --- arch/powerpc/kvm/book3s_64_mmu_ra

[PATCH v1 0/2] Use H_RPT_INVALIDATE for nested guest

2020-10-19 Thread Bharata B Rao
ses are quadrant 0. * Pages which are fully covered by the range are to be invalidated.   Those which are partially covered are considered outside invalidation   range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Bharata B Rao

Re: [RFC v1 2/2] KVM: PPC: Book3S HV: abstract secure VM related calls.

2020-10-12 Thread Bharata B Rao
On Mon, Oct 12, 2020 at 12:27:43AM -0700, Ram Pai wrote: > Abstract the secure VM related calls into generic calls. > > These generic calls will call the corresponding method of the > backend that prvoides the implementation to support secure VM. > > Currently there is only the ultravisor based

Re: [PATCH] KVM: PPC: Book3S HV: fix a oops in kvmppc_uvmem_page_free()

2020-07-31 Thread Bharata B Rao
On Fri, Jul 31, 2020 at 01:37:00AM -0700, Ram Pai wrote: > On Fri, Jul 31, 2020 at 09:59:40AM +0530, Bharata B Rao wrote: > > On Thu, Jul 30, 2020 at 04:25:26PM -0700, Ram Pai wrote: > > In our case, device pages that are in use are always associated with a valid >

Re: [PATCH] KVM: PPC: Book3S HV: Define H_PAGE_IN_NONSHARED for H_SVM_PAGE_IN hcall

2020-07-30 Thread Bharata B Rao
On Thu, Jul 30, 2020 at 04:21:01PM -0700, Ram Pai wrote: > H_SVM_PAGE_IN hcall takes a flag parameter. This parameter specifies the > way in which a page will be treated. H_PAGE_IN_NONSHARED indicates > that the page will be shared with the Secure VM, and H_PAGE_IN_SHARED > indicates that the

Re: [PATCH] KVM: PPC: Book3S HV: fix a oops in kvmppc_uvmem_page_free()

2020-07-30 Thread Bharata B Rao
On Thu, Jul 30, 2020 at 04:25:26PM -0700, Ram Pai wrote: > Observed the following oops while stress-testing, using multiple > secureVM on a distro kernel. However this issue theoritically exists in > 5.5 kernel and later. > > This issue occurs when the total number of requested device-PFNs exceed

Re: [PATCH v2] powerpc/book3s64/radix: Add kernel command line option to disable radix GTSE

2020-07-27 Thread Bharata B Rao
all. 2. radix_hcall_invalidate=on w/o H_RPT_INVALIDATE hcall, the guest kernel panics as per design. Tested-by: Bharata B Rao

[PATCH] powerpc/mm: Limit resize_hpt_for_hotplug() call to hash guests only

2020-07-27 Thread Bharata B Rao
Lynch Signed-off-by: Bharata B Rao --- Tested with memory hotplug and unplug for hash and radix KVM guests. arch/powerpc/include/asm/sparsemem.h | 6 -- arch/powerpc/mm/book3s64/hash_utils.c | 8 +++- arch/powerpc/mm/mem.c | 5 - 3 files changed, 7 insertions(+), 12

Re: [PATCH] powerpc/book3s64/radix: Add kernel command line option to disable radix GTSE

2020-07-27 Thread Bharata B Rao
On Fri, Jul 24, 2020 at 01:26:00PM +0530, Aneesh Kumar K.V wrote: > This adds a kernel command line option that can be used to disable GTSE > support. > Disabling GTSE implies kernel will make hcalls to invalidate TLB entries. > > This was done so that we can do VM migration between configs that

Re: [PATCH v5 5/7] KVM: PPC: Book3S HV: migrate hot plugged memory

2020-07-26 Thread Bharata B Rao
gt; + kvmppc_uvmem_memslot_create(kvm, new); Only concern is that kvmppc_uvmem_memslot_create() can fail due to multiple reasons but we ignore them and go ahead with memory hotplug. May be this hasn't been observed in reality but if we can note this as a TODO in the comments to dig further and explore the possibility of recovering from here, then Reviewed-by: Bharata B Rao Regards, Bharata.

Re: [PATCH v5 6/7] KVM: PPC: Book3S HV: move kvmppc_svm_page_out up

2020-07-26 Thread Bharata B Rao
> holding the kvm->arch.uvmem_lock, so prefix the original function with __ > and remove the locking in it, and introduce a wrapper which call that > function with the lock held. > > There is no functional change. > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras &g

Re: [PATCH] KVM: PPC: Book3S HV: rework secure mem slot dropping

2020-07-26 Thread Bharata B Rao
g > that time, not in write mode since the virual memory layout is not > impacted, and kvm->arch.uvmem_lock prevents concurrent operation > on the secure device. > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras > Signed-off-by: Ram Pai > [modified the

Re: [PATCH v3 0/4] powerpc/mm/radix: Memory unplug fixes

2020-07-24 Thread Bharata B Rao
On Fri, Jul 24, 2020 at 09:52:14PM +1000, Michael Ellerman wrote: > Bharata B Rao writes: > > On Tue, Jul 21, 2020 at 10:25:58PM +1000, Michael Ellerman wrote: > >> Bharata B Rao writes: > >> > On Tue, Jul 21, 2020 at 11:45:20AM +1000, Michael Ellerman wrote

Re: [PATCH v5 4/7] KVM: PPC: Book3S HV: in H_SVM_INIT_DONE, migrate remaining normal-GFNs to secure-GFNs.

2020-07-23 Thread Bharata B Rao
amin Herrenschmidt > Cc: Michael Ellerman > Cc: Bharata B Rao > Cc: Aneesh Kumar K.V > Cc: Sukadev Bhattiprolu > Cc: Laurent Dufour > Cc: Thiago Jung Bauermann > Cc: David Gibson > Cc: Claudio Carvalho > Cc: kvm-...@vger.kernel.org > Cc: linuxppc-dev@lists.ozla

Re: [PATCH v5 7/7] KVM: PPC: Book3S HV: rework secure mem slot dropping

2020-07-23 Thread Bharata B Rao
_sem is held in read mode during > that time, not in write mode since the virual memory layout is not > impacted, and kvm->arch.uvmem_lock prevents concurrent operation > on the secure device. > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras > Signed-off-by: Ram

Re: [v4 4/5] KVM: PPC: Book3S HV: retry page migration before erroring-out

2020-07-23 Thread Bharata B Rao
On Fri, Jul 17, 2020 at 01:00:26AM -0700, Ram Pai wrote: > @@ -812,7 +842,7 @@ unsigned long kvmppc_h_svm_page_in(struct kvm *kvm, > unsigned long gpa, > struct vm_area_struct *vma; > int srcu_idx; > unsigned long gfn = gpa >> page_shift; > - int ret; > + int ret,

Re: [v4 3/5] KVM: PPC: Book3S HV: in H_SVM_INIT_DONE, migrate remaining normal-GFNs to secure-GFNs.

2020-07-23 Thread Bharata B Rao
On Fri, Jul 17, 2020 at 01:00:25AM -0700, Ram Pai wrote: > > +int kvmppc_uv_migrate_mem_slot(struct kvm *kvm, > + const struct kvm_memory_slot *memslot) Don't see any callers for this outside of this file, so why not static? > +{ > + unsigned long gfn = memslot->base_gfn; > +

Re: [v4 2/5] KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs

2020-07-22 Thread Bharata B Rao
| > | Normal | Normal| Transient|Error|Error |Normal | > | | | | | | | > | Secure | Error | Error|Error|Error |Normal | > | | | | | |

Re: [PATCH v2 2/2] KVM: PPC: Book3S HV: rework secure mem slot dropping

2020-07-22 Thread Bharata B Rao
uring that time, not in write > mode since the virual memory layout is not impacted, and > kvm->arch.uvmem_lock prevents concurrent operation on the secure device. > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras > Signed-off-by: Laurent Dufour > --- > ar

Re: [v4 5/5] KVM: PPC: Book3S HV: migrate hot plugged memory

2020-07-22 Thread Bharata B Rao
On Fri, Jul 17, 2020 at 01:00:27AM -0700, Ram Pai wrote: > From: Laurent Dufour > > When a memory slot is hot plugged to a SVM, PFNs associated with the > GFNs in that slot must be migrated to secure-PFNs, aka device-PFNs. > > Call kvmppc_uv_migrate_mem_slot() to accomplish this. > Disable

Re: [v4 1/5] KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START

2020-07-22 Thread Bharata B Rao
ition. Delaying this operation, increases > the probability for those pages to acquire new references , making it > impossible to migrate those pages. > > Disable page-migration in H_SVM_INIT_START handling. > > Signed-off-by: Ram Pai Reviewed-by: Bharata B Rao with a few observations

Re: [PATCH v3 0/4] powerpc/mm/radix: Memory unplug fixes

2020-07-22 Thread Bharata B Rao
On Tue, Jul 21, 2020 at 10:25:58PM +1000, Michael Ellerman wrote: > Bharata B Rao writes: > > On Tue, Jul 21, 2020 at 11:45:20AM +1000, Michael Ellerman wrote: > >> Nathan Lynch writes: > >> > "Aneesh Kumar K.V" writes: > >> >> This is t

Re: [PATCH v3 0/4] powerpc/mm/radix: Memory unplug fixes

2020-07-20 Thread Bharata B Rao
On Tue, Jul 21, 2020 at 11:45:20AM +1000, Michael Ellerman wrote: > Nathan Lynch writes: > > "Aneesh Kumar K.V" writes: > >> This is the next version of the fixes for memory unplug on radix. > >> The issues and the fix are described in the actual patches. > > > > I guess this isn't actually

Re: [FIX PATCH] powerpc/prom: Enable Radix GTSE in cpu pa-features

2020-07-20 Thread Bharata B Rao
t in powerpc-cpu-features but was missed in pa-features. This causes random memory corruption during boot of PowerNV kernels if CONFIG_PPC_DT_CPU_FTRS isn't enabled. Fixes: 029ab30b4c0a ("powerpc/mm: Enable radix GTSE only if supported.") Reported-by: Qian Cai Signed-off-by: Nicholas Piggin Signed-off-by: Bh

[FIX PATCH] powerpc/prom: Enable Radix GTSE in cpu pa-features

2020-07-19 Thread Bharata B Rao
nels where CONFIG_PPC_DT_CPU_FTRS isn't enabled. Fixes: 029ab30b4c0a ("powerpc/mm: Enable radix GTSE only if supported.") Reported-by: Qian Cai Signed-off-by: Nicholas Piggin Signed-off-by: Bharata B Rao --- arch/powerpc/kernel/prom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a

Re: [PATCH v3 0/3] Off-load TLB invalidations to host for !GTSE

2020-07-16 Thread Bharata B Rao
On Fri, Jul 17, 2020 at 12:44:00PM +1000, Nicholas Piggin wrote: > Excerpts from Nicholas Piggin's message of July 17, 2020 12:08 pm: > > Excerpts from Qian Cai's message of July 17, 2020 3:27 am: > >> On Fri, Jul 03, 2020 at 11:06:05AM +0530, Bharata B Rao wrote: > >

Re: [v3 3/5] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-07-15 Thread Bharata B Rao
On Tue, Jul 14, 2020 at 10:05:41PM -0700, Ram Pai wrote: > On Mon, Jul 13, 2020 at 03:15:06PM +0530, Bharata B Rao wrote: > > On Sat, Jul 11, 2020 at 02:13:45AM -0700, Ram Pai wrote: > > > The Ultravisor is expected to explicitly call H_SVM_PAGE_IN for al

Re: [v3 1/5] KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START

2020-07-15 Thread Bharata B Rao
On Tue, Jul 14, 2020 at 10:16:14PM -0700, Ram Pai wrote: > On Mon, Jul 13, 2020 at 10:59:41AM +0530, Bharata B Rao wrote: > > On Sat, Jul 11, 2020 at 02:13:43AM -0700, Ram Pai wrote: > > > Merging of pages associated with each memslot of a SVM is > > > di

Re: [RFC PATCH v0 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-07-13 Thread Bharata B Rao
On Thu, Jul 09, 2020 at 08:07:11PM +1000, Paul Mackerras wrote: > On Thu, Jul 09, 2020 at 02:38:51PM +0530, Bharata B Rao wrote: > > On Thu, Jul 09, 2020 at 03:18:03PM +1000, Paul Mackerras wrote: > > > On Fri, Jul 03, 2020 at 04:14:20PM +0530, Bharata B Rao wrote: > > &g

Re: [v3 4/5] KVM: PPC: Book3S HV: retry page migration before erroring-out H_SVM_PAGE_IN

2020-07-13 Thread Bharata B Rao
ate. > > Cc: Paul Mackerras > Cc: Benjamin Herrenschmidt > Cc: Michael Ellerman > Cc: Bharata B Rao > Cc: Aneesh Kumar K.V > Cc: Sukadev Bhattiprolu > Cc: Laurent Dufour > Cc: Thiago Jung Bauermann > Cc: David Gibson > Cc: Claudio Carvalho > Cc: kvm-.

Re: [v3 3/5] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-07-13 Thread Bharata B Rao
Paged-in or Shared or > Paged-in followed by a Paged-out. > > Cc: Paul Mackerras > Cc: Benjamin Herrenschmidt > Cc: Michael Ellerman > Cc: Bharata B Rao > Cc: Aneesh Kumar K.V > Cc: Sukadev Bhattiprolu > Cc: Laurent Dufour > Cc: Thiago Jung Bauermann > C

Re: [v3 1/5] KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START

2020-07-12 Thread Bharata B Rao
On Sat, Jul 11, 2020 at 02:13:43AM -0700, Ram Pai wrote: > Merging of pages associated with each memslot of a SVM is > disabled the page is migrated in H_SVM_PAGE_IN handler. > > This operation should have been done much earlier; the moment the VM > is initiated for secure-transition. Delaying

Re: [RFC PATCH v0 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-07-09 Thread Bharata B Rao
On Thu, Jul 09, 2020 at 03:18:03PM +1000, Paul Mackerras wrote: > On Fri, Jul 03, 2020 at 04:14:20PM +0530, Bharata B Rao wrote: > > In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall > > H_RPT_INVALIDATE if available. The availability of this hcall > > is deter

Re: [PATCH 2/2] KVM: PPC: Book3S HV: rework secure mem slot dropping

2020-07-08 Thread Bharata B Rao
mmap_sem is help in read mode during that time, not in write > mode since the virual memory layout is not impacted, and > kvm->arch.uvmem_lock prevents concurrent operation on the secure device. > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras

Re: [PATCH v3 1/3] powerpc/mm: Enable radix GTSE only if supported.

2020-07-05 Thread Bharata B Rao
On Mon, Jul 06, 2020 at 07:19:02AM +0530, Santosh Sivaraj wrote: > > Hi Bharata, > > Bharata B Rao writes: > > > Make GTSE an MMU feature and enable it by default for radix. > > However for guest, conditionally enable it if hypervisor supports > > it via OV5 ve

[RFC PATCH v0 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-07-03 Thread Bharata B Rao
In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall H_RPT_INVALIDATE if available. The availability of this hcall is determined from "hcall-rpt-invalidate" string in ibm,hypertas-functions DT property. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/firmware.h

[RFC PATCH v0 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE (nested case only)

2020-07-03 Thread Bharata B Rao
Implements H_RPT_INVALIDATE hcall and supports only nested case currently. A KVM capability KVM_CAP_RPT_INVALIDATE is added to indicate the support for this hcall. Signed-off-by: Bharata B Rao --- Documentation/virt/kvm/api.rst| 17 .../include/asm/book3s/64/tlbflush

[RFC PATCH v0 0/2] Use H_RPT_INVALIDATE for nested guest

2020-07-03 Thread Bharata B Rao
by the range are to be invalidated.   Those which are partially covered are considered outside invalidation   range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Bharata B Rao (2): KVM: PPC: Book3S HV: Add support for H_R

[PATCH v3 3/3] powerpc/mm/book3s64/radix: Off-load TLB invalidations to host when !GTSE

2020-07-02 Thread Bharata B Rao
From: Nicholas Piggin When platform doesn't support GTSE, let TLB invalidation requests for radix guests be off-loaded to the host using H_RPT_INVALIDATE hcall. Signed-off-by: Nicholas Piggin Signed-off-by: Bharata B Rao [hcall wrapper, error path handling and renames

[PATCH v3 2/3] powerpc/pseries: H_REGISTER_PROC_TBL should ask for GTSE only if enabled

2020-07-02 Thread Bharata B Rao
H_REGISTER_PROC_TBL asks for GTSE by default. GTSE flag bit should be set only when GTSE is supported. Signed-off-by: Bharata B Rao Reviewed-by: Aneesh Kumar K.V --- arch/powerpc/platforms/pseries/lpar.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc

[PATCH v3 1/3] powerpc/mm: Enable radix GTSE only if supported.

2020-07-02 Thread Bharata B Rao
radix assumes GTSE is enabled by default. Signed-off-by: Bharata B Rao Reviewed-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/mmu.h| 4 arch/powerpc/kernel/dt_cpu_ftrs.c | 1 + arch/powerpc/kernel/prom_init.c | 13 - arch/powerpc/mm/init_64.c | 5 - 4

[PATCH v3 0/3] Off-load TLB invalidations to host for !GTSE

2020-07-02 Thread Bharata B Rao
the failed flush request with a full flush for the nested case. - s/psize_to_h_rpti/psize_to_rpti_pgsize v2: https://lore.kernel.org/linuxppc-dev/20200626131000.5207-1-bhar...@linux.ibm.com/T/#t Bharata B Rao (2): powerpc/mm: Enable radix GTSE only if supported. powerpc/pseries: H_REGISTER_PROC_TBL

Re: [PATCH v2 1/3] powerpc/mm: Enable radix GTSE only if supported.

2020-06-28 Thread Bharata B Rao
On Fri, Jun 26, 2020 at 05:55:30PM -0300, Murilo Opsfelder Araújo wrote: > > diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c > > index bc73abf0bc25..152aa0200cef 100644 > > --- a/arch/powerpc/mm/init_64.c > > +++ b/arch/powerpc/mm/init_64.c > > @@ -407,12 +407,15 @@ static void

Re: [PATCH v3 0/4] Migrate non-migrated pages of a SVM.

2020-06-28 Thread Bharata B Rao
On Sun, Jun 28, 2020 at 09:41:53PM +0530, Bharata B Rao wrote: > On Fri, Jun 19, 2020 at 03:43:38PM -0700, Ram Pai wrote: > > The time taken to switch a VM to Secure-VM, increases by the size of the > > VM. A > > 100GB VM takes about 7minutes. This is unacceptable.

Re: [PATCH v3 3/4] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-06-28 Thread Bharata B Rao
T_DONE. Skip the GFNs that are already Paged-in or Shared > through H_SVM_PAGE_IN, or Paged-in followed by a Paged-out through > UV_PAGE_OUT. > > Cc: Paul Mackerras > Cc: Benjamin Herrenschmidt > Cc: Michael Ellerman > Cc: Bharata B Rao > Cc: Aneesh Kumar K.V > Cc: Sukadev Bhat

Re: [PATCH v3 0/4] Migrate non-migrated pages of a SVM.

2020-06-28 Thread Bharata B Rao
On Fri, Jun 19, 2020 at 03:43:38PM -0700, Ram Pai wrote: > The time taken to switch a VM to Secure-VM, increases by the size of the VM. > A > 100GB VM takes about 7minutes. This is unacceptable. This linear increase is > caused by a suboptimal behavior by the Ultravisor and the Hypervisor. The

[PATCH v2 1/3] powerpc/mm: Enable radix GTSE only if supported.

2020-06-26 Thread Bharata B Rao
radix assumes GTSE is enabled by default. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/mmu.h| 4 arch/powerpc/kernel/dt_cpu_ftrs.c | 1 + arch/powerpc/kernel/prom_init.c | 13 - arch/powerpc/mm/init_64.c | 5 - 4 files changed, 17 insertions(+), 6

[PATCH v2 2/3] powerpc/pseries: H_REGISTER_PROC_TBL should ask for GTSE only if enabled

2020-06-26 Thread Bharata B Rao
H_REGISTER_PROC_TBL asks for GTSE by default. GTSE flag bit should be set only when GTSE is supported. Signed-off-by: Bharata B Rao --- arch/powerpc/platforms/pseries/lpar.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch

Re: [PATCH v1 2/3] powerpc/mm/radix: Fix PTE/PMD fragment count for early page table mappings

2020-06-23 Thread Bharata B Rao
On Tue, Jun 23, 2020 at 04:07:34PM +0530, Aneesh Kumar K.V wrote: > Bharata B Rao writes: > > > We can hit the following BUG_ON during memory unplug: > > > > kernel BUG at arch/powerpc/mm/book3s64/pgtable.c:342! > > Oops: Exception in kernel mode, sig: 5 [#1] >

[PATCH v1 2/3] powerpc/mm/radix: Fix PTE/PMD fragment count for early page table mappings

2020-06-23 Thread Bharata B Rao
with struct page size being 64B. 1 PUD table for 2G memory (1G mapping) 1 PUD table and 1 PMD table for 2M vmemmap (2M mappings) With default PUD[PMD]_TABLE_SIZE(4K), (1+1+1)*4K=12K With new PAGE_SIZE(64K) table allocations, (1+1+1)*64K=192K Signed-off-by: Bharata B Rao --- arch/powerpc/include

[PATCH v1 3/3] powerpc/mm/radix: Free PUD table when freeing pagetable

2020-06-23 Thread Bharata B Rao
remove_pagetable() isn't freeing PUD table. This causes memory leak during memory unplug. Fix this. Signed-off-by: Bharata B Rao --- arch/powerpc/mm/book3s64/radix_pgtable.c | 16 1 file changed, 16 insertions(+) diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch

[PATCH v1 1/3] powerpc/mm/radix: Create separate mappings for hot-plugged memory

2020-06-23 Thread Bharata B Rao
we end up issuing more number of mapping requests than earlier. Signed-off-by: Bharata B Rao --- arch/powerpc/mm/book3s64/radix_pgtable.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix

[PATCH v1 0/3] powerpc/mm/radix: Memory unplug fixes

2020-06-23 Thread Bharata B Rao
patch that removed split_kernel_mapping() to ensure that spilitting code is available for any radix guest running on platforms that don't set DRCONF_MEM_HOTREMOVABLE. v0: https://lore.kernel.org/linuxppc-dev/20200406034925.22586-1-bhar...@linux.ibm.com/ Bharata B Rao (3): powerpc/mm/radix

[PATCH v1 5/5] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-06-18 Thread Bharata B Rao
In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall H_RPT_INVALIDATE if available. The availability of this hcall is determined from "hcall-rpt-invalidate" string in ibm,hypertas-functions DT property. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/firmware.h

[PATCH v1 4/5] powerpc/mm/book3s64/radix: Off-load TLB invalidations to host when !GTSE

2020-06-18 Thread Bharata B Rao
From: Nicholas Piggin When platform doesn't support GTSE, let TLB invalidation requests for radix guests be off-loaded to the host using H_RPT_INVALIDATE hcall. Signed-off-by: Nicholas Piggin Signed-off-by: Bharata B Rao [hcall wrapper, error path handling and renames] --- arch

[PATCH v1 3/5] powerpc/pseries: H_REGISTER_PROC_TBL should ask for GTSE only if enabled

2020-06-18 Thread Bharata B Rao
H_REGISTER_PROC_TBL asks for GTSE by default. GTSE flag bit should be set only when GTSE is supported. Signed-off-by: Bharata B Rao --- arch/powerpc/platforms/pseries/lpar.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch

[PATCH v1 2/5] powerpc/prom_init: Ask for Radix GTSE only if supported.

2020-06-18 Thread Bharata B Rao
In the case of radix, don't ask for GTSE by default but ask only if GTSE is enabled. Signed-off-by: Bharata B Rao --- arch/powerpc/kernel/prom_init.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel

[PATCH v1 1/5] powerpc/mm: Make GTSE an MMU FTR

2020-06-18 Thread Bharata B Rao
-by: Bharata B Rao --- arch/powerpc/include/asm/mmu.h| 4 arch/powerpc/kernel/dt_cpu_ftrs.c | 1 + arch/powerpc/mm/init_64.c | 5 - 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index f4ac25d4df05

[PATCH v1 0/5] Off-load TLB invalidations to host for !GTSE

2020-06-18 Thread Bharata B Rao
xed page sizes. * Return H_SUCCESS on success. Bharata B Rao (4): powerpc/mm: Make GTSE an MMU FTR powerpc/prom_init: Ask for Radix GTSE only if supported. powerpc/pseries: H_REGISTER_PROC_TBL should ask for GTSE only if enabled KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested

[RFC PATCH v0 3/4] powerpc/pseries: H_REGISTER_PROC_TBL should ask for GTSE only if enabled

2020-06-08 Thread Bharata B Rao
H_REGISTER_PROC_TBL asks for GTSE by default. GTSE flag bit should be set only when GTSE is supported. Signed-off-by: Bharata B Rao --- arch/powerpc/platforms/pseries/lpar.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch

[RFC PATCH v0 4/4] powerpc/mm/book3s64/radix: Off-load TLB invalidations to host when !GTSE

2020-06-08 Thread Bharata B Rao
From: Nicholas Piggin When platform doesn't support GTSE, let TLB invalidation requests for radix guests be off-loaded to the host using H_RPT_INVALIDATE hcall Signed-off-by: Nicholas Piggin Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/hvcall.h | 1 + arch/powerpc

[RFC PATCH v0 1/4] powerpc/mm: Make GTSE as MMU FTR

2020-06-08 Thread Bharata B Rao
Make GTSE as an MMU feature and enable it by default for radix. However for guest, conditionally enable it if hypervisor supports it via OV5 vector. Making GTSE as a MMU feature will make it easy to enable radix without GTSE. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/mmu.h

[RFC PATCH v0 2/4] powerpc/prom_init: Ask for Radix GTSE only if supported.

2020-06-08 Thread Bharata B Rao
In the case of radix, don't ask for GTSE by default but ask only if GTSE is enabled. Signed-off-by: Bharata B Rao --- arch/powerpc/kernel/prom_init.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel

[RFC PATCH v0 0/4] Off-load TLB invalidations to host for !GTSE

2020-06-08 Thread Bharata B Rao
are fully covered by the range are to be invalidated. Those which are partially covered are considered outside invalidation range, which allows a call to optimally invalidate ranges that may contain mixed page sizes. * Return H_SUCCESS on success. Bharata B Rao (3): powerpc/mm: Make GTSE as MMU

Re: [PATCH v1 3/4] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-06-03 Thread Bharata B Rao
On Wed, Jun 03, 2020 at 04:10:25PM -0700, Ram Pai wrote: > On Tue, Jun 02, 2020 at 03:36:39PM +0530, Bharata B Rao wrote: > > On Mon, Jun 01, 2020 at 12:05:35PM -0700, Ram Pai wrote: > > > On Mon, Jun 01, 2020 at 05:25:18PM +0530, Bharata B Rao wrote: > > > > On S

Re: [PATCH v1 3/4] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-06-02 Thread Bharata B Rao
On Mon, Jun 01, 2020 at 12:05:35PM -0700, Ram Pai wrote: > On Mon, Jun 01, 2020 at 05:25:18PM +0530, Bharata B Rao wrote: > > On Sat, May 30, 2020 at 07:27:50PM -0700, Ram Pai wrote: > > > H_SVM_INIT_DONE incorrectly assumes that the Ultravisor has explicitly > > > c

Re: [PATCH v1 3/4] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-06-01 Thread Bharata B Rao
On Sat, May 30, 2020 at 07:27:50PM -0700, Ram Pai wrote: > H_SVM_INIT_DONE incorrectly assumes that the Ultravisor has explicitly > called H_SVM_PAGE_IN for all secure pages. I don't think that is quite true. HV doesn't assume anything about secure pages by itself. > These GFNs continue to be >

Re: [RFC PATCH v0 0/5] powerpc/mm/radix: Memory unplug fixes

2020-05-19 Thread Bharata B Rao
Aneesh, Do these memory unplug fixes on radix look fine? Do you want these to be rebased on recent kernel? Would you like me to test any specific scenario with these fixes? Regards, Bharata. On Mon, Apr 06, 2020 at 09:19:20AM +0530, Bharata B Rao wrote: > Memory unplug has a few bugs whic

Re: [RFC PATCH v0 0/5] powerpc/mm/radix: Memory unplug fixes

2020-04-08 Thread Bharata B Rao
On Mon, Apr 06, 2020 at 09:19:20AM +0530, Bharata B Rao wrote: > Memory unplug has a few bugs which I had attempted to fix ealier > at https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-July/194087.html > > Now with Leonardo's patch for PAPR changes that add a separate flag bit &g

Re: [PATCH v3 1/1] powerpc/kernel: Enables memory hot-remove after reboot on pseries guests

2020-04-06 Thread Bharata B Rao
On Mon, Apr 06, 2020 at 12:41:01PM -0300, Leonardo Bras wrote: > Hello Bharata, > > On Fri, 2020-04-03 at 20:08 +0530, Bharata B Rao wrote: > > The patch would be more complete with the following change that ensures > > that DRCONF_MEM_HOTREMOVABLE flag is set for non

[RFC PATCH v0 4/5] powerpc/mm/radix: Free PUD table when freeing pagetable

2020-04-05 Thread Bharata B Rao
remove_pagetable() isn't freeing PUD table. This causes memory leak during memory unplug. Fix this. Signed-off-by: Bharata B Rao --- arch/powerpc/mm/book3s64/radix_pgtable.c | 16 1 file changed, 16 insertions(+) diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch

[RFC PATCH v0 5/5] powerpc/mm/radix: Remove split_kernel_mapping()

2020-04-05 Thread Bharata B Rao
;) Signed-off-by: Bharata B Rao --- arch/powerpc/mm/book3s64/radix_pgtable.c | 93 +--- 1 file changed, 19 insertions(+), 74 deletions(-) diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c index 0d9ef3277579..56f2c698deac 100644

[RFC PATCH v0 3/5] powerpc/mm/radix: Fix PTE/PMD fragment count for early page table mappings

2020-04-05 Thread Bharata B Rao
for vmemmap with struct page size being 64B. 1 PUD table for 2G memory (1G mapping) 1 PUD table and 1 PMD table for 2M vmemmap (2M mappings) With default PUD[PMD]_TABLE_SIZE(4K), (1+1+1)*4K=12K With new PAGE_SIZE(64K) table allocations, (1+1+1)*64K=192K Signed-off-by: Bharata B Rao --- arch/powerpc

  1   2   3   4   >