All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Albert Esteve <aesteve@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	pbonzini@redhat.com, "David Hildenbrand" <david@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [RFC v2] memory.c: improve refcounting for RAM vs MMIO regions
Date: Wed, 6 Aug 2025 16:15:07 -0400	[thread overview]
Message-ID: <aJO3ywz2Ej_kToU_@x1.local> (raw)
In-Reply-To: <20250805081123.137064-1-aesteve@redhat.com>

On Tue, Aug 05, 2025 at 10:11:23AM +0200, Albert Esteve wrote:
> v1->v2:
> - Added documentation
> - Explained the reasoning in the commit message
> 
> In the last version of the SHMEM MAP/UNMAP [1] Stefan
> raised a concern [2] about dynamically creating and
> destroying memory regions and their lifecycle [3].
> 
> After some discussion, David Hildenbrand proposed
> to detect RAM regions and handle refcounting differently.
> I tried to extend the reasoning in the commit message
> below. If I wrote any innacuracies, please keep me
> honest. I hope we can gather some feedback with
> this RFC patch before sending it for inclusion.

This seems working.  Looks like so far all RAM MRs are fine with it, but
I'm not strongly confident it's true or it'll trivially keep true in the
future too.

Besides, this still adds some trivial complexity to memory_region_ref() on
treating RAM/MMIO MRs differently.

It also sounds like a pure "accident" that the shmem objects to be mapped
from the vhost-user devices are RAMs.  I wonder what happens if we want to
also support dynmaic MMIO regions.

Would this work even without changing QEMU memory core?

For example, have you thought about creating a VhostUserShmemObject for
each of the VHOST_USER_BACKEND_SHMEM_MAP request?

AFAICT, QEMU has complete refcounting support for objects, I thought that
should be totally fine being dynmaically created or destroyed.  Then MRs
will be children of those dynamic objects rather than the vhost-user
device.

Thanks,

-- 
Peter Xu



  reply	other threads:[~2025-08-06 20:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05  8:11 [RFC v2] memory.c: improve refcounting for RAM vs MMIO regions Albert Esteve
2025-08-06 20:15 ` Peter Xu [this message]
2025-08-06 20:36   ` David Hildenbrand
2025-08-06 20:56     ` Peter Xu
2025-08-07  7:22     ` Albert Esteve
2025-08-14  8:47       ` Albert Esteve

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=aJO3ywz2Ej_kToU_@x1.local \
    --to=peterx@redhat.com \
    --cc=aesteve@redhat.com \
    --cc=david@redhat.com \
    --cc=farosas@suse.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.