linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] x86/numa_emulation: fix parsing of numa_meminfo for uniform numa emulation
@ 2018-09-19 18:12 Dave Jiang
  2018-10-09 16:28 ` Dave Jiang
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2018-09-19 18:12 UTC (permalink / raw)
  To: mingo, dan.j.williams; +Cc: tglx, hpa, x86, linux-kernel

During fakenuma processing in numa_emulation(), pi gets passed in and
processed as new fake numa nodes are being split out. Once the original
memory region is proccessed, it gets removed from the pi by
numa_remove_memblk_from() in emu_setup_memblk(). So entry 0 gets deleted
and the rest of the entries get moved up. Therefore we should always pass
in entry 0 for the next entry to process.

Fixes: 1f6a2c6d9f121 ("x86/numa_emulation: Introduce uniform split
capability")

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
---

V2:
- Add comment for the code change (Dan)

 arch/x86/mm/numa_emulation.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index b54d52a2d00a..d71d72cf6c66 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -400,9 +400,17 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
 		n = simple_strtoul(emu_cmdline, &emu_cmdline, 0);
 		ret = -1;
 		for_each_node_mask(i, physnode_mask) {
+			/*
+			 * The reason we pass in blk[0] is due to
+			 * numa_remove_memblk_from() called by
+			 * emu_setup_memblk() will delete entry 0
+			 * and then move everything else up in the pi.blk
+			 * array. Therefore we should always be looking
+			 * at blk[0].
+			 */
 			ret = split_nodes_size_interleave_uniform(&ei, &pi,
-					pi.blk[i].start, pi.blk[i].end, 0,
-					n, &pi.blk[i], nid);
+					pi.blk[0].start, pi.blk[0].end, 0,
+					n, &pi.blk[0], nid);
 			if (ret < 0)
 				break;
 			if (ret < n) {


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

* Re: [PATCH v2] x86/numa_emulation: fix parsing of numa_meminfo for uniform numa emulation
  2018-09-19 18:12 [PATCH v2] x86/numa_emulation: fix parsing of numa_meminfo for uniform numa emulation Dave Jiang
@ 2018-10-09 16:28 ` Dave Jiang
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Jiang @ 2018-10-09 16:28 UTC (permalink / raw)
  To: mingo, dan.j.williams; +Cc: tglx, hpa, x86, linux-kernel



On 09/19/2018 11:12 AM, Dave Jiang wrote:
> During fakenuma processing in numa_emulation(), pi gets passed in and
> processed as new fake numa nodes are being split out. Once the original
> memory region is proccessed, it gets removed from the pi by
> numa_remove_memblk_from() in emu_setup_memblk(). So entry 0 gets deleted
> and the rest of the entries get moved up. Therefore we should always pass
> in entry 0 for the next entry to process.
> 
> Fixes: 1f6a2c6d9f121 ("x86/numa_emulation: Introduce uniform split
> capability")
> 
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>

Ingo,
Is this ok to make 4.19-rc as a fix? Thanks!

> ---
> 
> V2:
> - Add comment for the code change (Dan)
> 
>  arch/x86/mm/numa_emulation.c |   12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
> index b54d52a2d00a..d71d72cf6c66 100644
> --- a/arch/x86/mm/numa_emulation.c
> +++ b/arch/x86/mm/numa_emulation.c
> @@ -400,9 +400,17 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
>  		n = simple_strtoul(emu_cmdline, &emu_cmdline, 0);
>  		ret = -1;
>  		for_each_node_mask(i, physnode_mask) {
> +			/*
> +			 * The reason we pass in blk[0] is due to
> +			 * numa_remove_memblk_from() called by
> +			 * emu_setup_memblk() will delete entry 0
> +			 * and then move everything else up in the pi.blk
> +			 * array. Therefore we should always be looking
> +			 * at blk[0].
> +			 */
>  			ret = split_nodes_size_interleave_uniform(&ei, &pi,
> -					pi.blk[i].start, pi.blk[i].end, 0,
> -					n, &pi.blk[i], nid);
> +					pi.blk[0].start, pi.blk[0].end, 0,
> +					n, &pi.blk[0], nid);
>  			if (ret < 0)
>  				break;
>  			if (ret < n) {
> 

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

end of thread, other threads:[~2018-10-09 16:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 18:12 [PATCH v2] x86/numa_emulation: fix parsing of numa_meminfo for uniform numa emulation Dave Jiang
2018-10-09 16:28 ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).