public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: <pravin.bathija@dell.com>
Cc: <dev@dpdk.org>, <thomas@monjalon.net>,
	<maxime.coquelin@redhat.com>, <fengchengwen@huawei.com>
Subject: Re: [PATCH v9 0/5] Support add/remove memory region and get-max-slots
Date: Tue, 7 Apr 2026 07:21:18 -0700	[thread overview]
Message-ID: <20260407072118.341cdd6e@phoenix.local> (raw)
In-Reply-To: <20260407080636.3878354-1-pravin.bathija@dell.com>

On Tue, 7 Apr 2026 08:06:31 +0000
<pravin.bathija@dell.com> wrote:

> From: Pravin M Bathija <pravin.bathija@dell.com>
> 
> This is version v9 of the patchset and it incorporates the
> recommendations made by Stephen Hemminger.
> 
> Changes made to patch 3/5
> - Restored max_guest_pages initial value to hardcoded 8 instead of
>   VHOST_MEMORY_MAX_NREGIONS, matching upstream semantics.
> 
> Changes made to patch 4/5
> - Added close(reg->fd) and reg->fd = -1 before goto close_msg_fds in the
>   mmap failure path to fix fd leak after fd was moved from ctx->fds[0].
> - Converted dev_invalidate_vrings from a plain function to a macro +
>   implementation function pair, accepting message ID as a parameter so
>   the static_assert reports the correct handler at each call site.
> - Updated dev_invalidate_vrings call in add_mem_reg to pass
>   VHOST_USER_ADD_MEM_REG as message ID.
> - Updated dev_invalidate_vrings call in rem_mem_reg to pass
>   VHOST_USER_ADD_MEM_REG as message ID.
> 
> This implementation has been extensively tested by doing Read/Write I/O
> from multiple instances of fio + libblkio (front-end) talking to
> spdk/dpdk (back-end) based drives. Tested with qemu front-end talking to
> dpdk testpmd (back-end) performing add/removal of memory regions. Also
> tested post-copy live migration after doing add_memory_region.
> 
> Version Log:
> Version v9 (Current version): Incorporate code review suggestions from
> Stephen Hemminger as described above.
> Version v8:  Incorporate code review suggestions from Stephen Hemminger.
> rewrite async_dma_map_region function to iterate guest pages by host
> address range matching
> change function dev_invalidate_vrings to accept a double pointer to
> propagate pointer updates
> new function remove_guest_pages was added
> add_mem_reg error path was narrowed to only clean up the single failed
> region instead of destroting all existing regions
> Version v7: Incorporate code review suggestions from Maxime Coquelin.
> Add debug messages to vhost_postcopy_register function.
> Version v6: Added the enablement of this feature as a final patch in
> this patch-set and other code optimizations as suggested by Maxime
> Coquelin.
> Version v5: removed the patch that increased the number of memory regions
> from 8 to 128. This will be submitted as a separate feature at a later
> point after incorporating additional optimizations. Also includes code
> optimizations as suggested by Feng Cheng Wen.
> Version v4: code optimizations as suggested by Feng Cheng Wen.
> Version v3: code optimizations as suggested by Maxime Coquelin
> and Thomas Monjalon.
> Version v2: code optimizations as suggested by Maxime Coquelin.
> Version v1: Initial patch set.
> 
> Pravin M Bathija (5):
>   vhost: add user to mailmap and define to vhost hdr
>   vhost_user: header defines for add/rem mem region
>   vhost_user: support function defines for back-end
>   vhost_user: Function defs for add/rem mem regions
>   vhost_user: enable configure memory slots
> 
>  .mailmap               |   1 +
>  lib/vhost/rte_vhost.h  |   4 +
>  lib/vhost/vhost_user.c | 403 ++++++++++++++++++++++++++++++++++++-----
>  lib/vhost/vhost_user.h |  10 +
>  4 files changed, 375 insertions(+), 43 deletions(-)
> 

AI review is mostly clean now.

Patch series looks good overall. One issue in 4/5:
In rem_mem_reg, dev_invalidate_vrings (which calls
translate_ring_addresses) runs while the region being removed is still
mapped. Any vring address that resolves into that region will get a
pointer that becomes invalid after the subsequent
free_mem_region/munmap. Consider freeing the region first so translate
only sees surviving regions.

Also minor: the v9 cover letter changelog says rem_mem_reg passes
VHOST_USER_ADD_MEM_REG but the code correctly uses
VHOST_USER_REM_MEM_REG — just a typo in the changelog.

  parent reply	other threads:[~2026-04-07 15:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07  8:06 [PATCH v9 0/5] Support add/remove memory region and get-max-slots pravin.bathija
2026-04-07  8:06 ` [PATCH v9 1/5] vhost: add user to mailmap and define to vhost hdr pravin.bathija
2026-04-07  8:06 ` [PATCH v9 2/5] vhost_user: header defines for add/rem mem region pravin.bathija
2026-04-07  8:06 ` [PATCH v9 3/5] vhost_user: support function defines for back-end pravin.bathija
2026-04-07  8:06 ` [PATCH v9 4/5] vhost_user: Function defs for add/rem mem regions pravin.bathija
2026-04-07  8:06 ` [PATCH v9 5/5] vhost_user: enable configure memory slots pravin.bathija
2026-04-07 14:21 ` Stephen Hemminger [this message]
2026-04-07 22:44   ` [PATCH v9 0/5] Support add/remove memory region and get-max-slots Bathija, Pravin
  -- strict thread matches above, loose matches on Subject: below --
2026-04-07  7:42 pravin.bathija

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=20260407072118.341cdd6e@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=pravin.bathija@dell.com \
    --cc=thomas@monjalon.net \
    /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