From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 1070EF72 for ; Fri, 17 Aug 2018 16:05:19 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180817140518euoutp02a8697cb1ffaaa2eb35b3c369f1bae2fe~LsQG3CHHS0274602746euoutp02D for ; Fri, 17 Aug 2018 14:05:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180817140518euoutp02a8697cb1ffaaa2eb35b3c369f1bae2fe~LsQG3CHHS0274602746euoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1534514719; bh=kfY8IG/cFCvdkUgtZUjdhPUIwIdWfpBnTZ07TWoB32Q=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=vGlQPY++ewGXNUR9nw50y3N/BbNJdDdNxwwsop+MEEFpAiBw4HA90qV9HZcqkITxq +EchR90QPUsQi3EpUh0W6kpky3debiU2TLtTcFVvTPxo8MepV54nnlSsXtIjCvvrdj zlLrrkI5rnmQUkoyZK6eJolVQy0goFPVdyA/k4dU= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180817140518eucas1p184dc3401248771fc3834f4bb55d4d9f2~LsQGc08Ra1370713707eucas1p1_; Fri, 17 Aug 2018 14:05:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id A9.4C.04294.E16D67B5; Fri, 17 Aug 2018 15:05:18 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20180817140517eucas1p24703d1c0234958581830c117fce93f14~LsQFwJphW1727417274eucas1p2M; Fri, 17 Aug 2018 14:05:17 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20180817140517eusmtrp191eceb0c0398e084c0f2ee3c7ac88ba7~LsQFhfkoF0132901329eusmtrp1Z; Fri, 17 Aug 2018 14:05:17 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-39-5b76d61efafa Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id F4.19.04284.D16D67B5; Fri, 17 Aug 2018 15:05:17 +0100 (BST) Received: from [106.109.129.180] (unknown [106.109.129.180]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20180817140517eusmtip17bd9c0a7abc9ece39f45ef5b46d8c74d~LsQFFS9Sr1082910829eusmtip1M; Fri, 17 Aug 2018 14:05:17 +0000 (GMT) To: Nitin Katiyar , dev@dpdk.org Cc: Maxime Coquelin , "Bie, Tiwei" , Zhihong Wang From: Ilya Maximets Date: Fri, 17 Aug 2018 17:06:18 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1534537189-26763-1-git-send-email-nitin.katiyar@ericsson.com> Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0hTYRjG+c5lO4qbn9PyRaViFJHUXFkwSrpAghCFFGm1P+qopyk5Lzs6 s7JJRN5DTRMlwpKaF1rhNdRsHkQps5QuWBoJRnnJS2qky2ZuR8n/fu/zvO/7vQ98DKl4SPsw MXFJnCGOjVVKXKnGzoU3OzZ8MGrVMznumsmZJkLzLmNBqunMaqU0i/NFSNOQvkRo6voKiYOS EFv5AzrE9uu9JKSidZQImWpbppv11SiUPuMaFMXFxhg5Q8D+c67Rb60F0oRcxUWhcwilo155 NnJhAO+GOnMhkY1cGQWuRGDts6wUcwhGi6YkYjGLwGbPQasjF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mTM5+AtXIKeEsc2jSTHWKk usSfeZeYIWxxiaYvK1khbHmJ7W/nME9gFJqFpH0WkpZZSFpmIWlZwMiyilEktbQ4Nz232FCv ODG3uDQvXS85P3cTIzDSth37uXkH46WNwYcYBTgYlXh4X6wvjRZiTSwrrsw9xCjBwawkwhu5 vCxaiDclsbIqtSg/vqg0J7X4EKMp0HMTmaVEk/OBSSCvJN7Q1NDcwtLQ3Njc2MxCSZz3vEFl lJBAemJJanZqakFqEUwfEwenVAOj1lr+784ZXq4vZrxZ1ni6f55Mxc5tN03T42dOiS26cETz 6pbfJ7rPVBl/XF3zOdVVQnJfu5qev4kXg5Pj5ua9JV9+nNqyTjJNOLtGzj2W7VH8gZINgUHW K6VnRAq1xDFu+7ntheIN/x3OvJ+Pr5v6x/25xK9p1x+Izq5P/39+7oyq9VwbH96TVWIpzkg0 1GIuKk4EAFouY7rKAgAA Message-Id: <20180817140517eucas1p24703d1c0234958581830c117fce93f14~LsQFwJphW1727417274eucas1p2M@eucas1p2.samsung.com> X-CMS-MailID: 20180817140517eucas1p24703d1c0234958581830c117fce93f14 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20180817140517eucas1p24703d1c0234958581830c117fce93f14 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180817140517eucas1p24703d1c0234958581830c117fce93f14 References: <1534537189-26763-1-git-send-email-nitin.katiyar@ericsson.com> Subject: Re: [dpdk-dev] vhost: initializing iotlb memory only when IOMMU feature is enabled. 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: Fri, 17 Aug 2018 14:05:20 -0000 On 17.08.2018 23:19, Nitin Katiyar wrote: > DPDK 17.11 introduced the IOMMU feature which caused additional > DPDK memory requirement per vhostuser device as part of > iotlb_init(). Today this is done unconditionally (from DPDK > 17.11 onwards) i.e. irrespective of IOMMU feature being > enabled on the vhostuser device, iotlb is initialized. This > breaks the backward compatibility for applications like OVS > due to increase in the DPDK memory footprint and causes upgrade > failures. >> This patch is to do iotlb_init only if IOMMU feature is > enabled on device. I guess, "Fixes" line should be here? > > Signed-off-by: Nitin Katiyar > --- > lib/librte_vhost/iotlb.c | 7 +++++++ > lib/librte_vhost/vhost_user.c | 6 ++++++ > 2 files changed, 13 insertions(+) > > diff --git a/lib/librte_vhost/iotlb.c b/lib/librte_vhost/iotlb.c > index c6354fe..befa2d3 100644 > --- a/lib/librte_vhost/iotlb.c > +++ b/lib/librte_vhost/iotlb.c > @@ -317,6 +317,13 @@ struct vhost_iotlb_entry { > struct vhost_virtqueue *vq = dev->virtqueue[vq_index]; > int socket = 0; > > + if (!(dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) { vhost_user_iotlb_init() is called on the virtqueue allocation stage, most likely while processing VHOST_USER_SET_VRING_CALL. QEMU usually sends VHOST_USER_SET_FEATURES after the VHOST_USER_SET_VRING_CALL. This means that 'dev->features' are not yet initialized here. Have you tested that IOMMU feature works with this patch applied? > + RTE_LOG(INFO, VHOST_CONFIG, > + "IOMMU feature is not enabled for this dev(%s)\n", > + dev->ifname); > + return 0; > + } > + > if (vq->iotlb_pool) { > /* > * The cache has already been initialized, > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c > index a2d4c9f..7553a03 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -1366,6 +1366,12 @@ > uint16_t i; > uint64_t vva, len; > > + if (!(dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) { > + RTE_LOG(ERR, VHOST_CONFIG, > + "IOMMU feature is not enabled for this dev(%s)\n", > + dev->ifname); > + return -1; > + } > switch (imsg->type) { > case VHOST_IOTLB_UPDATE: > len = imsg->size; >