DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xia, Chenbo" <chenbo.xia@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v4 1/7] vhost: fix missing memory table NUMA realloc
Date: Fri, 18 Jun 2021 04:34:37 +0000	[thread overview]
Message-ID: <MN2PR11MB4063F4CAAADC2D434C6393959C0D9@MN2PR11MB4063.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210617153739.178011-2-maxime.coquelin@redhat.com>

Hi Maxime,

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Thursday, June 17, 2021 11:38 PM
> To: dev@dpdk.org; david.marchand@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; stable@dpdk.org
> Subject: [PATCH v4 1/7] vhost: fix missing memory table NUMA realloc
> 
> 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 iat least one cross-NUMA accesses for every burst
> of packets.

'at least' ?

> 
> This patch reallocates this table on the same NUMA node as the
> other metadata.
> 
> Fixes: 552e8fd3d2b4 ("vhost: simplify memory regions handling")
> Cc: stable@dpdk.org
> 
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/vhost/vhost_user.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 8f0eba6412..031e3bfa2f 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -557,6 +557,9 @@ numa_realloc(struct virtio_net *dev, int index)

As we are realloc more things now, the comment above 'numa_realloc(XXX)'
should also be changed like:

Reallocate related data structure to make them on the same numa node as
the memory of vring descriptor.

Thanks,
Chenbo

>  		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);
> @@ -568,6 +571,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.31.1


  reply	other threads:[~2021-06-18  4:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 15:37 [dpdk-dev] [PATCH v4 0/7] vhost: Fix and improve NUMA reallocation Maxime Coquelin
2021-06-17 15:37 ` [dpdk-dev] [PATCH v4 1/7] vhost: fix missing memory table NUMA realloc Maxime Coquelin
2021-06-18  4:34   ` Xia, Chenbo [this message]
2021-06-18  7:40     ` Maxime Coquelin
2021-06-17 15:37 ` [dpdk-dev] [PATCH v4 2/7] vhost: fix missing guest pages " Maxime Coquelin
2021-06-17 15:37 ` [dpdk-dev] [PATCH v4 3/7] vhost: fix missing cache logging " Maxime Coquelin
2021-06-17 15:37 ` [dpdk-dev] [PATCH v4 4/7] vhost: fix NUMA reallocation with multiqueue Maxime Coquelin
2021-06-18  4:34   ` Xia, Chenbo
2021-06-18  8:01     ` Maxime Coquelin
2021-06-18  8:21       ` Xia, Chenbo
2021-06-18  8:48         ` Maxime Coquelin
2021-06-24 10:49           ` Xia, Chenbo
2021-06-17 15:37 ` [dpdk-dev] [PATCH v4 5/7] vhost: improve NUMA reallocation Maxime Coquelin
2021-06-18  4:34   ` Xia, Chenbo
2021-06-18  8:01     ` Maxime Coquelin
2021-06-17 15:37 ` [dpdk-dev] [PATCH v4 6/7] vhost: allocate all data on same node as virtqueue Maxime Coquelin
2021-06-17 15:37 ` [dpdk-dev] [PATCH v4 7/7] vhost: convert inflight data to DPDK allocation API Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR11MB4063F4CAAADC2D434C6393959C0D9@MN2PR11MB4063.namprd11.prod.outlook.com \
    --to=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).