Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "Misc fixes: PMU driver corner cases, tooling fixes, and an 'AUX' (Intel PT) race related core fix" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/intel/cqm: Do not access cpu_data() from CPU_UP_PREPARE handler perf/x86/intel: Fix memory leak on hot-plug allocation fail perf: Fix PERF_EVENT_IOC_PERIOD migration race perf: Fix double-free of the AUX buffer perf: Fix fasync handling on inherited events perf tools: Fix test build error when bindir contains double slash perf stat: Fix transaction lenght metrics perf: Fix running time accounting
This commit is contained in:
@@ -2534,7 +2534,7 @@ static int intel_pmu_cpu_prepare(int cpu)
|
||||
if (x86_pmu.extra_regs || x86_pmu.lbr_sel_map) {
|
||||
cpuc->shared_regs = allocate_shared_regs(cpu);
|
||||
if (!cpuc->shared_regs)
|
||||
return NOTIFY_BAD;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) {
|
||||
@@ -2542,18 +2542,27 @@ static int intel_pmu_cpu_prepare(int cpu)
|
||||
|
||||
cpuc->constraint_list = kzalloc(sz, GFP_KERNEL);
|
||||
if (!cpuc->constraint_list)
|
||||
return NOTIFY_BAD;
|
||||
goto err_shared_regs;
|
||||
|
||||
cpuc->excl_cntrs = allocate_excl_cntrs(cpu);
|
||||
if (!cpuc->excl_cntrs) {
|
||||
kfree(cpuc->constraint_list);
|
||||
kfree(cpuc->shared_regs);
|
||||
return NOTIFY_BAD;
|
||||
}
|
||||
if (!cpuc->excl_cntrs)
|
||||
goto err_constraint_list;
|
||||
|
||||
cpuc->excl_thread_id = 0;
|
||||
}
|
||||
|
||||
return NOTIFY_OK;
|
||||
|
||||
err_constraint_list:
|
||||
kfree(cpuc->constraint_list);
|
||||
cpuc->constraint_list = NULL;
|
||||
|
||||
err_shared_regs:
|
||||
kfree(cpuc->shared_regs);
|
||||
cpuc->shared_regs = NULL;
|
||||
|
||||
err:
|
||||
return NOTIFY_BAD;
|
||||
}
|
||||
|
||||
static void intel_pmu_cpu_starting(int cpu)
|
||||
|
@@ -1255,7 +1255,7 @@ static inline void cqm_pick_event_reader(int cpu)
|
||||
cpumask_set_cpu(cpu, &cqm_cpumask);
|
||||
}
|
||||
|
||||
static void intel_cqm_cpu_prepare(unsigned int cpu)
|
||||
static void intel_cqm_cpu_starting(unsigned int cpu)
|
||||
{
|
||||
struct intel_pqr_state *state = &per_cpu(pqr_state, cpu);
|
||||
struct cpuinfo_x86 *c = &cpu_data(cpu);
|
||||
@@ -1296,13 +1296,11 @@ static int intel_cqm_cpu_notifier(struct notifier_block *nb,
|
||||
unsigned int cpu = (unsigned long)hcpu;
|
||||
|
||||
switch (action & ~CPU_TASKS_FROZEN) {
|
||||
case CPU_UP_PREPARE:
|
||||
intel_cqm_cpu_prepare(cpu);
|
||||
break;
|
||||
case CPU_DOWN_PREPARE:
|
||||
intel_cqm_cpu_exit(cpu);
|
||||
break;
|
||||
case CPU_STARTING:
|
||||
intel_cqm_cpu_starting(cpu);
|
||||
cqm_pick_event_reader(cpu);
|
||||
break;
|
||||
}
|
||||
@@ -1373,7 +1371,7 @@ static int __init intel_cqm_init(void)
|
||||
goto out;
|
||||
|
||||
for_each_online_cpu(i) {
|
||||
intel_cqm_cpu_prepare(i);
|
||||
intel_cqm_cpu_starting(i);
|
||||
cqm_pick_event_reader(i);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user