66
66
hard_irq_disable();
67
if (!cpu_isset(cpu, cpus_in_crash))
67
if (!cpumask_test_cpu(cpu, &cpus_in_crash))
68
68
crash_save_cpu(regs, cpu);
69
cpu_set(cpu, cpus_in_crash);
69
cpumask_set_cpu(cpu, &cpus_in_crash);
72
72
* Entered via soft-reset - could be the kdump
77
77
* Tell the kexec CPU that entered via soft-reset and ready
80
if (cpu_isset(cpu, cpus_in_sr)) {
81
cpu_clear(cpu, cpus_in_sr);
80
if (cpumask_test_cpu(cpu, &cpus_in_sr)) {
81
cpumask_clear_cpu(cpu, &cpus_in_sr);
82
82
atomic_inc(&enter_on_soft_reset);
87
87
* This barrier is needed to make sure that all CPUs are stopped.
88
88
* If not, soft-reset will be invoked to bring other CPUs.
90
while (!cpu_isset(crashing_cpu, cpus_in_crash))
90
while (!cpumask_test_cpu(crashing_cpu, &cpus_in_crash))
93
93
if (ppc_md.kexec_cpu_down)
110
110
unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
112
cpu_clear(cpu, cpus_in_sr);
112
cpumask_clear_cpu(cpu, &cpus_in_sr);
113
113
while (atomic_read(&enter_on_soft_reset) != ncpus)
144
144
* user to do soft reset such that we get all.
145
145
* Soft-reset will be used until better mechanism is implemented.
147
if (cpus_weight(cpus_in_crash) < ncpus) {
147
if (cpumask_weight(&cpus_in_crash) < ncpus) {
148
148
printk(KERN_EMERG "done waiting: %d cpu(s) not responding\n",
149
ncpus - cpus_weight(cpus_in_crash));
149
ncpus - cpumask_weight(&cpus_in_crash));
150
150
printk(KERN_EMERG "Activate soft-reset to stop other cpu(s)\n");
151
cpus_in_sr = CPU_MASK_NONE;
151
cpumask_clear(&cpus_in_sr);
152
152
atomic_set(&enter_on_soft_reset, 0);
153
while (cpus_weight(cpus_in_crash) < ncpus)
153
while (cpumask_weight(&cpus_in_crash) < ncpus)
157
157
* Make sure all CPUs are entered via soft-reset if the kdump is
158
158
* invoked using soft-reset.
160
if (cpu_isset(cpu, cpus_in_sr))
160
if (cpumask_test_cpu(cpu, &cpus_in_sr))
161
161
crash_soft_reset_check(cpu);
162
162
/* Leave the IPI callback set */
165
/* wait for all the CPUs to hit real mode but timeout if they don't come in */
166
#ifdef CONFIG_PPC_STD_MMU_64
167
static void crash_kexec_wait_realmode(int cpu)
173
for (i=0; i < NR_CPUS && msecs > 0; i++) {
177
while (paca[i].kexec_state < KEXEC_STATE_REAL_MODE) {
179
if (!cpu_possible(i)) {
182
if (!cpu_online(i)) {
194
166
* This function will be called by secondary cpus or by kexec cpu
195
167
* if soft-reset is activated to stop some CPUs.
210
182
* exited using 'x'(exit and recover) or
211
183
* kexec_should_crash() failed for all running tasks.
213
cpu_clear(cpu, cpus_in_sr);
185
cpumask_clear_cpu(cpu, &cpus_in_sr);
214
186
local_irq_restore(flags);
224
196
* then start kexec boot.
226
198
crash_soft_reset_check(cpu);
227
cpu_set(crashing_cpu, cpus_in_crash);
199
cpumask_set_cpu(crashing_cpu, &cpus_in_crash);
228
200
if (ppc_md.kexec_cpu_down)
229
201
ppc_md.kexec_cpu_down(1, 0);
230
202
machine_kexec(kexec_crash_image);
252
225
void crash_kexec_secondary(struct pt_regs *regs)
254
cpus_in_sr = CPU_MASK_NONE;
227
cpumask_clear(&cpus_in_sr);
229
#endif /* CONFIG_SMP */
231
/* wait for all the CPUs to hit real mode but timeout if they don't come in */
232
#if defined(CONFIG_SMP) && defined(CONFIG_PPC_STD_MMU_64)
233
static void crash_kexec_wait_realmode(int cpu)
239
for (i=0; i < nr_cpu_ids && msecs > 0; i++) {
243
while (paca[i].kexec_state < KEXEC_STATE_REAL_MODE) {
245
if (!cpu_possible(i)) {
248
if (!cpu_online(i)) {
258
static inline void crash_kexec_wait_realmode(int cpu) {}
259
#endif /* CONFIG_SMP && CONFIG_PPC_STD_MMU_64 */
259
262
* Register a function to be called on shutdown. Only use this if you
343
346
crashing_cpu = smp_processor_id();
344
347
crash_save_cpu(regs, crashing_cpu);
345
348
crash_kexec_prepare_cpus(crashing_cpu);
346
cpu_set(crashing_cpu, cpus_in_crash);
347
#if defined(CONFIG_PPC_STD_MMU_64) && defined(CONFIG_SMP)
349
cpumask_set_cpu(crashing_cpu, &cpus_in_crash);
348
350
crash_kexec_wait_realmode(crashing_cpu);
351
352
machine_kexec_mask_interrupts();