lkml.org 
[lkml]   [2021]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v8 01/11] x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT
On Mon, Oct 04, 2021 at 07:51:55PM -0700, Kuppuswamy Sathyanarayanan wrote:
> diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
> index c5ce9845c999..2a2ebf9af43e 100644
> --- a/arch/x86/include/asm/irqflags.h
> +++ b/arch/x86/include/asm/irqflags.h
> @@ -59,27 +59,15 @@ static inline __cpuidle void native_halt(void)
>
> #endif
>
> -#ifdef CONFIG_PARAVIRT_XXL
> -#include <asm/paravirt.h>
> -#else
> -#ifndef __ASSEMBLY__
> -#include <linux/types.h>
> +#ifdef CONFIG_PARAVIRT
>
> -static __always_inline unsigned long arch_local_save_flags(void)
> -{
> - return native_save_fl();
> -}
> -
> -static __always_inline void arch_local_irq_disable(void)
> -{
> - native_irq_disable();
> -}
> +# ifndef __ASSEMBLY__
> +# include <asm/paravirt.h>
> +# endif /* __ASSEMBLY__ */
>
> -static __always_inline void arch_local_irq_enable(void)
> -{
> - native_irq_enable();
> -}
> +#else /* ! CONFIG_PARAVIRT */
>
> +# ifndef __ASSEMBLY__
> /*
> * Used in the idle loop; sti takes one instruction cycle
> * to complete:
> @@ -97,6 +85,28 @@ static inline __cpuidle void halt(void)
> {
> native_halt();
> }
> +# endif /* __ASSEMBLY__ */
> +
> +#endif /* CONFIG_PARAVIRT */
> +
> +#ifndef CONFIG_PARAVIRT_XXL
> +#ifndef __ASSEMBLY__

There are a lot of '__ASSEMBLY__' #ifdefs which make this macro maze
extra hard to follow. Folding in something like this would help a lot:

diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 2a2ebf9af43e..afecf7fa20d0 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -57,17 +57,12 @@ static inline __cpuidle void native_halt(void)
asm volatile("hlt": : :"memory");
}

-#endif
-
#ifdef CONFIG_PARAVIRT

-# ifndef __ASSEMBLY__
# include <asm/paravirt.h>
-# endif /* __ASSEMBLY__ */

#else /* ! CONFIG_PARAVIRT */

-# ifndef __ASSEMBLY__
/*
* Used in the idle loop; sti takes one instruction cycle
* to complete:
@@ -85,9 +80,9 @@ static inline __cpuidle void halt(void)
{
native_halt();
}
-# endif /* __ASSEMBLY__ */

#endif /* CONFIG_PARAVIRT */
+#endif /* __ASSEMBLY__ */

#ifndef CONFIG_PARAVIRT_XXL
#ifndef __ASSEMBLY__
\
 
 \ /
  Last update: 2021-10-05 22:15    [W:0.580 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site