From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id B52E18DB1 for ; Fri, 20 Nov 2015 12:20:18 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 20 Nov 2015 03:20:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,322,1444719600"; d="scan'208";a="855494111" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by orsmga002.jf.intel.com with ESMTP; 20 Nov 2015 03:20:04 -0800 Date: Fri, 20 Nov 2015 19:21:25 +0800 From: Yuanhan Liu To: Tetsuya Mukawa Message-ID: <20151120112125.GA2325@yliu-dev.sh.intel.com> References: <1447914206-18369-1-git-send-email-mukawa@igel.co.jp> <1447924020-26894-1-git-send-email-mukawa@igel.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447924020-26894-1-git-send-email-mukawa@igel.co.jp> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: dev@dpdk.org, ann.zhuangyanying@huawei.com Subject: Re: [dpdk-dev] [PATCH v2] vhost: Fix reset_owner message handling not to clear callfd 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: Fri, 20 Nov 2015 11:20:19 -0000 On Thu, Nov 19, 2015 at 06:07:00PM +0900, Tetsuya Mukawa wrote: > The patch fixes reset_owner message handling not to clear callfd, > because callfd will be valid while connection is establihed. > > Signed-off-by: Tetsuya Mukawa .... > > /* > @@ -467,6 +486,7 @@ static int > reset_owner(struct vhost_device_ctx ctx) > { > struct virtio_net *dev; > + uint32_t i; > > dev = get_device(ctx); > if (dev == NULL) > @@ -475,7 +495,19 @@ reset_owner(struct vhost_device_ctx ctx) > if (dev->flags & VIRTIO_DEV_RUNNING) > notify_destroy_device(dev); > > - cleanup_device(dev); I would suggest to introduce the destory flag to cleanup_device() as well, so that we don't have to unfold the cleanup_device code here. (BTW, I should've reviewed this patch this morning, but I was busy). --yliu > + /* Unmap QEMU memory file if mapped. */ > + if (dev->mem) { > + munmap((void *)(uintptr_t)dev->mem->mapped_address, > + (size_t)dev->mem->mapped_size); > + free(dev->mem); > + dev->mem = NULL; > + } > + > + for (i = 0; i < dev->virt_qp_nb; i++) { > + cleanup_vq(dev->virtqueue[i * VIRTIO_QNUM + VIRTIO_RXQ], 0); > + cleanup_vq(dev->virtqueue[i * VIRTIO_QNUM + VIRTIO_TXQ], 0); > + } > + > reset_device(dev); > return 0; > } > -- > 2.1.4