From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDnwa-0007fB-MT for qemu-devel@nongnu.org; Fri, 30 Mar 2012 22:21:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDnwY-0006xq-PA for qemu-devel@nongnu.org; Fri, 30 Mar 2012 22:21:32 -0400 Received: from mail.hq.newdream.net ([66.33.206.127]:48311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDnwY-0006wi-9R for qemu-devel@nongnu.org; Fri, 30 Mar 2012 22:21:30 -0400 Message-ID: <4F766A22.8030606@dreamhost.com> Date: Fri, 30 Mar 2012 19:21:22 -0700 From: Josh Durgin MIME-Version: 1.0 References: <1324067607-17055-1-git-send-email-brogers@suse.com> In-Reply-To: <1324067607-17055-1-git-send-email-brogers@suse.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vhost-net: Move asserts to after check for end < start List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bruce Rogers Cc: qemu-devel@nongnu.org, mst@redhat.com On 12/16/2011 12:33 PM, Bruce Rogers wrote: > When migrating a vm using vhost-net we hit the following assertion: > > qemu-kvm: /usr/src/packages/BUILD/qemu-kvm-0.15.1/hw/vhost.c:30: > vhost_dev_sync_region: Assertion `start / (0x1000 * (8 * > sizeof(vhost_log_chunk_t)))< dev->log_size' failed. I consistently hit this assert while testing live migration with qemu 1.0.1 and the master branch. Applying this patch allowed live migration to complete successfully. Maybe it could be reviewed and merged? > The cases which the end< start check is intended to catch, such as > for vga video memory, will also likely trigger the assertion. > Reorder the code to handle this correctly. > > Signed-off-by: Bruce Rogers > --- > hw/vhost.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/vhost.c b/hw/vhost.c > index 0870cb7..7309f71 100644 > --- a/hw/vhost.c > +++ b/hw/vhost.c > @@ -26,11 +26,11 @@ static void vhost_dev_sync_region(struct vhost_dev *dev, > vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1; > uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK; > > - assert(end / VHOST_LOG_CHUNK< dev->log_size); > - assert(start / VHOST_LOG_CHUNK< dev->log_size); > if (end< start) { > return; > } > + assert(end / VHOST_LOG_CHUNK< dev->log_size); > + assert(start / VHOST_LOG_CHUNK< dev->log_size); > for (;from< to; ++from) { > vhost_log_chunk_t log; > int bit;