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]
Date:	Thu, 23 Sep 2010 11:05:15 +0800
From:	Xiao Guangrong <xiaoguangrong@...fujitsu.com>
To:	Avi Kivity <avi@...hat.com>
CC:	Marcelo Tosatti <mtosatti@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: Re: [PATCH 2/4] KVM: MMU: support unsync sp out of the protection
 of 'mmu_lock'

On 09/20/2010 11:19 PM, Avi Kivity wrote:
>  On 09/20/2010 04:19 PM, Xiao Guangrong wrote:
>> It allows keep unsync sp alive while it's out of the protection, later
>> we can use
>> kvm_mmu_free_page() to free it if !sp->active_count
> 
> Don't understand.  Of course unsync pages exist outside mmu_lock...?

Yes.

sorry, not describe it clear in the log.

> 
> 
>>   diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
>> index 839852d..4b7af3f 100644
>> --- a/arch/x86/kvm/mmu.c
>> +++ b/arch/x86/kvm/mmu.c
>> @@ -996,7 +996,6 @@ static void kvm_mmu_free_page(struct kvm *kvm,
>> struct kvm_mmu_page *sp)
>>   {
>>       ASSERT(is_empty_shadow_page(sp->spt));
>>       hlist_del(&sp->hash_link);
>> -    list_del(&sp->link);
>>       __free_page(virt_to_page(sp->spt));
>>       if (!sp->role.direct)
>>           __free_page(virt_to_page(sp->gfns));
>> @@ -1681,9 +1680,8 @@ static int kvm_mmu_prepare_zap_page(struct kvm
>> *kvm, struct kvm_mmu_page *sp,
>>       kvm_mmu_unlink_parents(kvm, sp);
>>       if (!sp->role.invalid&&  !sp->role.direct)
>>           unaccount_shadowed(kvm, sp->gfn);
>> -    if (sp->unsync)
>> -        kvm_unlink_unsync_page(kvm, sp);
>> -    if (!sp->active_count) {
>> +
>> +    if (!sp->active_count || sp->unsync) {
>>           /* Count self */
>>           ret++;
>>           list_move(&sp->link, invalid_list);
> 
> How can you drop an active unsync page?
> 
> I'm missing something here.
> 

Umm, this feature is used like this:

hold mmu_lock
increase sp->active_count
release mmu_lock
......
hold mmu_lock
increase sp->active_count
if (!sp->active_count && sp->invalid)
	kvm_mmu_free_page(sp);
......
release mmu_lock

--
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