All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] x86, calgary: use 8M TCE table size by default
@ 2014-03-10 14:52 ` WANG Chao
  0 siblings, 0 replies; 16+ messages in thread
From: WANG Chao @ 2014-03-10 14:52 UTC (permalink / raw)
  To: Muli Ben-Yehuda, Jon D. Mason, H. Peter Anvin, Vivek Goyal, Baoquan He
  Cc: kexec, x86, linux-kernel

New kexec-tools wants to pass kdump kernel needed memmap via E820
directly, instead of memmap=exactmap. This makes saved_max_pfn not
be passed down to 2nd kernel. To keep 1st kernel and 2nd kernel using
the same TCE table size, Muli suggest to hard code the size to max (8M).

We can't get rid of saved_max_pfn this time, for backward compatibility
with old first kernel and new second kernel. However new first kernel
and old second kernel can not work unfortunately.

v2->v1:
- retain saved_max_pfn so new 2nd kernel can work with old 1st kernel
  from Vivek

Signed-off-by: WANG Chao <chaowang@redhat.com>
---
 arch/x86/kernel/pci-calgary_64.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 299d493..0497f71 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1207,23 +1207,31 @@ error:
 	return ret;
 }
 
-static inline int __init determine_tce_table_size(u64 ram)
+static inline int __init determine_tce_table_size(void)
 {
 	int ret;
 
 	if (specified_table_size != TCE_TABLE_SIZE_UNSPECIFIED)
 		return specified_table_size;
 
-	/*
-	 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
-	 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
-	 * larger table size has twice as many entries, so shift the
-	 * max ram address by 13 to divide by 8K and then look at the
-	 * order of the result to choose between 0-7.
-	 */
-	ret = get_order(ram >> 13);
-	if (ret > TCE_TABLE_SIZE_8M)
+	if (is_kdump_kernel() && saved_max_pfn) {
+		/*
+		 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
+		 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
+		 * larger table size has twice as many entries, so shift the
+		 * max ram address by 13 to divide by 8K and then look at the
+		 * order of the result to choose between 0-7.
+		 */
+		ret = get_order((saved_max_pfn * PAGE_SIZE) >> 13);
+		if (ret > TCE_TABLE_SIZE_8M)
+			ret = TCE_TABLE_SIZE_8M;
+	} else {
+		/*
+		 * Use 8M by default (suggested by Muli) if it's not
+		 * kdump kernel and saved_max_pfn isn't set.
+		 */
 		ret = TCE_TABLE_SIZE_8M;
+	}
 
 	return ret;
 }
@@ -1418,8 +1426,7 @@ int __init detect_calgary(void)
 		return -ENOMEM;
 	}
 
-	specified_table_size = determine_tce_table_size((is_kdump_kernel() ?
-					saved_max_pfn : max_pfn) * PAGE_SIZE);
+	specified_table_size = determine_tce_table_size();
 
 	for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
 		struct calgary_bus_info *info = &bus_info[bus];
-- 
1.8.5.3


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

* [PATCH v2] x86, calgary: use 8M TCE table size by default
@ 2014-03-10 14:52 ` WANG Chao
  0 siblings, 0 replies; 16+ messages in thread
From: WANG Chao @ 2014-03-10 14:52 UTC (permalink / raw)
  To: Muli Ben-Yehuda, Jon D. Mason, H. Peter Anvin, Vivek Goyal, Baoquan He
  Cc: x86, kexec, linux-kernel

New kexec-tools wants to pass kdump kernel needed memmap via E820
directly, instead of memmap=exactmap. This makes saved_max_pfn not
be passed down to 2nd kernel. To keep 1st kernel and 2nd kernel using
the same TCE table size, Muli suggest to hard code the size to max (8M).

We can't get rid of saved_max_pfn this time, for backward compatibility
with old first kernel and new second kernel. However new first kernel
and old second kernel can not work unfortunately.

v2->v1:
- retain saved_max_pfn so new 2nd kernel can work with old 1st kernel
  from Vivek

Signed-off-by: WANG Chao <chaowang@redhat.com>
---
 arch/x86/kernel/pci-calgary_64.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 299d493..0497f71 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1207,23 +1207,31 @@ error:
 	return ret;
 }
 
-static inline int __init determine_tce_table_size(u64 ram)
+static inline int __init determine_tce_table_size(void)
 {
 	int ret;
 
 	if (specified_table_size != TCE_TABLE_SIZE_UNSPECIFIED)
 		return specified_table_size;
 
-	/*
-	 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
-	 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
-	 * larger table size has twice as many entries, so shift the
-	 * max ram address by 13 to divide by 8K and then look at the
-	 * order of the result to choose between 0-7.
-	 */
-	ret = get_order(ram >> 13);
-	if (ret > TCE_TABLE_SIZE_8M)
+	if (is_kdump_kernel() && saved_max_pfn) {
+		/*
+		 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
+		 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
+		 * larger table size has twice as many entries, so shift the
+		 * max ram address by 13 to divide by 8K and then look at the
+		 * order of the result to choose between 0-7.
+		 */
+		ret = get_order((saved_max_pfn * PAGE_SIZE) >> 13);
+		if (ret > TCE_TABLE_SIZE_8M)
+			ret = TCE_TABLE_SIZE_8M;
+	} else {
+		/*
+		 * Use 8M by default (suggested by Muli) if it's not
+		 * kdump kernel and saved_max_pfn isn't set.
+		 */
 		ret = TCE_TABLE_SIZE_8M;
+	}
 
 	return ret;
 }
@@ -1418,8 +1426,7 @@ int __init detect_calgary(void)
 		return -ENOMEM;
 	}
 
-	specified_table_size = determine_tce_table_size((is_kdump_kernel() ?
-					saved_max_pfn : max_pfn) * PAGE_SIZE);
+	specified_table_size = determine_tce_table_size();
 
 	for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
 		struct calgary_bus_info *info = &bus_info[bus];
-- 
1.8.5.3


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
  2014-03-10 14:52 ` WANG Chao
@ 2014-03-10 15:45   ` Vivek Goyal
  -1 siblings, 0 replies; 16+ messages in thread
From: Vivek Goyal @ 2014-03-10 15:45 UTC (permalink / raw)
  To: WANG Chao
  Cc: Muli Ben-Yehuda, Jon D. Mason, H. Peter Anvin, Baoquan He, kexec,
	x86, linux-kernel

On Mon, Mar 10, 2014 at 10:52:00PM +0800, WANG Chao wrote:
> New kexec-tools wants to pass kdump kernel needed memmap via E820
> directly, instead of memmap=exactmap. This makes saved_max_pfn not
> be passed down to 2nd kernel. To keep 1st kernel and 2nd kernel using
> the same TCE table size, Muli suggest to hard code the size to max (8M).
> 
> We can't get rid of saved_max_pfn this time, for backward compatibility
> with old first kernel and new second kernel. However new first kernel
> and old second kernel can not work unfortunately.
> 
> v2->v1:
> - retain saved_max_pfn so new 2nd kernel can work with old 1st kernel
>   from Vivek
> 
> Signed-off-by: WANG Chao <chaowang@redhat.com>

This patch looks good to me. This will use saved_max_pfn to determine
table size and retain backward compatibility with old kernel (if user
uses right kexec cmdline option --pass-memmap).

For others (majority of the cases), both first kernel and second kernel
will use 8M of calgary table. 8M does sound a lot in terms of memory but
assumption here is that there might be only some machines with calgary
hardware and only these will pay the penalty of this increased memory 
usage. This sounds better than exporting table size to user space.

Acked-by: Vivek Goyal <vgoyal@redhat.com>

Thanks
Vivek

> ---
>  arch/x86/kernel/pci-calgary_64.c | 31 +++++++++++++++++++------------
>  1 file changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
> index 299d493..0497f71 100644
> --- a/arch/x86/kernel/pci-calgary_64.c
> +++ b/arch/x86/kernel/pci-calgary_64.c
> @@ -1207,23 +1207,31 @@ error:
>  	return ret;
>  }
>  
> -static inline int __init determine_tce_table_size(u64 ram)
> +static inline int __init determine_tce_table_size(void)
>  {
>  	int ret;
>  
>  	if (specified_table_size != TCE_TABLE_SIZE_UNSPECIFIED)
>  		return specified_table_size;
>  
> -	/*
> -	 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
> -	 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
> -	 * larger table size has twice as many entries, so shift the
> -	 * max ram address by 13 to divide by 8K and then look at the
> -	 * order of the result to choose between 0-7.
> -	 */
> -	ret = get_order(ram >> 13);
> -	if (ret > TCE_TABLE_SIZE_8M)
> +	if (is_kdump_kernel() && saved_max_pfn) {
> +		/*
> +		 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
> +		 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
> +		 * larger table size has twice as many entries, so shift the
> +		 * max ram address by 13 to divide by 8K and then look at the
> +		 * order of the result to choose between 0-7.
> +		 */
> +		ret = get_order((saved_max_pfn * PAGE_SIZE) >> 13);
> +		if (ret > TCE_TABLE_SIZE_8M)
> +			ret = TCE_TABLE_SIZE_8M;
> +	} else {
> +		/*
> +		 * Use 8M by default (suggested by Muli) if it's not
> +		 * kdump kernel and saved_max_pfn isn't set.
> +		 */
>  		ret = TCE_TABLE_SIZE_8M;
> +	}
>  
>  	return ret;
>  }
> @@ -1418,8 +1426,7 @@ int __init detect_calgary(void)
>  		return -ENOMEM;
>  	}
>  
> -	specified_table_size = determine_tce_table_size((is_kdump_kernel() ?
> -					saved_max_pfn : max_pfn) * PAGE_SIZE);
> +	specified_table_size = determine_tce_table_size();
>  
>  	for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
>  		struct calgary_bus_info *info = &bus_info[bus];
> -- 
> 1.8.5.3

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
@ 2014-03-10 15:45   ` Vivek Goyal
  0 siblings, 0 replies; 16+ messages in thread
From: Vivek Goyal @ 2014-03-10 15:45 UTC (permalink / raw)
  To: WANG Chao
  Cc: Baoquan He, x86, kexec, linux-kernel, H. Peter Anvin,
	Muli Ben-Yehuda, Jon D. Mason

On Mon, Mar 10, 2014 at 10:52:00PM +0800, WANG Chao wrote:
> New kexec-tools wants to pass kdump kernel needed memmap via E820
> directly, instead of memmap=exactmap. This makes saved_max_pfn not
> be passed down to 2nd kernel. To keep 1st kernel and 2nd kernel using
> the same TCE table size, Muli suggest to hard code the size to max (8M).
> 
> We can't get rid of saved_max_pfn this time, for backward compatibility
> with old first kernel and new second kernel. However new first kernel
> and old second kernel can not work unfortunately.
> 
> v2->v1:
> - retain saved_max_pfn so new 2nd kernel can work with old 1st kernel
>   from Vivek
> 
> Signed-off-by: WANG Chao <chaowang@redhat.com>

This patch looks good to me. This will use saved_max_pfn to determine
table size and retain backward compatibility with old kernel (if user
uses right kexec cmdline option --pass-memmap).

For others (majority of the cases), both first kernel and second kernel
will use 8M of calgary table. 8M does sound a lot in terms of memory but
assumption here is that there might be only some machines with calgary
hardware and only these will pay the penalty of this increased memory 
usage. This sounds better than exporting table size to user space.

Acked-by: Vivek Goyal <vgoyal@redhat.com>

Thanks
Vivek

> ---
>  arch/x86/kernel/pci-calgary_64.c | 31 +++++++++++++++++++------------
>  1 file changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
> index 299d493..0497f71 100644
> --- a/arch/x86/kernel/pci-calgary_64.c
> +++ b/arch/x86/kernel/pci-calgary_64.c
> @@ -1207,23 +1207,31 @@ error:
>  	return ret;
>  }
>  
> -static inline int __init determine_tce_table_size(u64 ram)
> +static inline int __init determine_tce_table_size(void)
>  {
>  	int ret;
>  
>  	if (specified_table_size != TCE_TABLE_SIZE_UNSPECIFIED)
>  		return specified_table_size;
>  
> -	/*
> -	 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
> -	 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
> -	 * larger table size has twice as many entries, so shift the
> -	 * max ram address by 13 to divide by 8K and then look at the
> -	 * order of the result to choose between 0-7.
> -	 */
> -	ret = get_order(ram >> 13);
> -	if (ret > TCE_TABLE_SIZE_8M)
> +	if (is_kdump_kernel() && saved_max_pfn) {
> +		/*
> +		 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
> +		 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
> +		 * larger table size has twice as many entries, so shift the
> +		 * max ram address by 13 to divide by 8K and then look at the
> +		 * order of the result to choose between 0-7.
> +		 */
> +		ret = get_order((saved_max_pfn * PAGE_SIZE) >> 13);
> +		if (ret > TCE_TABLE_SIZE_8M)
> +			ret = TCE_TABLE_SIZE_8M;
> +	} else {
> +		/*
> +		 * Use 8M by default (suggested by Muli) if it's not
> +		 * kdump kernel and saved_max_pfn isn't set.
> +		 */
>  		ret = TCE_TABLE_SIZE_8M;
> +	}
>  
>  	return ret;
>  }
> @@ -1418,8 +1426,7 @@ int __init detect_calgary(void)
>  		return -ENOMEM;
>  	}
>  
> -	specified_table_size = determine_tce_table_size((is_kdump_kernel() ?
> -					saved_max_pfn : max_pfn) * PAGE_SIZE);
> +	specified_table_size = determine_tce_table_size();
>  
>  	for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
>  		struct calgary_bus_info *info = &bus_info[bus];
> -- 
> 1.8.5.3

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
  2014-03-10 15:45   ` Vivek Goyal
@ 2014-03-10 15:54     ` Muli Ben-Yehuda
  -1 siblings, 0 replies; 16+ messages in thread
From: Muli Ben-Yehuda @ 2014-03-10 15:54 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: WANG Chao, Jon D. Mason, H. Peter Anvin, Baoquan He, kexec, x86,
	linux-kernel

Patch looks good to me.

Acked-by: Muli Ben-Yehuda <mulix@mulix.org>

Cheers,
Muli

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
@ 2014-03-10 15:54     ` Muli Ben-Yehuda
  0 siblings, 0 replies; 16+ messages in thread
From: Muli Ben-Yehuda @ 2014-03-10 15:54 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Baoquan He, x86, kexec, linux-kernel, H. Peter Anvin,
	Jon D. Mason, WANG Chao

Patch looks good to me.

Acked-by: Muli Ben-Yehuda <mulix@mulix.org>

Cheers,
Muli

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
  2014-03-10 15:54     ` Muli Ben-Yehuda
@ 2014-03-11  5:26       ` Jon Mason
  -1 siblings, 0 replies; 16+ messages in thread
From: Jon Mason @ 2014-03-11  5:26 UTC (permalink / raw)
  To: Muli Ben-Yehuda
  Cc: Vivek Goyal, WANG Chao, H. Peter Anvin, Baoquan He, kexec, x86,
	linux-kernel

On Mon, Mar 10, 2014 at 8:54 AM, Muli Ben-Yehuda <muli@cs.technion.ac.il> wrote:
> Patch looks good to me.
>
> Acked-by: Muli Ben-Yehuda <mulix@mulix.org>

Me too (just in case you want us both).

Acked-by: Jon Mason <jdmason@kudzu.us>

>
> Cheers,
> Muli

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
@ 2014-03-11  5:26       ` Jon Mason
  0 siblings, 0 replies; 16+ messages in thread
From: Jon Mason @ 2014-03-11  5:26 UTC (permalink / raw)
  To: Muli Ben-Yehuda
  Cc: Baoquan He, x86, kexec, linux-kernel, Vivek Goyal,
	H. Peter Anvin, WANG Chao

On Mon, Mar 10, 2014 at 8:54 AM, Muli Ben-Yehuda <muli@cs.technion.ac.il> wrote:
> Patch looks good to me.
>
> Acked-by: Muli Ben-Yehuda <mulix@mulix.org>

Me too (just in case you want us both).

Acked-by: Jon Mason <jdmason@kudzu.us>

>
> Cheers,
> Muli

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
  2014-03-11  5:26       ` Jon Mason
@ 2014-03-12  2:32         ` WANG Chao
  -1 siblings, 0 replies; 16+ messages in thread
From: WANG Chao @ 2014-03-12  2:32 UTC (permalink / raw)
  To: Jon Mason
  Cc: Muli Ben-Yehuda, Vivek Goyal, H. Peter Anvin, Baoquan He, kexec,
	x86, linux-kernel

On 03/10/14 at 10:26pm, Jon Mason wrote:
> On Mon, Mar 10, 2014 at 8:54 AM, Muli Ben-Yehuda <muli@cs.technion.ac.il> wrote:
> > Patch looks good to me.
> >
> > Acked-by: Muli Ben-Yehuda <mulix@mulix.org>
> 
> Me too (just in case you want us both).
> 
> Acked-by: Jon Mason <jdmason@kudzu.us>

Thanks for review and helping push this change, to all of you.

WANG Chao

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
@ 2014-03-12  2:32         ` WANG Chao
  0 siblings, 0 replies; 16+ messages in thread
From: WANG Chao @ 2014-03-12  2:32 UTC (permalink / raw)
  To: Jon Mason
  Cc: Baoquan He, x86, kexec, linux-kernel, H. Peter Anvin,
	Muli Ben-Yehuda, Vivek Goyal

On 03/10/14 at 10:26pm, Jon Mason wrote:
> On Mon, Mar 10, 2014 at 8:54 AM, Muli Ben-Yehuda <muli@cs.technion.ac.il> wrote:
> > Patch looks good to me.
> >
> > Acked-by: Muli Ben-Yehuda <mulix@mulix.org>
> 
> Me too (just in case you want us both).
> 
> Acked-by: Jon Mason <jdmason@kudzu.us>

Thanks for review and helping push this change, to all of you.

WANG Chao

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
  2014-03-10 14:52 ` WANG Chao
@ 2014-03-20 15:54   ` Vivek Goyal
  -1 siblings, 0 replies; 16+ messages in thread
From: Vivek Goyal @ 2014-03-20 15:54 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Muli Ben-Yehuda, Jon D. Mason, H. Peter Anvin, Baoquan He, kexec,
	x86, linux-kernel, WANG Chao

Hi hpa,

I am wondering how to make progress on calgary issue now. We do want to
cleanup kexec-tools code and move to passing memory ranges in bootparams.

I see two choices here.

- Take this patch in so that new kernel code will work with modified
  kexec-tools without any user intervention. (Both first and second kernel
  need to be new). 

- Don't take this patch in and calgary will be broken with new
  kexec-tools. And that will always require manual user intervention
  from user to force passing memmap on command line.

I kind of prefer the first option so that even if there are some calgary
machines out there, they will work automatically with new kernel and
will require manual intervention only for old kernels and new kexec-tool
cobination.

But I can live with second option too if that's everybody agrees to and
hopefully we don't get lots of reports of breaking kdump with kexec-tools
upgrade.

Thanks
Vivek

On Mon, Mar 10, 2014 at 10:52:00PM +0800, WANG Chao wrote:
> New kexec-tools wants to pass kdump kernel needed memmap via E820
> directly, instead of memmap=exactmap. This makes saved_max_pfn not
> be passed down to 2nd kernel. To keep 1st kernel and 2nd kernel using
> the same TCE table size, Muli suggest to hard code the size to max (8M).
> 
> We can't get rid of saved_max_pfn this time, for backward compatibility
> with old first kernel and new second kernel. However new first kernel
> and old second kernel can not work unfortunately.
> 
> v2->v1:
> - retain saved_max_pfn so new 2nd kernel can work with old 1st kernel
>   from Vivek
> 
> Signed-off-by: WANG Chao <chaowang@redhat.com>
> ---
>  arch/x86/kernel/pci-calgary_64.c | 31 +++++++++++++++++++------------
>  1 file changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
> index 299d493..0497f71 100644
> --- a/arch/x86/kernel/pci-calgary_64.c
> +++ b/arch/x86/kernel/pci-calgary_64.c
> @@ -1207,23 +1207,31 @@ error:
>  	return ret;
>  }
>  
> -static inline int __init determine_tce_table_size(u64 ram)
> +static inline int __init determine_tce_table_size(void)
>  {
>  	int ret;
>  
>  	if (specified_table_size != TCE_TABLE_SIZE_UNSPECIFIED)
>  		return specified_table_size;
>  
> -	/*
> -	 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
> -	 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
> -	 * larger table size has twice as many entries, so shift the
> -	 * max ram address by 13 to divide by 8K and then look at the
> -	 * order of the result to choose between 0-7.
> -	 */
> -	ret = get_order(ram >> 13);
> -	if (ret > TCE_TABLE_SIZE_8M)
> +	if (is_kdump_kernel() && saved_max_pfn) {
> +		/*
> +		 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
> +		 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
> +		 * larger table size has twice as many entries, so shift the
> +		 * max ram address by 13 to divide by 8K and then look at the
> +		 * order of the result to choose between 0-7.
> +		 */
> +		ret = get_order((saved_max_pfn * PAGE_SIZE) >> 13);
> +		if (ret > TCE_TABLE_SIZE_8M)
> +			ret = TCE_TABLE_SIZE_8M;
> +	} else {
> +		/*
> +		 * Use 8M by default (suggested by Muli) if it's not
> +		 * kdump kernel and saved_max_pfn isn't set.
> +		 */
>  		ret = TCE_TABLE_SIZE_8M;
> +	}
>  
>  	return ret;
>  }
> @@ -1418,8 +1426,7 @@ int __init detect_calgary(void)
>  		return -ENOMEM;
>  	}
>  
> -	specified_table_size = determine_tce_table_size((is_kdump_kernel() ?
> -					saved_max_pfn : max_pfn) * PAGE_SIZE);
> +	specified_table_size = determine_tce_table_size();
>  
>  	for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
>  		struct calgary_bus_info *info = &bus_info[bus];
> -- 
> 1.8.5.3

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
@ 2014-03-20 15:54   ` Vivek Goyal
  0 siblings, 0 replies; 16+ messages in thread
From: Vivek Goyal @ 2014-03-20 15:54 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Baoquan He, x86, kexec, linux-kernel, H. Peter Anvin,
	Muli Ben-Yehuda, Jon D. Mason, WANG Chao

Hi hpa,

I am wondering how to make progress on calgary issue now. We do want to
cleanup kexec-tools code and move to passing memory ranges in bootparams.

I see two choices here.

- Take this patch in so that new kernel code will work with modified
  kexec-tools without any user intervention. (Both first and second kernel
  need to be new). 

- Don't take this patch in and calgary will be broken with new
  kexec-tools. And that will always require manual user intervention
  from user to force passing memmap on command line.

I kind of prefer the first option so that even if there are some calgary
machines out there, they will work automatically with new kernel and
will require manual intervention only for old kernels and new kexec-tool
cobination.

But I can live with second option too if that's everybody agrees to and
hopefully we don't get lots of reports of breaking kdump with kexec-tools
upgrade.

Thanks
Vivek

On Mon, Mar 10, 2014 at 10:52:00PM +0800, WANG Chao wrote:
> New kexec-tools wants to pass kdump kernel needed memmap via E820
> directly, instead of memmap=exactmap. This makes saved_max_pfn not
> be passed down to 2nd kernel. To keep 1st kernel and 2nd kernel using
> the same TCE table size, Muli suggest to hard code the size to max (8M).
> 
> We can't get rid of saved_max_pfn this time, for backward compatibility
> with old first kernel and new second kernel. However new first kernel
> and old second kernel can not work unfortunately.
> 
> v2->v1:
> - retain saved_max_pfn so new 2nd kernel can work with old 1st kernel
>   from Vivek
> 
> Signed-off-by: WANG Chao <chaowang@redhat.com>
> ---
>  arch/x86/kernel/pci-calgary_64.c | 31 +++++++++++++++++++------------
>  1 file changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
> index 299d493..0497f71 100644
> --- a/arch/x86/kernel/pci-calgary_64.c
> +++ b/arch/x86/kernel/pci-calgary_64.c
> @@ -1207,23 +1207,31 @@ error:
>  	return ret;
>  }
>  
> -static inline int __init determine_tce_table_size(u64 ram)
> +static inline int __init determine_tce_table_size(void)
>  {
>  	int ret;
>  
>  	if (specified_table_size != TCE_TABLE_SIZE_UNSPECIFIED)
>  		return specified_table_size;
>  
> -	/*
> -	 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
> -	 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
> -	 * larger table size has twice as many entries, so shift the
> -	 * max ram address by 13 to divide by 8K and then look at the
> -	 * order of the result to choose between 0-7.
> -	 */
> -	ret = get_order(ram >> 13);
> -	if (ret > TCE_TABLE_SIZE_8M)
> +	if (is_kdump_kernel() && saved_max_pfn) {
> +		/*
> +		 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
> +		 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
> +		 * larger table size has twice as many entries, so shift the
> +		 * max ram address by 13 to divide by 8K and then look at the
> +		 * order of the result to choose between 0-7.
> +		 */
> +		ret = get_order((saved_max_pfn * PAGE_SIZE) >> 13);
> +		if (ret > TCE_TABLE_SIZE_8M)
> +			ret = TCE_TABLE_SIZE_8M;
> +	} else {
> +		/*
> +		 * Use 8M by default (suggested by Muli) if it's not
> +		 * kdump kernel and saved_max_pfn isn't set.
> +		 */
>  		ret = TCE_TABLE_SIZE_8M;
> +	}
>  
>  	return ret;
>  }
> @@ -1418,8 +1426,7 @@ int __init detect_calgary(void)
>  		return -ENOMEM;
>  	}
>  
> -	specified_table_size = determine_tce_table_size((is_kdump_kernel() ?
> -					saved_max_pfn : max_pfn) * PAGE_SIZE);
> +	specified_table_size = determine_tce_table_size();
>  
>  	for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
>  		struct calgary_bus_info *info = &bus_info[bus];
> -- 
> 1.8.5.3

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
  2014-03-20 15:54   ` Vivek Goyal
@ 2014-03-20 16:01     ` H. Peter Anvin
  -1 siblings, 0 replies; 16+ messages in thread
From: H. Peter Anvin @ 2014-03-20 16:01 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Muli Ben-Yehuda, Jon D. Mason, Baoquan He, kexec, x86,
	linux-kernel, WANG Chao

On 03/20/2014 08:54 AM, Vivek Goyal wrote:
> Hi hpa,
> 
> I am wondering how to make progress on calgary issue now. We do want to
> cleanup kexec-tools code and move to passing memory ranges in bootparams.
> 
> I see two choices here.
> 
> - Take this patch in so that new kernel code will work with modified
>   kexec-tools without any user intervention. (Both first and second kernel
>   need to be new). 
> 
> - Don't take this patch in and calgary will be broken with new
>   kexec-tools. And that will always require manual user intervention
>   from user to force passing memmap on command line.
> 
> I kind of prefer the first option so that even if there are some calgary
> machines out there, they will work automatically with new kernel and
> will require manual intervention only for old kernels and new kexec-tool
> cobination.
> 
> But I can live with second option too if that's everybody agrees to and
> hopefully we don't get lots of reports of breaking kdump with kexec-tools
> upgrade.
> 

The patch seems simple enough and doesn't require any new command line
hacks.  It has been widely reviewed and acked, so I'll pick it up.

	-hpa



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

* Re: [PATCH v2] x86, calgary: use 8M TCE table size by default
@ 2014-03-20 16:01     ` H. Peter Anvin
  0 siblings, 0 replies; 16+ messages in thread
From: H. Peter Anvin @ 2014-03-20 16:01 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Baoquan He, x86, kexec, linux-kernel, Jon D. Mason,
	Muli Ben-Yehuda, WANG Chao

On 03/20/2014 08:54 AM, Vivek Goyal wrote:
> Hi hpa,
> 
> I am wondering how to make progress on calgary issue now. We do want to
> cleanup kexec-tools code and move to passing memory ranges in bootparams.
> 
> I see two choices here.
> 
> - Take this patch in so that new kernel code will work with modified
>   kexec-tools without any user intervention. (Both first and second kernel
>   need to be new). 
> 
> - Don't take this patch in and calgary will be broken with new
>   kexec-tools. And that will always require manual user intervention
>   from user to force passing memmap on command line.
> 
> I kind of prefer the first option so that even if there are some calgary
> machines out there, they will work automatically with new kernel and
> will require manual intervention only for old kernels and new kexec-tool
> cobination.
> 
> But I can live with second option too if that's everybody agrees to and
> hopefully we don't get lots of reports of breaking kdump with kexec-tools
> upgrade.
> 

The patch seems simple enough and doesn't require any new command line
hacks.  It has been widely reviewed and acked, so I'll pick it up.

	-hpa



_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [tip:x86/platform] x86, calgary: Use 8M TCE table size by default
  2014-03-10 14:52 ` WANG Chao
                   ` (2 preceding siblings ...)
  (?)
@ 2014-03-20 22:15 ` tip-bot for WANG Chao
  -1 siblings, 0 replies; 16+ messages in thread
From: tip-bot for WANG Chao @ 2014-03-20 22:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, mulix, vgoyal, jdmason, tglx, hpa, chaowang

Commit-ID:  936329de1e6bf3dfa8c056074e6fc6b673e7b1d0
Gitweb:     http://git.kernel.org/tip/936329de1e6bf3dfa8c056074e6fc6b673e7b1d0
Author:     WANG Chao <chaowang@redhat.com>
AuthorDate: Mon, 10 Mar 2014 22:52:00 +0800
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 20 Mar 2014 14:51:39 -0700

x86, calgary: Use 8M TCE table size by default

New kexec-tools wants to pass kdump kernel needed memmap via E820
directly, instead of memmap=exactmap. This makes saved_max_pfn not
be passed down to 2nd kernel. To keep 1st kernel and 2nd kernel using
the same TCE table size, Muli suggest to hard code the size to max (8M).

We can't get rid of saved_max_pfn this time, for backward compatibility
with old first kernel and new second kernel. However new first kernel
and old second kernel can not work unfortunately.

v2->v1:
- retain saved_max_pfn so new 2nd kernel can work with old 1st kernel
  from Vivek

Signed-off-by: WANG Chao <chaowang@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Muli Ben-Yehuda <mulix@mulix.org>
Acked-by: Jon Mason <jdmason@kudzu.us>
Link: http://lkml.kernel.org/r/1394463120-26999-1-git-send-email-chaowang@redhat.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/kernel/pci-calgary_64.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 299d493..0497f71 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1207,23 +1207,31 @@ error:
 	return ret;
 }
 
-static inline int __init determine_tce_table_size(u64 ram)
+static inline int __init determine_tce_table_size(void)
 {
 	int ret;
 
 	if (specified_table_size != TCE_TABLE_SIZE_UNSPECIFIED)
 		return specified_table_size;
 
-	/*
-	 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
-	 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
-	 * larger table size has twice as many entries, so shift the
-	 * max ram address by 13 to divide by 8K and then look at the
-	 * order of the result to choose between 0-7.
-	 */
-	ret = get_order(ram >> 13);
-	if (ret > TCE_TABLE_SIZE_8M)
+	if (is_kdump_kernel() && saved_max_pfn) {
+		/*
+		 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
+		 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
+		 * larger table size has twice as many entries, so shift the
+		 * max ram address by 13 to divide by 8K and then look at the
+		 * order of the result to choose between 0-7.
+		 */
+		ret = get_order((saved_max_pfn * PAGE_SIZE) >> 13);
+		if (ret > TCE_TABLE_SIZE_8M)
+			ret = TCE_TABLE_SIZE_8M;
+	} else {
+		/*
+		 * Use 8M by default (suggested by Muli) if it's not
+		 * kdump kernel and saved_max_pfn isn't set.
+		 */
 		ret = TCE_TABLE_SIZE_8M;
+	}
 
 	return ret;
 }
@@ -1418,8 +1426,7 @@ int __init detect_calgary(void)
 		return -ENOMEM;
 	}
 
-	specified_table_size = determine_tce_table_size((is_kdump_kernel() ?
-					saved_max_pfn : max_pfn) * PAGE_SIZE);
+	specified_table_size = determine_tce_table_size();
 
 	for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
 		struct calgary_bus_info *info = &bus_info[bus];

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

* [tip:x86/platform] x86, calgary: Use 8M TCE table size by default
  2014-03-10 14:52 ` WANG Chao
                   ` (3 preceding siblings ...)
  (?)
@ 2014-04-11  2:55 ` tip-bot for WANG Chao
  -1 siblings, 0 replies; 16+ messages in thread
From: tip-bot for WANG Chao @ 2014-04-11  2:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, mulix, vgoyal, jdmason, tglx, hpa, chaowang

Commit-ID:  0534af01cca338193abbfdb53650af91e65dbf10
Gitweb:     http://git.kernel.org/tip/0534af01cca338193abbfdb53650af91e65dbf10
Author:     WANG Chao <chaowang@redhat.com>
AuthorDate: Mon, 10 Mar 2014 22:52:00 +0800
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 10 Apr 2014 19:51:32 -0700

x86, calgary: Use 8M TCE table size by default

New kexec-tools wants to pass kdump kernel needed memmap via E820
directly, instead of memmap=exactmap. This makes saved_max_pfn not
be passed down to 2nd kernel. To keep 1st kernel and 2nd kernel using
the same TCE table size, Muli suggest to hard code the size to max (8M).

We can't get rid of saved_max_pfn this time, for backward compatibility
with old first kernel and new second kernel. However new first kernel
and old second kernel can not work unfortunately.

v2->v1:
- retain saved_max_pfn so new 2nd kernel can work with old 1st kernel
  from Vivek

Signed-off-by: WANG Chao <chaowang@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Muli Ben-Yehuda <mulix@mulix.org>
Acked-by: Jon Mason <jdmason@kudzu.us>
Link: http://lkml.kernel.org/r/1394463120-26999-1-git-send-email-chaowang@redhat.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/kernel/pci-calgary_64.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 299d493..0497f71 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1207,23 +1207,31 @@ error:
 	return ret;
 }
 
-static inline int __init determine_tce_table_size(u64 ram)
+static inline int __init determine_tce_table_size(void)
 {
 	int ret;
 
 	if (specified_table_size != TCE_TABLE_SIZE_UNSPECIFIED)
 		return specified_table_size;
 
-	/*
-	 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
-	 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
-	 * larger table size has twice as many entries, so shift the
-	 * max ram address by 13 to divide by 8K and then look at the
-	 * order of the result to choose between 0-7.
-	 */
-	ret = get_order(ram >> 13);
-	if (ret > TCE_TABLE_SIZE_8M)
+	if (is_kdump_kernel() && saved_max_pfn) {
+		/*
+		 * Table sizes are from 0 to 7 (TCE_TABLE_SIZE_64K to
+		 * TCE_TABLE_SIZE_8M). Table size 0 has 8K entries and each
+		 * larger table size has twice as many entries, so shift the
+		 * max ram address by 13 to divide by 8K and then look at the
+		 * order of the result to choose between 0-7.
+		 */
+		ret = get_order((saved_max_pfn * PAGE_SIZE) >> 13);
+		if (ret > TCE_TABLE_SIZE_8M)
+			ret = TCE_TABLE_SIZE_8M;
+	} else {
+		/*
+		 * Use 8M by default (suggested by Muli) if it's not
+		 * kdump kernel and saved_max_pfn isn't set.
+		 */
 		ret = TCE_TABLE_SIZE_8M;
+	}
 
 	return ret;
 }
@@ -1418,8 +1426,7 @@ int __init detect_calgary(void)
 		return -ENOMEM;
 	}
 
-	specified_table_size = determine_tce_table_size((is_kdump_kernel() ?
-					saved_max_pfn : max_pfn) * PAGE_SIZE);
+	specified_table_size = determine_tce_table_size();
 
 	for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
 		struct calgary_bus_info *info = &bus_info[bus];

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

end of thread, other threads:[~2014-04-11  2:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-10 14:52 [PATCH v2] x86, calgary: use 8M TCE table size by default WANG Chao
2014-03-10 14:52 ` WANG Chao
2014-03-10 15:45 ` Vivek Goyal
2014-03-10 15:45   ` Vivek Goyal
2014-03-10 15:54   ` Muli Ben-Yehuda
2014-03-10 15:54     ` Muli Ben-Yehuda
2014-03-11  5:26     ` Jon Mason
2014-03-11  5:26       ` Jon Mason
2014-03-12  2:32       ` WANG Chao
2014-03-12  2:32         ` WANG Chao
2014-03-20 15:54 ` Vivek Goyal
2014-03-20 15:54   ` Vivek Goyal
2014-03-20 16:01   ` H. Peter Anvin
2014-03-20 16:01     ` H. Peter Anvin
2014-03-20 22:15 ` [tip:x86/platform] x86, calgary: Use " tip-bot for WANG Chao
2014-04-11  2:55 ` tip-bot for WANG Chao

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.