mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
numa: __node_distance() should return u8
SLIT values are byte-sized and some of them (0-9 and 255) have special meaning. Adjust __node_distance() to reflect this and modify scrub_heap_pages() and do_sysctl() to deal with __node_distance() returning an invalid SLIT entry. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
This commit is contained in:
1 parent
188e9c541f
commit
59edde9481
5 files changed
+21
-8
No files matched your search
+10
-3
@@ -496,14 +496,21 @@ static unsigned node_to_pxm(nodeid_t n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __node_distance(nodeid_t a, nodeid_t b)
|
||||
u8 __node_distance(nodeid_t a, nodeid_t b)
|
||||
{
|
||||
int index;
|
||||
unsigned index;
|
||||
u8 slit_val;
|
||||
|
||||
if (!acpi_slit)
|
||||
return a == b ? 10 : 20;
|
||||
index = acpi_slit->locality_count * node_to_pxm(a);
|
||||
return acpi_slit->entry[index + node_to_pxm(b)];
|
||||
slit_val = acpi_slit->entry[index + node_to_pxm(b)];
|
||||
|
||||
/* ACPI defines 0xff as an unreachable node and 0-9 are undefined */
|
||||
if ((slit_val == 0xff) || (slit_val <= 9))
|
||||
return NUMA_NO_DISTANCE;
|
||||
else
|
||||
return slit_val;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(__node_distance);
|
||||
@@ -1434,13 +1434,13 @@ void __init scrub_heap_pages(void)
|
||||
/* Figure out which NODE CPUs are close. */
|
||||
for_each_online_node ( j )
|
||||
{
|
||||
int distance;
|
||||
u8 distance;
|
||||
|
||||
if ( cpumask_empty(&node_to_cpumask(j)) )
|
||||
continue;
|
||||
|
||||
distance = __node_distance(i, j);
|
||||
if ( distance < last_distance )
|
||||
if ( (distance < last_distance) && (distance != NUMA_NO_DISTANCE) )
|
||||
{
|
||||
last_distance = distance;
|
||||
best_node = j;
|
||||
|
||||
+6
-1
@@ -304,7 +304,12 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
|
||||
{
|
||||
uint32_t distance = ~0u;
|
||||
if ( node_online(i) && node_online(j) )
|
||||
distance = __node_distance(i, j);
|
||||
{
|
||||
u8 d = __node_distance(i, j);
|
||||
|
||||
if ( d != NUMA_NO_DISTANCE )
|
||||
distance = d;
|
||||
}
|
||||
if ( copy_to_guest_offset(
|
||||
ni->node_to_node_distance,
|
||||
i*(max_node_index+1) + j, &distance, 1) )
|
||||
|
||||
@@ -85,6 +85,6 @@ extern int valid_numa_range(u64 start, u64 end, nodeid_t node);
|
||||
#endif
|
||||
|
||||
void srat_parse_regions(u64 addr);
|
||||
extern int __node_distance(nodeid_t a, nodeid_t b);
|
||||
extern u8 __node_distance(nodeid_t a, nodeid_t b);
|
||||
|
||||
#endif
|
||||
@@ -7,7 +7,8 @@
|
||||
#define NODES_SHIFT 0
|
||||
#endif
|
||||
|
||||
#define NUMA_NO_NODE 0xFF
|
||||
#define NUMA_NO_NODE 0xFF
|
||||
#define NUMA_NO_DISTANCE 0xFF
|
||||
|
||||
#define MAX_NUMNODES (1 << NODES_SHIFT)
|
||||
|
||||
|
||||