[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY4PR12MB16402B523C336338BC3667B1F84D0@CY4PR12MB1640.namprd12.prod.outlook.com>
Date: Wed, 1 Feb 2017 21:37:02 +0000
From: "Ghannam, Yazen" <Yazen.Ghannam@....com>
To: Borislav Petkov <bp@...en8.de>, x86-ml <x86@...nel.org>
CC: Yves Dionne <yves.dionne@...il.com>,
Brice Goglin <Brice.Goglin@...ia.fr>,
Peter Zijlstra <peterz@...radead.org>,
lkml <linux-kernel@...r.kernel.org>
Subject: RE: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID
> -----Original Message-----
> From: Borislav Petkov [mailto:bp@...en8.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
Powered by blists - more mailing lists