lkml.org 
[lkml]   [2021]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/15] KVM: Use dedicated flag to track if KVM is handling an NMI from guest
On Thu, Aug 26, 2021 at 05:57:10PM -0700, Sean Christopherson wrote:
> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> index 5cedc0e8a5d5..4c5ba4128b38 100644
> --- a/arch/x86/kvm/x86.h
> +++ b/arch/x86/kvm/x86.h
> @@ -395,9 +395,10 @@ static inline void kvm_unregister_perf_callbacks(void)
>
> DECLARE_PER_CPU(struct kvm_vcpu *, current_vcpu);
>
> -static inline void kvm_before_interrupt(struct kvm_vcpu *vcpu)
> +static inline void kvm_before_interrupt(struct kvm_vcpu *vcpu, bool is_nmi)
> {
> __this_cpu_write(current_vcpu, vcpu);
> + WRITE_ONCE(vcpu->arch.handling_nmi_from_guest, is_nmi);
>
> kvm_register_perf_callbacks();
> }
> @@ -406,6 +407,7 @@ static inline void kvm_after_interrupt(struct kvm_vcpu *vcpu)
> {
> kvm_unregister_perf_callbacks();
>
> + WRITE_ONCE(vcpu->arch.handling_nmi_from_guest, false);
> __this_cpu_write(current_vcpu, NULL);
> }

Does this rely on kvm_{,un}register_perf_callback() being a function
call and thus implying a sequence point to order the stores?

\
 
 \ /
  Last update: 2021-08-27 09:35    [W:0.178 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site