Skip to content

Commit 82b23cb

Browse files
committed
Merge branches 'perf-urgent-for-linus', 'smp-urgent-for-linus' and 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf, cpu hotplug and timer fixes from Ingo Molnar: "perf: - A single tooling fix for a user-triggerable segfault. CPU hotplug: - Fix a CPU hotplug corner case regression, introduced by the recent hotplug rework timers: - Fix a boot hang in the ARM based Tango SoC clocksource driver" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf intel-pt: Fix segfault tracing transactions * 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: cpu/hotplug: Fix rollback during error-out in __cpu_disable() * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource/drivers/tango-xtal: Fix boot hang due to incorrect test
4 parents 0e11d25 + a19cad6 + 3b9d6da + 16eeed7 commit 82b23cb

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

drivers/clocksource/tango_xtal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void __init tango_clocksource_init(struct device_node *np)
4242

4343
ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350,
4444
32, clocksource_mmio_readl_up);
45-
if (!ret) {
45+
if (ret) {
4646
pr_err("%s: registration failed\n", np->full_name);
4747
return;
4848
}

kernel/cpu.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* @target: The target state
3737
* @thread: Pointer to the hotplug thread
3838
* @should_run: Thread should execute
39+
* @rollback: Perform a rollback
3940
* @cb_stat: The state for a single callback (install/uninstall)
4041
* @cb: Single callback function (install/uninstall)
4142
* @result: Result of the operation
@@ -47,6 +48,7 @@ struct cpuhp_cpu_state {
4748
#ifdef CONFIG_SMP
4849
struct task_struct *thread;
4950
bool should_run;
51+
bool rollback;
5052
enum cpuhp_state cb_state;
5153
int (*cb)(unsigned int cpu);
5254
int result;
@@ -301,6 +303,11 @@ static int cpu_notify(unsigned long val, unsigned int cpu)
301303
return __cpu_notify(val, cpu, -1, NULL);
302304
}
303305

306+
static void cpu_notify_nofail(unsigned long val, unsigned int cpu)
307+
{
308+
BUG_ON(cpu_notify(val, cpu));
309+
}
310+
304311
/* Notifier wrappers for transitioning to state machine */
305312
static int notify_prepare(unsigned int cpu)
306313
{
@@ -477,6 +484,16 @@ static void cpuhp_thread_fun(unsigned int cpu)
477484
} else {
478485
ret = cpuhp_invoke_callback(cpu, st->cb_state, st->cb);
479486
}
487+
} else if (st->rollback) {
488+
BUG_ON(st->state < CPUHP_AP_ONLINE_IDLE);
489+
490+
undo_cpu_down(cpu, st, cpuhp_ap_states);
491+
/*
492+
* This is a momentary workaround to keep the notifier users
493+
* happy. Will go away once we got rid of the notifiers.
494+
*/
495+
cpu_notify_nofail(CPU_DOWN_FAILED, cpu);
496+
st->rollback = false;
480497
} else {
481498
/* Cannot happen .... */
482499
BUG_ON(st->state < CPUHP_AP_ONLINE_IDLE);
@@ -636,11 +653,6 @@ static inline void check_for_tasks(int dead_cpu)
636653
read_unlock(&tasklist_lock);
637654
}
638655

639-
static void cpu_notify_nofail(unsigned long val, unsigned int cpu)
640-
{
641-
BUG_ON(cpu_notify(val, cpu));
642-
}
643-
644656
static int notify_down_prepare(unsigned int cpu)
645657
{
646658
int err, nr_calls = 0;
@@ -721,9 +733,10 @@ static int takedown_cpu(unsigned int cpu)
721733
*/
722734
err = stop_machine(take_cpu_down, NULL, cpumask_of(cpu));
723735
if (err) {
724-
/* CPU didn't die: tell everyone. Can't complain. */
725-
cpu_notify_nofail(CPU_DOWN_FAILED, cpu);
736+
/* CPU refused to die */
726737
irq_unlock_sparse();
738+
/* Unpark the hotplug thread so we can rollback there */
739+
kthread_unpark(per_cpu_ptr(&cpuhp_state, cpu)->thread);
727740
return err;
728741
}
729742
BUG_ON(cpu_online(cpu));
@@ -832,6 +845,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
832845
* to do the further cleanups.
833846
*/
834847
ret = cpuhp_down_callbacks(cpu, st, cpuhp_bp_states, target);
848+
if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) {
849+
st->target = prev_state;
850+
st->rollback = true;
851+
cpuhp_kick_ap_work(cpu);
852+
}
835853

836854
hasdied = prev_state != st->state && st->state == CPUHP_OFFLINE;
837855
out:
@@ -1249,6 +1267,7 @@ static struct cpuhp_step cpuhp_ap_states[] = {
12491267
.name = "notify:online",
12501268
.startup = notify_online,
12511269
.teardown = notify_down_prepare,
1270+
.skip_onerr = true,
12521271
},
12531272
#endif
12541273
/*

tools/perf/util/intel-pt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ static int intel_pt_synth_transaction_sample(struct intel_pt_queue *ptq)
11301130
pr_err("Intel Processor Trace: failed to deliver transaction event, error %d\n",
11311131
ret);
11321132

1133-
if (pt->synth_opts.callchain)
1133+
if (pt->synth_opts.last_branch)
11341134
intel_pt_reset_last_branch_rb(ptq);
11351135

11361136
return ret;

0 commit comments

Comments
 (0)