From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E0BF8CE7 for ; Mon, 11 Apr 2016 18:38:53 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 11 Apr 2016 09:38:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,462,1455004800"; d="scan'208";a="930087866" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.191]) by orsmga001.jf.intel.com with ESMTP; 11 Apr 2016 09:38:46 -0700 Date: Tue, 12 Apr 2016 00:41:20 +0800 From: Yuanhan Liu To: "Xie, Huawei" Cc: "Tao, Zhe" , "dev@dpdk.org" Message-ID: <20160411164120.GH3080@yliu-dev.sh.intel.com> References: <1460309332-21981-1-git-send-email-zhe.tao@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] vhost: fix mem share between VM and host X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2016 16:38:54 -0000 On Mon, Apr 11, 2016 at 06:22:12AM +0000, Xie, Huawei wrote: > On 4/11/2016 1:29 AM, Zhe Tao wrote: > > > > +/* Check the share memory in case the QEMU doesn't set the share option > > + * as on for the memory-backend-file object in the QEMU command line. > > + */ > > + > > +int > > +vhost_check_mem_shared(struct vhost_device_ctx ctx) > > +{ > > + struct virtio_net *dev; > > + struct vhost_virtqueue *vq; > > + int ret = 0; > > + > > + dev = get_device(ctx); > > + if ((dev == NULL) || (dev->mem == NULL)) > > + return -1; > > + > > + /* check first virtqueue 0 rxq. */ > > + vq = dev->virtqueue[VIRTIO_RXQ]; > > + ret = vq->desc[0].next == 0 ? -1 : 0; > > + > > + if (ret) > > + RTE_LOG(ERR, VHOST_CONFIG, > > + "The mem is not shared between VM and host\n"); > > + > > + return ret; > > +} > > + > > Zhe: This is known to vhost-user users that share=on is a must-to-have > option. I think this isn't an issue. Agreed. > It is OK if we could do some early check in vhost, however we couldn't I think if there is really a need to do the check, it might should be done in QEMU: the option is from QEMU after all. > assume the value of vq->desc[0].next. > Check if there is other simple and reliable way. I will not say no to an elegant check though. --yliu