From: Sheng Yang <sheng@linux.intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: Add reading critical region for kvm_io_bus_read/write
Date: Tue, 7 Dec 2010 10:35:08 +0800 [thread overview]
Message-ID: <201012071035.08573.sheng@linux.intel.com> (raw)
In-Reply-To: <4CFCDDE2.4040709@redhat.com>
On Monday 06 December 2010 20:58:10 Avi Kivity wrote:
> On 12/06/2010 10:44 AM, Sheng Yang wrote:
> > Seems we missed it.
> >
> > Signed-off-by: Sheng Yang<sheng@linux.intel.com>
> > ---
> > Do we need this, or slot_lock covered this?
> >
> > virt/kvm/kvm_main.c | 24 ++++++++++++++++--------
> > 1 files changed, 16 insertions(+), 8 deletions(-)
> >
> > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> > index c4ee364..3e71b91 100644
> > --- a/virt/kvm/kvm_main.c
> > +++ b/virt/kvm/kvm_main.c
> > @@ -2228,28 +2228,36 @@ static void kvm_io_bus_destroy(struct kvm_io_bus
> > *bus)
> >
> > int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
> >
> > int len, const void *val)
> >
> > {
> >
> > - int i;
> > + int i, idx, r = -EOPNOTSUPP;
> >
> > struct kvm_io_bus *bus;
> >
> > + idx = srcu_read_lock(&kvm->srcu);
> >
> > bus = srcu_dereference(kvm->buses[bus_idx],&kvm->srcu);
> > for (i = 0; i< bus->dev_count; i++)
> >
> > - if (!kvm_iodevice_write(bus->devs[i], addr, len, val))
> > - return 0;
> > - return -EOPNOTSUPP;
> > + if (!kvm_iodevice_write(bus->devs[i], addr, len, val)) {
> > + r = 0;
> > + break;
> > + }
> > + srcu_read_unlock(&kvm->srcu, idx);
> > + return r;
> >
> > }
>
> Isn't this already taken care of by srcu_read_lock() in
> vcpu_enter_guest(), just before calling ->handle_exit()?
Yes, finally found it. So big reading critical region...
--
regards
Yang, Sheng
prev parent reply other threads:[~2010-12-07 2:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-06 8:44 [PATCH] KVM: Add reading critical region for kvm_io_bus_read/write Sheng Yang
2010-12-06 12:58 ` Avi Kivity
2010-12-07 2:35 ` Sheng Yang [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=201012071035.08573.sheng@linux.intel.com \
--to=sheng@linux.intel.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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.