Received: from eggs.gnu.org ([208.118.235.92]:55018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufomm-00021F-Oe for qemu-devel@nongnu.org; Fri, 24 May 2013 05:59:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ufomk-0005f1-RU for qemu-devel@nongnu.org; Fri, 24 May 2013 05:59:44 -0400 Received: from mail-we0-x22b.google.com ([2a00:1450:400c:c03::22b]:51334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufomk-0005es-LS for qemu-devel@nongnu.org; Fri, 24 May 2013 05:59:42 -0400 Received: by mail-we0-f171.google.com with SMTP id t59so2690941wes.30 for ; Fri, 24 May 2013 02:59:41 -0700 (PDT) Date: Fri, 24 May 2013 11:59:38 +0200 From: Stefan Hajnoczi Message-ID: <20130524095938.GJ21639@stefanha-thinkpad.redhat.com> References: <1369331087-22345-1-git-send-email-coreyb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1369331087-22345-1-git-send-email-coreyb@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH 0/7] VNVRAM persistent storage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Corey Bryant Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanb@linux.vnet.ibm.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com, jschopp@linux.vnet.ibm.com, stefanha@redhat.com On Thu, May 23, 2013 at 01:44:40PM -0400, Corey Bryant wrote: > This patch series provides VNVRAM persistent storage support that > QEMU can use internally. The initial target user will be a software > vTPM 1.2 backend that needs to store keys in VNVRAM and be able to > reboot/migrate and retain the keys. > > This support uses QEMU's block driver to provide persistent storage > by reading/writing VNVRAM data from/to a drive image. The VNVRAM > drive image is provided with the -drive command line option just like > any other drive image and the vnvram_create() API will find it. > > The APIs allow for VNVRAM entries to be registered, one at a time, > each with a maximum blob size. Entry blobs can then be read/written > from/to an entry on the drive. Here's an example of usage: > > VNVRAM *vnvram; > int errcode > const VNVRAMEntryName entry_name; > const char *blob_w = "blob data"; > char *blob_r; > uint32_t blob_r_size; > > vnvram = vnvram_create("drive-ide0-0-0", false, &errcode); > strcpy((char *)entry_name, "first-entry"); VNVRAMEntryName is very prone to buffer overflow. I hope real code doesn't use strcpy(). The cast is ugly, please don't hide the type. > vnvram_register_entry(vnvram, &entry_name, 1024); > vnvram_write_entry(vnvram, &entry_name, (char *)blob_w, strlen(blob_w)+1); > vnvram_read_entry(vnvram, &entry_name, &blob_r, &blob_r_size); These are synchronous functions. If I/O is involved then this is a problem: QEMU will be blocked waiting for host I/O to complete and the big QEMU lock is held. This can cause poor guest interactivity and poor scalability because vcpus cannot make progress, neither can the QEMU monitor respond. Stefan