From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkEDO-000717-8x for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:57:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkEDN-0006Rw-1s for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:57:26 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:52823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkEDM-0006RH-Sh for qemu-devel@nongnu.org; Wed, 05 Jun 2013 09:57:24 -0400 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 5 Jun 2013 09:57:24 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 1203A6E803F for ; Wed, 5 Jun 2013 09:57:17 -0400 (EDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r55DvKOr293998 for ; Wed, 5 Jun 2013 09:57:20 -0400 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r55DvHgl012403 for ; Wed, 5 Jun 2013 07:57:17 -0600 Message-ID: <51AF43B8.90501@linux.vnet.ibm.com> Date: Wed, 05 Jun 2013 09:57:12 -0400 From: Corey Bryant MIME-Version: 1.0 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> <20130605134230.GF2611@dhcp-200-207.str.redhat.com> In-Reply-To: <20130605134230.GF2611@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Kevin Wolf 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 On 06/05/2013 09:42 AM, Kevin Wolf wrote: > 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 > > > Ah, thanks for explaining. Now I can work in bytes rather than sectors. :) -- Regards, Corey Bryant