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

[RFC PATCH v0 2/5] powerpc/mm/radix: Create separate mappings for hot-plugged memory

2020-04-05 Thread Bharata B Rao
-plugged memory from the boot time memory is now possible with PAPR extension to LMB flags. (Ref: https://lore.kernel.org/linuxppc-dev/f55a7b65a43cc9dc7b22385cf9960f8b11d5ce2e.ca...@linux.ibm.com/T/#t) Signed-off-by: Bharata B Rao --- arch/powerpc/mm/book3s64/radix_pgtable.c | 15 --- 1

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

2020-04-05 Thread Bharata B Rao
/linuxppc-dev/f55a7b65a43cc9dc7b22385cf9960f8b11d5ce2e.ca...@linux.ibm.com/T/#t), a few other issues around memory unplug on radix can be fixed. This series is a combination of those fixes. This series works on top of above mentioned Leonardo's patch. Bharata B Rao (5): powerpc/pseries/hotplug

[RFC PATCH v0 1/5] powerpc/pseries/hotplug-memory: Set DRCONF_MEM_HOTREMOVABLE for hot-plugged mem

2020-04-05 Thread Bharata B Rao
In addition to setting DRCONF_MEM_HOTREMOVABLE for boot-time hot-plugged memory, we should set the same too for the memory that gets hot-plugged post-boot. This ensures that correct LMB flags value is reflected in ibm,dynamic-memory-vN property. Signed-off-by: Bharata B Rao --- arch/powerpc

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

2020-04-03 Thread Bharata B Rao
plugable memory is enough to get the desirable > behavior. > > This should cause no change if 'movable_node' parameter is not passed > in kernel command-line. > > Signed-off-by: Leonardo Bras > Reviewed-by: Bharata B Rao > > --- > > Changes since v2: > -

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

2020-04-02 Thread Bharata B Rao
ur comments on this change, but it's still not > > ready for being merged. > > New flag got approved on the documentation. > Please review this patch. Looks good to me, also tested with PowerKVM guests. Reviewed-by: Bharata B Rao Regards, Bharata. -- http://raobharata.wordpress.com/

Re: [PATCH 2/2] KVM: PPC: Book3S HV: H_SVM_INIT_START must call UV_RETURN

2020-03-22 Thread Bharata B Rao
On Fri, Mar 20, 2020 at 03:36:05PM +0100, Laurent Dufour wrote: > Le 20/03/2020 à 12:24, Bharata B Rao a écrit : > > On Fri, Mar 20, 2020 at 11:26:43AM +0100, Laurent Dufour wrote: > > > When the call to UV_REGISTER_MEM_SLOT is failing, for instance because > > > there

Re: [PATCH 2/2] KVM: PPC: Book3S HV: H_SVM_INIT_START must call UV_RETURN

2020-03-20 Thread Bharata B Rao
gt; > Move the setting of kvm->arch.secure_guest earlier in > kvmppc_h_svm_init_start() so in the return path, UV_RETURN will be called > instead of rfid. > > Cc: Bharata B Rao > Cc: Paul Mackerras > Cc: Benjamin Herrenschmidt > Cc: Michael Ellerman > Signed-off-by: Lau

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-20 Thread Bharata B Rao
On Fri, Mar 20, 2020 at 09:37:18AM +0100, Vlastimil Babka wrote: > On 3/20/20 4:42 AM, Bharata B Rao wrote: > > On Thu, Mar 19, 2020 at 02:47:58PM +0100, Vlastimil Babka wrote: > >> diff --git a/mm/slub.c b/mm/slub.c > >> index 17dc00e33115..7113b1f9cd77 100644 > &g

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-19 Thread Bharata B Rao
On Thu, Mar 19, 2020 at 02:47:58PM +0100, Vlastimil Babka wrote: > diff --git a/mm/slub.c b/mm/slub.c > index 17dc00e33115..7113b1f9cd77 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -1973,8 +1973,6 @@ static void *get_partial(struct kmem_cache *s, gfp_t > flags, int node, > > if (node

Re: [RFC 1/2] mm, slub: prevent kmalloc_node crashes and memory leaks

2020-03-18 Thread Bharata B Rao
On Wed, Mar 18, 2020 at 03:42:19PM +0100, Vlastimil Babka wrote: > This is a PowerPC platform with following NUMA topology: > > available: 2 nodes (0-1) > node 0 cpus: > node 0 size: 0 MB > node 0 free: 0 MB > node 1 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 > 25 26

Re: Slub: Increased mem consumption on cpu,mem-less node powerpc guest

2020-03-17 Thread Bharata B Rao
On Wed, Mar 18, 2020 at 08:50:44AM +0530, Srikar Dronamraju wrote: > * Vlastimil Babka [2020-03-17 17:45:15]: > > > On 3/17/20 5:25 PM, Srikar Dronamraju wrote: > > > * Vlastimil Babka [2020-03-17 16:56:04]: > > > > > >> > > >> I wonder why do you get a memory leak while Sachin in the same

Re: [PATCH 4/4] powerpc/numa: Set fallback nodes for offline nodes

2020-03-17 Thread Bharata B Rao
This patchset can also fix a related problem that I reported earlier at https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-March/206076.html with an additional change, suggested by Srikar as shown below: On Tue, Mar 17, 2020 at 06:47:53PM +0530, Srikar Dronamraju wrote: > Currently fallback

Re: Slub: Increased mem consumption on cpu,mem-less node powerpc guest

2020-03-17 Thread Bharata B Rao
On Tue, Mar 17, 2020 at 02:56:28PM +0530, Bharata B Rao wrote: > Case 1: 2 node NUMA, node0 empty > > # numactl -H > available: 2 nodes (0-1) > node 0 cpus: > node 0 size: 0 MB > node 0 free: 0 MB > node 1 cpus: 0 1 2 3 4 5 6 7 > node 1 s

Slub: Increased mem consumption on cpu,mem-less node powerpc guest

2020-03-17 Thread Bharata B Rao
Hi, We are seeing an increased slab memory consumption on PowerPC guest LPAR (on PowerVM) having an uncommon topology where one NUMA node has no CPUs or any memory and the other node has all the CPUs and memory. Though QEMU prevents such topologies for KVM guest, I hacked QEMU to allow such

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

2020-03-03 Thread Bharata B Rao
On Fri, Feb 28, 2020 at 11:36 AM Leonardo Bras wrote: > > While providing guests, it's desirable to resize it's memory on demand. > > By now, it's possible to do so by creating a guest with a small base > memory, hot-plugging all the rest, and using 'movable_node' kernel > command-line parameter,

[PATCH FIX] KVM: PPC: Book3S HV: Release lock on page-out failure path

2020-01-21 Thread Bharata B Rao
When migrate_vma_setup() fails in kvmppc_svm_page_out(), release kvm->arch.uvmem_lock before returning. Fixes: ca9f4942670 ("KVM: PPC: Book3S HV: Support for running secure guests") Signed-off-by: Bharata B Rao --- Applies on paulus/kvm-ppc-next branch arch/powerpc/kvm/book3s_h

[PATCH] powerpc: Ultravisor: Fix the dependencies for CONFIG_PPC_UV

2020-01-09 Thread Bharata B Rao
Let PPC_UV depend only on DEVICE_PRIVATE which in turn will satisfy all the other required dependencies Fixes: 013a53f2d25a ("powerpc: Ultravisor: Add PPC_UV config option") Reported-by: kbuild test robot Signed-off-by: Bharata B Rao --- arch/powerpc/Kconfig | 6 +- 1 file

Re: [PATCH V3 2/2] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-12-15 Thread Bharata B Rao
On Sat, Dec 14, 2019 at 06:12:08PM -0800, Sukadev Bhattiprolu wrote: > +unsigned long kvmppc_h_svm_init_abort(struct kvm *kvm) > +{ > + int i; > + > + if (!(kvm->arch.secure_guest & KVMPPC_SECURE_INIT_START)) > + return H_UNSUPPORTED; > + > + for (i = 0; i <

Re: [PATCH v11 0/7] KVM: PPC: Driver to manage pages of secure guest

2019-12-03 Thread Bharata B Rao
On Sun, Dec 01, 2019 at 12:24:50PM -0800, Hugh Dickins wrote: > On Thu, 28 Nov 2019, Bharata B Rao wrote: > > On Mon, Nov 25, 2019 at 08:36:24AM +0530, Bharata B Rao wrote: > > > Hi, > > > > > > This is the next version of the patchset that adds required suppor

Re: [PATCH v11 0/7] KVM: PPC: Driver to manage pages of secure guest

2019-11-27 Thread Bharata B Rao
On Mon, Nov 25, 2019 at 08:36:24AM +0530, Bharata B Rao wrote: > Hi, > > This is the next version of the patchset that adds required support > in the KVM hypervisor to run secure guests on PEF-enabled POWER platforms. > Here is a fix for the issue Hugh identified with the usage

Re: [PATCH v11 1/7] mm: ksm: Export ksm_madvise()

2019-11-26 Thread Bharata B Rao
On Tue, Nov 26, 2019 at 07:59:49PM -0800, Hugh Dickins wrote: > On Mon, 25 Nov 2019, Bharata B Rao wrote: > > > On PEF-enabled POWER platforms that support running of secure guests, > > secure pages of the guest are represented by device private pages > > in the

Re: [PATCH v11 1/7] mm: ksm: Export ksm_madvise()

2019-11-24 Thread Bharata B Rao
On Mon, Nov 25, 2019 at 08:36:25AM +0530, Bharata B Rao wrote: > On PEF-enabled POWER platforms that support running of secure guests, > secure pages of the guest are represented by device private pages > in the host. Such pages needn't participate in KSM merging. This is > achie

[PATCH v11 7/7] KVM: PPC: Ultravisor: Add PPC_UV config option

2019-11-24 Thread Bharata B Rao
From: Anshuman Khandual CONFIG_PPC_UV adds support for ultravisor. Signed-off-by: Anshuman Khandual Signed-off-by: Bharata B Rao Signed-off-by: Ram Pai [ Update config help and commit message ] Signed-off-by: Claudio Carvalho Reviewed-by: Sukadev Bhattiprolu --- arch/powerpc/Kconfig | 17

[PATCH v11 6/7] KVM: PPC: Support reset of secure guest

2019-11-24 Thread Bharata B Rao
that they can be migrated back to secure side when guest becomes secure again. This is required because pinned pages can't be migrated. - Reinit the partition scoped page tables After these steps, guest is ready to issue UV_ESM call once again to switch to secure mode. Signed-off-by: Bharata B Rao

[PATCH v11 5/7] KVM: PPC: Handle memory plug/unplug to secure VM

2019-11-24 Thread Bharata B Rao
Register the new memslot with UV during plug and unregister the memslot during unplug. In addition, release all the device pages during unplug. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/kvm_book3s_uvmem.h | 6 arch/powerpc/include/asm/ultravisor-api.h | 1 + arch

[PATCH v11 4/7] KVM: PPC: Radix changes for secure guest

2019-11-24 Thread Bharata B Rao
so in case of secure VM. For secure guest, the active secondary page tables are in secure memory and the secondary page tables in HV are freed when guest becomes secure. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/kvm_book3s_uvmem.h | 6 arch/powerpc/include/asm/ultravisor

[PATCH v11 3/7] KVM: PPC: Shared pages support for secure guests

2019-11-24 Thread Bharata B Rao
the secure page is unmapped from the HV side page tables. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/hvcall.h | 3 ++ arch/powerpc/kvm/book3s_hv_uvmem.c | 85 -- 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm

[PATCH v11 2/7] KVM: PPC: Support for running secure guests

2019-11-24 Thread Bharata B Rao
ges() using UV_PAGE_IN and UV_PAGE_OUT ucalls. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/hvcall.h | 6 + arch/powerpc/include/asm/kvm_book3s_uvmem.h | 62 ++ arch/powerpc/include/asm/kvm_host.h | 6 + arch/powerpc/include/asm/ultravisor-api.h | 3 + a

[PATCH v11 1/7] mm: ksm: Export ksm_madvise()

2019-11-24 Thread Bharata B Rao
module. Signed-off-by: Bharata B Rao Acked-by: Paul Mackerras Cc: Andrea Arcangeli Cc: Hugh Dickins --- mm/ksm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/ksm.c b/mm/ksm.c index dbee2eb4dd05..e45b02ad3f0b 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -2478,6 +2478,7 @@ int ksm_madvise

[PATCH v11 0/7] KVM: PPC: Driver to manage pages of secure guest

2019-11-24 Thread Bharata B Rao
, when we unpin VPA pages, make sure that no vcpu is running and fail the SVM_OFF ioctl if any are running (Paul Mackerras) - Dropped the patch that implemented init_abort hcall as it still has unresolved questions. Anshuman Khandual (1): KVM: PPC: Ultravisor: Add PPC_UV config option Bharata B

Re: [PATCH v10 1/8] mm: ksm: Export ksm_madvise()

2019-11-15 Thread Bharata B Rao
On Thu, Nov 07, 2019 at 04:45:35PM +1100, Paul Mackerras wrote: > On Wed, Nov 06, 2019 at 12:15:42PM +0530, Bharata B Rao wrote: > > On Wed, Nov 06, 2019 at 03:33:29PM +1100, Paul Mackerras wrote: > > > On Mon, Nov 04, 2019 at 09:47:53AM +0530, Bharata B Rao wrote: > >

Re: [PATCH v10 6/8] KVM: PPC: Support reset of secure guest

2019-11-13 Thread Bharata B Rao
On Tue, Nov 12, 2019 at 04:34:34PM +1100, Paul Mackerras wrote: > On Mon, Nov 04, 2019 at 09:47:58AM +0530, Bharata B Rao wrote: > [snip] > > @@ -5442,6 +5471,64 @@ static int kvmhv_store_to_eaddr(struct kvm_vcpu > > *vcpu, ulong *eaddr, void *ptr,

Re: [PATCH v10 6/8] KVM: PPC: Support reset of secure guest

2019-11-10 Thread Bharata B Rao
On Mon, Nov 11, 2019 at 04:28:06PM +1100, Paul Mackerras wrote: > On Mon, Nov 04, 2019 at 09:47:58AM +0530, Bharata B Rao wrote: > > Add support for reset of secure guest via a new ioctl KVM_PPC_SVM_OFF. > > This ioctl will be issued by QEMU during reset and includes the > >

Re: [PATCH v10 4/8] KVM: PPC: Radix changes for secure guest

2019-11-06 Thread Bharata B Rao
On Wed, Nov 06, 2019 at 04:58:23PM +1100, Paul Mackerras wrote: > On Mon, Nov 04, 2019 at 09:47:56AM +0530, Bharata B Rao wrote: > > - After the guest becomes secure, when we handle a page fault of a page > > belonging to SVM in HV, send that page to UV via UV_PAGE_IN. > &

Re: [PATCH v10 3/8] KVM: PPC: Shared pages support for secure guests

2019-11-06 Thread Bharata B Rao
On Wed, Nov 06, 2019 at 01:52:39PM +0530, Bharata B Rao wrote: > > However, since kvmppc_gfn_is_uvmem_pfn() returned true, doesn't that > > mean that pfn here should be a device pfn, and in fact should be the > > same as uvmem_pfn (possibly with some extra bit(s) set)? > >

Re: [PATCH v10 3/8] KVM: PPC: Shared pages support for secure guests

2019-11-06 Thread Bharata B Rao
On Wed, Nov 06, 2019 at 03:52:38PM +1100, Paul Mackerras wrote: > On Mon, Nov 04, 2019 at 09:47:55AM +0530, Bharata B Rao wrote: > > A secure guest will share some of its pages with hypervisor (Eg. virtio > > bounce buffers etc). Support sharing of pages between hypervisor and

Re: [PATCH v10 1/8] mm: ksm: Export ksm_madvise()

2019-11-05 Thread Bharata B Rao
On Wed, Nov 06, 2019 at 03:33:29PM +1100, Paul Mackerras wrote: > On Mon, Nov 04, 2019 at 09:47:53AM +0530, Bharata B Rao wrote: > > KVM PPC module needs ksm_madvise() for supporting secure guests. > > Guest pages that become secure are represented as device private > &

Re: [PATCH v10 0/8] KVM: PPC: Driver to manage pages of secure guest

2019-11-05 Thread Bharata B Rao
On Wed, Nov 06, 2019 at 03:30:58PM +1100, Paul Mackerras wrote: > On Mon, Nov 04, 2019 at 09:47:52AM +0530, Bharata B Rao wrote: > > > > Now, all the dependencies required by this patchset are in powerpc/next > > on which this patchset is based upon. > > C

[PATCH v10 8/8] KVM: PPC: Ultravisor: Add PPC_UV config option

2019-11-03 Thread Bharata B Rao
From: Anshuman Khandual CONFIG_PPC_UV adds support for ultravisor. Signed-off-by: Anshuman Khandual Signed-off-by: Bharata B Rao Signed-off-by: Ram Pai [ Update config help and commit message ] Signed-off-by: Claudio Carvalho Reviewed-by: Sukadev Bhattiprolu --- arch/powerpc/Kconfig | 17

[PATCH v10 7/8] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-11-03 Thread Bharata B Rao
be stuck in secure memory. Since the SVM did not go secure, its MSR_S bit will be clear and the VM wont be able to access its pages even to do a clean exit. Based on patches and discussion with Ram Pai and Bharata Rao. Signed-off-by: Sukadev Bhattiprolu Signed-off-by: Ram Pai Signed-off-by: Bharata B

[PATCH v10 6/8] KVM: PPC: Support reset of secure guest

2019-11-03 Thread Bharata B Rao
call once again to switch to secure mode. Signed-off-by: Bharata B Rao Signed-off-by: Sukadev Bhattiprolu [Implementation of uv_svm_terminate() and its call from guest shutdown path] Signed-off-by: Ram Pai [Unpinning of VPA pages] --- Documentation/virt/kvm/api.txt

[PATCH v10 5/8] KVM: PPC: Handle memory plug/unplug to secure VM

2019-11-03 Thread Bharata B Rao
Register the new memslot with UV during plug and unregister the memslot during unplug. In addition, release all the device pages during unplug. Signed-off-by: Bharata B Rao Signed-off-by: Sukadev Bhattiprolu [Added skip_page_out arg to kvmppc_uvmem_drop_pages()] --- arch/powerpc

[PATCH v10 4/8] KVM: PPC: Radix changes for secure guest

2019-11-03 Thread Bharata B Rao
so in case of secure VM. For secure guest, the active secondary page tables are in secure memory and the secondary page tables in HV are freed when guest becomes secure. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/kvm_book3s_uvmem.h | 6 arch/powerpc/include/asm/ultravisor

[PATCH v10 3/8] KVM: PPC: Shared pages support for secure guests

2019-11-03 Thread Bharata B Rao
the secure page is unmapped from the HV side page tables. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/hvcall.h | 3 ++ arch/powerpc/kvm/book3s_hv_uvmem.c | 85 -- 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm

[PATCH v10 2/8] KVM: PPC: Support for running secure guests

2019-11-03 Thread Bharata B Rao
ges() using UV_PAGE_IN and UV_PAGE_OUT ucalls. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/hvcall.h | 6 + arch/powerpc/include/asm/kvm_book3s_uvmem.h | 62 ++ arch/powerpc/include/asm/kvm_host.h | 6 + arch/powerpc/include/asm/ultravisor-api.h | 3 + a

[PATCH v10 1/8] mm: ksm: Export ksm_madvise()

2019-11-03 Thread Bharata B Rao
KVM PPC module needs ksm_madvise() for supporting secure guests. Guest pages that become secure are represented as device private pages in the host. Such pages shouldn't participate in KSM merging. Signed-off-by: Bharata B Rao --- mm/ksm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm

[PATCH v10 0/8] KVM: PPC: Driver to manage pages of secure guest

2019-11-03 Thread Bharata B Rao
ies required by this patchset are in powerpc/next on which this patchset is based upon. Outside of PowerPC code, this needs a change in KSM code as this patchset uses ksm_madvise() which is not exported. Anshuman Khandual (1): KVM: PPC: Ultravisor: Add PPC_UV config option Bharata B Rao (6):

Re: [PATCH v9 2/8] KVM: PPC: Move pages between normal and secure memory

2019-10-22 Thread Bharata B Rao
On Wed, Oct 23, 2019 at 03:17:54PM +1100, Paul Mackerras wrote: > On Tue, Oct 22, 2019 at 11:59:35AM +0530, Bharata B Rao wrote: > The mapping of pages in userspace memory, and the mapping of userspace > memory to guest physical space, are two distinct things. The memslots > describe

Re: [PATCH v9 2/8] KVM: PPC: Move pages between normal and secure memory

2019-10-22 Thread Bharata B Rao
On Fri, Oct 18, 2019 at 8:31 AM Paul Mackerras wrote: > > On Wed, Sep 25, 2019 at 10:36:43AM +0530, Bharata B Rao wrote: > > Manage migration of pages betwen normal and secure memory of secure > > guest by implementing H_SVM_PAGE_IN and H_SVM_PAGE_OUT hcalls. > >

[PATCH v9 8/8] KVM: PPC: Ultravisor: Add PPC_UV config option

2019-09-24 Thread Bharata B Rao
From: Anshuman Khandual CONFIG_PPC_UV adds support for ultravisor. Signed-off-by: Anshuman Khandual Signed-off-by: Bharata B Rao Signed-off-by: Ram Pai [ Update config help and commit message ] Signed-off-by: Claudio Carvalho Reviewed-by: Sukadev Bhattiprolu --- arch/powerpc/Kconfig | 17

[PATCH v9 7/8] KVM: PPC: Support reset of secure guest

2019-09-24 Thread Bharata B Rao
call once again to switch to secure mode. Signed-off-by: Bharata B Rao Signed-off-by: Sukadev Bhattiprolu [Implementation of uv_svm_terminate() and its call from guest shutdown path] Signed-off-by: Ram Pai [Unpinning of VPA pages] --- Documentation/virt/kvm/api.txt

[PATCH v9 6/8] KVM: PPC: Radix changes for secure guest

2019-09-24 Thread Bharata B Rao
so in case of secure VM. For secure guest, the active secondary page tables are in secure memory and the secondary page tables in HV are freed when guest becomes secure. Signed-off-by: Bharata B Rao Reviewed-by: Sukadev Bhattiprolu --- arch/powerpc/include/asm/kvm_host.h | 12

[PATCH v9 5/8] KVM: PPC: Handle memory plug/unplug to secure VM

2019-09-24 Thread Bharata B Rao
Register the new memslot with UV during plug and unregister the memslot during unplug. Signed-off-by: Bharata B Rao Acked-by: Paul Mackerras Reviewed-by: Sukadev Bhattiprolu --- arch/powerpc/include/asm/ultravisor-api.h | 1 + arch/powerpc/include/asm/ultravisor.h | 5 + arch

[PATCH v9 4/8] KVM: PPC: H_SVM_INIT_START and H_SVM_INIT_DONE hcalls

2019-09-24 Thread Bharata B Rao
STARTED and transition to secure mode COMPLETED) are recorded in kvm->arch.secure_guest. Setting these states will cause the assembly code that enters the guest to call the UV_RETURN ucall instead of trying to enter the guest directly. Signed-off-by: Bharata B Rao Acked-by: Paul Mackerras Revie

[PATCH v9 3/8] KVM: PPC: Shared pages support for secure guests

2019-09-24 Thread Bharata B Rao
the secure page is unmapped from the HV side page tables. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/hvcall.h | 3 ++ arch/powerpc/kvm/book3s_hv_uvmem.c | 86 -- 2 files changed, 85 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm

[PATCH v9 2/8] KVM: PPC: Move pages between normal and secure memory

2019-09-24 Thread Bharata B Rao
memory is done via migrate_vma_pages() using UV_PAGE_IN and UV_PAGE_OUT ucalls. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/hvcall.h | 4 + arch/powerpc/include/asm/kvm_book3s_uvmem.h | 29 ++ arch/powerpc/include/asm/kvm_host.h | 13 + arch/powerpc/include/asm

[PATCH v9 1/8] KVM: PPC: Book3S HV: Define usage types for rmap array in guest memslot

2019-09-24 Thread Bharata B Rao
). Signed-off-by: Suraj Jitindar Singh Signed-off-by: Paul Mackerras Signed-off-by: Bharata B Rao [Added rmap type KVMPPC_RMAP_UVMEM_PFN] Reviewed-by: Sukadev Bhattiprolu --- arch/powerpc/include/asm/kvm_host.h | 28 arch/powerpc/kvm/book3s_hv_rm_mmu.c

[PATCH v9 0/8] KVM: PPC: Driver to manage pages of secure guest

2019-09-24 Thread Bharata B Rao
. - Address review comments by Suka - Misc cleanups v8: https://lore.kernel.org/linux-mm/20190910082946.7849-2-bhar...@linux.ibm.com/T/ Anshuman Khandual (1): KVM: PPC: Ultravisor: Add PPC_UV config option Bharata B Rao (6): KVM: PPC: Move pages between normal and secure memory KVM: PPC

Re: [PATCH v8 2/8] kvmppc: Movement of pages between normal and secure memory

2019-09-18 Thread Bharata B Rao
On Wed, Sep 18, 2019 at 12:42:10PM +0530, Bharata B Rao wrote: > On Tue, Sep 17, 2019 at 04:31:39PM -0700, Sukadev Bhattiprolu wrote: > > > > Minor: Can this allocation be outside the lock? I guess it would change > > the order of cleanup at the end of the function. > &g

<    1   2   3   4   >