Received: from eggs.gnu.org ([2001:4830:134:3::10]:36322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afBpQ-00072w-N8 for qemu-devel@nongnu.org; Sun, 13 Mar 2016 15:37:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afBpN-0002bw-GB for qemu-devel@nongnu.org; Sun, 13 Mar 2016 15:37:28 -0400 Received: from mail-io0-x231.google.com ([2607:f8b0:4001:c06::231]:33492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afBpN-0002a8-BK for qemu-devel@nongnu.org; Sun, 13 Mar 2016 15:37:25 -0400 Received: by mail-io0-x231.google.com with SMTP id n190so200862094iof.0 for ; Sun, 13 Mar 2016 12:37:23 -0700 (PDT) From: "Huaicheng Li (coperd)" Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-Id: Date: Sun, 13 Mar 2016 14:37:21 -0500 Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: [Qemu-devel] about correctness of IDE emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Stefan Hajnoczi , Fam Zheng Hi all,=20 I meet some trouble in understanding IDE emulation: (1) IDE I/O Down Path (In VCPU thread):=20 upon KVM_EXIT_IO, corresponding disk ioport write function will write IO = info to IDEState, then ide read callback function will eventually split = it into **several DMA transfers** and eventually submit them to the AIO = request list for handling.=20 (2). I/O Up Path (worker thread =E2=80=94> QEMU main loop thread) when the request in AIO request list has been successfully handled, the = worker thread will signal the QEMU main thread this I/O completion = event, which is later handled by its callback (posix_aio_read). = posix_aio_read will then eventually return to IDE callback function, = where virtual interrupt is generated to signal guest about I/O = completion. What I=E2=80=99m confused about is that: If one I/O is too large and may need several rounds (say 2) of DMA = transfers, it seems the second round transfer begins only after the = completion of the first part, by reading data from **IDEState**. But the = IDEState info may have been changed by VCPU threads (by writing new I/Os = to it) when the first transfer finishes. =46rom the code, I see that IDE = r/w call back function will continue the second transfer by referencing = IDEState=E2=80=99s information. Wouldn=E2=80=99t this be problematic? Am = I missing anything here? Thanks. Best, Huaicheng=