For dept to function properly, dept_task()->hardirqs_enabled must be set correctly. If it fails to set this value to false, for example, dept may mistakenly think irq is still enabled even when it's not.
Do dept_hardirqs_off() regardless of irq state not to miss any unexpected cases by any chance e.g. changes of the state by asm code. Signed-off-by: Byungchul Park <byungc...@sk.com> --- include/linux/irqflags.h | 14 ++++++++++++++ kernel/dependency/dept.c | 1 + 2 files changed, 15 insertions(+) diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h index d8b9cf093f83..586f5bad4da7 100644 --- a/include/linux/irqflags.h +++ b/include/linux/irqflags.h @@ -214,6 +214,13 @@ extern void warn_bogus_irq_restore(void); raw_local_irq_disable(); \ if (!was_disabled) \ trace_hardirqs_off(); \ + /* \ + * Just in case that C code has missed \ + * trace_hardirqs_off() at the first \ + * place e.g. disabling irq at asm code.\ + */ \ + else \ + dept_hardirqs_off(); \ } while (0) #define local_irq_save(flags) \ @@ -221,6 +228,13 @@ extern void warn_bogus_irq_restore(void); raw_local_irq_save(flags); \ if (!raw_irqs_disabled_flags(flags)) \ trace_hardirqs_off(); \ + /* \ + * Just in case that C code has missed \ + * trace_hardirqs_off() at the first \ + * place e.g. disabling irq at asm code.\ + */ \ + else \ + dept_hardirqs_off(); \ } while (0) #define local_irq_restore(flags) \ diff --git a/kernel/dependency/dept.c b/kernel/dependency/dept.c index a08d0e16978b..4ca1cc04293c 100644 --- a/kernel/dependency/dept.c +++ b/kernel/dependency/dept.c @@ -2248,6 +2248,7 @@ void noinstr dept_hardirqs_off(void) */ dept_task()->hardirqs_enabled = false; } +EXPORT_SYMBOL_GPL(dept_hardirqs_off); void noinstr dept_update_cxt(void) { -- 2.17.1