lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210524112617.GF1040@C02TD0UTHF1T.local>
Date:   Mon, 24 May 2021 12:26:17 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     Yejune Deng <yejune.deng@...il.com>
Cc:     peterz@...radead.org, tglx@...utronix.de, mingo@...nel.org,
        rafael.j.wysocki@...el.com, rostedt@...dmis.org, npiggin@...il.com,
        yejunedeng@...il.com, elver@...gle.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] irqflags: Remove the CONFIG_TRACE_IRQFLAGS

On Mon, May 24, 2021 at 10:51:19AM +0800, Yejune Deng wrote:
> trace_hardirqs_on() and trace_hardirqs_off() had include the
> CONFIG_TRACE_IRQFLAGS, so remove the redundant CONFIG_TRACE_IRQFLAGS.
> 
> Signed-off-by: Yejune Deng <yejunedeng@...il.com>
> ---
>  include/linux/irqflags.h | 16 ----------------
>  1 file changed, 16 deletions(-)
> 
> diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
> index 600c10d..b5edd7b 100644
> --- a/include/linux/irqflags.h
> +++ b/include/linux/irqflags.h
> @@ -189,12 +189,6 @@ extern void warn_bogus_irq_restore(void);
>  #define raw_irqs_disabled()		(arch_irqs_disabled())
>  #define raw_safe_halt()			arch_safe_halt()
>  
> -/*
> - * The local_irq_*() APIs are equal to the raw_local_irq*()
> - * if !TRACE_IRQFLAGS.
> - */
> -#ifdef CONFIG_TRACE_IRQFLAGS
> -
>  #define local_irq_enable()				\
>  	do {						\
>  		trace_hardirqs_on();			\
> @@ -230,16 +224,6 @@ extern void warn_bogus_irq_restore(void);
>  	} while (0)
>  
>  
> -#else /* !CONFIG_TRACE_IRQFLAGS */
> -
> -#define local_irq_enable()	do { raw_local_irq_enable(); } while (0)
> -#define local_irq_disable()	do { raw_local_irq_disable(); } while (0)

The implementation we're left with is:

| #define local_irq_disable()                             \
|         do {                                            \
|                 bool was_disabled = raw_irqs_disabled();\
|                 raw_local_irq_disable();                \
|                 if (!was_disabled)                      \
|                         trace_hardirqs_off();           \
|         } while (0)

... where the compiler almost certainly won't be able to optimize away
the call to raw_irqs_disabled(), which wraps arch_irqs_disabled(). Note
that arch_irqs_disabled() is typically implemented with a volatile asm
block to save the processor flags.

We could special-case local_irq_disable() to prevent this, or we could
leave it as-is. I'd err towards the latter.

Thanks,
Mark.

> -#define local_irq_save(flags)	do { raw_local_irq_save(flags); } while (0)
> -#define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
> -#define safe_halt()		do { raw_safe_halt(); } while (0)
> -
> -#endif /* CONFIG_TRACE_IRQFLAGS */
> -
>  #define local_save_flags(flags)	raw_local_save_flags(flags)
>  
>  /*
> -- 
> 2.7.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ