qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] nvram: Add TPM NVRAM implementation


From: Corey Bryant
Subject: Re: [Qemu-devel] [PATCH 1/2] nvram: Add TPM NVRAM implementation
Date: Wed, 05 Jun 2013 09:57:12 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6



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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]