From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O5IrT-0002K0-14 for qemu-devel@nongnu.org; Fri, 23 Apr 2010 09:24:03 -0400 Received: from [140.186.70.92] (port=56086 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O5IrR-0002Jj-Ab for qemu-devel@nongnu.org; Fri, 23 Apr 2010 09:24:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O5IrL-0001bp-HV for qemu-devel@nongnu.org; Fri, 23 Apr 2010 09:23:57 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:38284) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O5IrL-0001bj-Aj for qemu-devel@nongnu.org; Fri, 23 Apr 2010 09:23:55 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e31.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o3NDEFga021341 for ; Fri, 23 Apr 2010 07:14:15 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o3NDNmQ4242680 for ; Fri, 23 Apr 2010 07:23:48 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o3NDNlvL005651 for ; Fri, 23 Apr 2010 07:23:48 -0600 Message-ID: <4BD19F62.1060001@linux.vnet.ibm.com> Date: Fri, 23 Apr 2010 08:23:46 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1271829445-5328-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> <1271829445-5328-8-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> <4BD0A3B0.8040609@linux.vnet.ibm.com> <4BD11BCC.2050908@lab.ntt.co.jp> In-Reply-To: <4BD11BCC.2050908@lab.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [RFC PATCH 07/20] Introduce qemu_put_vector() and qemu_put_vector_prepare() to use put_vector() in QEMUFile. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yoshiaki Tamura Cc: ohmura.kei@lab.ntt.co.jp, kvm@vger.kernel.org, mtosatti@redhat.com, Anthony Liguori , qemu-devel@nongnu.org, yoshikawa.takuya@oss.ntt.co.jp, avi@redhat.com On 04/22/2010 11:02 PM, Yoshiaki Tamura wrote: > Anthony Liguori wrote: >> On 04/21/2010 12:57 AM, Yoshiaki Tamura wrote: >>> For fool proof purpose, qemu_put_vector_parepare should be called >>> before qemu_put_vector. Then, if qemu_put_* functions except this is >>> called after qemu_put_vector_prepare, program will abort(). >>> >>> Signed-off-by: Yoshiaki Tamura >> >> I don't get it. What's this protecting against? > > This was introduced to prevent mixing the order of normal write and > vector write, and flush QEMUFile buffer before handling vectors. > While qemu_put_buffer copies data to QEMUFile buffer, > qemu_put_vector() will bypass that buffer. > > It's just fool proof purpose for what we encountered at beginning, and > if the user of qemu_put_vector() is careful enough, we can remove > qemu_put_vectore_prepare(). While writing this message, I started to > think that just calling qemu_fflush() in qemu_put_vector() would be > enough... I definitely think removing the vector stuff in the first version would simplify the process of getting everything merged. I'd prefer not to have two apis so if vector operations were important from a performance perspective, I'd want to see everything converted to a vector API. Regards, Anthony Liguori