xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] x86: implement cpu_possible_map
@ 2017-12-28 17:25 Roger Pau Monne
  2018-01-02  9:45 ` Jan Beulich
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Pau Monne @ 2017-12-28 17:25 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Roger Pau Monne

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.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v1:
 - Use unlocked cpumask operations.
---
 xen/arch/x86/setup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 99f5d61eb8..bd6d8d0da6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -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. */
-- 
2.15.1


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

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

* Re: [PATCH v2] x86: implement cpu_possible_map
  2017-12-28 17:25 [PATCH v2] x86: implement cpu_possible_map Roger Pau Monne
@ 2018-01-02  9:45 ` Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2018-01-02  9:45 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: Andrew Cooper, xen-devel

>>> On 28.12.17 at 18:25, <roger.pau@citrix.com> 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.

> @@ -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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2018-01-02  9:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-28 17:25 [PATCH v2] x86: implement cpu_possible_map Roger Pau Monne
2018-01-02  9:45 ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).