All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec
@ 2016-10-01 10:41 Anton Blanchard
  2016-10-27  6:26 ` Mahesh Jagannath Salgaonkar
  2016-11-14 12:17 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Anton Blanchard @ 2016-10-01 10:41 UTC (permalink / raw)
  To: benh, paulus, mpe, mahesh, srikar, hbathini; +Cc: linuxppc-dev

From: Anton Blanchard <anton@samba.org>

An hcall was recently added that does exactly what we need
during kexec - it clears the entire MMU hash table, ignoring any
VRMA mappings.

Try it and fall back to the old method if we get a failure.

On a POWER8 box with 5TB of memory, this reduces the time it takes to
kexec a new kernel from from 4 minutes to 1 minute.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/include/asm/hvcall.h     |  3 ++-
 arch/powerpc/platforms/pseries/lpar.c | 14 +++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 708edeb..489748e 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -275,7 +275,8 @@
 #define H_COP			0x304
 #define H_GET_MPP_X		0x314
 #define H_SET_MODE		0x31C
-#define MAX_HCALL_OPCODE	H_SET_MODE
+#define H_CLEAR_HPT		0x358
+#define MAX_HCALL_OPCODE	H_CLEAR_HPT
 
 /* H_VIOCTL functions */
 #define H_GET_VIOA_DUMP_SIZE	0x01
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 86707e6..03884a8 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -221,7 +221,7 @@ static long pSeries_lpar_hpte_remove(unsigned long hpte_group)
 	return -1;
 }
 
-static void pSeries_lpar_hptab_clear(void)
+static void __pSeries_lpar_clear_hpt(void)
 {
 	unsigned long size_bytes = 1UL << ppc64_pft_size;
 	unsigned long hpte_count = size_bytes >> 4;
@@ -249,6 +249,18 @@ static void pSeries_lpar_hptab_clear(void)
 					&(ptes[j].pteh), &(ptes[j].ptel));
 		}
 	}
+}
+
+static void pSeries_lpar_hptab_clear(void)
+{
+	int rc;
+
+	do {
+		rc = plpar_hcall_norets(H_CLEAR_HPT);
+	} while (rc == H_CONTINUE);
+
+	if (rc != H_SUCCESS)
+		__pSeries_lpar_clear_hpt();
 
 #ifdef __LITTLE_ENDIAN__
 	/*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec
  2016-10-01 10:41 [PATCH] powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec Anton Blanchard
@ 2016-10-27  6:26 ` Mahesh Jagannath Salgaonkar
  2016-11-14 12:17 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Mahesh Jagannath Salgaonkar @ 2016-10-27  6:26 UTC (permalink / raw)
  To: Anton Blanchard, benh, paulus, mpe, srikar, hbathini; +Cc: linuxppc-dev

On 10/01/2016 04:11 PM, Anton Blanchard wrote:
> From: Anton Blanchard <anton@samba.org>
> 
> An hcall was recently added that does exactly what we need
> during kexec - it clears the entire MMU hash table, ignoring any
> VRMA mappings.
> 
> Try it and fall back to the old method if we get a failure.
> 
> On a POWER8 box with 5TB of memory, this reduces the time it takes to
> kexec a new kernel from from 4 minutes to 1 minute.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

Tested-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>

> ---
>  arch/powerpc/include/asm/hvcall.h     |  3 ++-
>  arch/powerpc/platforms/pseries/lpar.c | 14 +++++++++++++-
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
> index 708edeb..489748e 100644
> --- a/arch/powerpc/include/asm/hvcall.h
> +++ b/arch/powerpc/include/asm/hvcall.h
> @@ -275,7 +275,8 @@
>  #define H_COP			0x304
>  #define H_GET_MPP_X		0x314
>  #define H_SET_MODE		0x31C
> -#define MAX_HCALL_OPCODE	H_SET_MODE
> +#define H_CLEAR_HPT		0x358
> +#define MAX_HCALL_OPCODE	H_CLEAR_HPT
> 
>  /* H_VIOCTL functions */
>  #define H_GET_VIOA_DUMP_SIZE	0x01
> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
> index 86707e6..03884a8 100644
> --- a/arch/powerpc/platforms/pseries/lpar.c
> +++ b/arch/powerpc/platforms/pseries/lpar.c
> @@ -221,7 +221,7 @@ static long pSeries_lpar_hpte_remove(unsigned long hpte_group)
>  	return -1;
>  }
> 
> -static void pSeries_lpar_hptab_clear(void)
> +static void __pSeries_lpar_clear_hpt(void)
>  {
>  	unsigned long size_bytes = 1UL << ppc64_pft_size;
>  	unsigned long hpte_count = size_bytes >> 4;
> @@ -249,6 +249,18 @@ static void pSeries_lpar_hptab_clear(void)
>  					&(ptes[j].pteh), &(ptes[j].ptel));
>  		}
>  	}
> +}
> +
> +static void pSeries_lpar_hptab_clear(void)
> +{
> +	int rc;
> +
> +	do {
> +		rc = plpar_hcall_norets(H_CLEAR_HPT);
> +	} while (rc == H_CONTINUE);
> +
> +	if (rc != H_SUCCESS)
> +		__pSeries_lpar_clear_hpt();
> 
>  #ifdef __LITTLE_ENDIAN__
>  	/*
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec
  2016-10-01 10:41 [PATCH] powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec Anton Blanchard
  2016-10-27  6:26 ` Mahesh Jagannath Salgaonkar
@ 2016-11-14 12:17 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2016-11-14 12:17 UTC (permalink / raw)
  To: Anton Blanchard, benh, paulus, mahesh, srikar, hbathini; +Cc: linuxppc-dev

On Sat, 2016-01-10 at 10:41:56 UTC, Anton Blanchard wrote:
> From: Anton Blanchard <anton@samba.org>
> 
> An hcall was recently added that does exactly what we need
> during kexec - it clears the entire MMU hash table, ignoring any
> VRMA mappings.
> 
> Try it and fall back to the old method if we get a failure.
> 
> On a POWER8 box with 5TB of memory, this reduces the time it takes to
> kexec a new kernel from from 4 minutes to 1 minute.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/5246adec59458b5d325b8e1462ea9e

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-14 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-01 10:41 [PATCH] powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec Anton Blanchard
2016-10-27  6:26 ` Mahesh Jagannath Salgaonkar
2016-11-14 12:17 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.