Skip to content

Commit 66ef349

Browse files
committed
Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 platform changes from Ingo Molnar: "Misc updates to the Intel MID and SGI UV platforms" * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/intel-mid: Make intel_mid_ops static arch/x86/intel-mid: Use kmemdup rather than duplicating its implementation x86/platform/uv: Implement simple dump failover if kdump fails x86/platform/uv: Insert per_cpu accessor function on uv_hub_nmi
2 parents 639ab3e + d1f0f6c commit 66ef349

File tree

4 files changed

+33
-27
lines changed

4 files changed

+33
-27
lines changed

arch/x86/include/asm/uv/uv_hub.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ struct uv_cpu_nmi_s {
609609

610610
DECLARE_PER_CPU(struct uv_cpu_nmi_s, uv_cpu_nmi);
611611

612-
#define uv_hub_nmi (uv_cpu_nmi.hub)
612+
#define uv_hub_nmi this_cpu_read(uv_cpu_nmi.hub)
613613
#define uv_cpu_nmi_per(cpu) (per_cpu(uv_cpu_nmi, cpu))
614614
#define uv_hub_nmi_per(cpu) (uv_cpu_nmi_per(cpu).hub)
615615

arch/x86/platform/intel-mid/intel-mid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
enum intel_mid_timer_options intel_mid_timer_options;
6262

6363
/* intel_mid_ops to store sub arch ops */
64-
struct intel_mid_ops *intel_mid_ops;
64+
static struct intel_mid_ops *intel_mid_ops;
6565
/* getter function for sub arch ops*/
6666
static void *(*get_intel_mid_ops[])(void) = INTEL_MID_OPS_INIT;
6767
enum intel_mid_cpu_type __intel_mid_cpu_chip;

arch/x86/platform/intel-mid/sfi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,9 @@ static int __init sfi_parse_gpio(struct sfi_table_header *table)
197197
num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry);
198198
pentry = (struct sfi_gpio_table_entry *)sb->pentry;
199199

200-
gpio_table = kmalloc(num * sizeof(*pentry), GFP_KERNEL);
200+
gpio_table = kmemdup(pentry, num * sizeof(*pentry), GFP_KERNEL);
201201
if (!gpio_table)
202202
return -1;
203-
memcpy(gpio_table, pentry, num * sizeof(*pentry));
204203
gpio_num_entry = num;
205204

206205
pr_debug("GPIO pin info:\n");

arch/x86/platform/uv/uv_nmi.c

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -376,38 +376,42 @@ static void uv_nmi_wait(int master)
376376
atomic_read(&uv_nmi_cpus_in_nmi), num_online_cpus());
377377
}
378378

379+
/* Dump Instruction Pointer header */
379380
static void uv_nmi_dump_cpu_ip_hdr(void)
380381
{
381-
printk(KERN_DEFAULT
382-
"\nUV: %4s %6s %-32s %s (Note: PID 0 not listed)\n",
382+
pr_info("\nUV: %4s %6s %-32s %s (Note: PID 0 not listed)\n",
383383
"CPU", "PID", "COMMAND", "IP");
384384
}
385385

386+
/* Dump Instruction Pointer info */
386387
static void uv_nmi_dump_cpu_ip(int cpu, struct pt_regs *regs)
387388
{
388-
printk(KERN_DEFAULT "UV: %4d %6d %-32.32s ",
389-
cpu, current->pid, current->comm);
390-
389+
pr_info("UV: %4d %6d %-32.32s ", cpu, current->pid, current->comm);
391390
printk_address(regs->ip);
392391
}
393392

394-
/* Dump this cpu's state */
393+
/*
394+
* Dump this CPU's state. If action was set to "kdump" and the crash_kexec
395+
* failed, then we provide "dump" as an alternate action. Action "dump" now
396+
* also includes the show "ips" (instruction pointers) action whereas the
397+
* action "ips" only displays instruction pointers for the non-idle CPU's.
398+
* This is an abbreviated form of the "ps" command.
399+
*/
395400
static void uv_nmi_dump_state_cpu(int cpu, struct pt_regs *regs)
396401
{
397402
const char *dots = " ................................. ";
398403

399-
if (uv_nmi_action_is("ips")) {
400-
if (cpu == 0)
401-
uv_nmi_dump_cpu_ip_hdr();
404+
if (cpu == 0)
405+
uv_nmi_dump_cpu_ip_hdr();
402406

403-
if (current->pid != 0)
404-
uv_nmi_dump_cpu_ip(cpu, regs);
407+
if (current->pid != 0 || !uv_nmi_action_is("ips"))
408+
uv_nmi_dump_cpu_ip(cpu, regs);
405409

406-
} else if (uv_nmi_action_is("dump")) {
407-
printk(KERN_DEFAULT
408-
"UV:%sNMI process trace for CPU %d\n", dots, cpu);
410+
if (uv_nmi_action_is("dump")) {
411+
pr_info("UV:%sNMI process trace for CPU %d\n", dots, cpu);
409412
show_regs(regs);
410413
}
414+
411415
this_cpu_write(uv_cpu_nmi.state, UV_NMI_STATE_DUMP_DONE);
412416
}
413417

@@ -469,8 +473,7 @@ static void uv_nmi_dump_state(int cpu, struct pt_regs *regs, int master)
469473
uv_nmi_trigger_dump(tcpu);
470474
}
471475
if (ignored)
472-
printk(KERN_DEFAULT "UV: %d CPUs ignored NMI\n",
473-
ignored);
476+
pr_alert("UV: %d CPUs ignored NMI\n", ignored);
474477

475478
console_loglevel = saved_console_loglevel;
476479
pr_alert("UV: process trace complete\n");
@@ -492,8 +495,9 @@ static void uv_nmi_touch_watchdogs(void)
492495
touch_nmi_watchdog();
493496
}
494497

495-
#if defined(CONFIG_KEXEC_CORE)
496498
static atomic_t uv_nmi_kexec_failed;
499+
500+
#if defined(CONFIG_KEXEC_CORE)
497501
static void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
498502
{
499503
/* Call crash to dump system state */
@@ -502,10 +506,9 @@ static void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
502506
crash_kexec(regs);
503507

504508
pr_emerg("UV: crash_kexec unexpectedly returned, ");
509+
atomic_set(&uv_nmi_kexec_failed, 1);
505510
if (!kexec_crash_image) {
506511
pr_cont("crash kernel not loaded\n");
507-
atomic_set(&uv_nmi_kexec_failed, 1);
508-
uv_nmi_sync_exit(1);
509512
return;
510513
}
511514
pr_cont("kexec busy, stalling cpus while waiting\n");
@@ -514,16 +517,14 @@ static void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
514517
/* If crash exec fails the slaves should return, otherwise stall */
515518
while (atomic_read(&uv_nmi_kexec_failed) == 0)
516519
mdelay(10);
517-
518-
/* Crash kernel most likely not loaded, return in an orderly fashion */
519-
uv_nmi_sync_exit(0);
520520
}
521521

522522
#else /* !CONFIG_KEXEC_CORE */
523523
static inline void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
524524
{
525525
if (master)
526526
pr_err("UV: NMI kdump: KEXEC not supported in this kernel\n");
527+
atomic_set(&uv_nmi_kexec_failed, 1);
527528
}
528529
#endif /* !CONFIG_KEXEC_CORE */
529530

@@ -613,9 +614,14 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
613614
master = (atomic_read(&uv_nmi_cpu) == cpu);
614615

615616
/* If NMI action is "kdump", then attempt to do it */
616-
if (uv_nmi_action_is("kdump"))
617+
if (uv_nmi_action_is("kdump")) {
617618
uv_nmi_kdump(cpu, master, regs);
618619

620+
/* Unexpected return, revert action to "dump" */
621+
if (master)
622+
strncpy(uv_nmi_action, "dump", strlen(uv_nmi_action));
623+
}
624+
619625
/* Pause as all cpus enter the NMI handler */
620626
uv_nmi_wait(master);
621627

@@ -640,6 +646,7 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
640646
atomic_set(&uv_nmi_cpus_in_nmi, -1);
641647
atomic_set(&uv_nmi_cpu, -1);
642648
atomic_set(&uv_in_nmi, 0);
649+
atomic_set(&uv_nmi_kexec_failed, 0);
643650
}
644651

645652
uv_nmi_touch_watchdogs();

0 commit comments

Comments
 (0)