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

Re: [Xen-devel] [PATCH 1/2] add cpu_thread_id to struct cpuinfo_x86



>>> On 31.08.18 at 18:22, <jgross@xxxxxxxx> wrote:
> Add the thread-id to the cpu config data and an accessor macro
> cpu_to_thread().
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> ---
>  xen/arch/x86/cpu/common.c       |  1 +
>  xen/arch/x86/smpboot.c          | 10 ++++++++++
>  xen/include/asm-arm/processor.h |  1 +
>  xen/include/asm-x86/processor.h |  2 ++
>  xen/include/public/sysctl.h     |  1 +
>  5 files changed, 15 insertions(+)
> 
> diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
> index 057859ab14..f626a6a510 100644
> --- a/xen/arch/x86/cpu/common.c
> +++ b/xen/arch/x86/cpu/common.c
> @@ -434,6 +434,7 @@ void identify_cpu(struct cpuinfo_x86 *c)
>       c->phys_proc_id = XEN_INVALID_SOCKET_ID;
>       c->cpu_core_id = XEN_INVALID_CORE_ID;
>       c->compute_unit_id = INVALID_CUID;
> +     c->cpu_thread_id = XEN_INVALID_THREAD_ID;
>       memset(&c->x86_capability, 0, sizeof c->x86_capability);
>  
>       generic_identify(c);
> diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
> index 7e76cc3d68..2c6a40c543 100644
> --- a/xen/arch/x86/smpboot.c
> +++ b/xen/arch/x86/smpboot.c
> @@ -247,6 +247,8 @@ static void set_cpu_sibling_map(unsigned int cpu)
>      cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
>      cpumask_set_cpu(cpu, per_cpu(cpu_sibling_mask, cpu));
>  
> +    c[cpu].cpu_thread_id = 0;
> +
>      if ( c[cpu].x86_num_siblings > 1 )
>      {
>          for_each_cpu ( i, &cpu_sibling_setup_map )
> @@ -270,6 +272,14 @@ static void set_cpu_sibling_map(unsigned int cpu)
>                         "CPU%u: unclear relationship with CPU%u\n",
>                         cpu, i);
>          }
> +
> +        for_each_cpu ( i, per_cpu(cpu_sibling_mask, cpu) )
> +        {
> +            if ( cpu == i )
> +                break;
> +            c[cpu].cpu_thread_id++;

No. This wants doing alongside setting of the other similar fields,
i.e. in (at least) detect_extended_topology() and detect_ht(). It
is the hardware which tells us what the thread ID is.

I think you also want to reset the new field in cpu_smpboot_free().

Jan



_______________________________________________
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®.