From: Andrea Arcangeli <aarcange@redhat.com>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>,
avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: mmu_notifier: Flush TLBs before releasing mmu_lock
Date: Tue, 14 Feb 2012 18:27:39 +0100 [thread overview]
Message-ID: <20120214172739.GM9440@redhat.com> (raw)
In-Reply-To: <4F34CCD1.6050103@linux.vnet.ibm.com>
On Fri, Feb 10, 2012 at 03:52:49PM +0800, Xiao Guangrong wrote:
> On 02/10/2012 02:28 PM, Takuya Yoshikawa wrote:
>
> > Other threads may process the same page in that small window and skip
> > TLB flush and then return before these functions do flush.
> >
>
>
> It is possible that flush tlb in mmu lock only when writeable
> spte is invalided? Sometimes, kvm_flush_remote_tlbs need
> long time to wait.
readonly isn't enough to defer the flush after mmu_lock is
released... if you do it only for writable spte, then what can happen
is the guest may read random data and would crash.
However for this case, the mmu_notifier methods (and only them) are
perfectly safe to flush the shadow MMU TLB after the mmu_lock is
released because the page reference is guaranteed hold by the caller
(not the case for any other place where a spte gets dropped in KVM,
all other places dropping sptes, can only on the mmu notifier to block
on the mmu_lock in order to have a guarantee of the page not being
freed under them, so in every other place the shadow MMU TLB flush
must happen before releasing the mmu_lock so the mmu_notifier will
wait and prevent the page to be freed until all other CPUs running in
guest mode stopped accessing it).
next prev parent reply other threads:[~2012-02-14 17:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 6:28 [PATCH 1/2] KVM: mmu_notifier: Flush TLBs before releasing mmu_lock Takuya Yoshikawa
2012-02-10 6:29 ` [PATCH 2/2] KVM: MMU: Flush TLBs only once in invlpg() " Takuya Yoshikawa
2012-02-10 6:55 ` Xiao Guangrong
2012-02-10 7:21 ` Takuya Yoshikawa
2012-02-10 7:42 ` Xiao Guangrong
2012-02-14 4:36 ` Takuya Yoshikawa
2012-02-14 4:56 ` Takuya Yoshikawa
2012-02-14 17:21 ` Andrea Arcangeli
2012-02-10 7:52 ` [PATCH 1/2] KVM: mmu_notifier: Flush TLBs " Xiao Guangrong
2012-02-13 6:00 ` Takuya Yoshikawa
2012-02-14 17:27 ` Andrea Arcangeli [this message]
2012-02-10 17:26 ` Marcelo Tosatti
2012-02-14 17:10 ` Andrea Arcangeli
2012-02-14 17:29 ` Marcelo Tosatti
2012-02-14 18:53 ` Andrea Arcangeli
2012-02-14 19:43 ` Marcelo Tosatti
2012-02-15 9:18 ` Avi Kivity
2012-02-15 9:47 ` Avi Kivity
2012-02-15 11:37 ` Xiao Guangrong
2012-02-15 14:07 ` Avi Kivity
2012-02-15 19:16 ` Andrea Arcangeli
2012-02-16 4:50 ` Xiao Guangrong
2012-02-16 11:57 ` Avi Kivity
2012-02-17 2:36 ` Xiao Guangrong
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=20120214172739.GM9440@redhat.com \
--to=aarcange@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=xiaoguangrong@linux.vnet.ibm.com \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
/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.