[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 27/42] ivshmem: Receive shared memory synchro
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH v2 27/42] ivshmem: Receive shared memory synchronously in realize() |
Date: |
Wed, 9 Mar 2016 13:45:51 +0100 |
On Mon, Mar 7, 2016 at 8:25 PM, Markus Armbruster <address@hidden> wrote:
> When configured for interrupts (property "chardev" given), we receive
> the shared memory from an ivshmem server. We do so asynchronously
> after realize() completes, by setting up callbacks with
> qemu_chr_add_handlers().
>
> Keeping server I/O out of realize() that way avoids delays due to a
> slow server. This is probably relevant only for hot plug.
>
> However, this funny "no shared memory, yet" state of the device also
> causes a raft of issues that are hard or impossible to work around:
>
> * The guest is exposed to this state: when we enter and leave it its
> shared memory contents is apruptly replaced, and device register
> IVPosition changes.
>
> This is a known issue. We document that guests should not access
> the shared memory after device initialization until the IVPosition
> register becomes non-negative.
>
> For cold plug, the funny state is unlikely to be visible in
> practice, because we normally receive the shared memory long before
> the guest gets around to mess with the device.
>
> For hot plug, the timing is tighter, but the relative slowness of
> PCI device configuration has a good chance to hide the funny state.
>
> In either case, guests complying with the documented procedure are
> safe.
>
> * Migration becomes racy.
>
> If migration completes before the shared memory setup completes on
> the source, shared memory contents is silently lost. Fortunately,
> migration is rather unlikely to win this race.
>
> If the shared memory's ramblock arrives at the destination before
> shared memory setup completes, migration fails.
>
> There is no known way for a management application to wait for
> shared memory setup to complete.
>
> All you can do is retry failed migration. You can improve your
> chances by leaving more time between running the destination QEMU
> and the migrate command.
>
> To mitigate silent memory loss, you need to ensure the server
> initializes shared memory exactly the same on source and
> destination.
>
> These issues are entirely undocumented so far.
>
> I'd expect the server to be almost always fast enough to hide these
> issues. But then rare catastrophic races are in a way the worst kind.
>
> This is way more trouble than I'm willing to take from any device.
> Kill the funny state by receiving shared memory synchronously in
> realize(). If your hot plug hangs, go kill your ivshmem server.
>
> For easier review, this commit only makes the receive synchronous, it
> doesn't add the necessary error propagation. Without that, the funny
> state persists. The next commit will do that, and kill it off for
> real.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
Reviewed-by: Marc-André Lureau <address@hidden>
--
Marc-André Lureau
- [Qemu-devel] [PATCH v2 28/42] ivshmem: Propagate errors through ivshmem_recv_setup(), (continued)
- [Qemu-devel] [PATCH v2 28/42] ivshmem: Propagate errors through ivshmem_recv_setup(), Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 42/42] contrib/ivshmem-server: Print "not for production" warning, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 41/42] ivshmem: Require master to have ID zero, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 07/42] event_notifier: Make event_notifier_init_fd() #ifdef CONFIG_EVENTFD, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 22/42] ivshmem: Leave INTx alone when using MSI-X, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 15/42] ivshmem: Clean up after commit 9940c32, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 18/42] ivshmem: Fix harmless misuse of Error, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 27/42] ivshmem: Receive shared memory synchronously in realize(), Markus Armbruster, 2016/03/07
- Re: [Qemu-devel] [PATCH v2 27/42] ivshmem: Receive shared memory synchronously in realize(),
Marc-André Lureau <=
- [Qemu-devel] [PATCH v2 32/42] ivshmem: Tighten check of property "size", Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 26/42] ivshmem: Plug leaks on unplug, fix peer disconnect, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 37/42] ivshmem: Replace int role_val by OnOffAuto master, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 39/42] ivshmem: Clean up after the previous commit, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 31/42] ivshmem: Simplify how we cope with short reads from server, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 29/42] ivshmem: Rely on server sending the ID right after the version, Markus Armbruster, 2016/03/07
- [Qemu-devel] [PATCH v2 38/42] ivshmem: Split ivshmem-plain, ivshmem-doorbell off ivshmem, Markus Armbruster, 2016/03/07