dump: rewrite NMI handling (for resume) and fix PANIC register saving

Change-Id: I360e9aa8efa64b6ebd99b209a5dd4ee0dc7806cf
This commit is contained in:
Balazs Gerofi
2020-02-04 23:35:30 +00:00
parent 6bef773741
commit 55faba77a5
8 changed files with 202 additions and 138 deletions

View File

@@ -7,6 +7,7 @@
#include <ihk/monitor.h>
#include <init.h>
extern int nmi_mode;
extern void mod_nmi_ctx(void *, void(*)());
extern void lapic_ack();
extern void __freeze();
@@ -70,3 +71,48 @@ freeze_thaw(void *nmi_ctx)
}
return 0;
}
extern void arch_save_panic_regs(void *irq_regs);
extern void arch_clear_panic(void);
void
multi_nm_interrupt_handler(void *irq_regs)
{
dkprintf("%s: ...\n", __func__);
switch (nmi_mode) {
case 1:
case 2:
/* mode == 1 or 2, for FREEZER NMI */
dkprintf("%s: freeze mode NMI catch. (nmi_mode=%d)\n",
__func__, nmi_mode);
freeze_thaw(NULL);
break;
case 0:
/* mode == 0, for MEMDUMP NMI */
arch_save_panic_regs(irq_regs);
ihk_mc_query_mem_areas();
/* memdump-nmi is halted McKernel, break is unnecessary. */
/* fall through */
case 3:
/* mode == 3, for SHUTDOWN-WAIT NMI */
kprintf("%s: STOP\n", __func__);
while (nmi_mode != 4)
cpu_halt();
break;
case 4:
/* mode == 4, continue NMI */
arch_clear_panic();
if (!ihk_mc_get_processor_id()) {
ihk_mc_clear_dump_page_completion();
}
kprintf("%s: RESUME, nmi_mode: %d\n", __func__, nmi_mode);
break;
default:
ekprintf("%s: Unknown nmi-mode(%d) detected.\n",
__func__, nmi_mode);
break;
}
}