From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>,
agraf@suse.de, kvm@vger.kernel.org, kvm-ia64@vger.kernel.org,
kvm-ppc@vger.kernel.org, takuya.yoshikawa@gmail.com
Subject: Re: [PATCH v2 3/4] KVM: cleanup: remove kvm_get_dirty_log()
Date: Wed, 23 Jun 2010 21:58:59 -0300 [thread overview]
Message-ID: <20100624005859.GD9388@amt.cnet> (raw)
In-Reply-To: <4C21CD3F.4030308@redhat.com>
On Wed, Jun 23, 2010 at 12:00:47PM +0300, Avi Kivity wrote:
> On 06/23/2010 12:01 PM, Takuya Yoshikawa wrote:
> >(2010/06/23 17:48), Avi Kivity wrote:
> >
> >>>diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
> >>>index 801d9f3..bea6f7c 100644
> >>>--- a/arch/powerpc/kvm/book3s.c
> >>>+++ b/arch/powerpc/kvm/book3s.c
> >>>@@ -1185,28 +1185,43 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
> >>>struct kvm_memory_slot *memslot;
> >>>struct kvm_vcpu *vcpu;
> >>>ulong ga, ga_end;
> >>>- int is_dirty = 0;
> >>>- int r;
> >>>+ unsigned long is_dirty = 0;
> >>>+ int r, i;
> >>>unsigned long n;
> >>>
> >>>mutex_lock(&kvm->slots_lock);
> >>>
> >>>- r = kvm_get_dirty_log(kvm, log,&is_dirty);
> >>>- if (r)
> >>>+ r = -EINVAL;
> >>>+ if (log->slot>= KVM_MEMORY_SLOTS)
> >>>+ goto out;
> >>>+
> >>>+ memslot =&kvm->memslots->memslots[log->slot];
> >>
> >>Not introduced by this patch, but shouldn't this use rcu_dereference()?
> >>
> >>
> >
> >I was thinking like that, but sorry I don't know well about ppc.
> >
> >My final goal is to make everything except
> >
> > /* If nothing is dirty, don't bother messing with page tables. */
> >
> >part arch independent, so that we can concentrate on the truely
> >dirty logging things in the future.
> >
> >So, making ppc code same as x86, rcu_dereference() for example , really
> >helps me.
> >
> >
> >Do you like this approach?
>
> Well yes, I expect that not using rcu_dereference() (and
> srcu_read_lock()) is a bug here.
>
> Marcelo?
No because slots_lock is held which serializes with memslot updates.
> On a related note, I'd like to consolidate rcu locking:
>
> - all vcpu ioctls take srcu_read_lock() when they start and drop it
> at the end.
> - KVM_VCPU_RUN drops the lock when sleeping and entering the guest
> (also on context switch?)
Yep, makes sense.
next prev parent reply other threads:[~2010-06-24 1:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-23 5:58 [PATCH v2 0/4] KVM: kvm_vm_ioctl_get_dirty_log() fix and cleanup Takuya Yoshikawa
2010-06-23 6:00 ` [PATCH v2 2/4] KVM: ia64: cleanup kvm_ia64_sync_dirty_log() Takuya Yoshikawa
[not found] ` <20100623145807.07a07c4c.yoshikawa.takuya-gVGce1chcLdL9jVzuh4AOg@public.gmane.org>
2010-06-23 5:59 ` [PATCH v2 1/4] KVM: ia64: fix dirty_log_lock spin_lock section not to include get_dirty_log() Takuya Yoshikawa
2010-06-23 6:01 ` [PATCH v2 3/4] KVM: cleanup: remove kvm_get_dirty_log() Takuya Yoshikawa
[not found] ` <20100623150134.9fb5915b.yoshikawa.takuya-gVGce1chcLdL9jVzuh4AOg@public.gmane.org>
2010-06-23 8:48 ` Avi Kivity
[not found] ` <4C21CA5D.4060800-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-23 9:01 ` Takuya Yoshikawa
2010-06-23 9:00 ` Avi Kivity
2010-06-24 0:58 ` Marcelo Tosatti [this message]
[not found] ` <20100624005859.GD9388-I4X2Mt4zSy4@public.gmane.org>
2010-06-24 8:10 ` Avi Kivity
2010-06-25 19:25 ` Alexander Graf
[not found] ` <E5BC6546-6255-4E25-B3DD-F6B6261B6830-l3A5Bk7waGM@public.gmane.org>
2010-06-26 0:38 ` Takuya Yoshikawa
2010-06-26 0:55 ` Takuya Yoshikawa
2010-06-26 9:38 ` Alexander Graf
2010-06-27 7:32 ` Avi Kivity
[not found] ` <4C26FE7B.9090406-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-28 8:14 ` Takuya Yoshikawa
2010-06-28 9:36 ` Avi Kivity
2010-06-23 6:02 ` [PATCH v2 4/4] KVM: cleanup: make kvm_vm_ioctl_get_dirty_log() arch independent Takuya Yoshikawa
2010-06-23 8:50 ` [PATCH v2 0/4] KVM: kvm_vm_ioctl_get_dirty_log() fix and cleanup 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=20100624005859.GD9388@amt.cnet \
--to=mtosatti@redhat.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=kvm-ia64@vger.kernel.org \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=takuya.yoshikawa@gmail.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