Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1571194
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Thomas Gleixner <tglx@linutronix.de> |
| Newsgroups | linux.kernel |
| Subject | [patch 2/3] perf/x86/intel/uncore: Cleanup hotplug conversion fallout |
| Date | Wed, 01 Feb 2017 00:10:01 +0100 |
| Message-ID | <t5PIJ-6HT-1@gated-at.bofh.it> (permalink) |
| References | <t5PIJ-6HT-3@gated-at.bofh.it> |
| User-Agent | quilt/0.63-1 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-15 |
| Content-Disposition | inline; filename=perf-x86-intel-uncore--Cleanup-hotplug-conversion-fallout.patch |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 109 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | x86@kernel.org, Peter Zijlstra <peterz@infradead.org>, Sebastian Siewior <bigeasy@linutronix.de>, Yasuaki Ishimatsu <yasu.isimatu@gmail.com> |
| X-Original-Date | Tue, 31 Jan 2017 23:58:39 +0100 |
| X-Original-Message-ID | <20170131230141.298032324@linutronix.de> |
| X-Original-References | <20170131225837.646254998@linutronix.de> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1571194 |
Show key headers only | View raw
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.
Fixes: 1a246b9f58c6 ("perf/x86/intel/uncore: Convert to hotplug state machine")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/events/intel/uncore.c | 44 +++--------------------------------------
1 file changed, 4 insertions(+), 40 deletions(-)
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -764,30 +764,6 @@ static void uncore_pmu_unregister(struct
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
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
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;
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[patch 2/3] perf/x86/intel/uncore: Cleanup hotplug conversion fallout Thomas Gleixner <tglx@linutronix.de> - 2017-02-01 00:10 +0100 [tip:perf/urgent] perf/x86/intel/uncore: Clean up hotplug conversion fallout tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-02-01 10:50 +0100
csiph-web