public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/4] KVM: MMU: Introduce drop_spte()
Date: Sun, 06 Jun 2010 17:33:12 +0300	[thread overview]
Message-ID: <4C0BB1A8.2020406@redhat.com> (raw)
In-Reply-To: <1275829583-7117-2-git-send-email-avi@redhat.com>

On 06/06/2010 04:06 PM, Avi Kivity wrote:
> When we call rmap_remove(), we (almost) always immediately follow it by
> an __set_spte() to a nonpresent pte.  Since we need to perform the two
> operations atomically, to avoid losing the dirty and accessed bits, introduce
> a helper drop_spte() and convert all call sites.
>
> The operation is still nonatomic at this point.
>
>
> @@ -1498,13 +1502,14 @@ static void kvm_mmu_page_unlink_children(struct kvm *kvm,
>   				ent&= PT64_BASE_ADDR_MASK;
>   				mmu_page_remove_parent_pte(page_header(ent),
>   							&pt[i]);
> +				pt[i] = shadow_trap_nonpresent_pte;
>   			} else {
>   				if (is_large_pte(ent))
>   					--kvm->stat.lpages;
> -				rmap_remove(kvm,&pt[i]);
> +				drop_spte(kvm,&pt[i],
> +					  shadow_trap_nonpresent_pte);
>   			}
>   		}
> -		pt[i] = shadow_trap_nonpresent_pte;
>   	}
>   }
>    

Autotest points out that this transformation (and an identical one in 
zap_pte) does not preserve the semantics; if the outer if () fails, the 
new code does not update pt[i].

With the original line after the if () retained, autotest is happier.

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


  reply	other threads:[~2010-06-06 14:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-06 13:06 [PATCH 0/4] Fix accessed bit tracking Avi Kivity
2010-06-06 13:06 ` [PATCH 1/4] KVM: MMU: Introduce drop_spte() Avi Kivity
2010-06-06 14:33   ` Avi Kivity [this message]
2010-06-06 13:06 ` [PATCH 2/4] KVM: MMU: Move accessed/dirty bit checks from rmap_remove() to drop_spte() Avi Kivity
2010-06-06 13:06 ` [PATCH 3/4] KVM: MMU: Atomically check for accessed bit when dropping an spte Avi Kivity
2010-06-06 13:06 ` [PATCH 4/4] KVM: MMU: Don't drop accessed bit while updating " Avi Kivity

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=4C0BB1A8.2020406@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox