qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: David Marchand <david.marchand@6wind.com>
Cc: kvm@vger.kernel.org, claudio.fontana@huawei.com,
	qemu-devel@nongnu.org, armbru@redhat.com,
	arei.gonglei@huawei.com, mkletzan@redhat.com,
	pbonzini@redhat.com, jani.kokkonen@huawei.com,
	cam@cs.ualberta.ca
Subject: Re: [Qemu-devel] [PATCH v5 3/3] ivshmem: add check on protocol version in QEMU
Date: Mon, 8 Sep 2014 09:30:17 +0100	[thread overview]
Message-ID: <20140908083017.GA7638@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <5409ABA1.3070900@6wind.com>

[-- Attachment #1: Type: text/plain, Size: 1838 bytes --]

On Fri, Sep 05, 2014 at 02:25:05PM +0200, David Marchand wrote:
> Hello Stefan,
> 
> On 09/05/2014 12:29 PM, Stefan Hajnoczi wrote:
> >On Thu, Sep 04, 2014 at 02:51:01PM +0200, David Marchand wrote:
> >>+                "server using a different protocol please check your setup\n");
> >>+        qemu_chr_delete(s->server_chr);
> >>+        s->server_chr = NULL;
> >>+        return;
> >>+    }
> >>+
> >>+    IVSHMEM_DPRINTF("version check ok, finish init and switch to real chardev "
> >>+                    "handler\n");
> >>+
> >>+    pci_register_bar(dev, 2, s->ivshmem_attr, &s->bar);
> >
> >Not sure if it is okay to delay PCI initialization to a fd hander
> >callback.
> >
> >If the version message is too slow the guest could see the PCI adapter
> >without the BAR!
> >
> >Did you move this code in order to prevent the guest from accessing the
> >device before it has connected to the server?  Perhaps the device needs
> >a state field that tracks whether or not it is ready for operation.  Any
> >access before RUNNING state is reached will be ignored (?).
> 
> Yes, exactly.
> 
> There already is a synchronisation mechanism described in the documentation:
> "When using the server, since the server is a separate process, the VM ID
> will only be set when the device is ready (shared memory is received from
> the server and accessible via the device).  If the device is not ready, the
> IVPosition will return -1.
> Applications should ensure that they have a valid VM ID before accessing the
> shared memory."
> 
> So actually, this move is unneeded if ivshmem users comply to this.
> 
> I will let the init stuff (pci_register_bar + gmalloc) where it was before,
> ivshmem_check_version will only switch the chardev handler.
> 
> What do you think about this ?

Sounds good.

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-09-08  8:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 12:50 [Qemu-devel] [PATCH v5 0/3] ivshmem: update documentation, add client/server tools David Marchand
2014-09-04 12:50 ` [Qemu-devel] [PATCH v5 1/3] contrib: add ivshmem client and server David Marchand
2014-09-04 15:56   ` Michael S. Tsirkin
2014-09-05  8:52     ` Claudio Fontana
2014-09-05 12:07     ` David Marchand
2014-09-07  5:58       ` Michael S. Tsirkin
2014-09-04 15:58   ` Michael S. Tsirkin
2014-09-05 10:40   ` Stefan Hajnoczi
2014-09-04 12:51 ` [Qemu-devel] [PATCH v5 2/3] docs: update ivshmem device spec David Marchand
2014-09-05 10:30   ` Stefan Hajnoczi
2014-09-04 12:51 ` [Qemu-devel] [PATCH v5 3/3] ivshmem: add check on protocol version in QEMU David Marchand
2014-09-05 10:29   ` Stefan Hajnoczi
2014-09-05 12:25     ` David Marchand
2014-09-08  8:30       ` Stefan Hajnoczi [this message]
2014-09-04 15:40 ` [Qemu-devel] [PATCH v5 0/3] ivshmem: update documentation, add client/server tools Michael S. Tsirkin

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=20140908083017.GA7638@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=cam@cs.ualberta.ca \
    --cc=claudio.fontana@huawei.com \
    --cc=david.marchand@6wind.com \
    --cc=jani.kokkonen@huawei.com \
    --cc=kvm@vger.kernel.org \
    --cc=mkletzan@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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).