public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Some trivial noinstr fixes
@ 2022-03-24 18:36 Borislav Petkov
  2022-03-24 18:36 ` [PATCH 1/3] task_stack, x86/cea: Force-inline stack helpers Borislav Petkov
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Borislav Petkov @ 2022-03-24 18:36 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

Hi,

here are some trivial noinstr fixes which sprang up from recent clang
allmodconfigs.

Thx.

Borislav Petkov (3):
  task_stack, x86/cea: Force-inline stack helpers
  x86/kvm/svm: Force-inline GHCB accessors
  x86/mm: Force-inline __phys_addr_nodebug()

 arch/x86/include/asm/cpu_entry_area.h | 2 +-
 arch/x86/include/asm/page_64.h        | 2 +-
 arch/x86/include/asm/svm.h            | 8 ++++----
 include/linux/sched/task_stack.h      | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.35.1


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

* [PATCH 1/3] task_stack, x86/cea: Force-inline stack helpers
  2022-03-24 18:36 [PATCH 0/3] Some trivial noinstr fixes Borislav Petkov
@ 2022-03-24 18:36 ` Borislav Petkov
  2022-04-04 17:46   ` [tip: locking/core] " tip-bot2 for Borislav Petkov
  2022-03-24 18:36 ` [PATCH 2/3] x86/kvm/svm: Force-inline GHCB accessors Borislav Petkov
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2022-03-24 18:36 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

Force-inline two stack helpers to fix the following objtool warnings:

  vmlinux.o: warning: objtool: in_task_stack()+0xc: call to task_stack_page() leaves .noinstr.text section
  vmlinux.o: warning: objtool: in_entry_stack()+0x10: call to cpu_entry_stack() leaves .noinstr.text section

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/include/asm/cpu_entry_area.h | 2 +-
 include/linux/sched/task_stack.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/cpu_entry_area.h b/arch/x86/include/asm/cpu_entry_area.h
index dd5ea1bdf04c..75efc4c6f076 100644
--- a/arch/x86/include/asm/cpu_entry_area.h
+++ b/arch/x86/include/asm/cpu_entry_area.h
@@ -143,7 +143,7 @@ extern void cea_set_pte(void *cea_vaddr, phys_addr_t pa, pgprot_t flags);
 
 extern struct cpu_entry_area *get_cpu_entry_area(int cpu);
 
-static inline struct entry_stack *cpu_entry_stack(int cpu)
+static __always_inline struct entry_stack *cpu_entry_stack(int cpu)
 {
 	return &get_cpu_entry_area(cpu)->entry_stack_page.stack;
 }
diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h
index d10150587d81..1009b6b5ce40 100644
--- a/include/linux/sched/task_stack.h
+++ b/include/linux/sched/task_stack.h
@@ -16,7 +16,7 @@
  * try_get_task_stack() instead.  task_stack_page will return a pointer
  * that could get freed out from under you.
  */
-static inline void *task_stack_page(const struct task_struct *task)
+static __always_inline void *task_stack_page(const struct task_struct *task)
 {
 	return task->stack;
 }
-- 
2.35.1


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

* [PATCH 2/3] x86/kvm/svm: Force-inline GHCB accessors
  2022-03-24 18:36 [PATCH 0/3] Some trivial noinstr fixes Borislav Petkov
  2022-03-24 18:36 ` [PATCH 1/3] task_stack, x86/cea: Force-inline stack helpers Borislav Petkov
@ 2022-03-24 18:36 ` Borislav Petkov
  2022-04-04 17:46   ` [tip: locking/core] " tip-bot2 for Borislav Petkov
  2022-03-24 18:36 ` [PATCH 3/3] x86/mm: Force-inline __phys_addr_nodebug() Borislav Petkov
  2022-03-25  7:44 ` [PATCH 0/3] Some trivial noinstr fixes Peter Zijlstra
  3 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2022-03-24 18:36 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML, kvm

From: Borislav Petkov <bp@suse.de>

In order to fix:

  vmlinux.o: warning: objtool: __sev_es_nmi_complete()+0x4c: call to ghcb_set_sw_exit_code() leaves .noinstr.text section

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: kvm@vger.kernel.org
---
 arch/x86/include/asm/svm.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
index bb2fb78523ce..eab0749262b7 100644
--- a/arch/x86/include/asm/svm.h
+++ b/arch/x86/include/asm/svm.h
@@ -436,23 +436,23 @@ struct vmcb {
 	(offsetof(struct vmcb_save_area, field) / sizeof(u64))
 
 #define DEFINE_GHCB_ACCESSORS(field)						\
-	static inline bool ghcb_##field##_is_valid(const struct ghcb *ghcb)	\
+	static __always_inline bool ghcb_##field##_is_valid(const struct ghcb *ghcb) \
 	{									\
 		return test_bit(GHCB_BITMAP_IDX(field),				\
 				(unsigned long *)&ghcb->save.valid_bitmap);	\
 	}									\
 										\
-	static inline u64 ghcb_get_##field(struct ghcb *ghcb)			\
+	static __always_inline u64 ghcb_get_##field(struct ghcb *ghcb)		\
 	{									\
 		return ghcb->save.field;					\
 	}									\
 										\
-	static inline u64 ghcb_get_##field##_if_valid(struct ghcb *ghcb)	\
+	static __always_inline u64 ghcb_get_##field##_if_valid(struct ghcb *ghcb) \
 	{									\
 		return ghcb_##field##_is_valid(ghcb) ? ghcb->save.field : 0;	\
 	}									\
 										\
-	static inline void ghcb_set_##field(struct ghcb *ghcb, u64 value)	\
+	static __always_inline void ghcb_set_##field(struct ghcb *ghcb, u64 value) \
 	{									\
 		__set_bit(GHCB_BITMAP_IDX(field),				\
 			  (unsigned long *)&ghcb->save.valid_bitmap);		\
-- 
2.35.1


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

* [PATCH 3/3] x86/mm: Force-inline __phys_addr_nodebug()
  2022-03-24 18:36 [PATCH 0/3] Some trivial noinstr fixes Borislav Petkov
  2022-03-24 18:36 ` [PATCH 1/3] task_stack, x86/cea: Force-inline stack helpers Borislav Petkov
  2022-03-24 18:36 ` [PATCH 2/3] x86/kvm/svm: Force-inline GHCB accessors Borislav Petkov
@ 2022-03-24 18:36 ` Borislav Petkov
  2022-04-04 17:46   ` [tip: locking/core] " tip-bot2 for Borislav Petkov
  2022-03-25  7:44 ` [PATCH 0/3] Some trivial noinstr fixes Peter Zijlstra
  3 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2022-03-24 18:36 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

Fix:

  vmlinux.o: warning: objtool: __sev_es_nmi_complete()+0x8b: call to __phys_addr_nodebug() leaves .noinstr.text section

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/include/asm/page_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h
index e9c86299b835..baa70451b8df 100644
--- a/arch/x86/include/asm/page_64.h
+++ b/arch/x86/include/asm/page_64.h
@@ -16,7 +16,7 @@ extern unsigned long page_offset_base;
 extern unsigned long vmalloc_base;
 extern unsigned long vmemmap_base;
 
-static inline unsigned long __phys_addr_nodebug(unsigned long x)
+static __always_inline unsigned long __phys_addr_nodebug(unsigned long x)
 {
 	unsigned long y = x - __START_KERNEL_map;
 
-- 
2.35.1


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

* Re: [PATCH 0/3] Some trivial noinstr fixes
  2022-03-24 18:36 [PATCH 0/3] Some trivial noinstr fixes Borislav Petkov
                   ` (2 preceding siblings ...)
  2022-03-24 18:36 ` [PATCH 3/3] x86/mm: Force-inline __phys_addr_nodebug() Borislav Petkov
@ 2022-03-25  7:44 ` Peter Zijlstra
  3 siblings, 0 replies; 8+ messages in thread
From: Peter Zijlstra @ 2022-03-25  7:44 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: X86 ML, LKML

On Thu, Mar 24, 2022 at 07:36:04PM +0100, Borislav Petkov wrote:

> Borislav Petkov (3):
>   task_stack, x86/cea: Force-inline stack helpers
>   x86/kvm/svm: Force-inline GHCB accessors
>   x86/mm: Force-inline __phys_addr_nodebug()

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

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

* [tip: locking/core] x86/mm: Force-inline __phys_addr_nodebug()
  2022-03-24 18:36 ` [PATCH 3/3] x86/mm: Force-inline __phys_addr_nodebug() Borislav Petkov
@ 2022-04-04 17:46   ` tip-bot2 for Borislav Petkov
  0 siblings, 0 replies; 8+ messages in thread
From: tip-bot2 for Borislav Petkov @ 2022-04-04 17:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Borislav Petkov, Peter Zijlstra (Intel), x86, linux-kernel

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     ace1a98519270c586c0d4179419292df67441cd1
Gitweb:        https://git.kernel.org/tip/ace1a98519270c586c0d4179419292df67441cd1
Author:        Borislav Petkov <bp@suse.de>
AuthorDate:    Wed, 23 Mar 2022 23:24:12 +01:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 04 Apr 2022 10:13:25 +02:00

x86/mm: Force-inline __phys_addr_nodebug()

Fix:

  vmlinux.o: warning: objtool: __sev_es_nmi_complete()+0x8b: call to __phys_addr_nodebug() leaves .noinstr.text section

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220324183607.31717-4-bp@alien8.de
---
 arch/x86/include/asm/page_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h
index e9c8629..baa7045 100644
--- a/arch/x86/include/asm/page_64.h
+++ b/arch/x86/include/asm/page_64.h
@@ -16,7 +16,7 @@ extern unsigned long page_offset_base;
 extern unsigned long vmalloc_base;
 extern unsigned long vmemmap_base;
 
-static inline unsigned long __phys_addr_nodebug(unsigned long x)
+static __always_inline unsigned long __phys_addr_nodebug(unsigned long x)
 {
 	unsigned long y = x - __START_KERNEL_map;
 

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

* [tip: locking/core] task_stack, x86/cea: Force-inline stack helpers
  2022-03-24 18:36 ` [PATCH 1/3] task_stack, x86/cea: Force-inline stack helpers Borislav Petkov
@ 2022-04-04 17:46   ` tip-bot2 for Borislav Petkov
  0 siblings, 0 replies; 8+ messages in thread
From: tip-bot2 for Borislav Petkov @ 2022-04-04 17:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Borislav Petkov, Peter Zijlstra (Intel), x86, linux-kernel

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     e87f4152e542610d0b4c6c8548964a68a59d2040
Gitweb:        https://git.kernel.org/tip/e87f4152e542610d0b4c6c8548964a68a59d2040
Author:        Borislav Petkov <bp@suse.de>
AuthorDate:    Wed, 23 Mar 2022 20:02:41 +01:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 04 Apr 2022 10:13:07 +02:00

task_stack, x86/cea: Force-inline stack helpers

Force-inline two stack helpers to fix the following objtool warnings:

  vmlinux.o: warning: objtool: in_task_stack()+0xc: call to task_stack_page() leaves .noinstr.text section
  vmlinux.o: warning: objtool: in_entry_stack()+0x10: call to cpu_entry_stack() leaves .noinstr.text section

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220324183607.31717-2-bp@alien8.de
---
 arch/x86/include/asm/cpu_entry_area.h | 2 +-
 include/linux/sched/task_stack.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/cpu_entry_area.h b/arch/x86/include/asm/cpu_entry_area.h
index dd5ea1b..75efc4c 100644
--- a/arch/x86/include/asm/cpu_entry_area.h
+++ b/arch/x86/include/asm/cpu_entry_area.h
@@ -143,7 +143,7 @@ extern void cea_set_pte(void *cea_vaddr, phys_addr_t pa, pgprot_t flags);
 
 extern struct cpu_entry_area *get_cpu_entry_area(int cpu);
 
-static inline struct entry_stack *cpu_entry_stack(int cpu)
+static __always_inline struct entry_stack *cpu_entry_stack(int cpu)
 {
 	return &get_cpu_entry_area(cpu)->entry_stack_page.stack;
 }
diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h
index 892562e..5e799a4 100644
--- a/include/linux/sched/task_stack.h
+++ b/include/linux/sched/task_stack.h
@@ -16,7 +16,7 @@
  * try_get_task_stack() instead.  task_stack_page will return a pointer
  * that could get freed out from under you.
  */
-static inline void *task_stack_page(const struct task_struct *task)
+static __always_inline void *task_stack_page(const struct task_struct *task)
 {
 	return task->stack;
 }

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

* [tip: locking/core] x86/kvm/svm: Force-inline GHCB accessors
  2022-03-24 18:36 ` [PATCH 2/3] x86/kvm/svm: Force-inline GHCB accessors Borislav Petkov
@ 2022-04-04 17:46   ` tip-bot2 for Borislav Petkov
  0 siblings, 0 replies; 8+ messages in thread
From: tip-bot2 for Borislav Petkov @ 2022-04-04 17:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Borislav Petkov, Peter Zijlstra (Intel), x86, linux-kernel

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     6b91ec4ad290a808a894e7d3448eb82d0b8ef8d5
Gitweb:        https://git.kernel.org/tip/6b91ec4ad290a808a894e7d3448eb82d0b8ef8d5
Author:        Borislav Petkov <bp@suse.de>
AuthorDate:    Wed, 23 Mar 2022 21:52:44 +01:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 04 Apr 2022 10:13:20 +02:00

x86/kvm/svm: Force-inline GHCB accessors

In order to fix:

  vmlinux.o: warning: objtool: __sev_es_nmi_complete()+0x4c: call to ghcb_set_sw_exit_code() leaves .noinstr.text section

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220324183607.31717-3-bp@alien8.de
---
 arch/x86/include/asm/svm.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
index f70a510..e255039 100644
--- a/arch/x86/include/asm/svm.h
+++ b/arch/x86/include/asm/svm.h
@@ -444,23 +444,23 @@ struct vmcb {
 	(offsetof(struct vmcb_save_area, field) / sizeof(u64))
 
 #define DEFINE_GHCB_ACCESSORS(field)						\
-	static inline bool ghcb_##field##_is_valid(const struct ghcb *ghcb)	\
+	static __always_inline bool ghcb_##field##_is_valid(const struct ghcb *ghcb) \
 	{									\
 		return test_bit(GHCB_BITMAP_IDX(field),				\
 				(unsigned long *)&ghcb->save.valid_bitmap);	\
 	}									\
 										\
-	static inline u64 ghcb_get_##field(struct ghcb *ghcb)			\
+	static __always_inline u64 ghcb_get_##field(struct ghcb *ghcb)		\
 	{									\
 		return ghcb->save.field;					\
 	}									\
 										\
-	static inline u64 ghcb_get_##field##_if_valid(struct ghcb *ghcb)	\
+	static __always_inline u64 ghcb_get_##field##_if_valid(struct ghcb *ghcb) \
 	{									\
 		return ghcb_##field##_is_valid(ghcb) ? ghcb->save.field : 0;	\
 	}									\
 										\
-	static inline void ghcb_set_##field(struct ghcb *ghcb, u64 value)	\
+	static __always_inline void ghcb_set_##field(struct ghcb *ghcb, u64 value) \
 	{									\
 		__set_bit(GHCB_BITMAP_IDX(field),				\
 			  (unsigned long *)&ghcb->save.valid_bitmap);		\

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

end of thread, other threads:[~2022-04-04 22:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-24 18:36 [PATCH 0/3] Some trivial noinstr fixes Borislav Petkov
2022-03-24 18:36 ` [PATCH 1/3] task_stack, x86/cea: Force-inline stack helpers Borislav Petkov
2022-04-04 17:46   ` [tip: locking/core] " tip-bot2 for Borislav Petkov
2022-03-24 18:36 ` [PATCH 2/3] x86/kvm/svm: Force-inline GHCB accessors Borislav Petkov
2022-04-04 17:46   ` [tip: locking/core] " tip-bot2 for Borislav Petkov
2022-03-24 18:36 ` [PATCH 3/3] x86/mm: Force-inline __phys_addr_nodebug() Borislav Petkov
2022-04-04 17:46   ` [tip: locking/core] " tip-bot2 for Borislav Petkov
2022-03-25  7:44 ` [PATCH 0/3] Some trivial noinstr fixes Peter Zijlstra

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