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 E3EC5A0C47 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 DA614411C5; 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 4DFE14014F for ; Tue, 10 Aug 2021 17:41:53 +0200 (CEST) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (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 317D03F0A1 for ; Tue, 10 Aug 2021 15:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628610113; bh=jETY0mIiZgV40kzUSUOm5BFqGdLE2sJ+uFVbWH7sqIg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=isOJnahpIOHTJJT8qJdUhplc3qPFO5U0f1TahKdZh61DjfiNSTJ8NAKV1I8mlu/Ek Xp4658t0Tk3Qy+WWgOskWo+hpXqNrN8k8RMbOUBi3h9nTiWNIM4ixJF4tcRHVwBO60 fINhRndYdhn2V5x6KNDDbEf9UXnuobQju226hD0uXUCjJE2FpsEOKb6/zxy5TyYdBv 4R+zJMJ1P1SDdoOoZxpbVVmYDLsHm0IY3GUMgovNGpQbe/2OIZ8YJONwjWYLtYdQQY fJ7nCM9Au0H4sk4pXnWLK/i7Y2+RM8ULDsO6K0XWvE6xBMeO2Dyonmmy2WE1aPvlco U7Tmf//qZmVMg== Received: by mail-ej1-f71.google.com with SMTP id ne21-20020a1709077b95b029057eb61c6fdfso5748600ejc.22 for ; Tue, 10 Aug 2021 08:41:53 -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=jETY0mIiZgV40kzUSUOm5BFqGdLE2sJ+uFVbWH7sqIg=; b=FAaOSNCmK4n6ZrNbm3HuhhjI8/QsizpMohnE+F8hK5wkjvwlXAHDapvEn6lbGo3S22 cXHLSHeNTbLbbxLoiwyV4akExr5GC17g6sWTDoPYWsvZtTMMXxqXmev9tngrvSsDIMIG ZtSvcgvbOriZNbXkxWXDDmX4/LUQ4M1/T/I1SfH45XccpPuOCYOXInEOvqGoYgSPnsW+ 4U+xLFK9GBocHm64ek6E5A0zQu1dDPrbOikaqlMAyN138Pk4Q47BOARyIsoibdTy1mSR xY/O/sT/HAo/DYSaiqY7Qn3hzqrTjK+qPUcuUlkQR4/9sE8gpDsoCQdkqzXOSQz5TZi9 A8Lg== X-Gm-Message-State: AOAM531XdJFk7/EmAUZgonGaZ5mpYJTMdFXSNz1rSK339hQJsYJPpey8 70s2M0/98+0f2c2FfpKUVkQHMfZbbHK+oBQh4ST8l42pmVGbM1VlsY1xLfRm/sr2bj3A0ePU2m2 6P1sDJ44/Nxcft37F8yP/G0Iu X-Received: by 2002:a05:6402:b99:: with SMTP id cf25mr5676401edb.130.1628610112932; Tue, 10 Aug 2021 08:41:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw49plPIzThFcGZk6cqmrCTdxV5rWlRvw+B5JKccm6W6zDZJ+JYNc61VhLYTcEPhpdeBLC5SQ== X-Received: by 2002:a05:6402:b99:: with SMTP id cf25mr5676382edb.130.1628610112760; Tue, 10 Aug 2021 08:41:52 -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:52 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Maxime Coquelin Cc: Chenbo Xia , dpdk stable Date: Tue, 10 Aug 2021 17:39:07 +0200 Message-Id: <20210810154022.749358-27-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 guest pages 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/eb35473b23045d32d4abd4d31ca36483e37953df Thanks. Christian Ehrhardt --- >From eb35473b23045d32d4abd4d31ca36483e37953df Mon Sep 17 00:00:00 2001 From: Maxime Coquelin Date: Tue, 29 Jun 2021 18:11:28 +0200 Subject: [PATCH] vhost: fix missing guest pages table NUMA realloc [ upstream commit 57589cdfd784e6704ded490d80038584d6ade9df ] 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 guest pages 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: e246896178e6 ("vhost: get guest/host physical address mappings") Signed-off-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- lib/librte_vhost/vhost_user.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 54079a9efc..c016114e75 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -594,7 +594,8 @@ numa_realloc(struct virtio_net *dev, int index) } if (oldnode != newnode) { struct rte_vhost_memory *old_mem; - ssize_t mem_size; + struct guest_page *old_gp; + ssize_t mem_size, gp_size; RTE_LOG(INFO, VHOST_CONFIG, "reallocate dev from %d to %d node\n", @@ -619,6 +620,17 @@ numa_realloc(struct virtio_net *dev, int index) memcpy(dev->mem, old_mem, mem_size); rte_free(old_mem); + + gp_size = dev->max_guest_pages * sizeof(*dev->guest_pages); + old_gp = dev->guest_pages; + dev->guest_pages = rte_malloc_socket(NULL, gp_size, RTE_CACHE_LINE_SIZE, newnode); + if (!dev->guest_pages) { + dev->guest_pages = old_gp; + goto out; + } + + memcpy(dev->guest_pages, old_gp, gp_size); + rte_free(old_gp); } out: -- 2.32.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-08-10 15:11:14.116402406 +0200 +++ 0027-vhost-fix-missing-guest-pages-table-NUMA-realloc.patch 2021-08-10 15:11:12.942637551 +0200 @@ -1 +1 @@ -From 57589cdfd784e6704ded490d80038584d6ade9df Mon Sep 17 00:00:00 2001 +From eb35473b23045d32d4abd4d31ca36483e37953df Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 57589cdfd784e6704ded490d80038584d6ade9df ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ - lib/vhost/vhost_user.c | 14 +++++++++++++- + lib/librte_vhost/vhost_user.c | 14 +++++++++++++- @@ -26,5 +27,5 @@ -diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c -index b5a84f3dcd..5fb055ea2e 100644 ---- a/lib/vhost/vhost_user.c -+++ b/lib/vhost/vhost_user.c -@@ -558,7 +558,8 @@ numa_realloc(struct virtio_net *dev, int index) +diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c +index 54079a9efc..c016114e75 100644 +--- a/lib/librte_vhost/vhost_user.c ++++ b/lib/librte_vhost/vhost_user.c +@@ -594,7 +594,8 @@ numa_realloc(struct virtio_net *dev, int index) @@ -38 +39 @@ - VHOST_LOG_CONFIG(INFO, + RTE_LOG(INFO, VHOST_CONFIG, @@ -40 +41 @@ -@@ -583,6 +584,17 @@ numa_realloc(struct virtio_net *dev, int index) +@@ -619,6 +620,17 @@ numa_realloc(struct virtio_net *dev, int index)