From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: Re: [PATCH 6/7] Do not modify VirtQueueElement Date: Thu, 04 Dec 2008 12:06:37 +0000 Message-ID: <1228392397.3732.71.camel@blaa> References: <1228325221-18106-1-git-send-email-aliguori@us.ibm.com> <1228325221-18106-2-git-send-email-aliguori@us.ibm.com> <1228325221-18106-3-git-send-email-aliguori@us.ibm.com> <1228325221-18106-4-git-send-email-aliguori@us.ibm.com> <1228325221-18106-5-git-send-email-aliguori@us.ibm.com> <1228325221-18106-6-git-send-email-aliguori@us.ibm.com> Reply-To: Mark McLoughlin Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Avi Kivity To: Anthony Liguori Return-path: Received: from mx2.redhat.com ([66.187.237.31]:50842 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750948AbYLDMIC (ORCPT ); Thu, 4 Dec 2008 07:08:02 -0500 In-Reply-To: <1228325221-18106-6-git-send-email-aliguori@us.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 2008-12-03 at 11:27 -0600, Anthony Liguori wrote: > Right now, virtio-net modifies the iovec structure in VirtQueueElement. This is > evil. This creates an impossible situation if we want to bounce iovec buffers > in VirtQueueElement as we lose track of the original buffers and the resulting > free results in very bad things. > > I tried to refactor receive_headers() and iov_fill() to be able to skip the > header if present but failed miserably. Instead of spending more time trying to > get that to work, I simply decided to leave the code as-is and copy the iovec > to a temporary buffer. Sounds sensible to me. We could perhaps make things a bit more clear by never using the guest supplied header and always translating between the two header formats. But whatever way we do it, if we want to avoid modifying the original iovec structure, we need the temporary buffer. Cheers, Mark.