From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v2] vhost: Fix reset_owner message handling not to clear callfd Date: Fri, 20 Nov 2015 19:21:25 +0800 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 Cc: dev@dpdk.org, ann.zhuangyanying@huawei.com To: Tetsuya Mukawa 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) Content-Disposition: inline In-Reply-To: <1447924020-26894-1-git-send-email-mukawa@igel.co.jp> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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