TO RESET: arm64: enable interrupt on panic

Change-Id: I1ceb321de324f307fc82366b162c72f64184247b
This commit is contained in:
Masamichi Takagi
2020-06-15 12:55:00 +09:00
parent bbfb296c26
commit 8f2c8791bf
5 changed files with 54 additions and 0 deletions

View File

@ -791,6 +791,19 @@ void cpu_safe_halt(void)
cpu_enable_interrupt(); cpu_enable_interrupt();
} }
#ifdef ENABLE_FUGAKU_HACKS
/*@
@ assigns \nothing;
@ ensures \interrupt_disabled == 0;
@*/
void cpu_halt_panic(void)
{
extern void __cpu_do_idle(void);
cpu_enable_interrupt();
__cpu_do_idle();
}
#endif
#if defined(CONFIG_HAS_NMI) #if defined(CONFIG_HAS_NMI)
#include <arm-gic-v3.h> #include <arm-gic-v3.h>

View File

@ -7,6 +7,9 @@
#include <process.h> #include <process.h>
#include <syscall.h> #include <syscall.h>
#include <ihk/debug.h> #include <ihk/debug.h>
#ifdef ENABLE_FUGAKU_HACKS
#include <ihk/monitor.h>
#endif
#include <arch-timer.h> #include <arch-timer.h>
#include <cls.h> #include <cls.h>
@ -313,14 +316,27 @@ void handle_interrupt_gicv3(struct pt_regs *regs)
struct cpu_local_var *v = get_this_cpu_local_var(); struct cpu_local_var *v = get_this_cpu_local_var();
//unsigned long irqflags; //unsigned long irqflags;
int do_check = 0; int do_check = 0;
#ifdef ENABLE_FUGAKU_HACKS
struct ihk_os_cpu_monitor *monitor = cpu_local_var(monitor);
++v->in_interrupt;
#endif
irqnr = gic_read_iar(); irqnr = gic_read_iar();
cpu_enable_nmi(); cpu_enable_nmi();
set_cputime(from_user ? CPUTIME_MODE_U2K : CPUTIME_MODE_K2K_IN); set_cputime(from_user ? CPUTIME_MODE_U2K : CPUTIME_MODE_K2K_IN);
while (irqnr != ICC_IAR1_EL1_SPURIOUS) { while (irqnr != ICC_IAR1_EL1_SPURIOUS) {
if ((irqnr < 1020) || (irqnr >= 8192)) { if ((irqnr < 1020) || (irqnr >= 8192)) {
gic_write_eoir(irqnr); gic_write_eoir(irqnr);
#ifndef ENABLE_FUGAKU_HACKS
handle_IPI(irqnr, regs); handle_IPI(irqnr, regs);
#else
/* Once paniced, only allow CPU stop and NMI IRQs */
if (monitor->status != IHK_OS_MONITOR_PANIC ||
irqnr == INTRID_CPU_STOP ||
irqnr == INTRID_MULTI_NMI) {
handle_IPI(irqnr, regs);
}
#endif
} }
irqnr = gic_read_iar(); irqnr = gic_read_iar();
} }
@ -335,7 +351,12 @@ void handle_interrupt_gicv3(struct pt_regs *regs)
} }
//ihk_mc_spinlock_unlock(&v->runq_lock, irqflags); //ihk_mc_spinlock_unlock(&v->runq_lock, irqflags);
#ifndef ENABLE_FUGAKU_HACKS
if (do_check) { if (do_check) {
#else
--v->in_interrupt;
if (monitor->status != IHK_OS_MONITOR_PANIC && do_check) {
#endif
check_signal(0, regs, 0); check_signal(0, regs, 0);
schedule(); schedule();
} }

View File

@ -1137,6 +1137,17 @@ void cpu_halt(void)
asm volatile("hlt"); asm volatile("hlt");
} }
#ifdef ENABLE_FUGAKU_HACKS
/*@
@ assigns \nothing;
@ ensures \interrupt_disabled == 0;
@*/
void cpu_halt_panic(void)
{
cpu_halt();
}
#endif
/*@ /*@
@ assigns \nothing; @ assigns \nothing;
@ ensures \interrupt_disabled == 0; @ ensures \interrupt_disabled == 0;

View File

@ -22,12 +22,18 @@ void panic(const char *msg)
arch_print_stack(); arch_print_stack();
#ifndef ENABLE_FUGAKU_HACKS
/* do not assume anything after this is executed */ /* do not assume anything after this is executed */
arch_cpu_stop(); arch_cpu_stop();
while (1) { while (1) {
cpu_halt(); cpu_halt();
} }
#else
while (1) {
cpu_halt_panic();
}
#endif
} }
extern void arch_show_interrupt_context(const void*); extern void arch_show_interrupt_context(const void*);

View File

@ -24,6 +24,9 @@ extern int num_processors;
void cpu_enable_interrupt(void); void cpu_enable_interrupt(void);
void cpu_disable_interrupt(void); void cpu_disable_interrupt(void);
void cpu_halt(void); void cpu_halt(void);
#ifdef ENABLE_FUGAKU_HACKS
void cpu_halt_panic(void);
#endif
void cpu_safe_halt(void); void cpu_safe_halt(void);
void cpu_restore_interrupt(unsigned long); void cpu_restore_interrupt(unsigned long);
void cpu_pause(void); void cpu_pause(void);