Skip to contentSkip to conversation

x86: implement cpu_possible_map

PATCH In review Roger Pau Monne 2 participants 2 messages Dec 28, 2017 – Jan 2, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86: implement cpu_possible_map

On x86 cpu_possible_map is not defined, so trying to use num_possible_cpus will generate link time errors.

This patch defines and fills cpu_possible_map with the current CPUs plus the hotpluggable ones.

Note that this is already implemented on ARM.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
---
Changes since v1:
- Use unlocked cpumask operations.

---
 xen/arch/x86/setup.c | 4 ++++
 1 file changed, 4 insertions(+)
xen/arch/x86/setup.c +4 -0
index 99f5d61eb8..bd6d8d0da6 100644
@@ -86,6 +86,7 @@ size_param("highmem-start", highmem_start);
 #endif
 
 cpumask_t __read_mostly cpu_present_map;
+cpumask_t __read_mostly cpu_possible_map;
 
 unsigned long __read_mostly xen_phys_start;
 
@@ -1474,11 +1475,14 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     {
         max_cpus = 0;
         set_nr_cpu_ids(1);
+        __cpumask_set_cpu(0, &cpu_possible_map);
     }
     else
     {
         set_nr_cpu_ids(max_cpus);
         max_cpus = nr_cpu_ids;
+        for ( i = 0; i < nr_cpu_ids; i++ )
+            __cpumask_set_cpu(i, &cpu_possible_map);
     }
 
     /* Low mappings were only needed for some BIOS table parsing. */
Signature · 7 lines
2.15.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 28.12.17 at 18:25, <[email protected]> wrote:

On x86 cpu_possible_map is not defined, so trying to use num_possible_cpus will generate link time errors.

I think this makes sense only in connection with a patch actually requiring the symbol. The variable isn't there on x86 (anymore iirc) for the very reason that the last user has long gone.

xen/arch/x86/setup.c void __init noreturn __start_xen(unsigned long mbi_p) · line 1486

Quoted 13 lines
xen/arch/x86/setup.c +3 -0
@@ -1474,11 +1475,14 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     {
         max_cpus = 0;
         set_nr_cpu_ids(1);
+        __cpumask_set_cpu(0, &cpu_possible_map);
     }
     else
     {
         set_nr_cpu_ids(max_cpus);
         max_cpus = nr_cpu_ids;
+        for ( i = 0; i < nr_cpu_ids; i++ )
+            __cpumask_set_cpu(i, &cpu_possible_map);
     }

Considering this - why can't you use nr_cpu_ids instead of num_possible_cpus?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel