Skip to contentSkip to conversation

Some trivial noinstr fixes

PATCH Applied Borislav Petkov 3 participants 8 messages Mar 24, 2022 – Apr 4, 2022

Subsystems (3)
lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

cover Some trivial noinstr fixes

From: Borislav Petkov <[email protected]>

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(-)
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 1/3 task_stack, x86/cea: Force-inline stack helpers

From: Borislav Petkov <[email protected]>

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

---
 arch/x86/include/asm/cpu_entry_area.h | 2 +-
 include/linux/sched/task_stack.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/cpu_entry_area.h +1 -1
index dd5ea1bdf04c..75efc4c6f076 100644
@@ -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;
 }
include/linux/sched/task_stack.h +1 -1
index d10150587d81..1009b6b5ce40 100644
@@ -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;
 }
Signature · 1 line
2.35.1
#2 lore raw

[tip: locking/core] task_stack, x86/cea: Force-inline stack helpers

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

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 <[email protected]>
AuthorDate:    Wed, 23 Mar 2022 20:02:41 +01:00
Committer:     Borislav Petkov <[email protected]>
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

---
 arch/x86/include/asm/cpu_entry_area.h | 2 +-
 include/linux/sched/task_stack.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/cpu_entry_area.h +1 -1
index dd5ea1b..75efc4c 100644
@@ -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;
 }
include/linux/sched/task_stack.h +1 -1
index 892562e..5e799a4 100644
@@ -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;
 }
author maintainer
#3 lore raw

PATCH 2/3 x86/kvm/svm: Force-inline GHCB accessors

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

In order to fix:

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

---
 arch/x86/include/asm/svm.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/include/asm/svm.h +4 -4
index bb2fb78523ce..eab0749262b7 100644
@@ -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);		\
Signature · 1 line
2.35.1
#4 lore raw

[tip: locking/core] x86/kvm/svm: Force-inline GHCB accessors

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

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 <[email protected]>
AuthorDate:    Wed, 23 Mar 2022 21:52:44 +01:00
Committer:     Borislav Petkov <[email protected]>
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

---
 arch/x86/include/asm/svm.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/include/asm/svm.h +4 -4
index f70a510..e255039 100644
@@ -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);		\
author maintainer
#5 lore raw

PATCH 3/3 x86/mm: Force-inline __phys_addr_nodebug()

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

Fix:

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

---
 arch/x86/include/asm/page_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/page_64.h +1 -1
index e9c86299b835..baa70451b8df 100644
@@ -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;
 
Signature · 1 line
2.35.1
#6 lore raw

[tip: locking/core] x86/mm: Force-inline __phys_addr_nodebug()

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

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 <[email protected]>
AuthorDate:    Wed, 23 Mar 2022 23:24:12 +01:00
Committer:     Borislav Petkov <[email protected]>
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

---
 arch/x86/include/asm/page_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/page_64.h +1 -1
index e9c8629..baa7045 100644
@@ -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;