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: <4E14B39A.5020401@cn.fujitsu.com>
Date:	Thu, 07 Jul 2011 03:12:26 +0800
From:	Xiao Guangrong <xiaoguangrong@...fujitsu.com>
To:	Marcelo Tosatti <mtosatti@...hat.com>
CC:	Avi Kivity <avi@...hat.com>, LKML <linux-kernel@...r.kernel.org>,
	KVM <kvm@...r.kernel.org>
Subject: Re: [PATCH v3 05/19] KVM: MMU: optimize to handle dirty bit

On 07/07/2011 12:51 AM, Marcelo Tosatti wrote:
> On Wed, Jul 06, 2011 at 09:22:28AM +0800, Xiao Guangrong wrote:
>> On 07/06/2011 03:27 AM, Marcelo Tosatti wrote:
>>> On Thu, Jun 30, 2011 at 04:21:30PM +0800, Xiao Guangrong wrote:
>>>> If dirty bit is not set, we can make the pte access read-only to avoid handing
>>>> dirty bit everywhere
>>>>
>>>> Signed-off-by: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
>>>
>>>> -static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte)
>>>> +static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte,
>>>> +				   bool last)
>>>>  {
>>>>  	unsigned access;
>>>>  
>>>>  	access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK;
>>>> +	if (last && !is_dirty_gpte(gpte))
>>>> +		access &= ~ACC_WRITE_MASK;
>>>> +
>>>
>>> What if the walker marks the dirty bit on the gpte?
>>>
>>
>> Actually, we get guest pte access after mark the dirty bit:
>>
>> 	if (write_fault && unlikely(!is_dirty_gpte(pte))) {
>> 		int ret;
>>
>> 		trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte));
>> 		ret = FNAME(cmpxchg_gpte)(vcpu, mmu, ptep_user, index,
>> 					  pte, pte|PT_DIRTY_MASK);
>> 		if (unlikely(ret < 0)) {
>> 			present = false;
>> 			goto error;
>> 		} else if (ret)
>> 			goto walk;
>>
>> 		mark_page_dirty(vcpu->kvm, table_gfn);
>> 		pte |= PT_DIRTY_MASK;
>> 		walker->ptes[walker->level - 1] = pte;
>> 	}
>>
>> 	pte_access = pt_access & FNAME(gpte_access)(vcpu, pte, true);
>>  
>> So, i think it works well :-)
> 
> I think you meant after marking the accessed bit. The dirty bit is set
> just before returning.
> 

In this patch, i moved getting pte_access to the behind of setting dirty bit set
--
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