qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>,
	qemu-devel@nongnu.org
Cc: pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] Restore atapi_dma flag across migration
Date: Wed, 10 Dec 2014 00:04:59 -0500	[thread overview]
Message-ID: <5487D47B.2060209@redhat.com> (raw)
In-Reply-To: <1418148909-19870-2-git-send-email-dgilbert@redhat.com>



On 12/09/2014 01:15 PM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> If a migration happens just after the guest has kicked
> off an ATAPI command and kicked off DMA, we lose the atapi_dma
> flag, and the destination tries to complete the command as PIO
> rather than DMA.  This upsets Linux; modern libata based kernels
> stumble and recover OK, older kernels end up passing bad data
> to userspace.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>   hw/ide/core.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index d4af5e2..ac3f015 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -2417,6 +2417,7 @@ static int ide_drive_pio_post_load(void *opaque, int version_id)
>       s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx];
>       s->data_ptr = s->io_buffer + s->cur_io_buffer_offset;
>       s->data_end = s->data_ptr + s->cur_io_buffer_len;
> +    s->atapi_dma = s->feature & 1; /* as per cmd_packet */
>
>       return 0;
>   }
>

This looks fine to me; though perhaps a more comprehensive fix might 
prevent us needing this at all. As the code exists today, it's 
definitely an error to lose this value, as you've noticed.

Reviewed-by: John Snow <jsnow@redhat.com>

  reply	other threads:[~2014-12-10  5:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09 18:15 [Qemu-devel] [PATCH 0/2] ATAPI migration fix/hack Dr. David Alan Gilbert (git)
2014-12-09 18:15 ` [Qemu-devel] [PATCH 1/2] Restore atapi_dma flag across migration Dr. David Alan Gilbert (git)
2014-12-10  5:04   ` John Snow [this message]
2014-12-09 18:15 ` [Qemu-devel] [PATCH 2/2] atapi migration: Throw recoverable error to avoid recovery Dr. David Alan Gilbert (git)
2014-12-10  6:14   ` John Snow
2014-12-10 12:05     ` Dr. David Alan Gilbert
2014-12-10 20:09     ` Dr. David Alan Gilbert
2014-12-10 22:04   ` Paolo Bonzini
2014-12-11 19:45     ` Dr. David Alan Gilbert
2014-12-18 19:39       ` Dr. David Alan Gilbert
2014-12-18 23:42         ` John Snow
2015-01-16 17:28   ` John Snow
2015-02-02 12:11     ` Kevin Wolf
2015-01-07 16:26 ` [Qemu-devel] [PATCH 0/2] ATAPI migration fix/hack Dr. David Alan Gilbert
2015-01-30 16:07   ` Dr. David Alan Gilbert

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=5487D47B.2060209@redhat.com \
    --to=jsnow@redhat.com \
    --cc=dgilbert@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).