From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Lin Ming <ming.m.lin@intel.com>
Cc: Borislav Petkov <bp@amd64.org>, Ingo Molnar <mingo@elte.hu>,
Andi Kleen <andi@firstfloor.org>,
Stephane Eranian <eranian@google.com>,
"Richter, Robert" <robert.richter@amd.com>,
lkml <linux-kernel@vger.kernel.org>,
Andreas Herrmann <andreas.herrmann3@amd.com>
Subject: Re: [PATCH 5/7] perf: Optimise topology iteration
Date: Wed, 05 Jan 2011 10:51:11 +0100 [thread overview]
Message-ID: <1294221071.2016.207.camel@laptop> (raw)
In-Reply-To: <1294205040.9261.4.camel@minggr.sh.intel.com>
On Wed, 2011-01-05 at 13:24 +0800, Lin Ming wrote:
> > > > + for_each_cpu(i, topology_core_cpumask(cpu)) {
> > > > nb = per_cpu(cpu_hw_events, i).amd_nb;
> > > > if (WARN_ON_ONCE(!nb))
> > > > continue;
> > >
> > > Borislav, is topology_core_cpumask() the right mask for northbridge_id
> > > span? I could imagine Magny-Cours would have all 12 cores in the
> > > core_cpumask() and have the node_mask() be half that.
> >
> > So, topology_core_cpumask() or cpu_core_mask() both are cpu_core_map
> > which represents the socket mask. I.e., on a multisocket cpu you'll have
> > in it all the cores on one socket. A 12-cores Magny-Cours contains two
> > internal northbridges and this mask will have 12 bits set.
> >
> > AFAICT, you want to iterate over the cores on a single node here
> > (an internal node in the Magny-Cours case) so for this we have the
> > llc_shared_map. See near the top of cache_shared_cpu_map_setup() in
> > <arch/x86/kernel/cpu/intel_cacheinfo.c> for an example.
>
> cpu_coregroup_mask() seems the right mask for northbridge_id span.
>
> arch/x86/kernel/smpboot.c:
>
> /* maps the cpu to the sched domain representing multi-core */
> const struct cpumask *cpu_coregroup_mask(int cpu)
> {
> struct cpuinfo_x86 *c = &cpu_data(cpu);
> /*
> * For perf, we return last level cache shared map.
> * And for power savings, we return cpu_core_map
> */
> if ((sched_mc_power_savings || sched_smt_power_savings) &&
> !(cpu_has(c, X86_FEATURE_AMD_DCM)))
> return cpu_core_mask(cpu);
> else
> return c->llc_shared_map;
> }
Argh, that function really must die, its the most horrible brain damage
around. Andreas promised he'd clean that up after making it worse for
Magny-Cours.
But yes, assuming all Magny-Cours have this AMD_DCM thing set, it seems
to return the right map.
prev parent reply other threads:[~2011-01-05 9:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-27 15:38 [PATCH 5/7] perf: Optimise topology iteration Lin Ming
2011-01-03 11:02 ` Peter Zijlstra
2011-01-03 15:20 ` Andi Kleen
2011-01-04 7:13 ` Lin Ming
2011-01-04 6:18 ` Lin Ming
2011-01-04 12:06 ` Peter Zijlstra
2011-01-04 14:22 ` Borislav Petkov
2011-01-05 5:24 ` Lin Ming
2011-01-05 9:51 ` Peter Zijlstra [this message]
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=1294221071.2016.207.camel@laptop \
--to=a.p.zijlstra@chello.nl \
--cc=andi@firstfloor.org \
--cc=andreas.herrmann3@amd.com \
--cc=bp@amd64.org \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.m.lin@intel.com \
--cc=mingo@elte.hu \
--cc=robert.richter@amd.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