[PATCH] numa_node_to_proximity_domain_info should cope with NUMA_NO_NODE

From: Wei Liu
Date: Wed Jun 30 2021 - 07:08:31 EST


Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx>
---
include/asm-generic/mshyperv.h | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
index d9b91b8f63c8..44552b7a02ef 100644
--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -31,10 +31,14 @@ numa_node_to_proximity_domain_info(int node)
{
union hv_proximity_domain_info proximity_domain_info;

- proximity_domain_info.domain_id = node_to_pxm(node);
- proximity_domain_info.flags.reserved = 0;
- proximity_domain_info.flags.proximity_info_valid = 1;
- proximity_domain_info.flags.proximity_preferred = 1;
+ proximity_domain_info.as_uint64 = 0;
+
+ if (node != NUMA_NO_NODE) {
+ proximity_domain_info.domain_id = node_to_pxm(node);
+ proximity_domain_info.flags.reserved = 0;
+ proximity_domain_info.flags.proximity_info_valid = 1;
+ proximity_domain_info.flags.proximity_preferred = 1;
+ }

return proximity_domain_info;
}
--
2.30.2


[...]
> +int
> +hv_call_connect_port(u64 port_partition_id, union hv_port_id port_id,
> + u64 connection_partition_id,
> + union hv_connection_id connection_id,
> + struct hv_connection_info *connection_info,
> + u8 connection_vtl, int node)
> +{
> + struct hv_connect_port *input;
> + unsigned long flags;
> + int ret = 0, status;
> +
> + do {
> + local_irq_save(flags);
> + input = (struct hv_connect_port *)(*this_cpu_ptr(
> + hyperv_pcpu_input_arg));
> + memset(input, 0, sizeof(*input));
> + input->port_partition_id = port_partition_id;
> + input->port_id = port_id;
> + input->connection_partition_id = connection_partition_id;
> + input->connection_id = connection_id;
> + input->connection_info = *connection_info;
> + input->connection_vtl = connection_vtl;
> + input->proximity_domain_info =
> + numa_node_to_proximity_domain_info(node);

Here...