From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH v2 1/2] kvm tools: Fix VHOST_SET_MEM_TABLE failure Date: Fri, 13 Jul 2012 02:27:24 +0300 Message-ID: <20120712232724.GD9317@redhat.com> References: <1342022894-1034-1-git-send-email-asias.hejun@gmail.com> <4FFDA543.2030304@redhat.com> <4FFE88A3.8010408@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Asias He , Pekka Enberg , Sasha Levin , Ingo Molnar , Cyrill Gorcunov , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:61800 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161989Ab2GLX1P (ORCPT ); Thu, 12 Jul 2012 19:27:15 -0400 Content-Disposition: inline In-Reply-To: <4FFE88A3.8010408@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jul 12, 2012 at 11:19:47AM +0300, Avi Kivity wrote: > On 07/12/2012 05:46 AM, Asias He wrote: > > On Thu, Jul 12, 2012 at 12:09 AM, Avi Kivity wrote: > >> On 07/11/2012 07:08 PM, Asias He wrote: > >>> VHOST_SET_MEM_TABLE failed: Operation not supported > >>> > >>> In vhost_set_memory(), We have > >>> > >>> if (mem.padding) > >>> return -EOPNOTSUPP; > >>> > >>> So, we need to zero struct vhost_memory. > >>> > >> > >> Is this due to a change in vhost? > > > > Seems we have this bit in the very beginning (commit 3a4d5c94). > > Okay, so it's a documentation problem. Michael, where is the > documentation for vhost-net? Most fields are documented in include/linux/vhost.h Yes the approach vhost consistently takes is to require all unused fields to be zeroed out. > Note we have to initialize it with memset(); We can also use = {} if we want to avoid naming it. > presumably when we > repurpose it the name will change, and anonymous unions are not very > portable. Looks like in the new C standard they are :) I'm not sure what we'll do, exactly, if we need to reuse this padding for something else, but not breaking build for old userspace will be a priority. > -- > error compiling committee.c: too many arguments to function >