On Fri, Mar 25, 2022, Wanpeng Li wrote: > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 425fd7f38fa9..6b300496bbd0 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -10375,6 +10375,28 @@ static int vcpu_run(struct kvm_vcpu *vcpu) > return r; > } > > +static int kvm_vcpu_non_preemptable(struct kvm_vcpu *vcpu) s/preemtable/preemptible And I'd recommend inverting the return, and also return a bool, i.e. static bool kvm_vcpu_is_preemptible(struct kvm_vcpu *vcpu) > +{ > + int count; > + > + if (!vcpu->arch.pv_pc.preempt_count_enabled) > + return 0; > + > + if (!kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.pv_pc.preempt_count_cache, > + &count, sizeof(int))) > + return (count & ~PREEMPT_NEED_RESCHED); This cements PREEMPT_NEED_RESCHED into KVM's guest/host ABI. I doubt the sched folks will be happy with that. > + > + return 0; > +} > +