From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCyUd-0003ka-OT for qemu-devel@nongnu.org; Thu, 31 Jul 2014 18:06:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCyUX-0004oj-J5 for qemu-devel@nongnu.org; Thu, 31 Jul 2014 18:06:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCyUX-0004m4-BI for qemu-devel@nongnu.org; Thu, 31 Jul 2014 18:06:29 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6VM6Rfi018274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 31 Jul 2014 18:06:27 -0400 Message-ID: <53DABDDB.3030400@redhat.com> Date: Thu, 31 Jul 2014 18:06:19 -0400 From: John Snow MIME-Version: 1.0 References: <1404757089-4836-1-git-send-email-jsnow@redhat.com> <1404757089-4836-4-git-send-email-jsnow@redhat.com> <20140731105856.GF25929@stefanha-thinkpad.redhat.com> In-Reply-To: <20140731105856.GF25929@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 03/28] ide-test: add test for werror=stop List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: paolo Bonzini Cc: qemu-devel@nongnu.org, Stefan Hajnoczi On 07/31/2014 06:58 AM, Stefan Hajnoczi wrote: > On Mon, Jul 07, 2014 at 02:17:44PM -0400, John Snow wrote: >> +static void test_retry_flush(void) >> +{ >> + uint8_t data; >> + const char *s; >> + >> + prepare_blkdebug_script(debug_path, "flush_to_disk"); >> + >> + ide_test_start( >> + "-vnc none " >> + "-drive file=blkdebug:%s:%s,if=ide,cache=writeback,rerror=stop,werror=stop", >> + debug_path, tmp_path); >> + >> + /* FLUSH CACHE command on device 0*/ >> + outb(IDE_BASE + reg_device, 0); >> + outb(IDE_BASE + reg_command, CMD_FLUSH_CACHE); >> + >> + /* Check status while request is in flight*/ >> + data = inb(IDE_BASE + reg_status); >> + assert_bit_set(data, BSY | DRDY); >> + assert_bit_clear(data, DF | ERR | DRQ); >> + >> + sleep(1); /* HACK: wait for event */ >> + >> + /* Complete the command */ >> + s = "{'execute':'cont' }"; >> + while (!qmp(s)) { >> + s = ""; >> + sleep(1); >> + } > I guess we're supposed to wait for the block I/O error event when the > machine stops. Please implement that and replace this polling loop. > > See the STOP event in docs/qmp/qmp-events.txt. > Paolo: I edited in a bit to check for the STOP event instead of sleeping in V2, but what's the point of setting s = "" and sleeping and resending a blank string? Can't we just g_assert(qmp(s)) the first go around, provided the STOP event has already occurred? It works in practice, but I am curious. --J