From: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
To: Borislav Petkov <bp@alien8.de>, x86-ml <x86@kernel.org>
Cc: Yves Dionne <yves.dionne@gmail.com>,
Brice Goglin <Brice.Goglin@inria.fr>,
Peter Zijlstra <peterz@infradead.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: RE: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID
Date: Wed, 1 Feb 2017 21:37:02 +0000 [thread overview]
Message-ID: <CY4PR12MB16402B523C336338BC3667B1F84D0@CY4PR12MB1640.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20170201200237.36s2jwjgxi24we66@pd.tnic>
> -----Original Message-----
> From: Borislav Petkov [mailto:bp@alien8.de]
> Sent: Wednesday, February 1, 2017 3:03 PM
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 548da5a8013e..f06fa338076b 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -433,9 +433,13 @@ static bool match_smt(struct cpuinfo_x86 *c, struct
> cpuinfo_x86 *o)
> int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
>
> if (c->phys_proc_id == o->phys_proc_id &&
> - per_cpu(cpu_llc_id, cpu1) == per_cpu(cpu_llc_id, cpu2) &&
> - c->cpu_core_id == o->cpu_core_id)
> - return topology_sane(c, o, "smt");
> + per_cpu(cpu_llc_id, cpu1) == per_cpu(cpu_llc_id, cpu2)) {
> + if (c->cpu_core_id == o->cpu_core_id)
> + return topology_sane(c, o, "smt");
> +
> + if (c->cu_id == o->cu_id)
> + return topology_sane(c, o, "smt");
> + }
>
This hunk won't work for SMT enabled systems. It'll cause all threads under
an LLC to be considered SMT siblings. For example, threads 0 &2 will have
different cpu_core_id, so the first check will fail. But it'll match on the
second check since cu_id will be initialized to 0.
To get around this we can set cu_id for all TOPOEXT systems, and update
cpu_core_id, etc. for SMT enabled systems. This way we can just change
cpu_core_id to cu_id in match_smt().
I tested this patch, with the above changes, on a Fam17h SMT enabled
system. I'll test with SMT disabled and also on a fully-loaded Fam15h
system soon.
Thanks,
Yazen
next prev parent reply other threads:[~2017-02-01 21:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 20:02 [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov
2017-02-01 21:37 ` Ghannam, Yazen [this message]
2017-02-01 21:44 ` Borislav Petkov
2017-02-01 21:55 ` Ghannam, Yazen
2017-02-01 22:25 ` Borislav Petkov
2017-02-01 22:41 ` Borislav Petkov
2017-02-02 12:10 ` Borislav Petkov
2017-02-02 15:43 ` Borislav Petkov
2017-02-02 16:09 ` Ingo Molnar
2017-02-02 17:04 ` Borislav Petkov
2017-02-02 18:10 ` Borislav Petkov
2017-02-02 20:45 ` Ghannam, Yazen
2017-02-02 16:14 ` Ghannam, Yazen
2017-02-02 16:29 ` Ingo Molnar
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=CY4PR12MB16402B523C336338BC3667B1F84D0@CY4PR12MB1640.namprd12.prod.outlook.com \
--to=yazen.ghannam@amd.com \
--cc=Brice.Goglin@inria.fr \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
--cc=yves.dionne@gmail.com \
/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 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).