lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4EE9B694.1000905@gmail.com>
Date:	Thu, 15 Dec 2011 16:57:56 +0800
From:	Xiao Guangrong <xiaoguangrong.eric@...il.com>
To:	Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
CC:	Liu ping fan <kernelfans@...il.com>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org, avi@...hat.com, aliguori@...ibm.com,
	gleb@...hat.com, mtosatti@...hat.com, jan.kiszka@....de
Subject: Re: [PATCH v4] kvm: make vcpu life cycle separated from kvm instance

On 12/15/2011 04:25 PM, Xiao Guangrong wrote:

> On 12/15/2011 02:53 PM, Liu ping fan wrote:
> 
> 
>>
>>>> +struct kvm_vcpu *kvm_vcpu_get(struct kvm_vcpu *vcpu)
>>>> +{
>>>> +     if (vcpu == NULL)
>>>> +             return NULL;
>>>> +     if (atomic_add_unless(&vcpu->refcount, 1, 0))
>>>
>>>
>>> Why do not use atomic_inc()?
>>> Also, i think a memory barrier is needed after increasing refcount.
>>>
>> Because when refcout==0, we prepare to destroy vcpu, and do not to
>> disturb it by increasing the refcount.
> 
> 
> Oh, get it.
> 


But i think we can do it like this:

On the vcpu free path:

hold kvm->lock
delete vcpu from the kvm->vcpus
release kvm->lock

synchronize_rcu()
kvm_vcpu_put()

then, we can avoid get invalid instance and it can make the code simple?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ