From: tip-bot for Thomas Gleixner <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: yasu.isimatu@gmail.com, jolsa@redhat.com, eranian@google.com,
peterz@infradead.org, alexander.shishkin@linux.intel.com,
mingo@kernel.org, bigeasy@linutronix.de,
vincent.weaver@maine.edu, linux-kernel@vger.kernel.org,
hpa@zytor.com, acme@redhat.com, tglx@linutronix.de,
torvalds@linux-foundation.org
Subject: [tip:perf/urgent] perf/x86/intel/uncore: Clean up hotplug conversion fallout
Date: Wed, 1 Feb 2017 01:43:38 -0800 [thread overview]
Message-ID: <tip-1aa6cfd33df492939b0be15ebdbcff1f8ae5ddb6@git.kernel.org> (raw)
In-Reply-To: <20170131230141.298032324@linutronix.de>
Commit-ID: 1aa6cfd33df492939b0be15ebdbcff1f8ae5ddb6
Gitweb: http://git.kernel.org/tip/1aa6cfd33df492939b0be15ebdbcff1f8ae5ddb6
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 31 Jan 2017 23:58:39 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 1 Feb 2017 08:37:27 +0100
perf/x86/intel/uncore: Clean up hotplug conversion fallout
The recent conversion to the hotplug state machine kept two mechanisms from
the original code:
1) The first_init logic which adds the number of online CPUs in a package
to the refcount. That's wrong because the callbacks are executed for
all online CPUs.
Remove it so the refcounting is correct.
2) The on_each_cpu() call to undo box->init() in the error handling
path. That's bogus because when the prepare callback fails no box has
been initialized yet.
Remove it.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Stephane Eranian <eranian@google.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
Fixes: 1a246b9f58c6 ("perf/x86/intel/uncore: Convert to hotplug state machine")
Link: http://lkml.kernel.org/r/20170131230141.298032324@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/events/intel/uncore.c | 44 ++++--------------------------------------
1 file changed, 4 insertions(+), 40 deletions(-)
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index 8c4ccdc..56c5235 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -764,30 +764,6 @@ static void uncore_pmu_unregister(struct intel_uncore_pmu *pmu)
pmu->registered = false;
}
-static void __uncore_exit_boxes(struct intel_uncore_type *type, int cpu)
-{
- struct intel_uncore_pmu *pmu = type->pmus;
- struct intel_uncore_box *box;
- int i, pkg;
-
- if (pmu) {
- pkg = topology_physical_package_id(cpu);
- for (i = 0; i < type->num_boxes; i++, pmu++) {
- box = pmu->boxes[pkg];
- if (box)
- uncore_box_exit(box);
- }
- }
-}
-
-static void uncore_exit_boxes(void *dummy)
-{
- struct intel_uncore_type **types;
-
- for (types = uncore_msr_uncores; *types; types++)
- __uncore_exit_boxes(*types++, smp_processor_id());
-}
-
static void uncore_free_boxes(struct intel_uncore_pmu *pmu)
{
int pkg;
@@ -1078,22 +1054,12 @@ static int uncore_cpu_dying(unsigned int cpu)
return 0;
}
-static int first_init;
-
static int uncore_cpu_starting(unsigned int cpu)
{
struct intel_uncore_type *type, **types = uncore_msr_uncores;
struct intel_uncore_pmu *pmu;
struct intel_uncore_box *box;
- int i, pkg, ncpus = 1;
-
- if (first_init) {
- /*
- * On init we get the number of online cpus in the package
- * and set refcount for all of them.
- */
- ncpus = cpumask_weight(topology_core_cpumask(cpu));
- }
+ int i, pkg;
pkg = topology_logical_package_id(cpu);
for (; *types; types++) {
@@ -1104,7 +1070,7 @@ static int uncore_cpu_starting(unsigned int cpu)
if (!box)
continue;
/* The first cpu on a package activates the box */
- if (atomic_add_return(ncpus, &box->refcnt) == ncpus)
+ if (atomic_inc_return(&box->refcnt) == 1)
uncore_box_init(box);
}
}
@@ -1408,19 +1374,17 @@ static int __init intel_uncore_init(void)
"perf/x86/intel/uncore:prepare",
uncore_cpu_prepare, NULL);
}
- first_init = 1;
+
cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_STARTING,
"perf/x86/uncore:starting",
uncore_cpu_starting, uncore_cpu_dying);
- first_init = 0;
+
cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE,
"perf/x86/uncore:online",
uncore_event_cpu_online, uncore_event_cpu_offline);
return 0;
err:
- /* Undo box->init_box() */
- on_each_cpu_mask(&uncore_cpu_mask, uncore_exit_boxes, NULL, 1);
uncore_types_exit(uncore_msr_uncores);
uncore_pci_exit();
return ret;
next prev parent reply other threads:[~2017-02-01 9:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-31 22:58 [patch 0/3] perf/x86/intel: Fix RAPL and UNCORE hotplug issues Thomas Gleixner
2017-01-31 22:58 ` [patch 1/3] perf/x86/intel/rapl: Make package handling more robust Thomas Gleixner
2017-02-01 9:43 ` [tip:perf/urgent] " tip-bot for Thomas Gleixner
2017-01-31 22:58 ` [patch 2/3] perf/x86/intel/uncore: Cleanup hotplug conversion fallout Thomas Gleixner
2017-02-01 9:43 ` tip-bot for Thomas Gleixner [this message]
2017-01-31 22:58 ` [patch 3/3] perf/x86/intel/uncore: Make package handling more robust Thomas Gleixner
2017-02-01 9:44 ` [tip:perf/urgent] " tip-bot for Thomas Gleixner
2017-02-01 19:52 ` [patch 0/3] perf/x86/intel: Fix RAPL and UNCORE hotplug issues Yasuaki Ishimatsu
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=tip-1aa6cfd33df492939b0be15ebdbcff1f8ae5ddb6@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=vincent.weaver@maine.edu \
--cc=yasu.isimatu@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