From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
kvm@vger.kernel.org, takuya.yoshikawa@gmail.com
Subject: Re: [PATCH 1/4] KVM: Add APIs for unlocked TLB flush
Date: Tue, 08 May 2012 15:39:43 +0300 [thread overview]
Message-ID: <4FA9140F.6080601@redhat.com> (raw)
In-Reply-To: <20120508022513.GA26114@amt.cnet>
On 05/08/2012 05:25 AM, Marcelo Tosatti wrote:
> > >
> > > We need call kvm_cond_flush_remote_tlbs in rmap_write-protect
> > > unconditionally?
> >
> > Yes, that's the point. We change
> >
> > spin_lock(mmu_lock)
> > conditionally flush the tlb
> > spin_unlock(mmu_lock)
> >
> > to
> >
> > spin_lock(mmu_lock)
> > conditionally mark the tlb as dirty
> > spin_unlock(mmu_lock)
> > kvm_cond_flush_remote_tlbs()
> >
> > but that means the entire codebase has to be converted.
>
> Is there any other site which expects sptes and TLBs to be in sync,
> other than rmap_write_protect?
I wouldn't say rmap_write_protect() expects sptes and TLBs to be in
sync. Rather its callers.
> Please convert the flush_remote_tlbs at the end of set_spte (RW->RO) to
> mark_dirty.
I'd like to take an incremental approach, since there are many paths. I
don't have a concrete plan though.
> Looks good in general (patchset is incomplete though). One thing that
> is annoying is that there is no guarantee of progress for flushed_count
> increment (it can, in theory, always race with a mark_dirty). But since
> that would be only a performance, and not correctness, aspect, it is
> fine.
We don't have a while () look in cond_flush(), so it won't be slowed
down by the race; whoever caused the race will have to flush on their
own, but they do that anyway now.
We can regress if vcpu 0 marks the tlb as dirty, and then vcpu 0 and 1
simultaneously flush, even though vcpu 1 did nothing to deserve it. I
don't see a way around it except to hope its a rare event.
> It has the advantage that it requires code to explicitly document where
> the TLB must be flushed and the sites which expect sptes to be in sync
> with TLBs.
I'm looking for an idea of how to make the flush in those cases not hold
mmu_lock.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-05-08 12:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 11:22 [PATCH 0/4] Unlocked TLB flush Avi Kivity
2012-05-03 11:22 ` [PATCH 1/4] KVM: Add APIs for unlocked " Avi Kivity
2012-05-03 13:23 ` Xiao Guangrong
2012-05-03 14:11 ` Avi Kivity
2012-05-07 7:06 ` Xiao Guangrong
2012-05-07 7:59 ` Avi Kivity
2012-05-08 1:55 ` Marcelo Tosatti
2012-05-08 9:09 ` Avi Kivity
2012-05-08 13:50 ` Marcelo Tosatti
2012-05-08 9:09 ` Avi Kivity
2012-05-08 2:25 ` Marcelo Tosatti
2012-05-08 12:39 ` Avi Kivity [this message]
2012-05-09 21:03 ` Marcelo Tosatti
2012-05-21 14:45 ` Avi Kivity
2012-05-03 11:23 ` [PATCH 2/4] KVM: Flush TLB in mmu notifier without holding mmu_lock Avi Kivity
2012-05-03 11:23 ` [PATCH 3/4] KVM: Flush TLB in FNAME(invlpg) " Avi Kivity
2012-05-03 11:23 ` [PATCH 4/4] KVM: Flush TLB in change_pte mmu notifier " Avi Kivity
2012-05-08 1:25 ` [PATCH 0/4] Unlocked TLB flush Marcelo Tosatti
2012-05-08 1:27 ` Marcelo Tosatti
2012-05-08 10:51 ` 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=4FA9140F.6080601@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=takuya.yoshikawa@gmail.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.