On Thu, Sep 21, 2017 at 09:36:53AM -0400, Konrad Rzeszutek Wilk wrote: > On Thu, Sep 21, 2017 at 08:38:38AM -0300, Marcelo Tosatti wrote: > > Add hypercalls to spinlock/unlock to set/unset FIFO priority > > for the vcpu, protected by a static branch to avoid performance > > increase in the normal kernels. > > > > Enable option by "kvmfifohc" kernel command line parameter (disabled > > by default). WTF kind of fudge is this? Changelog completely fails to explain the problem this would solve. Why are you doing insane things like this? NAK! > > Index: kvm.fifopriohc-submit/include/linux/spinlock_api_smp.h > > =================================================================== > > --- kvm.fifopriohc-submit.orig/include/linux/spinlock_api_smp.h > > +++ kvm.fifopriohc-submit/include/linux/spinlock_api_smp.h > > @@ -136,11 +136,28 @@ static inline void __raw_spin_lock_bh(ra > > LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); > > } > > > > +#ifdef CONFIG_KVM_GUEST > > +DECLARE_STATIC_KEY_FALSE(kvm_fifo_hc_key); > > +#endif > > + > > static inline void __raw_spin_lock(raw_spinlock_t *lock) > > { > > preempt_disable(); > > + > > +#if defined(CONFIG_KVM_GUEST) && defined(CONFIG_SMP) > > + /* enable FIFO priority */ > > + if (static_branch_unlikely(&kvm_fifo_hc_key)) > > + kvm_hypercall1(KVM_HC_RT_PRIO, 0x1); > > +#endif > > + > > spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); > > LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); > > + > > +#if defined(CONFIG_KVM_GUEST) && defined(CONFIG_SMP) > > + /* disable FIFO priority */ > > + if (static_branch_unlikely(&kvm_fifo_hc_key)) > > + kvm_hypercall1(KVM_HC_RT_PRIO, 0); > > +#endif > > } > > > > #endif /* !CONFIG_GENERIC_LOCKBREAK || CONFIG_DEBUG_LOCK_ALLOC */