From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: kvm@vger.kernel.org, Stefan Hajnoczi <stefanha@gmail.com>,
qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org,
target-devel@vger.kernel.org,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Asias He <asias@redhat.com>
Subject: Re: [Qemu-devel] [PATCH V3 WIP 3/3] disable vhost_verify_ring_mappings check
Date: Wed, 27 Mar 2013 23:56:25 +0200 [thread overview]
Message-ID: <20130327215625.GC10678@redhat.com> (raw)
In-Reply-To: <1364419887.17698.19.camel@haakon2.linux-iscsi.org>
On Wed, Mar 27, 2013 at 02:31:27PM -0700, Nicholas A. Bellinger wrote:
> On Wed, 2013-03-20 at 11:51 +0200, Michael S. Tsirkin wrote:
> > On Tue, Mar 19, 2013 at 06:57:08PM -0700, Nicholas A. Bellinger wrote:
> > > On Tue, 2013-03-19 at 09:40 +0100, Stefan Hajnoczi wrote:
> > > > On Tue, Mar 19, 2013 at 08:34:45AM +0800, Asias He wrote:
> > > > > ---
> > > > > hw/vhost.c | 2 ++
> > > > > 1 file changed, 2 insertions(+)
> > > > >
> > > > > diff --git a/hw/vhost.c b/hw/vhost.c
> > > > > index 4d6aee3..0c52ec4 100644
> > > > > --- a/hw/vhost.c
> > > > > +++ b/hw/vhost.c
> > > > > @@ -421,10 +421,12 @@ static void vhost_set_memory(MemoryListener *listener,
> > > > > return;
> > > > > }
> > > > >
> > > > > +#if 0
> > > > > if (dev->started) {
> > > > > r = vhost_verify_ring_mappings(dev, start_addr, size);
> > > > > assert(r >= 0);
> > > > > }
> > > > > +#endif
> > > >
> > > > Please add a comment to explain why.
> > > >
> > >
> > > Btw, the output that Asias added in the failure case at the behest of
> > > MST is here:
> > >
> > > http://www.spinics.net/lists/target-devel/msg04077.html
> >
> > Yes I suspected we could get l > ring_size, but this is
> > not the case here.
> >
>
> Hi MST & Co,
>
> A quick update here..
>
> So this issue appears to be related to performing the
> vhost_verify_ring_mappings() call after vhost_dev_unassign_memory() has
> been invoked with vhost_set_memory(..., add=false).
>
> AFAICT from the logs below, things appear to work as expected when
> vhost_verify_ring_mappings() is called only for the
> vhost_set_memory(..., add=true) case.
>
> Calling vhost_verify_ring_mappings() when dev->started == true +
> vhost_set_memory(..., add=false) appears to be a bug caused by fallout
> from:
>
> commit 24f4fe345c1b80bab1ee18573914123d8028a9e6
> Author: Michael S. Tsirkin <mst@redhat.com>
> Date: Tue Dec 25 17:41:07 2012 +0200
>
> vhost: set started flag while start is in progress
>
> I'm including the following patch in the forth-coming vhost-scsi series.
> Please let me know if you have any concerns.
>
> diff --git a/hw/vhost.c b/hw/vhost.c
> index 4d6aee3..687a689 100644
> --- a/hw/vhost.c
> +++ b/hw/vhost.c
> @@ -421,7 +421,7 @@ static void vhost_set_memory(MemoryListener *listener,
> return;
> }
>
> - if (dev->started) {
> + if (dev->started && add) {
> r = vhost_verify_ring_mappings(dev, start_addr, size);
> assert(r >= 0);
> }
>
> Thanks!
>
> --nab
Sorry NAK,
I think this will shut down too much stuff:
the main reason to check is when we delete a region.
> vhost_set_memory: section: 0x7f2249986b60 section->size: 2146697216 add: 0
> Before vhost_verify_ring_mappings: start_addr: c0000 size: 2146697216
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Calling l: 5124 for start_addr: c0000 for vq 2
> Unable to map ring buffer for ring 2
> l: 4096 ring_size: 5124
> vhost_set_memory: section: 0x7f2249986aa0 section->size: 32768 add: 1
> Before vhost_verify_ring_mappings: start_addr: c0000 size: 32768
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 2 ring_phys: ee000 ring_size: 5124
> vhost_set_memory: section: 0x7f2249986aa0 section->size: 2146664448 add: 1
> Before vhost_verify_ring_mappings: start_addr: c8000 size: 2146664448
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Calling l: 5124 for start_addr: c8000 for vq 2
> vhost_set_memory: section: 0x7f2249986b60 section->size: 32768 add: 0
> Before vhost_verify_ring_mappings: start_addr: c0000 size: 32768
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 2 ring_phys: ee000 ring_size: 5124
> vhost_set_memory: section: 0x7f2249986b60 section->size: 2146664448 add: 0
> Before vhost_verify_ring_mappings: start_addr: c8000 size: 2146664448
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Calling l: 5124 for start_addr: c8000 for vq 2
> Unable to map ring buffer for ring 2
> l: 0 ring_size: 5124
> vhost_set_memory: section: 0x7f2249986aa0 section->size: 36864 add: 1
> Before vhost_verify_ring_mappings: start_addr: c0000 size: 36864
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 2 ring_phys: ee000 ring_size: 5124
> vhost_set_memory: section: 0x7f2249986aa0 section->size: 2146660352 add: 1
> Before vhost_verify_ring_mappings: start_addr: c9000 size: 2146660352
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Calling l: 5124 for start_addr: c9000 for vq 2
> vhost_set_memory: section: 0x7f2249986b60 section->size: 2146660352 add: 0
> Before vhost_verify_ring_mappings: start_addr: c9000 size: 2146660352
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Calling l: 5124 for start_addr: c9000 for vq 2
> Unable to map ring buffer for ring 2
> l: 0 ring_size: 5124
> vhost_set_memory: section: 0x7f2249986aa0 section->size: 159744 add: 1
> Before vhost_verify_ring_mappings: start_addr: c9000 size: 159744
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Calling l: 5124 for start_addr: c9000 for vq 2
> vhost_set_memory: section: 0x7f2249986aa0 section->size: 65536 add: 1
> Before vhost_verify_ring_mappings: start_addr: f0000 size: 65536
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 2 ring_phys: ee000 ring_size: 5124
> vhost_set_memory: section: 0x7f2249986aa0 section->size: 2146435072 add: 1
> Before vhost_verify_ring_mappings: start_addr: 100000 size: 2146435072
> Checking vq: 0 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 0 ring_phys: 0 ring_size: 1028
> Checking vq: 1 ring_phys: 0 ring_size: 1028 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 1 ring_phys: 0 ring_size: 1028
> Checking vq: 2 ring_phys: ee000 ring_size: 5124 >>>>>>>>>>>>>>>>>>.
> Got ranges_overlap for vq: 2 ring_phys: ee000 ring_size: 5124
I still do not understand how this happened. Somehow a memory region
was deleted after vhost_dev_start but before vhost_virtqueue_start was
called?
Can you set a breakpoint there and see please?
next prev parent reply other threads:[~2013-03-27 21:55 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 0:34 [Qemu-devel] [PATCH V3 WIP 0/3] vhost-scsi: new device supporting the tcm_vhost Linux kernel module Asias He
2013-03-19 0:34 ` [Qemu-devel] [PATCH V3 WIP 1/3] virtio-scsi: create VirtIOSCSICommon Asias He
2013-03-19 0:34 ` [Qemu-devel] [PATCH V3 WIP 2/3] vhost-scsi: new device supporting the tcm_vhost Linux kernel module Asias He
2013-03-19 8:40 ` Stefan Hajnoczi
2013-03-19 0:34 ` [Qemu-devel] [PATCH V3 WIP 3/3] disable vhost_verify_ring_mappings check Asias He
2013-03-19 8:40 ` Stefan Hajnoczi
2013-03-19 8:47 ` Asias He
2013-03-20 1:57 ` Nicholas A. Bellinger
2013-03-20 9:51 ` Michael S. Tsirkin
2013-03-27 21:31 ` Nicholas A. Bellinger
2013-03-27 21:56 ` Michael S. Tsirkin [this message]
2013-03-27 22:33 ` Nicholas A. Bellinger
2013-03-28 6:45 ` Nicholas A. Bellinger
2013-03-28 7:35 ` Nicholas A. Bellinger
2013-03-28 9:04 ` Michael S. Tsirkin
2013-03-28 10:03 ` Paolo Bonzini
2013-03-29 2:47 ` Nicholas A. Bellinger
2013-03-28 10:13 ` Paolo Bonzini
2013-03-29 2:53 ` Nicholas A. Bellinger
2013-03-29 8:14 ` Paolo Bonzini
2013-04-02 1:05 ` Nicholas A. Bellinger
2013-04-02 13:27 ` Michael S. Tsirkin
2013-04-03 4:04 ` Nicholas A. Bellinger
2013-04-03 4:59 ` Nicholas A. Bellinger
2013-04-03 6:47 ` Paolo Bonzini
2013-03-29 3:28 ` Nicholas A. Bellinger
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=20130327215625.GC10678@redhat.com \
--to=mst@redhat.com \
--cc=asias@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=stefanha@redhat.com \
--cc=target-devel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).