Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1695429

Re: [PATCH v3] KVM: LAPIC: Fix reentrancy issues with preempt notifiers

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3] KVM: LAPIC: Fix reentrancy issues with preempt notifiers
Date 2017-07-25 09:30 +0200
Message-ID <u72s1-8ic-1@gated-at.bofh.it> (permalink)
References <u6UkN-2Vc-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 25/07/2017 00:43, Wanpeng Li wrote:
> -	WARN_ON(!apic->lapic_timer.hv_timer_in_use);
> +	preempt_disable();
> +	/* The preempt notifier has called apic_timer_expired already */
> +	if (!apic->lapic_timer.hv_timer_in_use)
> +		goto out;
>  	WARN_ON(swait_active(&vcpu->wq));
>  	cancel_hv_timer(apic);
>  	apic_timer_expired(apic);
> +out:
> +	preempt_enable();

If apic_timer_expired was called, and the timer is in periodic mode, it
has already set the hv timer.  Should the out label be really at the end
of the function, after the timer is restarted?  Otherwise you can call
advance_periodic_timer_expiration twice.

Thanks,

Paolo

>  
>  	if (apic_lvtt_period(apic) && apic->lapic_timer.period) {
>  		advance_periodic_target_expiration(apic);
> @@ -1582,9 +1588,11 @@ void kvm_lapic_switch_to_sw_timer(struct kvm_vcpu *vcpu)
>  {
>  	struct kvm_lapic *apic = vcpu->arch.apic;
>  
> +	preempt_disable();
>  	/* Possibly the TSC deadline timer is not enabled yet */
>  	if (apic->lapic_timer.hv_timer_in_use)
>  		start_sw_timer(apic);
> +	preempt_enable();
>  }
>  EXPORT_SYMBOL_GPL(kvm_lapic_switch_to_sw_timer);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3] KVM: LAPIC: Fix reentrancy issues with preempt notifiers Wanpeng Li <kernellwp@gmail.com> - 2017-07-25 00:50 +0200
  Re: [PATCH v3] KVM: LAPIC: Fix reentrancy issues with preempt  notifiers Paolo Bonzini <pbonzini@redhat.com> - 2017-07-25 09:30 +0200
    Re: [PATCH v3] KVM: LAPIC: Fix reentrancy issues with preempt notifiers Wanpeng Li <kernellwp@gmail.com> - 2017-07-25 09:50 +0200

csiph-web