[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86: implement cpu_possible_map



On Thu, Dec 28, 2017 at 02:41:57PM +0000, Andrew Cooper wrote:
> On 28/12/17 14:33, Roger Pau Monne wrote:
> > 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@xxxxxxxxxx>
> > ---
> > Cc: Jan Beulich <jbeulich@xxxxxxxx>
> > Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> > ---
> >  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..d62d232f46 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);
> 
> There are no concurrency issues, so you can use __cpumask_set_cpu().
> 
> However, bitmap_fill(... , nr_cpu_ids) would be far more efficient.

I would rather use the unlocked version of the cpumask operation,
using bitmap directly seems like a layering violation.

> Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Thanks, Roger.

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.