From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB886A0566 for ; Tue, 10 Mar 2020 12:34:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9ECEC1BFFB; Tue, 10 Mar 2020 12:34:41 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id C12A223D; Tue, 10 Mar 2020 12:34:38 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Mar 2020 04:34:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,536,1574150400"; d="scan'208";a="276920263" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by fmsmga002.fm.intel.com with ESMTP; 10 Mar 2020 04:34:36 -0700 Date: Tue, 10 Mar 2020 19:32:06 +0800 From: Ye Xiaolong To: Itsuro Oda Cc: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com, stable@dpdk.org Message-ID: <20200310113206.GA14733@intel.com> References: <20200310050003.16728-1-oda@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200310050003.16728-1-oda@valinux.co.jp> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-stable] [PATCH] vhost: make iotlb cache name unique among multi processes X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 03/10, Itsuro Oda wrote: >Currently, iotlb cache name is comprised of vid and virtqueue >index. For example, "iotlb_cache_0_0". Because vid is assigned >per process, iotlb cache name is not unique among multi processes. >For example a secondary process uses a vhost >(ex. eth_vhost0,iface=/tmp/sock0) and another secondary process >uses a vhost (ex. eth_vhost1,iface=/tmp/sock1), iotlb cache >name of both vhost ("iotlb_cache_0_0") are same and as a result >iotlb cache is broken. > >This patch makes iotlb cache name unique among milti processes >by using the interface name not vid to comprise iotlb cache name. >Since the length of interface name is variable, this patch uses >hash value calculated by the interface name. > >Fixes: d012d1f293f4 (vhost: add IOTLB helper functions) >Cc: stable@dpdk.org > >Signed-off-by: Itsuro Oda >--- > lib/librte_vhost/iotlb.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/lib/librte_vhost/iotlb.c b/lib/librte_vhost/iotlb.c >index bc1758528..0992c145b 100644 >--- a/lib/librte_vhost/iotlb.c >+++ b/lib/librte_vhost/iotlb.c >@@ -6,6 +6,7 @@ > #include > #endif > >+#include > #include > > #include "iotlb.h" >@@ -288,6 +289,7 @@ vhost_user_iotlb_init(struct virtio_net *dev, int vq_index) > char pool_name[RTE_MEMPOOL_NAMESIZE]; > struct vhost_virtqueue *vq = dev->virtqueue[vq_index]; > int socket = 0; >+ uint32_t val; > > if (vq->iotlb_pool) { > /* >@@ -308,8 +310,10 @@ vhost_user_iotlb_init(struct virtio_net *dev, int vq_index) > TAILQ_INIT(&vq->iotlb_list); > TAILQ_INIT(&vq->iotlb_pending_list); > >- snprintf(pool_name, sizeof(pool_name), "iotlb_cache_%d_%d", >- dev->vid, vq_index); >+ val = rte_jhash(dev->ifname, strlen(dev->ifname), 0); >+ snprintf(pool_name, sizeof(pool_name), "iotlb_cache_%08x_%d", >+ val, vq_index); >+ VHOST_LOG_CONFIG(DEBUG, "IOTLB cache name: %s\n", pool_name); > > /* If already created, free it and recreate */ > vq->iotlb_pool = rte_mempool_lookup(pool_name); >-- >2.17.0 > Acked-by: Xiaolong Ye