All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Juergen Gross <jgross@suse.com>, Jan Beulich <JBeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Tim Deegan <tim@xen.org>, Ian Jackson <Ian.Jackson@eu.citrix.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 1/2] add cpu_thread_id to struct cpuinfo_x86
Date: Mon, 3 Sep 2018 16:07:59 +0100	[thread overview]
Message-ID: <f15ef3ca-1a87-0633-14f6-8afa392041e9@citrix.com> (raw)
In-Reply-To: <a43cb3dc-e3a2-?= =?UTF-8?Q?8ac5-a429-2b9be4fd324f@suse.com>

On 03/09/18 15:52, Juergen Gross wrote:
> On 03/09/18 16:47, Jan Beulich wrote:
>>>>> On 03.09.18 at 15:53, <jgross@suse.com> wrote:
>>> On 03/09/18 15:46, Jan Beulich wrote:
>>>>>>> On 31.08.18 at 18:22, <jgross@suse.com> wrote:
>>>>> Add the thread-id to the cpu config data and an accessor macro
>>>>> cpu_to_thread().
>>>>>
>>>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>>>> ---
>>>>>  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?

Fam 15/16 "Compute Units" are complicated.

The have a shared L1 I$, fetch and branch prediction, separate integer
pipelines, but a shared FPU pipeline.

Half of the pipeline looks very much like threads, and half looks like
separate cores.

~Andrew

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

  parent reply	other threads:[~2018-09-03 15:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180831162215.23318=ef=bf=bd1=ef=bf=bdjgross@suse.co?= =?UTF-8?Q?m>
     [not found] ` <20180831162215.23318=ef=bf=bd2=ef=bf=bdjgross@suse.com>
     [not found]   ` <5B8D?= =?UTF-8?Q?3B2702000078001E4A27@suse.com>
     [not found]     ` <412351d9-d3c6-81c6-e754-83180345a?= =?UTF-8?Q?ea7@suse.com>
     [not found]       ` <5B8D499202000078001E4AE3@suse.com>
2018-09-03 14:52         ` [PATCH 1/2] add cpu_thread_id to struct cpuinfo_x86 Juergen Gross
     [not found]           ` <5B8D4E2202000078001E4B4D@suse.com>
2018-09-03 15:07           ` Jan Beulich
     [not found]           ` <?= =?UTF-8?Q?5B8D4E2202000078001E4B4D@suse.com>
2018-09-03 15:11             ` Juergen Gross
2018-09-03 15:14               ` Jan Beulich
     [not found]         ` <a43cb3dc-e3a2-?= =?UTF-8?Q?8ac5-a429-2b9be4fd324f@suse.com>
2018-09-03 15:07           ` Andrew Cooper [this message]
2018-08-31 16:22 [PATCH 0/2] add thread id and online state to cpu topology info Juergen Gross
2018-08-31 16:22 ` [PATCH 1/2] add cpu_thread_id to struct cpuinfo_x86 Juergen Gross
2018-09-03 13:46   ` Jan Beulich
     [not found]   ` <5B8D3B2702000078001E4A27@suse.com>
2018-09-03 13:53     ` Juergen Gross
2018-09-03 14:47       ` Jan Beulich
2018-08-31 16:22 ` [PATCH 2/2] add thread and state info to XEN_SYSCTL_cputopoinfo Juergen Gross
2018-09-03 13:49   ` Jan Beulich
     [not found]   ` <5B8D3BCF02000078001E4A3B@suse.com>
2018-09-03 13:54     ` Juergen Gross
     [not found] <412351d9=ef=bf=bdd3c6=ef=bf=bd81c6?= =?UTF-8?Q?=ef=bf=bde754=ef=bf=bd83180345aea7@suse.com>
     [not found] <20180831162215.23318*1*jgross@suse.com>
     [not found] <20180831162215.23318****1****jgross@suse.com>

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f15ef3ca-1a87-0633-14f6-8afa392041e9@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.