From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by dpdk.org (Postfix) with ESMTP id 39D7D2EDA for ; Thu, 19 Nov 2015 08:12:15 +0100 (CET) Received: by padhx2 with SMTP id hx2so71997960pad.1 for ; Wed, 18 Nov 2015 23:12:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=pCousJ9tDJeJxxPqNKQoSCkWLNKQIwtoEGfZB0wK5EQ=; b=wuyugGKd5oV2+zIQMaVfxBou9MHAL38eX77Rls7vt7wz1F22wf9ohhkDEy5Db7ryqk dTIwLbNMaaRYqEKDKk/BFAaLtDahD91NDHbU1uxHPjyoPYNq+iFbiy9NuYj0R+sJRofw gO1lFjOCgDSbxBn0jdfQH7kwnF5lNDji+1e0SArXSWY2OtHgIfdvlMMK9Sb3WQfVz1JZ wUwK6NRCzsft8XL+kZS9LrjhuRuVMQ7sLGSFTA4y1viMpTjh0wRfgF2rJjAh/yESVaou ePzlZIa11ebEw8Tb78u8pJ+rOwt04qNs/vbQyWnu1ih0ainde9s9PSCml4TEAXCxcX16 IK0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=pCousJ9tDJeJxxPqNKQoSCkWLNKQIwtoEGfZB0wK5EQ=; b=ZH6ANlBvVLpbZfUX4Sy1SRrWUT6o3LO1EU1dZqSBNuQANtx2Z1FTM1eUkD17JBWX9d Zv9q0gtR3WDpyGLd+C+lDsTCtfIF7NkPgjXFVJPVtXYxOBGPKh06j78StDSH7BWPXd5C 1XhcN/hoBKk7thgEOuO511OeS0nx1uVgVX+p9Idqc+qWCqtGNn3gzj6YNWVzZkuqjRoM HjODrSLpN+46Eqop3TjZWkiXo1YNWJVPJfhJZ/pYQCqn8DKkZDmZHO1gb6WPmucAgQE4 74e+wn5zPvDbA1Jf0rWjnzG9mzAtg3BL9x5PiiguuoT/QMO+GhypKGaIgUkEnlBOI6hz LxZQ== X-Gm-Message-State: ALoCoQlqp78cTKTgcqUegLZAVpd9yyd+aUYjUEPbcKp+4xEu1GYeoJmVUNCVG48BGBaRVQBP8isU X-Received: by 10.68.179.69 with SMTP id de5mr8351254pbc.113.1447917134575; Wed, 18 Nov 2015 23:12:14 -0800 (PST) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by smtp.googlemail.com with ESMTPSA id bs3sm8259545pbd.89.2015.11.18.23.12.12 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Nov 2015 23:12:14 -0800 (PST) To: Yuanhan Liu References: <1447914206-18369-1-git-send-email-mukawa@igel.co.jp> <20151119070320.GK2326@yliu-dev.sh.intel.com> From: Tetsuya Mukawa Message-ID: <564D764B.3070003@igel.co.jp> Date: Thu, 19 Nov 2015 16:12:11 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151119070320.GK2326@yliu-dev.sh.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, ann.zhuangyanying@huawei.com Subject: Re: [dpdk-dev] [PATCH] 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: Thu, 19 Nov 2015 07:12:15 -0000 On 2015/11/19 16:03, Yuanhan Liu wrote: > On Thu, Nov 19, 2015 at 03:23:26PM +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 >> --- >> lib/librte_vhost/virtio-net.c | 21 ++++++++++++++++++++- >> 1 file changed, 20 insertions(+), 1 deletion(-) >> >> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c >> index 886c104..ae1e4bd 100644 >> --- a/lib/librte_vhost/virtio-net.c >> +++ b/lib/librte_vhost/virtio-net.c >> @@ -322,6 +322,25 @@ init_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx) >> init_vring_queue(dev->virtqueue[base_idx + VIRTIO_TXQ], qp_idx); >> } >> >> +static void >> +reset_vring_queue(struct vhost_virtqueue *vq, int qp_idx) >> +{ >> + int callfd; >> + >> + callfd = vq->callfd; >> + init_vring_queue(vq, qp_idx); >> + vq->callfd = callfd; > It may fix your issue, but it's not a proper fix. As we actually closed > callfd at cleanup_vq(). Yes, you are correct. We also need to fix above. > > BTW, the name, cleanup_vq/device, is not well taken. For a name like > cleanup, those functions should be invoked at device remove stage (say, > shutting down a VM), but not at reset stage (which is actually treated > as STOP in current QEMU implementation). > > I have a plan to correct it, but I guess it's not the right time as > v2.2 is coming soon. However, for a fix, it could be simple: how about > adding another arg to cleanup_vq: > > cleanup_vq(struct vhost_virtqueue *vq, int destory) > > And we only close callfd when destroy flag is set. (And of course, this > patch is needed). Yes I agree with it! Let me have a few hours, I will send it by today. Thanks, Tetsuya > What do you think of that? > > --yliu >> +} >> + >> +static void >> +reset_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx) >> +{ >> + uint32_t base_idx = qp_idx * VIRTIO_QNUM; >> + >> + reset_vring_queue(dev->virtqueue[base_idx + VIRTIO_RXQ], qp_idx); >> + reset_vring_queue(dev->virtqueue[base_idx + VIRTIO_TXQ], qp_idx); >> +} >> + >> static int >> alloc_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx) >> { >> @@ -362,7 +381,7 @@ reset_device(struct virtio_net *dev) >> dev->flags = 0; >> >> for (i = 0; i < dev->virt_qp_nb; i++) >> - init_vring_queue_pair(dev, i); >> + reset_vring_queue_pair(dev, i); >> } >> >> /* >> -- >> 2.1.4