From: Marcelo Tosatti <mtosatti@redhat.com>
To: Peter Teoh <htmldeveloper@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: tlb flushing after spin_unlock of mmu lock
Date: Thu, 16 Apr 2009 16:19:20 -0300 [thread overview]
Message-ID: <20090416191920.GB15317@amt.cnet> (raw)
In-Reply-To: <804dabb00904102145r446de3dfw6e2a287736fb170c@mail.gmail.com>
Peter,
On Sat, Apr 11, 2009 at 12:45:21AM -0400, Peter Teoh wrote:
> In this function, the TLB flushing comes before spin unlock,
>
> void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
> {
> struct kvm_mmu_page *sp;
>
> spin_lock(&kvm->mmu_lock);
>
> kvm_flush_remote_tlbs(kvm);
> spin_unlock(&kvm->mmu_lock);
> }
kvm_vm_ioctl_get_dirty_log does:
down_write(slots_lock)
- collect data from dirty bitmap (kvm_get_dirty_log)
if (something was dirty)
- remove write access for all translations
- flush remote tlb's
- clear the dirty bitmap
up_write(slots_lock)
The vmexit path (take a look at vcpu_run), takes slots_lock in
read-mode. This means that no other vcpu will be able to dirty a
shadow translation (spte) in the meantime.
So its safe.
> but in kvm_vm_ioctl_set_memory_alias():
>
> spin_unlock(&kvm->mmu_lock);
> kvm_mmu_zap_all(kvm);
>
> it comes after inside kvm_mmu_zap_all(). Does it sound logical?
Note that here it also takes slots_lock in write-mode, which blocks all
other vcpus.
prev parent reply other threads:[~2009-04-16 19:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-11 4:45 tlb flushing after spin_unlock of mmu lock Peter Teoh
2009-04-16 19:19 ` Marcelo Tosatti [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=20090416191920.GB15317@amt.cnet \
--to=mtosatti@redhat.com \
--cc=htmldeveloper@gmail.com \
--cc=kvm@vger.kernel.org \
/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