From: Kanaka Juvva <kanaka.d.juvva@linux.intel.com>
To: kanaka.d.juvva@intel.com, glenn.p.williamson@intel.com,
matt.fleming@intel.com, will.auld@intel.com, andi@firstfloor.org,
ananth.s.narayan@intel.com, linux-kernel@vger.kernel.org,
andrew.j.herdrich@intel.com, tony.luck@intel.com,
peterz@infradead.org, tglx@linutronix.de, x86@kernel.org,
mingo@redhat.com, hpa@zytor.com, luto@amacapital.net,
dvlasenk@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
peter.p.waskiewicz.jr@intel.com, imammedo@redhat.com, bp@suse.de,
ross.zwisler@linux.intel.com, jacob.w.shin@gmail.com,
dirk.j.brandewie@intel.com, vikas.shivappa@intel.com,
edwin.verplanke@intel.com, tomasz.kantecki@intel.com
Subject: [PATCH v1 2/2] x86, perf,cqm: handle CPU hotplug
Date: Thu, 18 Jun 2015 11:49:29 -0700 [thread overview]
Message-ID: <1434653369-5162-1-git-send-email-kanaka.d.juvva@linux.intel.com> (raw)
Added lock in event reader function. The cqm_pick_event_reader() function
accesses cqm_cpumask and it is critical section between this and
cqm_stable().
This situation is true when a CPU is hotplugged. Mutex is used to protect
the critical section.
Signed-off-by: Kanaka Juvva <kanaka.d.juvva@linux.intel.com>
---
arch/x86/kernel/cpu/perf_event_intel_cqm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_cqm.c b/arch/x86/kernel/cpu/perf_event_intel_cqm.c
index 1880761..e17e37f 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_cqm.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_cqm.c
@@ -1239,12 +1239,15 @@ static inline void cqm_pick_event_reader(int cpu)
int phys_id = topology_physical_package_id(cpu);
int i;
+ mutex_lock(&cache_mutex);
for_each_cpu(i, &cqm_cpumask) {
if (phys_id == topology_physical_package_id(i))
- return; /* already got reader for this socket */
+ goto out; /* already got reader for this socket */
}
cpumask_set_cpu(cpu, &cqm_cpumask);
+out:
+ mutex_unlock(&cache_mutex);
}
static void intel_cqm_cpu_prepare(unsigned int cpu)
--
2.1.0
next reply other threads:[~2015-06-18 18:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-18 18:49 Kanaka Juvva [this message]
2015-06-18 19:47 ` Thomas Gleixner
2015-06-18 20:00 ` Dave Hansen
2015-06-18 20:09 ` Thomas Gleixner
2015-06-23 20:32 ` Vikas Shivappa
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=1434653369-5162-1-git-send-email-kanaka.d.juvva@linux.intel.com \
--to=kanaka.d.juvva@linux.intel.com \
--cc=ananth.s.narayan@intel.com \
--cc=andi@firstfloor.org \
--cc=andrew.j.herdrich@intel.com \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=dave.hansen@linux.intel.com \
--cc=dirk.j.brandewie@intel.com \
--cc=dvlasenk@redhat.com \
--cc=edwin.verplanke@intel.com \
--cc=glenn.p.williamson@intel.com \
--cc=hpa@zytor.com \
--cc=imammedo@redhat.com \
--cc=jacob.w.shin@gmail.com \
--cc=kanaka.d.juvva@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=matt.fleming@intel.com \
--cc=mingo@redhat.com \
--cc=peter.p.waskiewicz.jr@intel.com \
--cc=peterz@infradead.org \
--cc=ross.zwisler@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=tomasz.kantecki@intel.com \
--cc=tony.luck@intel.com \
--cc=vikas.shivappa@intel.com \
--cc=will.auld@intel.com \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®