All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: David Gibson <david@gibson.dropbear.id.au>,
	mst@redhat.com, amit.shah@redhat.com, rusty@rustcorp.com.au
Cc: aik@ozlabs.ru, qemu-devel@nongnu.org, mdroth@us.ibm.com
Subject: Re: [Qemu-devel] [PATCHv3 0/2] Fix virtio-serial migration on bi-endian targets
Date: Fri, 19 Dec 2014 11:03:05 +0100	[thread overview]
Message-ID: <5493F7D9.3040705@suse.de> (raw)
In-Reply-To: <1418961447-16287-1-git-send-email-david@gibson.dropbear.id.au>



On 19.12.14 04:57, David Gibson wrote:
> On a bi-endian target, with a guest in the non-default endian mode,
> attempting to migrate twice in a row with a virtio-serial device wil
> cause a qemu SEGV on the second outgoing migration.
> 
> The problem is that virtio_serial_save_device() (and other places) expect
> VirtIOSerial->config to be in current guest endianness.  On a fresh boot,
> virtio_serial_device_realize() will initialize VirtIOSerial->config in
> default endianness.  It's assumed the guest OS will make its true
> endianness known before the device is reset and initialized, then
> vser_reset adjusts VirtIOSerial->config into the new endianness.
> 
> But on an incoming migration, the device isn't reset (after all the guest
> has a running driver as far as it's concerned), which means that
> VirtIOSerial->config retains its default endianness value from
> virtio_serial_device_realize().
> 
> On a subsequent outgoing migration, virtio_serial_save_device() attempts
> to interpret VirtIOSerial->config.max_nr_ports in current endianness when
> its actually in default endianness and then runs off the end of the
> ports_map array in the loop immediately afterwards.
> 
> We could fix this by adjusting VirtIOSerial->config into the correct
> current endianness after an incoming migration.  But in fact we
> already have a host endian copy of the max number of ports readily
> available, so it's simpler to just use that instead.  Patch 1/2 does
> that.
> 
> Once that's done, it becomes clear that there's really no reason to
> keep the guest-endian copy of the config space around persistently
> (config accesses aren't a fast path, so it can be constructed when
> necessary).  Patch 2/2 makes that cleanup.

Reviewed-by: Alexander Graf <agraf@suse.de>

  parent reply	other threads:[~2014-12-19 10:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19  3:57 [Qemu-devel] [PATCHv3 0/2] Fix virtio-serial migration on bi-endian targets David Gibson
2014-12-19  3:57 ` [Qemu-devel] [PATCHv3 1/2] virtio_serial: Don't use vser->config.max_nr_ports internally David Gibson
2014-12-19  3:57 ` [Qemu-devel] [PATCHv3 2/2] virtio-serial: Don't keep a persistent copy of config space David Gibson
2014-12-19 10:01 ` [Qemu-devel] [PATCHv3 0/2] Fix virtio-serial migration on bi-endian targets Alexander Graf
2014-12-19 10:03 ` Alexander Graf [this message]
2015-01-05  7:30 ` Amit Shah

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=5493F7D9.3040705@suse.de \
    --to=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=amit.shah@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=mdroth@us.ibm.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    /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.