All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v2 9/9] KVM: MMU: Avoid access/dirty update loop if all is well
Date: Wed, 19 Sep 2012 19:12:20 +0300	[thread overview]
Message-ID: <5059EEE4.4080802@redhat.com> (raw)
In-Reply-To: <50582110.4070506@linux.vnet.ibm.com>

On 09/18/2012 10:21 AM, Xiao Guangrong wrote:
> On 09/16/2012 08:07 PM, Avi Kivity wrote:
> 
>> +	/*
>> +	 * On a write fault, fold the dirty bit into accessed_dirty by shifting it one
>> +	 * place right.
>> +	 *
>> +	 * On a read fault, do nothing.
>> +	 */
>> +	accessed_dirty &= pte >> (write_fault >> ilog2(PFERR_WRITE_MASK));
> 
> It is too trick: it depends on DIRTY_SHIFT = ACCESSED_SHIFT + 1. How about change it
> to:
>   accessed_dirty &= pte >> (!!write_fault >> (DIRTY_SHIFT - ACCESSED_SHIFT)) ?

!! forces a branch, unless gcc is really clever.  So I changed it to

	shift = write_fault >> ilog2(PFERR_WRITE_MASK);
	shift *= PT_DIRTY_SHIFT - PT_ACCESSED_SHIFT;
	accessed_dirty &= pte >> shift;

which should result in the same code.

-- 
error compiling committee.c: too many arguments to function

      reply	other threads:[~2012-09-19 16:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-16 12:07 [PATCH v2 0/9] Optimize page table walk Avi Kivity
2012-09-16 12:07 ` [PATCH v2 1/9] KVM: MMU: Push clean gpte write protection out of gpte_access() Avi Kivity
2012-09-16 12:07 ` [PATCH v2 2/9] KVM: MMU: Optimize gpte_access() slightly Avi Kivity
2012-09-16 12:07 ` [PATCH v2 3/9] KVM: MMU: Move gpte_access() out of paging_tmpl.h Avi Kivity
2012-09-16 12:07 ` [PATCH v2 4/9] KVM: MMU: Update accessed and dirty bits after guest pagetable walk Avi Kivity
2012-09-18  6:37   ` Xiao Guangrong
2012-09-16 12:07 ` [PATCH v2 5/9] KVM: MMU: Optimize pte permission checks Avi Kivity
2012-09-18  6:45   ` Xiao Guangrong
2012-09-19 16:06     ` Avi Kivity
2012-09-16 12:07 ` [PATCH v2 6/9] KVM: MMU: Simplify walk_addr_generic() loop Avi Kivity
2012-09-18  6:53   ` Xiao Guangrong
2012-09-19 16:29     ` Avi Kivity
2012-09-16 12:07 ` [PATCH v2 7/9] KVM: MMU: Optimize is_last_gpte() Avi Kivity
2012-09-18  7:36   ` Xiao Guangrong
2012-09-19 17:17     ` Avi Kivity
2012-09-19 17:18       ` Avi Kivity
2012-09-16 12:07 ` [PATCH v2 8/9] KVM: MMU: Eliminate eperm temporary Avi Kivity
2012-09-18  7:00   ` Xiao Guangrong
2012-09-16 12:07 ` [PATCH v2 9/9] KVM: MMU: Avoid access/dirty update loop if all is well Avi Kivity
2012-09-18  7:21   ` Xiao Guangrong
2012-09-19 16:12     ` Avi Kivity [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5059EEE4.4080802@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.