From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj22Z-0005N2-T1 for qemu-devel@nongnu.org; Thu, 24 Mar 2016 05:58:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aj22V-0006Pl-Qm for qemu-devel@nongnu.org; Thu, 24 Mar 2016 05:58:55 -0400 Received: from mail-am1on0107.outbound.protection.outlook.com ([157.56.112.107]:44416 helo=emea01-am1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj22U-0006PT-M3 for qemu-devel@nongnu.org; Thu, 24 Mar 2016 05:58:51 -0400 References: <1458728792-15779-1-git-send-email-den@openvz.org> <1458728792-15779-2-git-send-email-den@openvz.org> <56F2FDE5.5020908@redhat.com> From: Pavel Butsykin Message-ID: <56F3B249.50605@virtuozzo.com> Date: Thu, 24 Mar 2016 12:24:25 +0300 MIME-Version: 1.0 In-Reply-To: <56F2FDE5.5020908@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed 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: Paolo Bonzini , "Denis V. Lunev" , qemu-devel@nongnu.org Cc: John Snow On 23.03.2016 23:34, Paolo Bonzini wrote: > > > 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 > You mean to do something like that: ide_handle_rw_error(s, -ret, s->dma_cmd | IDE_RETRY_DMA) ?