RE: kvm/ia64: Fix halt emulation logic.

"Zhang, Xiantao" <[email protected]>
Newsgroups org.kernel.vger.kvm-ia64,org.kernel.vger.kvm
Message-ID <706158FABBBA044BAD4FE898A02E4BC2171F5148@pdsmsx503.ccr.corp.intel.com>
Marcelo Tosatti wrote:
> 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?

Hi, Marcelo
	Agree, I have made a patch to remove it last week, but seems Avi hasn't commited it yet.  

Avi, 
	Could you help to commit the attached patch, even though it is just a potential issue(write lock is very rare in current code). 
Thanks
Xiantao
(unnamed) (message/rfc822, 7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.