Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1726575
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock |
| Date | 2017-09-05 11:10 +0200 |
| Message-ID | <umi1P-Ly-13@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <umgCL-8ei-21@gated-at.bofh.it> <umhfs-el-11@gated-at.bofh.it> <umhfs-el-9@gated-at.bofh.it> <umhp8-hk-3@gated-at.bofh.it> <umhS9-t5-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Sep 05, 2017 at 10:52:06AM +0200, Juergen Gross wrote:
> > Hmm, that might work. Could we somehow nop that call when
> > !X86_FEATURE_HYPERVISOR?, that saves native from having to do the call
> > and would be a win for everyone.
>
> So in fact we want a "always false" shortcut for bare metal and for any
> virtualization environment selecting bare metal behavior.
>
> I'll have a try.
Right, so for native I think you can do this:
diff --git a/arch/x86/kernel/paravirt_patch_64.c b/arch/x86/kernel/paravirt_patch_64.c
index 11aaf1eaa0e4..4e9839001291 100644
--- a/arch/x86/kernel/paravirt_patch_64.c
+++ b/arch/x86/kernel/paravirt_patch_64.c
@@ -21,6 +21,7 @@ DEF_NATIVE(, mov64, "mov %rdi, %rax");
#if defined(CONFIG_PARAVIRT_SPINLOCKS)
DEF_NATIVE(pv_lock_ops, queued_spin_unlock, "movb $0, (%rdi)");
DEF_NATIVE(pv_lock_ops, vcpu_is_preempted, "xor %rax, %rax");
+DEF_NATIVE(pv_lock_ops, virt_spin_lock, "xor %rax, %rax");
#endif
unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len)
@@ -77,6 +78,13 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
goto patch_site;
}
goto patch_default;
+ case PARAVIRT_PATCH(pv_lock_ops.virt_spin_lock):
+ if (!this_cpu_has(X86_FEATURE_HYPERVISOR)) {
+ start = start_pv_lock_ops_virt_spin_lock;
+ end = end_pv_lock_ops_virt_spin_lock;
+ goto patch_side;
+ }
+ goto patch_default;
#endif
default:
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Oscar Salvador <osalvador@suse.de> - 2017-09-04 16:40 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Peter Zijlstra <peterz@infradead.org> - 2017-09-04 16:50 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Waiman Long <longman@redhat.com> - 2017-09-04 21:40 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Davidlohr Bueso <dave@stgolabs.net> - 2017-09-05 00:30 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Juergen Gross <jgross@suse.com> - 2017-09-05 08:30 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Peter Zijlstra <peterz@infradead.org> - 2017-09-05 09:00 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Juergen Gross <jgross@suse.com> - 2017-09-05 09:40 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Juergen Gross <jgross@suse.com> - 2017-09-05 10:20 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Peter Zijlstra <peterz@infradead.org> - 2017-09-05 10:30 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Juergen Gross <jgross@suse.com> - 2017-09-05 11:00 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Peter Zijlstra <peterz@infradead.org> - 2017-09-05 11:10 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Juergen Gross <jgross@suse.com> - 2017-09-05 11:20 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Peter Zijlstra <peterz@infradead.org> - 2017-09-05 10:20 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Oscar Salvador <osalvador@suse.de> - 2017-09-05 09:00 +0200
Re: [PATCH resend] x86,kvm: Add a kernel parameter to disable PV spinlock Peter Zijlstra <peterz@infradead.org> - 2017-09-05 10:10 +0200
csiph-web