[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


  • To: Jan Beulich <JBeulich@xxxxxxxx>
  • From: Juergen Gross <jgross@xxxxxxxx>
  • Date: Mon, 3 Sep 2018 17:11:08 +0200
  • Autocrypt: addr=jgross@xxxxxxxx; prefer-encrypt=mutual; keydata= xsBNBFOMcBYBCACgGjqjoGvbEouQZw/ToiBg9W98AlM2QHV+iNHsEs7kxWhKMjrioyspZKOB ycWxw3ie3j9uvg9EOB3aN4xiTv4qbnGiTr3oJhkB1gsb6ToJQZ8uxGq2kaV2KL9650I1SJve dYm8Of8Zd621lSmoKOwlNClALZNew72NjJLEzTalU1OdT7/i1TXkH09XSSI8mEQ/ouNcMvIJ NwQpd369y9bfIhWUiVXEK7MlRgUG6MvIj6Y3Am/BBLUVbDa4+gmzDC9ezlZkTZG2t14zWPvx XP3FAp2pkW0xqG7/377qptDmrk42GlSKN4z76ELnLxussxc7I2hx18NUcbP8+uty4bMxABEB AAHNHkp1ZXJnZW4gR3Jvc3MgPGpncm9zc0BzdXNlLmRlPsLAeQQTAQIAIwUCU4xw6wIbAwcL CQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJELDendYovxMvi4UH/Ri+OXlObzqMANruTd4N zmVBAZgx1VW6jLc8JZjQuJPSsd/a+bNr3BZeLV6lu4Pf1Yl2Log129EX1KWYiFFvPbIiq5M5 kOXTO8Eas4CaScCvAZ9jCMQCgK3pFqYgirwTgfwnPtxFxO/F3ZcS8jovza5khkSKL9JGq8Nk czDTruQ/oy0WUHdUr9uwEfiD9yPFOGqp4S6cISuzBMvaAiC5YGdUGXuPZKXLpnGSjkZswUzY d9BVSitRL5ldsQCg6GhDoEAeIhUC4SQnT9SOWkoDOSFRXZ+7+WIBGLiWMd+yKDdRG5RyP/8f 3tgGiB6cyuYfPDRGsELGjUaTUq3H2xZgIPfOwE0EU4xwFgEIAMsx+gDjgzAY4H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FC4hJ3YEetuRBURYPiGzuJXU pAd7a7BdsqWC4o+GTm5tnGrCyD+4gfDSpkOT53S/GNO07YkPkm/8J4OBoFfgSaCnQ1izwgJQ jIpcG2fPCI2/hxf2oqXPYbKr1v4Z1wthmoyUgGN0LPTIm+B5vdY82wI5qe9uN6UOGyTH2B3p hRQUWqCwu2sqkI3LLbTdrnyDZaixT2T0f4tyF5Lfs+Ha8xVMhIyzNb1byDI5FKCb
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wei.liu2@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 03 Sep 2018 15:11:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Openpgp: preference=signencrypt

On 03/09/18 17:07, Jan Beulich wrote:
>>>> On 03.09.18 at 16:52, <jgross@xxxxxxxx> wrote:
>> On 03/09/18 16:47, Jan Beulich wrote:
>>>>>> On 03.09.18 at 15:53, <jgross@xxxxxxxx> wrote:
>>>> On 03/09/18 15:46, Jan Beulich wrote:
>>>>>>>> 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 wasn't able to find the related information for AMD cpus. In case it
>>>> is in the specs it is hidden very well.
>>>
>>> What was used for compute units in Fam16 and earlier is used for
>>> hyperthreads in Fam17 (and going forward, from what iirc Brian
>>> has said).
>>
>> And what about hyperthreads in Fam16 and earlier? Or are "compute units"
>> just another name for the threads and I can rename that field?
> 
> When there are compute units, there are no threads. But the difference
> is more than just the names, so folding the fields is not a good idea imo.

So another flag and display the column title accordingly?

I'd put thread and compute unit in a union then.


Juergen


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