All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/srat: fix the end pfn check in valid_numa_range()
@ 2018-02-12  1:44 Haozhong Zhang
  2018-02-12 10:32 ` Andrew Cooper
  2018-02-13 10:41 ` Jan Beulich
  0 siblings, 2 replies; 3+ messages in thread
From: Haozhong Zhang @ 2018-02-12  1:44 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Haozhong Zhang

... and fix the coding style on fly.

valid_numa_range(..., epfn << PAGE_SHIFT, ...) and its only caller
memory_add(..., epfn, pxm) interpret epfn inconsistently. The former
interprets epfn as the last pfn, while the latter interprets it as the
last pfn plus one. Fix this inconsistency in valid_numa_range(), since
most of other places use the latter interpretation.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
 xen/arch/x86/srat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index 528ec7181a..49d04b887b 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -110,8 +110,8 @@ int valid_numa_range(u64 start, u64 end, nodeid_t node)
 	for (i = 0; i < num_node_memblks; i++) {
 		struct node *nd = &node_memblk_range[i];
 
-		if (nd->start <= start && nd->end > end &&
-			memblk_nodeid[i] == node )
+		if (nd->start <= start && nd->end >= end &&
+			memblk_nodeid[i] == node)
 			return 1;
 	}
 
-- 
2.14.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] x86/srat: fix the end pfn check in valid_numa_range()
  2018-02-12  1:44 [PATCH] x86/srat: fix the end pfn check in valid_numa_range() Haozhong Zhang
@ 2018-02-12 10:32 ` Andrew Cooper
  2018-02-13 10:41 ` Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2018-02-12 10:32 UTC (permalink / raw)
  To: Haozhong Zhang, xen-devel; +Cc: Jan Beulich

On 12/02/18 01:44, Haozhong Zhang wrote:
> ... and fix the coding style on fly.
>
> valid_numa_range(..., epfn << PAGE_SHIFT, ...) and its only caller
> memory_add(..., epfn, pxm) interpret epfn inconsistently. The former
> interprets epfn as the last pfn, while the latter interprets it as the
> last pfn plus one. Fix this inconsistency in valid_numa_range(), since
> most of other places use the latter interpretation.
>
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>

Acked-by: Andrew Cooper <andrew.cooper@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] x86/srat: fix the end pfn check in valid_numa_range()
  2018-02-12  1:44 [PATCH] x86/srat: fix the end pfn check in valid_numa_range() Haozhong Zhang
  2018-02-12 10:32 ` Andrew Cooper
@ 2018-02-13 10:41 ` Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2018-02-13 10:41 UTC (permalink / raw)
  To: Haozhong Zhang; +Cc: Andrew Cooper, xen-devel

>>> On 12.02.18 at 02:44, <haozhong.zhang@intel.com> wrote:
> --- a/xen/arch/x86/srat.c
> +++ b/xen/arch/x86/srat.c
> @@ -110,8 +110,8 @@ int valid_numa_range(u64 start, u64 end, nodeid_t node)
>  	for (i = 0; i < num_node_memblks; i++) {
>  		struct node *nd = &node_memblk_range[i];
>  
> -		if (nd->start <= start && nd->end > end &&
> -			memblk_nodeid[i] == node )
> +		if (nd->start <= start && nd->end >= end &&
> +			memblk_nodeid[i] == node)
>  			return 1;
>  	}
>  

You also should have fixed the indentation issue on the second
line of the if().

There looks to be a similar issue in nodes_cover_memory(), and I
think it would be rather desirable if a change here dealt with all
such issues rather than just picking one. Anyway - I'll produce a
patch for this second issue.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2018-02-13 10:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12  1:44 [PATCH] x86/srat: fix the end pfn check in valid_numa_range() Haozhong Zhang
2018-02-12 10:32 ` Andrew Cooper
2018-02-13 10:41 ` Jan Beulich

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.