Skip to contentSkip to conversation

context_tracking: Tag context_tracking_enabled_this_cpu() __always_inline

PATCH In review Sean Christopherson 2 participants 2 messages Jun 17, 2024 – Jun 18, 2024 Context tracking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 context_tracking: Tag context_tracking_enabled_this_cpu() __always_inline

Force context_tracking_enabled_this_cpu() to be inlined so that invoking it from guest_context_enter_irqoff(), which KVM uses in non-instrumentable code, doesn't unexpectedly leave a noinstr section.

vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0x1c7: call to
context_tracking_enabled_this_cpu() leaves .noinstr.text section
vmlinux.o: warning: objtool: svm_vcpu_enter_exit+0x83: call to
context_tracking_enabled_this_cpu() leaves .noinstr.text section

Note, the CONFIG_CONTEXT_TRACKING_USER=n stub is already __always_inline.

---
 include/linux/context_tracking_state.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/context_tracking_state.h +1 -1
index bbff5f7f8803..1a23d8c7d8c3 100644
@@ -113,7 +113,7 @@ static __always_inline bool context_tracking_enabled_cpu(int cpu)
 	return context_tracking_enabled() && per_cpu(context_tracking.active, cpu);
 }
 
-static inline bool context_tracking_enabled_this_cpu(void)
+static __always_inline bool context_tracking_enabled_this_cpu(void)
 {
 	return context_tracking_enabled() && __this_cpu_read(context_tracking.active);
 }

base-commit: e4e9e1067138e5620cf0500c3e5f6ebfb9d322c8

Signature · 1 line
2.45.2.627.g7a2c4fd464-goog
maintainer
#1 lore raw
Quoted 4 lines · Sean Christopherson

Force context_tracking_enabled_this_cpu() to be inlined so that invoking it from guest_context_enter_irqoff(), which KVM uses in non-instrumentable code, doesn't unexpectedly leave a noinstr section.

Quoted 8 lines

vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0x1c7: call to
context_tracking_enabled_this_cpu() leaves .noinstr.text section
vmlinux.o: warning: objtool: svm_vcpu_enter_exit+0x83: call to
context_tracking_enabled_this_cpu() leaves .noinstr.text section

Note, the CONFIG_CONTEXT_TRACKING_USER=n stub is already __always_inline.

Thank you, Sean, I have queued this for further review and testing.

Thanx, Paul

Quoted 22 lines
---
 include/linux/context_tracking_state.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/context_tracking_state.h +1 -1
index bbff5f7f8803..1a23d8c7d8c3 100644
@@ -113,7 +113,7 @@ static __always_inline bool context_tracking_enabled_cpu(int cpu)
 	return context_tracking_enabled() && per_cpu(context_tracking.active, cpu);
 }
 
-static inline bool context_tracking_enabled_this_cpu(void)
+static __always_inline bool context_tracking_enabled_this_cpu(void)
 {
 	return context_tracking_enabled() && __this_cpu_read(context_tracking.active);
 }

base-commit: e4e9e1067138e5620cf0500c3e5f6ebfb9d322c8

Signature · 1 line
2.45.2.627.g7a2c4fd464-goog