kprintf: fix checking if interrupt is disabled
Change-Id: I2ee1a1e2438ae761c4136593953ede2738bc6f74
This commit is contained in:
committed by
Masamichi Takagi
parent
c94cf8e6f0
commit
3e00189de0
@ -912,7 +912,6 @@ unsigned long cpu_enable_interrupt_save(void)
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FUGAKU_HACKS
|
|
||||||
int cpu_interrupt_disabled(void)
|
int cpu_interrupt_disabled(void)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@ -925,7 +924,6 @@ int cpu_interrupt_disabled(void)
|
|||||||
: "memory");
|
: "memory");
|
||||||
return (flags == masked);
|
return (flags == masked);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* defined(CONFIG_HAS_NMI) */
|
#else /* defined(CONFIG_HAS_NMI) */
|
||||||
|
|
||||||
@ -989,6 +987,18 @@ unsigned long cpu_enable_interrupt_save(void)
|
|||||||
: "memory");
|
: "memory");
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cpu_interrupt_disabled(void)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
asm volatile(
|
||||||
|
"mrs %0, daif // arch_local_irq_save\n"
|
||||||
|
: "=r" (flags)
|
||||||
|
:
|
||||||
|
: "memory");
|
||||||
|
return !!(flags & 0x2);
|
||||||
|
}
|
||||||
#endif /* defined(CONFIG_HAS_NMI) */
|
#endif /* defined(CONFIG_HAS_NMI) */
|
||||||
|
|
||||||
/* we not have "pause" instruction, instead "yield" instruction */
|
/* we not have "pause" instruction, instead "yield" instruction */
|
||||||
|
|||||||
@ -1273,6 +1273,15 @@ unsigned long cpu_enable_interrupt_save(void)
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cpu_interrupt_disabled(void)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
asm volatile("pushf; pop %0" : "=r"(flags) : : "memory", "cc");
|
||||||
|
|
||||||
|
return !(flags & 0x200);
|
||||||
|
}
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
@ behavior valid_vector:
|
@ behavior valid_vector:
|
||||||
@ assumes 32 <= vector <= 255;
|
@ assumes 32 <= vector <= 255;
|
||||||
|
|||||||
@ -87,7 +87,7 @@ void kputs(char *buf)
|
|||||||
debug_spin_unlock_irqrestore(&kmsg_buf->lock, flags_inner);
|
debug_spin_unlock_irqrestore(&kmsg_buf->lock, flags_inner);
|
||||||
kprintf_unlock(flags_outer);
|
kprintf_unlock(flags_outer);
|
||||||
|
|
||||||
if (irqflags_can_interrupt(flags_outer) &&
|
if (!cpu_interrupt_disabled() &&
|
||||||
DEBUG_KMSG_USED > IHK_KMSG_HIGH_WATER_MARK) {
|
DEBUG_KMSG_USED > IHK_KMSG_HIGH_WATER_MARK) {
|
||||||
eventfd(IHK_OS_EVENTFD_TYPE_KMSG);
|
eventfd(IHK_OS_EVENTFD_TYPE_KMSG);
|
||||||
ihk_mc_delay_us(IHK_KMSG_NOTIFY_DELAY);
|
ihk_mc_delay_us(IHK_KMSG_NOTIFY_DELAY);
|
||||||
@ -128,7 +128,7 @@ int __kprintf(const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug_spin_unlock_irqrestore(&kmsg_buf->lock, flags_inner);
|
debug_spin_unlock_irqrestore(&kmsg_buf->lock, flags_inner);
|
||||||
if (irqflags_can_interrupt(flags_inner) &&
|
if (!cpu_interrupt_disabled() &&
|
||||||
DEBUG_KMSG_USED > IHK_KMSG_HIGH_WATER_MARK) {
|
DEBUG_KMSG_USED > IHK_KMSG_HIGH_WATER_MARK) {
|
||||||
eventfd(IHK_OS_EVENTFD_TYPE_KMSG);
|
eventfd(IHK_OS_EVENTFD_TYPE_KMSG);
|
||||||
ihk_mc_delay_us(IHK_KMSG_NOTIFY_DELAY);
|
ihk_mc_delay_us(IHK_KMSG_NOTIFY_DELAY);
|
||||||
@ -171,7 +171,7 @@ int kprintf(const char *format, ...)
|
|||||||
debug_spin_unlock_irqrestore(&kmsg_buf->lock, flags_inner);
|
debug_spin_unlock_irqrestore(&kmsg_buf->lock, flags_inner);
|
||||||
kprintf_unlock(flags_outer);
|
kprintf_unlock(flags_outer);
|
||||||
|
|
||||||
if (irqflags_can_interrupt(flags_outer) &&
|
if (!cpu_interrupt_disabled() &&
|
||||||
DEBUG_KMSG_USED > IHK_KMSG_HIGH_WATER_MARK) {
|
DEBUG_KMSG_USED > IHK_KMSG_HIGH_WATER_MARK) {
|
||||||
eventfd(IHK_OS_EVENTFD_TYPE_KMSG);
|
eventfd(IHK_OS_EVENTFD_TYPE_KMSG);
|
||||||
ihk_mc_delay_us(IHK_KMSG_NOTIFY_DELAY);
|
ihk_mc_delay_us(IHK_KMSG_NOTIFY_DELAY);
|
||||||
|
|||||||
@ -23,9 +23,7 @@ extern int num_processors;
|
|||||||
|
|
||||||
void cpu_enable_interrupt(void);
|
void cpu_enable_interrupt(void);
|
||||||
void cpu_disable_interrupt(void);
|
void cpu_disable_interrupt(void);
|
||||||
#ifdef ENABLE_FUGAKU_HACKS
|
|
||||||
int cpu_interrupt_disabled(void);
|
int cpu_interrupt_disabled(void);
|
||||||
#endif
|
|
||||||
void cpu_halt(void);
|
void cpu_halt(void);
|
||||||
#ifdef ENABLE_FUGAKU_HACKS
|
#ifdef ENABLE_FUGAKU_HACKS
|
||||||
void cpu_halt_panic(void);
|
void cpu_halt_panic(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user