x86/srat: fix the end pfn check in valid_numa_range()
PATCH 1/1 x86/srat: fix the end pfn check in valid_numa_range()
... 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.
--- xen/arch/x86/srat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/srat.c +2 -2
@@ -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 ; }
Signature · 7 lines
2.14.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Haozhong Zhang
... and fix the coding style on fly.
valid_numa_range(..., epfn << PAGE_SHIFT, ...)and its only callermemory_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 invalid_numa_range(), since most of other places use the latter interpretation.Signed-off-by Haozhong Zhang <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 12.02.18 at 02:44, <[email protected]> wrote:
xen/arch/x86/srat.c int valid_numa_range(u64 start, u64 end, nodeid_t node) · line 117
Quoted 10 lines
xen/arch/x86/srat.c +2
-2@@ -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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel