From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aipUV-0006sp-Gx for qemu-devel@nongnu.org; Wed, 23 Mar 2016 16:34:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aipUP-00063f-TT for qemu-devel@nongnu.org; Wed, 23 Mar 2016 16:34:55 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34060) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aipUP-00063X-MK for qemu-devel@nongnu.org; Wed, 23 Mar 2016 16:34:49 -0400 Received: by mail-wm0-x244.google.com with SMTP id p65so7172408wmp.1 for ; Wed, 23 Mar 2016 13:34:49 -0700 (PDT) Sender: Paolo Bonzini References: <1458728792-15779-1-git-send-email-den@openvz.org> <1458728792-15779-2-git-send-email-den@openvz.org> From: Paolo Bonzini Message-ID: <56F2FDE5.5020908@redhat.com> Date: Wed, 23 Mar 2016 21:34:45 +0100 MIME-Version: 1.0 In-Reply-To: <1458728792-15779-2-git-send-email-den@openvz.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] ide: don't loose pending dma state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" , qemu-devel@nongnu.org Cc: John Snow , Pavel Butsykin On 23/03/2016 11:26, Denis V. Lunev wrote: > If the migration occurs after the IDE DMA has been set up but before it > has been initiated, the state gets lost upon save/restore. Specifically, > ->dma_cb callback gets cleared, so, when the guest eventually starts bus > mastering, the DMA never completes, causing the guest to time out the > operation. > > OTOH all the infrastructure is already in place to restart the DMA if > the migration happens while the DMA is in progress. > > So reuse that infrastructure, by calling the DMA callback with an > artificial error code in pre_save if the callback is already set but > DMAING is clear. The callback then sets bus->error_status to indicate > the need for restart; however since DMAING is clear the state upon > restore will be exactly "ready forDMA" as before the save. Could you just use the dma_cmd field to build the error_status? For extra points, make ide_handle_rw_error convert IDE_DMA_* to IDE_RETRY_* so that the callers only need to pass in IDE_RETRY_DMA (like they only need to pass in IDE_RETRY_PIO). Paolo