--- zzzz-none-000/linux-4.9.279/arch/x86/include/asm/irqflags.h 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/arch/x86/include/asm/irqflags.h 2023-02-08 11:43:42.000000000 +0000 @@ -10,6 +10,10 @@ /* Provide __cpuidle; we can't safely include */ #define __cpuidle __attribute__((__section__(".cpuidle.text"))) +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) +#include +#include +#endif /* * Interrupt control: */ @@ -80,16 +84,42 @@ static inline notrace void arch_local_irq_restore(unsigned long flags) { +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + avm_simple_profiling_irq_disabled((unsigned long)&&here, _RET_IP_, + 0x1, /* old-disable-status */ + !(flags & X86_EFLAGS_IF) /* new-disable-status */ + ); +here: +#endif native_restore_fl(flags); } static inline notrace void arch_local_irq_disable(void) { +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + unsigned long flags = arch_local_save_flags(); + native_irq_disable(); + avm_simple_profiling_irq_disabled(_THIS_IP_, _RET_IP_, + !(flags & X86_EFLAGS_IF), /* old-disable-status */ + 0x1 /* new-disable-status */ + ); +#else + native_irq_disable(); +#endif } static inline notrace void arch_local_irq_enable(void) { +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + unsigned long flags = arch_local_save_flags(); + + avm_simple_profiling_irq_disabled((unsigned long)&&here, _RET_IP_, + !(flags & X86_EFLAGS_IF), /* old-disable-status */ + 0x0 /* new-disable-status */ + ); +here: +#endif native_irq_enable(); } @@ -117,7 +147,14 @@ static inline notrace unsigned long arch_local_irq_save(void) { unsigned long flags = arch_local_save_flags(); - arch_local_irq_disable(); + + native_irq_disable(); +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + avm_simple_profiling_irq_disabled(_THIS_IP_, _RET_IP_, + !(flags & X86_EFLAGS_IF), /* old-disable-status */ + 0x1 /* new-disable-status */ + ); +#endif return flags; } #else