mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/asm: Always inline serialize()
@ 2025-01-16 14:28 Nathan Chancellor
  2025-01-16 14:32 ` Jürgen Groß
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2025-01-16 14:28 UTC (permalink / raw)
  To: x86
  Cc: Juergen Gross, linux-kernel, llvm, kernel test robot,
	Sean Christopherson, Linux Kernel Functional Testing,
	Nathan Chancellor

serialize() may be called from noinstr code and if it is not inlined,
objtool may warn like:

  vmlinux.o: warning: objtool: __static_call_update_early+0x2a: call to serialize() leaves .noinstr.text section

Mark serialize() with __always_inline to clear up the warning and
prevent future ones from occurring.

Fixes: 0ef8047b737d ("x86/static-call: provide a way to do very early static-call updates")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/202412181756.aJvzih2K-lkp@intel.com/
Reported-by: Sean Christopherson <seanjc@google.com>
Closes: https://lore.kernel.org/Z4bWnWYqu1LaD-JG@google.com/
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Closes: https://lore.kernel.org/CA+G9fYv-AgeUpP1yPDmy48T869Ms80jgUdjnwtBNoJmCKQvZDQ@mail.gmail.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/x86/include/asm/special_insns.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
index fab7c8af27a4d00647f2f52e7fe4f91bd42a7291..03e7c2d495597597a635f83116fafa1a95ed357e 100644
--- a/arch/x86/include/asm/special_insns.h
+++ b/arch/x86/include/asm/special_insns.h
@@ -211,7 +211,7 @@ static inline int write_user_shstk_64(u64 __user *addr, u64 val)
 
 #define nop() asm volatile ("nop")
 
-static inline void serialize(void)
+static __always_inline void serialize(void)
 {
 	/* Instruction opcode for SERIALIZE; supported in binutils >= 2.35. */
 	asm volatile(".byte 0xf, 0x1, 0xe8" ::: "memory");

---
base-commit: 37bc915c6ad0fb8a192dafb6b7046c79cad1f4a2
change-id: 20250116-always-inline-serialize-for-noinstr-4e9e9826d967

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


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

* Re: [PATCH] x86/asm: Always inline serialize()
  2025-01-16 14:28 [PATCH] x86/asm: Always inline serialize() Nathan Chancellor
@ 2025-01-16 14:32 ` Jürgen Groß
  0 siblings, 0 replies; 2+ messages in thread
From: Jürgen Groß @ 2025-01-16 14:32 UTC (permalink / raw)
  To: Nathan Chancellor, x86
  Cc: linux-kernel, llvm, kernel test robot, Sean Christopherson,
	Linux Kernel Functional Testing


[-- Attachment #1.1.1: Type: text/plain, Size: 1936 bytes --]

On 16.01.25 15:28, Nathan Chancellor wrote:
> serialize() may be called from noinstr code and if it is not inlined,
> objtool may warn like:
> 
>    vmlinux.o: warning: objtool: __static_call_update_early+0x2a: call to serialize() leaves .noinstr.text section
> 
> Mark serialize() with __always_inline to clear up the warning and
> prevent future ones from occurring.
> 
> Fixes: 0ef8047b737d ("x86/static-call: provide a way to do very early static-call updates")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/202412181756.aJvzih2K-lkp@intel.com/
> Reported-by: Sean Christopherson <seanjc@google.com>
> Closes: https://lore.kernel.org/Z4bWnWYqu1LaD-JG@google.com/
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Closes: https://lore.kernel.org/CA+G9fYv-AgeUpP1yPDmy48T869Ms80jgUdjnwtBNoJmCKQvZDQ@mail.gmail.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>   arch/x86/include/asm/special_insns.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
> index fab7c8af27a4d00647f2f52e7fe4f91bd42a7291..03e7c2d495597597a635f83116fafa1a95ed357e 100644
> --- a/arch/x86/include/asm/special_insns.h
> +++ b/arch/x86/include/asm/special_insns.h
> @@ -211,7 +211,7 @@ static inline int write_user_shstk_64(u64 __user *addr, u64 val)
>   
>   #define nop() asm volatile ("nop")
>   
> -static inline void serialize(void)
> +static __always_inline void serialize(void)
>   {
>   	/* Instruction opcode for SERIALIZE; supported in binutils >= 2.35. */
>   	asm volatile(".byte 0xf, 0x1, 0xe8" ::: "memory");
> 
> ---
> base-commit: 37bc915c6ad0fb8a192dafb6b7046c79cad1f4a2
> change-id: 20250116-always-inline-serialize-for-noinstr-4e9e9826d967
> 
> Best regards,

I have sent the very same patch on Dec. 18th already.


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

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

end of thread, other threads:[~2025-01-16 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-16 14:28 [PATCH] x86/asm: Always inline serialize() Nathan Chancellor
2025-01-16 14:32 ` Jürgen Groß

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®