From: Peter Xu <peterx@redhat.com>
To: Chenyi Qiang <chenyi.qiang@intel.com>
Cc: "David Hildenbrand" <david@redhat.com>,
"Alexey Kardashevskiy" <aik@amd.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, "Gao Chao" <chao.gao@intel.com>,
"Li Xiaoyao" <xiaoyao.li@intel.com>
Subject: Re: [PATCH] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend
Date: Fri, 17 Oct 2025 09:57:01 -0400 [thread overview]
Message-ID: <aPJLLQmL9W1nMIi7@x1.local> (raw)
In-Reply-To: <20251017081445.175342-1-chenyi.qiang@intel.com>
On Fri, Oct 17, 2025 at 04:14:23PM +0800, Chenyi Qiang wrote:
> Currently, private memory and shared memory have different backend in
> CoCo VMs. It is possible for users to specify the shared memory with
> hugetlbfs backend while private memory with guest_memfd backend only
> supports 4K page size. In this case, ram_block->page_size is different
> from the host page size which will trigger the assertion when getting
> block size. Relax the restriction to allow shared memory to use
> hugetlbfs backend.
Is it proper I add this into the commit message too, when queue it?
This patch fixes a regression of using hugetlbfs memory backends with
CoCo VMs, with or without VFIO devices' presence.
Thanks,
>
> Fixes: 5d6483edaa92 ("ram-block-attributes: Introduce RamBlockAttributes to manage RAMBlock with guest_memfd")
> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
> ---
> system/ram-block-attributes.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
> index 68e8a027032..0f39ccf9090 100644
> --- a/system/ram-block-attributes.c
> +++ b/system/ram-block-attributes.c
> @@ -28,10 +28,11 @@ ram_block_attributes_get_block_size(const RamBlockAttributes *attr)
> * Because page conversion could be manipulated in the size of at least 4K
> * or 4K aligned, Use the host page size as the granularity to track the
> * memory attribute.
> + * When hugetlbfs is used as backend of shared memory, ram_block->page_size
> + * is different from host page size. So it is not appropriate to use
> + * ram_block->page_size here.
> */
> - g_assert(attr && attr->ram_block);
> - g_assert(attr->ram_block->page_size == qemu_real_host_page_size());
> - return attr->ram_block->page_size;
> + return qemu_real_host_page_size();
> }
>
>
> --
> 2.43.5
>
--
Peter Xu
next prev parent reply other threads:[~2025-10-17 13:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 8:14 [PATCH] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend Chenyi Qiang
2025-10-17 13:57 ` Peter Xu [this message]
2025-10-17 15:13 ` David Hildenbrand
2025-10-20 10:32 ` Chenyi Qiang
2025-10-20 11:31 ` David Hildenbrand
2025-10-20 11:48 ` Chenyi Qiang
2025-10-20 11:34 ` David Hildenbrand
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=aPJLLQmL9W1nMIi7@x1.local \
--to=peterx@redhat.com \
--cc=aik@amd.com \
--cc=chao.gao@intel.com \
--cc=chenyi.qiang@intel.com \
--cc=david@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=xiaoyao.li@intel.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 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).