linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] asm-generic: Add sched.h inclusion in simd.h
@ 2025-05-30  4:16 Huacai Chen
  2025-05-30 13:00 ` Herbert Xu
  2025-06-03  5:44 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Huacai Chen @ 2025-05-30  4:16 UTC (permalink / raw)
  To: Arnd Bergmann, Huacai Chen, Herbert Xu
  Cc: linux-arch, Ard Biesheuvel, David S . Miller, Eric Biggers,
	linux-crypto, linux-kernel, Huacai Chen

Commit 7ba8df47810f073 ("asm-generic: Make simd.h more resilient")
causes a build error for PREEMPT_RT kernels:

  CC      lib/crypto/sha256.o
In file included from ./include/asm-generic/simd.h:6,
                 from ./arch/loongarch/include/generated/asm/simd.h:1,
                 from ./include/crypto/internal/simd.h:9,
                 from ./include/crypto/internal/sha2.h:6,
                 from lib/crypto/sha256.c:15:
./include/asm-generic/simd.h: In function 'may_use_simd':
./include/linux/preempt.h:111:34: error: 'current' undeclared (first use in this function)
  111 | # define softirq_count()        (current->softirq_disable_cnt & SOFTIRQ_MASK)
      |                                  ^~~~~~~
./include/linux/preempt.h:112:82: note: in expansion of macro 'softirq_count'
  112 | # define irq_count()            ((preempt_count() & (NMI_MASK | HARDIRQ_MASK)) | softirq_count())
      |                                                                                  ^~~~~~~~~~~~~
./include/linux/preempt.h:143:34: note: in expansion of macro 'irq_count'
  143 | #define in_interrupt()          (irq_count())
      |                                  ^~~~~~~~~
./include/asm-generic/simd.h:18:17: note: in expansion of macro 'in_interrupt'
   18 |         return !in_interrupt();
      |                 ^~~~~~~~~~~~

So add sched.h inclusion in simd.h to fix it.

Fixes: 7ba8df47810f073 ("asm-generic: Make simd.h more resilient")
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 include/asm-generic/simd.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/asm-generic/simd.h b/include/asm-generic/simd.h
index ac29a22eb7cf..70c8716ad32a 100644
--- a/include/asm-generic/simd.h
+++ b/include/asm-generic/simd.h
@@ -4,6 +4,7 @@
 
 #include <linux/compiler_attributes.h>
 #include <linux/preempt.h>
+#include <linux/sched.h>
 #include <linux/types.h>
 
 /*
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] asm-generic: Add sched.h inclusion in simd.h
  2025-05-30  4:16 [PATCH] asm-generic: Add sched.h inclusion in simd.h Huacai Chen
@ 2025-05-30 13:00 ` Herbert Xu
  2025-06-03  5:44 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2025-05-30 13:00 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Arnd Bergmann, Huacai Chen, linux-arch, Ard Biesheuvel,
	David S . Miller, Eric Biggers, linux-crypto, linux-kernel

On Fri, May 30, 2025 at 12:16:58PM +0800, Huacai Chen wrote:
> Commit 7ba8df47810f073 ("asm-generic: Make simd.h more resilient")
> causes a build error for PREEMPT_RT kernels:
> 
>   CC      lib/crypto/sha256.o
> In file included from ./include/asm-generic/simd.h:6,
>                  from ./arch/loongarch/include/generated/asm/simd.h:1,
>                  from ./include/crypto/internal/simd.h:9,
>                  from ./include/crypto/internal/sha2.h:6,
>                  from lib/crypto/sha256.c:15:
> ./include/asm-generic/simd.h: In function 'may_use_simd':
> ./include/linux/preempt.h:111:34: error: 'current' undeclared (first use in this function)
>   111 | # define softirq_count()        (current->softirq_disable_cnt & SOFTIRQ_MASK)
>       |                                  ^~~~~~~
> ./include/linux/preempt.h:112:82: note: in expansion of macro 'softirq_count'
>   112 | # define irq_count()            ((preempt_count() & (NMI_MASK | HARDIRQ_MASK)) | softirq_count())
>       |                                                                                  ^~~~~~~~~~~~~
> ./include/linux/preempt.h:143:34: note: in expansion of macro 'irq_count'
>   143 | #define in_interrupt()          (irq_count())
>       |                                  ^~~~~~~~~
> ./include/asm-generic/simd.h:18:17: note: in expansion of macro 'in_interrupt'
>    18 |         return !in_interrupt();
>       |                 ^~~~~~~~~~~~
> 
> So add sched.h inclusion in simd.h to fix it.
> 
> Fixes: 7ba8df47810f073 ("asm-generic: Make simd.h more resilient")
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>  include/asm-generic/simd.h | 1 +
>  1 file changed, 1 insertion(+)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] asm-generic: Add sched.h inclusion in simd.h
  2025-05-30  4:16 [PATCH] asm-generic: Add sched.h inclusion in simd.h Huacai Chen
  2025-05-30 13:00 ` Herbert Xu
@ 2025-06-03  5:44 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2025-06-03  5:44 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Arnd Bergmann, Huacai Chen, Herbert Xu, linux-arch,
	Ard Biesheuvel, David S . Miller, Eric Biggers, linux-crypto,
	linux-kernel

On Fri, May 30, 2025 at 12:16:58PM +0800, Huacai Chen wrote:
> Commit 7ba8df47810f073 ("asm-generic: Make simd.h more resilient")
> causes a build error for PREEMPT_RT kernels:
> 
>   CC      lib/crypto/sha256.o
> In file included from ./include/asm-generic/simd.h:6,
>                  from ./arch/loongarch/include/generated/asm/simd.h:1,
>                  from ./include/crypto/internal/simd.h:9,
>                  from ./include/crypto/internal/sha2.h:6,
>                  from lib/crypto/sha256.c:15:
> ./include/asm-generic/simd.h: In function 'may_use_simd':
> ./include/linux/preempt.h:111:34: error: 'current' undeclared (first use in this function)
>   111 | # define softirq_count()        (current->softirq_disable_cnt & SOFTIRQ_MASK)
>       |                                  ^~~~~~~
> ./include/linux/preempt.h:112:82: note: in expansion of macro 'softirq_count'
>   112 | # define irq_count()            ((preempt_count() & (NMI_MASK | HARDIRQ_MASK)) | softirq_count())
>       |                                                                                  ^~~~~~~~~~~~~
> ./include/linux/preempt.h:143:34: note: in expansion of macro 'irq_count'
>   143 | #define in_interrupt()          (irq_count())
>       |                                  ^~~~~~~~~
> ./include/asm-generic/simd.h:18:17: note: in expansion of macro 'in_interrupt'
>    18 |         return !in_interrupt();
>       |                 ^~~~~~~~~~~~
> 
> So add sched.h inclusion in simd.h to fix it.
> 
> Fixes: 7ba8df47810f073 ("asm-generic: Make simd.h more resilient")
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

Tested-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  include/asm-generic/simd.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/asm-generic/simd.h b/include/asm-generic/simd.h
> index ac29a22eb7cf..70c8716ad32a 100644
> --- a/include/asm-generic/simd.h
> +++ b/include/asm-generic/simd.h
> @@ -4,6 +4,7 @@
>  
>  #include <linux/compiler_attributes.h>
>  #include <linux/preempt.h>
> +#include <linux/sched.h>
>  #include <linux/types.h>
>  
>  /*

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-03  5:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-30  4:16 [PATCH] asm-generic: Add sched.h inclusion in simd.h Huacai Chen
2025-05-30 13:00 ` Herbert Xu
2025-06-03  5:44 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).