mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] KVM:X86 simply update A/D bits route
  2017-10-12 21:17 [PATCH] KVM:X86 simply update A/D bits route Peng Hao
@ 2017-10-12 14:18 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2017-10-12 14:18 UTC (permalink / raw)
  To: Peng Hao, rkrcmar; +Cc: x86, kvm, linux-kernel

On 12/10/2017 23:17, Peng Hao wrote:
> update_accessed_dirty_bits return 0 when dirty/accessed bits are
> not supported. So walk_addr_generic just call update_accessed_dirty_bits
> with supporting dirty/accessed bits.
> 
> Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
> ---
>  arch/x86/kvm/paging_tmpl.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> index 86b68dc..b40f23e 100644
> --- a/arch/x86/kvm/paging_tmpl.h
> +++ b/arch/x86/kvm/paging_tmpl.h
> @@ -422,7 +422,7 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
>  		accessed_dirty &= pte >>
>  			(PT_GUEST_DIRTY_SHIFT - PT_GUEST_ACCESSED_SHIFT);
>  
> -	if (unlikely(!accessed_dirty)) {
> +	if (unlikely(!accessed_dirty && have_ad)) {
>  		ret = FNAME(update_accessed_dirty_bits)(vcpu, mmu, walker, write_fault);
>  		if (unlikely(ret < 0))
>  			goto error;
> 

At least you would have to remove the corresponding conditional in
update_accessed_dirty_bits, or change it to a WARN.

But I don't see the point really... why is it _better_ to check in
walk_addr_generic instead of update_accessed_dirty_bits?

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH]  KVM:X86 simply update A/D bits route
@ 2017-10-12 21:17 Peng Hao
  2017-10-12 14:18 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Hao @ 2017-10-12 21:17 UTC (permalink / raw)
  To: pbonzini, rkrcmar; +Cc: x86, kvm, linux-kernel, Peng Hao

update_accessed_dirty_bits return 0 when dirty/accessed bits are
not supported. So walk_addr_generic just call update_accessed_dirty_bits
with supporting dirty/accessed bits.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
 arch/x86/kvm/paging_tmpl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 86b68dc..b40f23e 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -422,7 +422,7 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
 		accessed_dirty &= pte >>
 			(PT_GUEST_DIRTY_SHIFT - PT_GUEST_ACCESSED_SHIFT);
 
-	if (unlikely(!accessed_dirty)) {
+	if (unlikely(!accessed_dirty && have_ad)) {
 		ret = FNAME(update_accessed_dirty_bits)(vcpu, mmu, walker, write_fault);
 		if (unlikely(ret < 0))
 			goto error;
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-12 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-12 21:17 [PATCH] KVM:X86 simply update A/D bits route Peng Hao
2017-10-12 14:18 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®