From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyZSY-0005U0-2Q for qemu-devel@nongnu.org; Wed, 10 Dec 2014 00:05:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyZSR-0005dg-18 for qemu-devel@nongnu.org; Wed, 10 Dec 2014 00:05:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyZSQ-0005XH-Jz for qemu-devel@nongnu.org; Wed, 10 Dec 2014 00:05:02 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBA551lk030875 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 10 Dec 2014 00:05:01 -0500 Message-ID: <5487D47B.2060209@redhat.com> Date: Wed, 10 Dec 2014 00:04:59 -0500 From: John Snow MIME-Version: 1.0 References: <1418148909-19870-1-git-send-email-dgilbert@redhat.com> <1418148909-19870-2-git-send-email-dgilbert@redhat.com> In-Reply-To: <1418148909-19870-2-git-send-email-dgilbert@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] Restore atapi_dma flag across migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" , qemu-devel@nongnu.org Cc: pbonzini@redhat.com On 12/09/2014 01:15 PM, Dr. David Alan Gilbert (git) wrote: > From: "Dr. David Alan Gilbert" > > 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 > --- > 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