kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
	Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>,
	kvm@vger.kernel.org
Subject: Re: [PATCH v2 3/5] KVM: Flush TLB in mmu notifier without holding mmu_lock
Date: Mon, 02 Jul 2012 15:41:30 +0300	[thread overview]
Message-ID: <4FF196FA.9020309@redhat.com> (raw)
In-Reply-To: <4FF18E7D.7020102@redhat.com>

On 07/02/2012 03:05 PM, Avi Kivity wrote:
> We need something for lockbreaking too:
> 
>    def mmu_lockbreak():
>        if not (contended or need_resched):
>            return False
>        remember flush counter
>        cond_resched_lock
>        return flush counter changed
> 
> The caller would check the return value to see if it needs to redo
> anything.  But this has the danger of long operations (like write
> protecting a slot) never completing.

In fact I don't think we need the return value.  All long running
operations can tolerate a lock break.

kvm_mmu_change_mmu_pages: so long as the counter is maintained
correctly, it will function.  May livelock though, so we should abort if
we don't manage to keep the counter down.

get_dirty_log: so long as a write fault updates the next bitmap, we're fine

kvm_mmu_slot_remove_write_access: same.  It's hard to continue the loop
after a lockbreak though.  We can switch it to be rmap based instead.

flush_shadow (zap_all): just restart from the beginning after dropping
the lock.  May livelock, can be fixed by using a generation counter for
kvm_mmu_page.

kvm_mmu_sync_roots: already does lockbreaking

kvm_mmu_unprotect_page: not long-running in normal operation, but a
guest can make it long running.  However, we're allowed not to be
accurate about it and just return to the guest.

kvm_mmu_pte_write: can be a long operation with crazy guests. Normal
guests will work fine.

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



  reply	other threads:[~2012-07-02 12:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17 10:24 [PATCH v2 1/5] KVM: Add APIs for unlocked TLB flush Avi Kivity
2012-05-17 10:24 ` [PATCH v2 2/5] KVM: MMU: Convert remote flushes to kvm_mark_tlb_dirty() and a conditional flush Avi Kivity
2012-05-21 20:13   ` Marcelo Tosatti
2012-05-22 14:46   ` Takuya Yoshikawa
2012-05-17 10:24 ` [PATCH v2 3/5] KVM: Flush TLB in mmu notifier without holding mmu_lock Avi Kivity
2012-05-21 20:58   ` Marcelo Tosatti
2012-05-21 21:07     ` Marcelo Tosatti
2012-07-02 12:05     ` Avi Kivity
2012-07-02 12:41       ` Avi Kivity [this message]
2012-07-02 14:09         ` Takuya Yoshikawa
2012-07-02 14:18           ` Avi Kivity
2012-05-17 10:24 ` [PATCH v2 4/5] KVM: Flush TLB in FNAME(invlpg) " Avi Kivity
2012-05-17 10:24 ` [PATCH v2 5/5] KVM: Flush TLB in change_pte mmu notifier " Avi Kivity
2012-05-17 11:51 ` [PATCH v2 1/5] KVM: Add APIs for unlocked TLB flush 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=4FF196FA.9020309@redhat.com \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).