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 95156A0C4C for ; Mon, 12 Jul 2021 15:12:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F1F8406B4; Mon, 12 Jul 2021 15:12:52 +0200 (CEST) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mails.dpdk.org (Postfix) with ESMTP id 339864069D for ; Mon, 12 Jul 2021 15:12:51 +0200 (CEST) Received: by mail-wr1-f52.google.com with SMTP id f9so19888783wrq.11 for ; Mon, 12 Jul 2021 06:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pgmzVGtpoTr+cypG4NpziiwuGzSbB1AmUbF2BHMslSw=; b=b2mwKm80x8GeSohO0trXwJ2cl28k8lgwlvjS89LOucxPlCICPqzMsp/84m0XqZA5Za +JF3gULYsKv6dKb5mIuwggwpoGdpqVfEpPC4+sUNSHMz2++Z7zqiKczZbHgBm063dlsG fP9TQebIBp5N5ISqvVnFEd9ybaAtc5os/24AWJOWuNF/QrkYYMJXNUDBO5A34uvCsudO 6a3Jk7QIAs2s7x0TaOg6OBDZPHvsAQH6pXgx3ZgabPuJfos/aLr1/w1+0kiFnwaRs2Yy BpL8uPe430h6mgManOGUTQPFgpOoi3rLOmof8wn2dmdUN2TKQMhs+E4JqWwqHmV1B4Qb iRCQ== 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=pgmzVGtpoTr+cypG4NpziiwuGzSbB1AmUbF2BHMslSw=; b=qRtVcLfiCgjgNEXilS+QisBs18NSXZqdWGTVPwkm/NzlXjOaxhBE4xsvpMRfxMXd11 8JbBRXfsS4qHG0n0chx7vY1UkJldMm7kaWMkMipe2iTbW08yr47m0fBbyBCbG11rb0av 2/yDw922DWElTDyuRjpRWfDOPMzw6j2jPuotFtB4YqMXkEoOn70DMnCT/WMkadESonxw 7lTQ999aZL8GSC2OTTkoOmnNDmLBGEpCfR3e8DKtl78nnxWzFBV0WUqRokvOp0XscB59 4+5tRdujJyCZiT3Ydc09KR5si2u1DwcWKWaXN4UpIbDX5v1/eqMkTfEFUnF/uGU+oM2Z 4QZg== X-Gm-Message-State: AOAM530Ry65G5bLW3r/AvvBvBnlUoH1mSH2cRXQvtVWitZCMslkBLNEJ pp26O/Af568MLmLvpFZywMs= X-Google-Smtp-Source: ABdhPJxbG+uqphm+6U0GNSLUw0O+buM79XBEZ5Bt1o3JkVCAZdEkYeJwxQ1v7tx4KPk/BzBry/zWPQ== X-Received: by 2002:a5d:408a:: with SMTP id o10mr20138626wrp.272.1626095571018; Mon, 12 Jul 2021 06:12:51 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id b11sm14336239wrf.43.2021.07.12.06.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 06:12:50 -0700 (PDT) From: luca.boccassi@gmail.com To: Maxime Coquelin Cc: David Marchand , Chenbo Xia , dpdk stable Date: Mon, 12 Jul 2021 14:04:47 +0100 Message-Id: <20210712130551.2462159-52-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.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 20.11.3 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 20.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/14/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/a21845c789798d48b6b23754719e58b55439830f Thanks. Luca Boccassi --- >From a21845c789798d48b6b23754719e58b55439830f 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 78fb49b311..bef269298b 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -474,8 +474,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* @@ -558,6 +558,9 @@ numa_realloc(struct virtio_net *dev, int index) goto out; } if (oldnode != newnode) { + struct rte_vhost_memory *old_mem; + ssize_t mem_size; + VHOST_LOG_CONFIG(INFO, "reallocate dev from %d to %d node\n", oldnode, newnode); @@ -569,6 +572,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.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-12 13:41:39.371492516 +0100 +++ 0052-vhost-fix-missing-memory-table-NUMA-realloc.patch 2021-07-12 13:41:36.434121444 +0100 @@ -1 +1 @@ -From 8119ca9114b2ab2d42732e2a8b5cb31c47ed4eb3 Mon Sep 17 00:00:00 2001 +From a21845c789798d48b6b23754719e58b55439830f 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 78fb49b311..bef269298b 100644 +--- a/lib/librte_vhost/vhost_user.c ++++ b/lib/librte_vhost/vhost_user.c +@@ -474,8 +474,8 @@ vhost_user_set_vring_num(struct virtio_net **pdev, @@ -42 +43 @@ -@@ -557,6 +557,9 @@ numa_realloc(struct virtio_net *dev, int index) +@@ -558,6 +558,9 @@ numa_realloc(struct virtio_net *dev, int index) @@ -52 +53 @@ -@@ -568,6 +571,18 @@ numa_realloc(struct virtio_net *dev, int index) +@@ -569,6 +572,18 @@ numa_realloc(struct virtio_net *dev, int index)