Received: from eggs.gnu.org ([2001:4830:134:3::10]:55864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDzM-0007ux-Sg for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:43:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkDzI-0001AL-Bv for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:42:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47301) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkDzI-0001AE-1z for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:42:52 -0400 Date: Wed, 5 Jun 2013 15:42:30 +0200 From: Kevin Wolf Message-ID: <20130605134230.GF2611@dhcp-200-207.str.redhat.com> References: <1370369921-14925-1-git-send-email-coreyb@linux.vnet.ibm.com> <1370369921-14925-2-git-send-email-coreyb@linux.vnet.ibm.com> <20130605090536.GB27374@stefanha-thinkpad.muc.redhat.com> <51AF3D00.8020005@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51AF3D00.8020005@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH 1/2] nvram: Add TPM NVRAM implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Corey Bryant Cc: aliguori@us.ibm.com, stefanb@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, jschopp@linux.vnet.ibm.com, Stefan Hajnoczi Am 05.06.2013 um 15:28 hat Corey Bryant geschrieben: > >>+ > >>+ if (rwr->rc == 0) { > >>+ rwr->rc = rwr->num_sectors; > >>+ *rwr->blob_r = g_malloc(rwr->size); > >>+ memcpy(*rwr->blob_r, buf, rwr->size); > > > >Use bdrv_pread()/bdrv_pwrite() for byte-granularity I/O instead of > >duplicating the buffering yourself. > > > > Aren't bdrv_pread()/bdrv_pwrite() synchronous? Wouldn't using them > block the main QEMU thread? That is why I switched to using the > coroutine versions. You need to call them from coroutine context to avoid that they invoke their on coroutine on which they wait in this this while (!done) { qemu_aio_wait(); } loop that blocks everything. Called from coroutine context, they do the Right Thing, though. Kevin