From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id BBDFE3254 for ; Tue, 5 Sep 2017 10:18:40 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D73C54A6FD; Tue, 5 Sep 2017 08:18:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D73C54A6FD Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=maxime.coquelin@redhat.com Received: from [10.36.112.29] (ovpn-112-29.ams2.redhat.com [10.36.112.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF2E67B220; Tue, 5 Sep 2017 08:18:35 +0000 (UTC) To: Tiwei Bie Cc: dev@dpdk.org, yliu@fridaylinux.org, jfreiman@redhat.com, mst@redhat.com, vkaplans@redhat.com, jasowang@redhat.com References: <20170831095023.21037-1-maxime.coquelin@redhat.com> <20170831095023.21037-6-maxime.coquelin@redhat.com> <20170905041940.GB31895@debian-ZGViaWFuCg> From: Maxime Coquelin Message-ID: <72d37140-551e-35ed-0dc0-7f209a3632cb@redhat.com> Date: Tue, 5 Sep 2017 10:18:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170905041940.GB31895@debian-ZGViaWFuCg> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 05 Sep 2017 08:18:40 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH 05/21] vhost: add support to slave requests channel X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2017 08:18:41 -0000 On 09/05/2017 06:19 AM, Tiwei Bie wrote: > On Thu, Aug 31, 2017 at 11:50:07AM +0200, Maxime Coquelin wrote: >> Currently, only QEMU sends requests, the backend sends >> replies. In some cases, the backend may need to send >> requests to QEMU, like IOTLB miss events when IOMMU is >> supported. >> >> This patch introduces a new channel for such requests. >> QEMU sends a file descriptor of a new socket using >> VHOST_USER_SET_SLAVE_REQ_FD. >> >> Signed-off-by: Maxime Coquelin >> --- >> lib/librte_vhost/vhost.h | 2 ++ >> lib/librte_vhost/vhost_user.c | 27 +++++++++++++++++++++++++++ >> lib/librte_vhost/vhost_user.h | 10 +++++++++- >> 3 files changed, 38 insertions(+), 1 deletion(-) >> >> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h >> index 18ad69c85..2340b0c2a 100644 >> --- a/lib/librte_vhost/vhost.h >> +++ b/lib/librte_vhost/vhost.h >> @@ -196,6 +196,8 @@ struct virtio_net { >> uint32_t nr_guest_pages; >> uint32_t max_guest_pages; >> struct guest_page *guest_pages; >> + >> + int slave_req_fd; >> } __rte_cache_aligned; >> >> >> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c >> index 8984dcb6a..7b3c2f32a 100644 >> --- a/lib/librte_vhost/vhost_user.c >> +++ b/lib/librte_vhost/vhost_user.c >> @@ -76,6 +76,7 @@ static const char *vhost_message_str[VHOST_USER_MAX] = { >> [VHOST_USER_SET_VRING_ENABLE] = "VHOST_USER_SET_VRING_ENABLE", >> [VHOST_USER_SEND_RARP] = "VHOST_USER_SEND_RARP", >> [VHOST_USER_NET_SET_MTU] = "VHOST_USER_NET_SET_MTU", >> + [VHOST_USER_SET_SLAVE_REQ_FD] = "VHOST_USER_SET_SLAVE_REQ_FD", >> }; >> >> static uint64_t >> @@ -122,6 +123,11 @@ vhost_backend_cleanup(struct virtio_net *dev) >> munmap((void *)(uintptr_t)dev->log_addr, dev->log_size); >> dev->log_addr = 0; >> } >> + >> + if (dev->slave_req_fd >= 0) { >> + close(dev->slave_req_fd); >> + dev->slave_req_fd = -1; > > The slave_req_fd should also be initialized to -1 when allocating > the virtio_net structure. Currently, it's missing. Good catch, thanks for spotting this. Maxime > Best regards, > Tiwei Bie >