From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 162FBC0044D for ; Wed, 11 Mar 2020 23:19:23 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id D4CD920751 for ; Wed, 11 Mar 2020 23:19:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4CD920751 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=valinux.co.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C6CBD1BF7F; Thu, 12 Mar 2020 00:19:21 +0100 (CET) Received: from valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by dpdk.org (Postfix) with ESMTP id 1CAD92BE6; Thu, 12 Mar 2020 00:19:20 +0100 (CET) Received: by valinux.co.jp (Postfix, from userid 1000) id 5E0B624092A; Thu, 12 Mar 2020 08:19:18 +0900 (JST) From: Itsuro Oda To: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com, xiaolong.ye@intel.com, stable@dpdk.org Date: Thu, 12 Mar 2020 08:19:18 +0900 Message-Id: <20200311231918.20701-1-oda@valinux.co.jp> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200310050003.16728-1-oda@valinux.co.jp> References: <20200310050003.16728-1-oda@valinux.co.jp> Subject: [dpdk-dev] [PATCH v3] vhost: make iotlb cache name unique among multi processes 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 adding process id to the iotlb cache name. The prefix of the name is shortend to "iotlb_" since the maximum length of pool name is 25 bytes (RTE_MEMPOOL_NAMESIZE is 26). Note that it is just 25 characters in maximum at the moment. Here, * pid_t == int: max 10 digits. * vid < MAX_VHOST_DECICE(1024): max 4 digits. * vq_index < VHOST_MAX_VRING(256): max 3 digits. Fixes: d012d1f293f4 (vhost: add IOTLB helper functions) Cc: stable@dpdk.org Signed-off-by: Itsuro Oda --- v3: * change format. * fix commit message. v2: * use the process id to make the iotlb cache name unique. lib/librte_vhost/iotlb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/iotlb.c b/lib/librte_vhost/iotlb.c index bc1758528..5b3a0c090 100644 --- a/lib/librte_vhost/iotlb.c +++ b/lib/librte_vhost/iotlb.c @@ -308,8 +308,9 @@ 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); + snprintf(pool_name, sizeof(pool_name), "iotlb_%u_%d_%d", + getpid(), dev->vid, 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