public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: "Zhang, Xiantao" <xiantao.zhang@intel.com>
Cc: avi <avi@redhat.com>, kvm-ia64@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: kvm/ia64: Fix halt emulation logic.
Date: Sat, 18 Oct 2008 13:27:45 -0200	[thread overview]
Message-ID: <20081018152745.GA32642@dmt.cnet> (raw)
In-Reply-To: <42DFA526FC41B1429CE7279EF83C6BDC01B47EA5@pdsmsx415.ccr.corp.intel.com>

Hi Xiantao,

On Wed, Oct 15, 2008 at 09:47:24PM +0800, Zhang, Xiantao wrote:
> +		expires = div64_u64(itc_diff, cyc_per_usec);
> +		kt = ktime_set(0, 1000 * expires);
> +
> +		down_read(&vcpu->kvm->slots_lock);
> +		vcpu->arch.ht_active = 1;
> +		hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS);
>  
> -	if (irqchip_in_kernel(vcpu->kvm)) {
>  		vcpu->arch.mp_state = KVM_MP_STATE_HALTED;
>  		kvm_vcpu_block(vcpu);
>  		hrtimer_cancel(p_ht);
>  		vcpu->arch.ht_active = 0;
>  
> +		if (test_and_clear_bit(KVM_REQ_UNHALT, &vcpu->requests))
> +			if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED)
> +				vcpu->arch.mp_state =
> +					KVM_MP_STATE_RUNNABLE;
> +		up_read(&vcpu->kvm->slots_lock);

You should release slots_lock when blocking via kvm_vcpu_block().
Otherwise paths that grab it for write will depend on these vcpus to
unhalt.

BTW, none of the data structures in this section of code should be
protected by slots_lock?

  parent reply	other threads:[~2008-11-03  2:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15 13:47 kvm/ia64: Fix halt emulation logic Zhang, Xiantao
2008-10-16  8:53 ` Avi Kivity
2008-10-16  8:57   ` Zhang, Xiantao
2008-10-16  9:01     ` Avi Kivity
2008-10-16  9:19       ` Zhang, Xiantao
2008-10-16  9:43         ` Avi Kivity
2008-10-18 15:27 ` Marcelo Tosatti [this message]
2008-11-03  4:36   ` Zhang, Xiantao
  -- strict thread matches above, loose matches on Subject: below --
2008-10-15 13:52 Zhang, Xiantao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081018152745.GA32642@dmt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm-ia64@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=xiantao.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox