All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] include/uapi/linux/swab: Fix potentially missing __always_inline
@ 2021-07-29  9:45 Pavo Banicevic
  0 siblings, 0 replies; 6+ messages in thread
From: Pavo Banicevic @ 2021-07-29  9:45 UTC (permalink / raw)
  To: arkamar, matt.redfearn, mingo, dvlasenk, linux-kernel

From: Matt Redfearn <matt.redfearn@mips.com>

Commit bc27fb68aaad ("include/uapi/linux/byteorder, swab: force inlining
of some byteswap operations") added __always_inline to swab functions
and commit 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to
userspace headers") added a definition of __always_inline for use in
exported headers when the kernel's compiler.h is not available.

However, since swab.h does not include stddef.h, if the header soup does
not indirectly include it, the definition of __always_inline is missing,
resulting in a compilation failure, which was observed compiling the
perf tool using exported headers containing this commit:

In file included from /usr/include/linux/byteorder/little_endian.h:12:0,
                 from /usr/include/asm/byteorder.h:14,
                 from tools/include/uapi/linux/perf_event.h:20,
                 from perf.h:8,
                 from builtin-bench.c:18:
/usr/include/linux/swab.h:160:8: error: unknown type name `__always_inline'
 static __always_inline __u16 __swab16p(const __u16 *p)

Fix this by replacing the inclusion of linux/compiler.h with
linux/stddef.h to ensure that we pick up that definition if required,
without relying on it's indirect inclusion. compiler.h is then included
indirectly, via stddef.h.

Fixes: 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to userspace headers")

Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
Reviewed-by: Petr Vaněk <arkamar@atlas.cz>
---

Resending as patch is not really related to previous series and to not wait long for the merge.

---
 include/uapi/linux/swab.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
index 7272f85d6d6a..3736f2fe1541 100644
--- a/include/uapi/linux/swab.h
+++ b/include/uapi/linux/swab.h
@@ -3,7 +3,7 @@
 #define _UAPI_LINUX_SWAB_H
 
 #include <linux/types.h>
-#include <linux/compiler.h>
+#include <linux/stddef.h>
 #include <asm/bitsperlong.h>
 #include <asm/swab.h>
 
-- 
2.32.0


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

* Re: [PATCH] include/uapi/linux/swab: Fix potentially missing __always_inline
  2022-10-06 20:33   ` Florian Fainelli
@ 2022-10-28 19:19     ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2022-10-28 19:19 UTC (permalink / raw)
  To: Nathan Chancellor, Arnd Bergmann
  Cc: linux-kernel, Petr Vaněk, Nick Desaulniers, Tom Rix,
	Justin Stitt, Andrew Morton, Denys Vlasenko, Ingo Molnar,
	open list:CLANG/LLVM BUILD SUPPORT, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, open list:PERFORMANCE EVENTS SUBSYSTEM,
	mmayer, Khem Raj, Philippe Ombredanne, Kate Stewart,
	Greg Kroah-Hartman, Thomas Gleixner

On 10/6/22 13:33, Florian Fainelli wrote:
> Hi Nathan,
> 
> On 9/28/2022 3:36 PM, Nathan Chancellor wrote:
>> Hi Florian,
>>
>> On Tue, Sep 27, 2022 at 02:52:56PM -0700, Florian Fainelli wrote:
>>> From: Matt Redfearn <matt.redfearn@mips.com>
>>>
>>> Commit bc27fb68aaad ("include/uapi/linux/byteorder, swab: force inlining
>>> of some byteswap operations") added __always_inline to swab functions
>>> and commit 283d75737837 ("uapi/linux/stddef.h: Provide 
>>> __always_inline to
>>> userspace headers") added a definition of __always_inline for use in
>>> exported headers when the kernel's compiler.h is not available.
>>>
>>> However, since swab.h does not include stddef.h, if the header soup does
>>> not indirectly include it, the definition of __always_inline is missing,
>>> resulting in a compilation failure, which was observed compiling the
>>> perf tool using exported headers containing this commit:
>>>
>>> In file included from /usr/include/linux/byteorder/little_endian.h:12:0,
>>>                   from /usr/include/asm/byteorder.h:14,
>>>                   from tools/include/uapi/linux/perf_event.h:20,
>>>                   from perf.h:8,
>>>                   from builtin-bench.c:18:
>>> /usr/include/linux/swab.h:160:8: error: unknown type name 
>>> `__always_inline'
>>>   static __always_inline __u16 __swab16p(const __u16 *p)
>>>
>>> Fix this by replacing the inclusion of linux/compiler.h with
>>> linux/stddef.h to ensure that we pick up that definition if required,
>>> without relying on it's indirect inclusion. compiler.h is then included
>>> indirectly, via stddef.h.
>>>
>>> Fixes: 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to 
>>> userspace headers")
>>> Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
>>> Reviewed-by: Petr Vaněk <arkamar@atlas.cz>
>>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>
>> I took this through my kernel build matrix and did not see any new
>> issues.
>>
>> Tested-by: Nathan Chancellor <nathan@kernel.org>
> 
> Great thanks! Since this is really useful for kernel-headers in 
> toolchains, it would be great to get this picked up. Arnd is this 
> something that would go via your tree?

Arnd, is this a patch you can merge? Thanks
-- 
Florian


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

* Re: [PATCH] include/uapi/linux/swab: Fix potentially missing __always_inline
  2022-09-28 22:36 ` Nathan Chancellor
@ 2022-10-06 20:33   ` Florian Fainelli
  2022-10-28 19:19     ` Florian Fainelli
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2022-10-06 20:33 UTC (permalink / raw)
  To: Nathan Chancellor, Arnd Bergmann
  Cc: linux-kernel, Petr Vaněk, Nick Desaulniers, Tom Rix,
	Justin Stitt, Andrew Morton, Denys Vlasenko, Ingo Molnar,
	open list:CLANG/LLVM BUILD SUPPORT, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, open list:PERFORMANCE EVENTS SUBSYSTEM,
	mmayer, Khem Raj, Philippe Ombredanne, Kate Stewart,
	Greg Kroah-Hartman, Thomas Gleixner

Hi Nathan,

On 9/28/2022 3:36 PM, Nathan Chancellor wrote:
> Hi Florian,
> 
> On Tue, Sep 27, 2022 at 02:52:56PM -0700, Florian Fainelli wrote:
>> From: Matt Redfearn <matt.redfearn@mips.com>
>>
>> Commit bc27fb68aaad ("include/uapi/linux/byteorder, swab: force inlining
>> of some byteswap operations") added __always_inline to swab functions
>> and commit 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to
>> userspace headers") added a definition of __always_inline for use in
>> exported headers when the kernel's compiler.h is not available.
>>
>> However, since swab.h does not include stddef.h, if the header soup does
>> not indirectly include it, the definition of __always_inline is missing,
>> resulting in a compilation failure, which was observed compiling the
>> perf tool using exported headers containing this commit:
>>
>> In file included from /usr/include/linux/byteorder/little_endian.h:12:0,
>>                   from /usr/include/asm/byteorder.h:14,
>>                   from tools/include/uapi/linux/perf_event.h:20,
>>                   from perf.h:8,
>>                   from builtin-bench.c:18:
>> /usr/include/linux/swab.h:160:8: error: unknown type name `__always_inline'
>>   static __always_inline __u16 __swab16p(const __u16 *p)
>>
>> Fix this by replacing the inclusion of linux/compiler.h with
>> linux/stddef.h to ensure that we pick up that definition if required,
>> without relying on it's indirect inclusion. compiler.h is then included
>> indirectly, via stddef.h.
>>
>> Fixes: 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to userspace headers")
>> Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
>> Reviewed-by: Petr Vaněk <arkamar@atlas.cz>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> I took this through my kernel build matrix and did not see any new
> issues.
> 
> Tested-by: Nathan Chancellor <nathan@kernel.org>

Great thanks! Since this is really useful for kernel-headers in 
toolchains, it would be great to get this picked up. Arnd is this 
something that would go via your tree?
-- 
Florian

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

* Re: [PATCH] include/uapi/linux/swab: Fix potentially missing __always_inline
  2022-09-27 21:52 Florian Fainelli
@ 2022-09-28 22:36 ` Nathan Chancellor
  2022-10-06 20:33   ` Florian Fainelli
  0 siblings, 1 reply; 6+ messages in thread
From: Nathan Chancellor @ 2022-09-28 22:36 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-kernel, Matt Redfearn, Petr Vaněk, Nick Desaulniers,
	Tom Rix, Justin Stitt, Andrew Morton, Denys Vlasenko,
	Ingo Molnar, open list:CLANG/LLVM BUILD SUPPORT, Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	open list:PERFORMANCE EVENTS SUBSYSTEM, mmayer, Khem Raj,
	Philippe Ombredanne, Kate Stewart, Greg Kroah-Hartman,
	Thomas Gleixner

Hi Florian,

On Tue, Sep 27, 2022 at 02:52:56PM -0700, Florian Fainelli wrote:
> From: Matt Redfearn <matt.redfearn@mips.com>
> 
> Commit bc27fb68aaad ("include/uapi/linux/byteorder, swab: force inlining
> of some byteswap operations") added __always_inline to swab functions
> and commit 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to
> userspace headers") added a definition of __always_inline for use in
> exported headers when the kernel's compiler.h is not available.
> 
> However, since swab.h does not include stddef.h, if the header soup does
> not indirectly include it, the definition of __always_inline is missing,
> resulting in a compilation failure, which was observed compiling the
> perf tool using exported headers containing this commit:
> 
> In file included from /usr/include/linux/byteorder/little_endian.h:12:0,
>                  from /usr/include/asm/byteorder.h:14,
>                  from tools/include/uapi/linux/perf_event.h:20,
>                  from perf.h:8,
>                  from builtin-bench.c:18:
> /usr/include/linux/swab.h:160:8: error: unknown type name `__always_inline'
>  static __always_inline __u16 __swab16p(const __u16 *p)
> 
> Fix this by replacing the inclusion of linux/compiler.h with
> linux/stddef.h to ensure that we pick up that definition if required,
> without relying on it's indirect inclusion. compiler.h is then included
> indirectly, via stddef.h.
> 
> Fixes: 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to userspace headers")
> Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
> Reviewed-by: Petr Vaněk <arkamar@atlas.cz>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

I took this through my kernel build matrix and did not see any new
issues.

Tested-by: Nathan Chancellor <nathan@kernel.org>

Cheers,
Nathan

> ---
> Apologies for the insanely long CC list. I encountered this problem
> again while attempting to build perf with a LLVM 13 toolchain using
> musl-libc. Not sure why it did not get picked up last time?
> 
> Khem did submit an alternative patch a few years ago, too which also did
> not get picked up:
> 
> https://lore.kernel.org/lkml/20180913005654.39976-1-raj.khem@gmail.com/
> 
>  include/uapi/linux/swab.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
> index 0723a9cce747..01717181339e 100644
> --- a/include/uapi/linux/swab.h
> +++ b/include/uapi/linux/swab.h
> @@ -3,7 +3,7 @@
>  #define _UAPI_LINUX_SWAB_H
>  
>  #include <linux/types.h>
> -#include <linux/compiler.h>
> +#include <linux/stddef.h>
>  #include <asm/bitsperlong.h>
>  #include <asm/swab.h>
>  
> -- 
> 2.25.1
> 
> 

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

* [PATCH] include/uapi/linux/swab: Fix potentially missing __always_inline
@ 2022-09-27 21:52 Florian Fainelli
  2022-09-28 22:36 ` Nathan Chancellor
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2022-09-27 21:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: Matt Redfearn, Petr Vaněk, Florian Fainelli,
	Nathan Chancellor, Nick Desaulniers, Tom Rix, Justin Stitt,
	Andrew Morton, Denys Vlasenko, Ingo Molnar,
	open list:CLANG/LLVM BUILD SUPPORT, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, open list:PERFORMANCE EVENTS SUBSYSTEM,
	mmayer, Khem Raj, Philippe Ombredanne, Kate Stewart,
	Greg Kroah-Hartman, Thomas Gleixner

From: Matt Redfearn <matt.redfearn@mips.com>

Commit bc27fb68aaad ("include/uapi/linux/byteorder, swab: force inlining
of some byteswap operations") added __always_inline to swab functions
and commit 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to
userspace headers") added a definition of __always_inline for use in
exported headers when the kernel's compiler.h is not available.

However, since swab.h does not include stddef.h, if the header soup does
not indirectly include it, the definition of __always_inline is missing,
resulting in a compilation failure, which was observed compiling the
perf tool using exported headers containing this commit:

In file included from /usr/include/linux/byteorder/little_endian.h:12:0,
                 from /usr/include/asm/byteorder.h:14,
                 from tools/include/uapi/linux/perf_event.h:20,
                 from perf.h:8,
                 from builtin-bench.c:18:
/usr/include/linux/swab.h:160:8: error: unknown type name `__always_inline'
 static __always_inline __u16 __swab16p(const __u16 *p)

Fix this by replacing the inclusion of linux/compiler.h with
linux/stddef.h to ensure that we pick up that definition if required,
without relying on it's indirect inclusion. compiler.h is then included
indirectly, via stddef.h.

Fixes: 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to userspace headers")
Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
Reviewed-by: Petr Vaněk <arkamar@atlas.cz>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Apologies for the insanely long CC list. I encountered this problem
again while attempting to build perf with a LLVM 13 toolchain using
musl-libc. Not sure why it did not get picked up last time?

Khem did submit an alternative patch a few years ago, too which also did
not get picked up:

https://lore.kernel.org/lkml/20180913005654.39976-1-raj.khem@gmail.com/

 include/uapi/linux/swab.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
index 0723a9cce747..01717181339e 100644
--- a/include/uapi/linux/swab.h
+++ b/include/uapi/linux/swab.h
@@ -3,7 +3,7 @@
 #define _UAPI_LINUX_SWAB_H
 
 #include <linux/types.h>
-#include <linux/compiler.h>
+#include <linux/stddef.h>
 #include <asm/bitsperlong.h>
 #include <asm/swab.h>
 
-- 
2.25.1


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

* [PATCH] include/uapi/linux/swab: Fix potentially missing __always_inline
@ 2018-01-03  9:57 Matt Redfearn
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Redfearn @ 2018-01-03  9:57 UTC (permalink / raw)
  To: Denys Vlasenko
  Cc: Ingo Molnar, Matt Redfearn, linux-kernel, Thomas Gleixner,
	Philippe Ombredanne, Kate Stewart, Greg Kroah-Hartman

Commit bc27fb68aaad ("include/uapi/linux/byteorder, swab: force inlining
of some byteswap operations") added __always_inline to swab functions
and commit 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to
userspace headers") added a definition of __always_inline for use in
exported headers when the kernel's compiler.h is not available.

However, since swab.h does not include stddef.h, if the header soup does
not indirectly include it, the definition of __always_inline is missing,
resulting in a compilation failure, which was observed compiling the
perf tool using exported headers containing this commit:

In file included from /usr/include/linux/byteorder/little_endian.h:12:0,
                 from /usr/include/asm/byteorder.h:14,
                 from tools/include/uapi/linux/perf_event.h:20,
                 from perf.h:8,
                 from builtin-bench.c:18:
/usr/include/linux/swab.h:160:8: error: unknown type name ‘__always_inline’
 static __always_inline __u16 __swab16p(const __u16 *p)

Fix this by replacing the inclusion of linux/compiler.h with
linux/stddef.h to ensure that we pick up that definition if required,
without relying on it's indirect inclusion. compiler.h is then included
indirectly, via stddef.h.

Fixes: 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to userspace headers")
Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>

---

 include/uapi/linux/swab.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
index 23cd84868cc3..f6a8cf737abf 100644
--- a/include/uapi/linux/swab.h
+++ b/include/uapi/linux/swab.h
@@ -3,7 +3,7 @@
 #define _UAPI_LINUX_SWAB_H
 
 #include <linux/types.h>
-#include <linux/compiler.h>
+#include <linux/stddef.h>
 #include <asm/swab.h>
 
 /*
-- 
2.7.4

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

end of thread, other threads:[~2022-10-28 19:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  9:45 [PATCH] include/uapi/linux/swab: Fix potentially missing __always_inline Pavo Banicevic
  -- strict thread matches above, loose matches on Subject: below --
2022-09-27 21:52 Florian Fainelli
2022-09-28 22:36 ` Nathan Chancellor
2022-10-06 20:33   ` Florian Fainelli
2022-10-28 19:19     ` Florian Fainelli
2018-01-03  9:57 Matt Redfearn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.