From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BF609A0C47 for ; Tue, 10 Aug 2021 17:41:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9BA74014F; Tue, 10 Aug 2021 17:41:53 +0200 (CEST) Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by mails.dpdk.org (Postfix) with ESMTP id 6FF7F4014F for ; Tue, 10 Aug 2021 17:41:52 +0200 (CEST) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 522E13F0A1 for ; Tue, 10 Aug 2021 15:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628610112; bh=wG7ks2TmOKSzvLeoqFxBl7LC3l2bjLdKuLLDS1PpY/E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MGIUnyVFTpeprrH9D30I9lM+a/T9gkEPDV6YUWXFhmJlovSDs0P/3UOAcMjrpyyT0 ipI2u4ow4+5/JPWGsVewl6R5Pk6zZjZBaD4lJJSzbD297W8nNwz3s4zOJg6OUu/lrm E9TCaVG8hADix0zKk6u1IKuvfn9tMADiPN++eZZ01rVLQ6IUaM4hql2vhZPBNKK95j noVq9oS7G+leXvRszUK2elX+zsZr0R4TOeDNXe9r5vZOyNxB2WuYXjZlRK5aQ406Ht pFKJT8w8F/WQGg4Q3g790AiaA4MONMJfgd6UGcwgiZdwoLrOhS7u0UaxWLstm89vch iYB0LIlSFuGHQ== Received: by mail-ej1-f69.google.com with SMTP id ne21-20020a1709077b95b029057eb61c6fdfso5748588ejc.22 for ; Tue, 10 Aug 2021 08:41:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wG7ks2TmOKSzvLeoqFxBl7LC3l2bjLdKuLLDS1PpY/E=; b=YIikapFaM7ehFkcxddMUIpnKPEHru4jJ9v1R4trvX7JU+9JahGJghsAyWOjZ2w/T+n 0L8/fK5seZ91gkOQjY/ImxKBdduSHhBEIJlPUrDpNMOkPoXneVK8qTVuTlU5LFjjBSNy yoNrTN0d7h49MQaF43+KNrCPmygvl12MkuB8KJGdTZ9ERitwUmtjq+CdPY6E4dH4DTfC jo7IKo432nUnllxCmphAzgm/3L6hF1w3xvm4iAemHGhRO20DPCPUYEc8ME4c1naF71kR BhMN1p/0i3hrmmwbWs9uE6Z4WGEhcZeeAG+mox8PZ7otW/Dk1JzuDMsDmNZgAQsi0TaZ 7YVw== X-Gm-Message-State: AOAM530AqE4AhBVTzN6wteFoPCMWe3u1uxFcZm5INkNcfXq7PB84M6Sr sQrY2mjiWYehY+lO2k+glZu7Bcju8KbTQTriCAE0+z3D0NKNXACCrlR0mDHbLYnH2AqlPKcbJ6g TIu7gCUMfeyMxkXZWBSE4SqdY X-Received: by 2002:a17:906:a98e:: with SMTP id jr14mr28260666ejb.450.1628610111987; Tue, 10 Aug 2021 08:41:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOX2DcLYQhknUm9zbIKZqnfQ5kCamHbbk1DRXMSPp9ISRAJpU/DYur++Zsc4J4+oyVt9ZDDw== X-Received: by 2002:a17:906:a98e:: with SMTP id jr14mr28260648ejb.450.1628610111813; Tue, 10 Aug 2021 08:41:51 -0700 (PDT) Received: from Keschdeichel.fritz.box ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id f20sm6969858ejz.30.2021.08.10.08.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 08:41:51 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Maxime Coquelin Cc: David Marchand , Chenbo Xia , dpdk stable Date: Tue, 10 Aug 2021 17:39:06 +0200 Message-Id: <20210810154022.749358-26-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810154022.749358-1-christian.ehrhardt@canonical.com> References: <20210810154022.749358-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'vhost: fix missing memory table NUMA realloc' has been queued to stable release 19.11.10 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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" Hi, FYI, your patch has been queued to stable release 19.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/354836674a9f7aa25649209f09c645fdb1eaf7e7 Thanks. Christian Ehrhardt --- >From 354836674a9f7aa25649209f09c645fdb1eaf7e7 Mon Sep 17 00:00:00 2001 From: Maxime Coquelin Date: Tue, 29 Jun 2021 18:11:27 +0200 Subject: [PATCH] vhost: fix missing memory table NUMA realloc [ upstream commit 8119ca9114b2ab2d42732e2a8b5cb31c47ed4eb3 ] When the guest allocates virtqueues on a different NUMA node than the one the Vhost metadata are allocated, both the Vhost device struct and the virtqueues struct are reallocated. However, reallocating the Vhost memory table was missing, which likely causes at least one cross-NUMA accesses for every burst of packets. This patch reallocates this table on the same NUMA node as the other metadata. Fixes: 552e8fd3d2b4 ("vhost: simplify memory regions handling") Reported-by: David Marchand Signed-off-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- lib/librte_vhost/vhost_user.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index dc1e312d84..54079a9efc 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -498,8 +498,8 @@ vhost_user_set_vring_num(struct virtio_net **pdev, } /* - * Reallocate virtio_dev and vhost_virtqueue data structure to make them on the - * same numa node as the memory of vring descriptor. + * Reallocate virtio_dev, vhost_virtqueue and related data structures to + * make them on the same numa node as the memory of vring descriptor. */ #ifdef RTE_LIBRTE_VHOST_NUMA static struct virtio_net* @@ -593,6 +593,9 @@ numa_realloc(struct virtio_net *dev, int index) goto out; } if (oldnode != newnode) { + struct rte_vhost_memory *old_mem; + ssize_t mem_size; + RTE_LOG(INFO, VHOST_CONFIG, "reallocate dev from %d to %d node\n", oldnode, newnode); @@ -604,6 +607,18 @@ numa_realloc(struct virtio_net *dev, int index) memcpy(dev, old_dev, sizeof(*dev)); rte_free(old_dev); + + mem_size = sizeof(struct rte_vhost_memory) + + sizeof(struct rte_vhost_mem_region) * dev->mem->nregions; + old_mem = dev->mem; + dev->mem = rte_malloc_socket(NULL, mem_size, 0, newnode); + if (!dev->mem) { + dev->mem = old_mem; + goto out; + } + + memcpy(dev->mem, old_mem, mem_size); + rte_free(old_mem); } out: -- 2.32.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-08-10 15:11:14.080158255 +0200 +++ 0026-vhost-fix-missing-memory-table-NUMA-realloc.patch 2021-08-10 15:11:12.938637523 +0200 @@ -1 +1 @@ -From 8119ca9114b2ab2d42732e2a8b5cb31c47ed4eb3 Mon Sep 17 00:00:00 2001 +From 354836674a9f7aa25649209f09c645fdb1eaf7e7 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8119ca9114b2ab2d42732e2a8b5cb31c47ed4eb3 ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ - lib/vhost/vhost_user.c | 19 +++++++++++++++++-- + lib/librte_vhost/vhost_user.c | 19 +++++++++++++++++-- @@ -27,5 +28,5 @@ -diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c -index 8f0eba6412..b5a84f3dcd 100644 ---- a/lib/vhost/vhost_user.c -+++ b/lib/vhost/vhost_user.c -@@ -473,8 +473,8 @@ vhost_user_set_vring_num(struct virtio_net **pdev, +diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c +index dc1e312d84..54079a9efc 100644 +--- a/lib/librte_vhost/vhost_user.c ++++ b/lib/librte_vhost/vhost_user.c +@@ -498,8 +498,8 @@ vhost_user_set_vring_num(struct virtio_net **pdev, @@ -42 +43 @@ -@@ -557,6 +557,9 @@ numa_realloc(struct virtio_net *dev, int index) +@@ -593,6 +593,9 @@ numa_realloc(struct virtio_net *dev, int index) @@ -49 +50 @@ - VHOST_LOG_CONFIG(INFO, + RTE_LOG(INFO, VHOST_CONFIG, @@ -52 +53 @@ -@@ -568,6 +571,18 @@ numa_realloc(struct virtio_net *dev, int index) +@@ -604,6 +607,18 @@ numa_realloc(struct virtio_net *dev, int index)