qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix a regression with hugetlbfs for shared memory in CoCo VMs
@ 2025-10-23  9:55 Chenyi Qiang
  2025-10-23  9:55 ` [PATCH v2 1/2] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend Chenyi Qiang
  2025-10-23  9:55 ` [PATCH v2 2/2] ram-block-attributes: Unify the retrieval of the block size Chenyi Qiang
  0 siblings, 2 replies; 9+ messages in thread
From: Chenyi Qiang @ 2025-10-23  9:55 UTC (permalink / raw)
  To: Peter Xu, David Hildenbrand, Alexey Kardashevskiy, Paolo Bonzini,
	Philippe Mathieu-Daudé
  Cc: Chenyi Qiang, qemu-devel, Gao Chao, Li Xiaoyao

In CoCo VMs, although the hugepage for private memory is not supported yet, Users
can still specify hugetlbfs backend for shared memory. However, due to the
recent changes of ram-block-attributes, it triggers an assertion failure when
getting the block size because the page size of ram_block is different from the
host page size. This patch series fixes this regression and clean up the code to
unify the retrieval of block size.

Chenyi Qiang (2):
  ram-block-attributes: Avoid the overkill of shared memory with
    hugetlbfs backend
  ram-block-attributes: Unify the retrieval of the block size

 system/ram-block-attributes.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

-- 
2.43.5



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/2] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend
  2025-10-23  9:55 [PATCH v2 0/2] Fix a regression with hugetlbfs for shared memory in CoCo VMs Chenyi Qiang
@ 2025-10-23  9:55 ` Chenyi Qiang
  2025-10-23 10:16   ` David Hildenbrand
  2025-10-24  0:16   ` Xiaoyao Li
  2025-10-23  9:55 ` [PATCH v2 2/2] ram-block-attributes: Unify the retrieval of the block size Chenyi Qiang
  1 sibling, 2 replies; 9+ messages in thread
From: Chenyi Qiang @ 2025-10-23  9:55 UTC (permalink / raw)
  To: Peter Xu, David Hildenbrand, Alexey Kardashevskiy, Paolo Bonzini,
	Philippe Mathieu-Daudé
  Cc: Chenyi Qiang, qemu-devel, Gao Chao, Li Xiaoyao, Farrah Chen

Currently, CoCo VMs can perform conversion at the base page granularity,
which is the granularity that has to be tracked. In relevant setups, the
target page size is assumed to be equal to the host page size, thus
fixing the block size to the host page size.

However, since private memory and shared memory have different backend
at present, users can specify shared memory with a hugetlbfs backend
while private memory with guest_memfd backend only supports 4K page
size. In this scenario, ram_block->page_size is different from the host
page size which will trigger an assertion when retrieving the block
size.

To address this, return the host page size directly to relax the
restriction. This changes fixes a regression of using hugetlbfs backend
for shared memory within CoCo VMs, with or without VFIO devices' presence.

Acked-by: David Hildenbrand <david@redhat.com>
Tested-by: Farrah Chen <farrah.chen@intel.com>
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
---
Changes in v2:
  - Modify the commit message
  - Remove the argument in ram_block_attributes_get_block_size()
---
 system/ram-block-attributes.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
index 68e8a027032..a7579de5b46 100644
--- a/system/ram-block-attributes.c
+++ b/system/ram-block-attributes.c
@@ -22,16 +22,14 @@ OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(RamBlockAttributes,
                                           { })
 
 static size_t
-ram_block_attributes_get_block_size(const RamBlockAttributes *attr)
+ram_block_attributes_get_block_size(void)
 {
     /*
      * 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.
      */
-    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();
 }
 
 
@@ -40,7 +38,7 @@ ram_block_attributes_rdm_is_populated(const RamDiscardManager *rdm,
                                       const MemoryRegionSection *section)
 {
     const RamBlockAttributes *attr = RAM_BLOCK_ATTRIBUTES(rdm);
-    const size_t block_size = ram_block_attributes_get_block_size(attr);
+    const size_t block_size = ram_block_attributes_get_block_size();
     const uint64_t first_bit = section->offset_within_region / block_size;
     const uint64_t last_bit =
         first_bit + int128_get64(section->size) / block_size - 1;
@@ -81,7 +79,7 @@ ram_block_attributes_for_each_populated_section(const RamBlockAttributes *attr,
 {
     unsigned long first_bit, last_bit;
     uint64_t offset, size;
-    const size_t block_size = ram_block_attributes_get_block_size(attr);
+    const size_t block_size = ram_block_attributes_get_block_size();
     int ret = 0;
 
     first_bit = section->offset_within_region / block_size;
@@ -122,7 +120,7 @@ ram_block_attributes_for_each_discarded_section(const RamBlockAttributes *attr,
 {
     unsigned long first_bit, last_bit;
     uint64_t offset, size;
-    const size_t block_size = ram_block_attributes_get_block_size(attr);
+    const size_t block_size = ram_block_attributes_get_block_size();
     int ret = 0;
 
     first_bit = section->offset_within_region / block_size;
@@ -163,7 +161,7 @@ ram_block_attributes_rdm_get_min_granularity(const RamDiscardManager *rdm,
     const RamBlockAttributes *attr = RAM_BLOCK_ATTRIBUTES(rdm);
 
     g_assert(mr == attr->ram_block->mr);
-    return ram_block_attributes_get_block_size(attr);
+    return ram_block_attributes_get_block_size();
 }
 
 static void
@@ -265,7 +263,7 @@ ram_block_attributes_is_valid_range(RamBlockAttributes *attr, uint64_t offset,
     g_assert(mr);
 
     uint64_t region_size = memory_region_size(mr);
-    const size_t block_size = ram_block_attributes_get_block_size(attr);
+    const size_t block_size = ram_block_attributes_get_block_size();
 
     if (!QEMU_IS_ALIGNED(offset, block_size) ||
         !QEMU_IS_ALIGNED(size, block_size)) {
@@ -322,7 +320,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
                                       uint64_t offset, uint64_t size,
                                       bool to_discard)
 {
-    const size_t block_size = ram_block_attributes_get_block_size(attr);
+    const size_t block_size = ram_block_attributes_get_block_size();
     const unsigned long first_bit = offset / block_size;
     const unsigned long nbits = size / block_size;
     const unsigned long last_bit = first_bit + nbits - 1;
-- 
2.43.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] ram-block-attributes: Unify the retrieval of the block size
  2025-10-23  9:55 [PATCH v2 0/2] Fix a regression with hugetlbfs for shared memory in CoCo VMs Chenyi Qiang
  2025-10-23  9:55 ` [PATCH v2 1/2] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend Chenyi Qiang
@ 2025-10-23  9:55 ` Chenyi Qiang
  2025-10-23 10:17   ` David Hildenbrand
  2025-10-24  0:16   ` Xiaoyao Li
  1 sibling, 2 replies; 9+ messages in thread
From: Chenyi Qiang @ 2025-10-23  9:55 UTC (permalink / raw)
  To: Peter Xu, David Hildenbrand, Alexey Kardashevskiy, Paolo Bonzini,
	Philippe Mathieu-Daudé
  Cc: Chenyi Qiang, qemu-devel, Gao Chao, Li Xiaoyao, Farrah Chen

There's an existing helper function designed to obtain the block size.
Modify ram_block_attribute_create() to use this function for
consistency.

Tested-by: Farrah Chen <farrah.chen@intel.com>
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
---
Changes in v2:
  - Newly added.
---
 system/ram-block-attributes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
index a7579de5b46..cf8f5f41966 100644
--- a/system/ram-block-attributes.c
+++ b/system/ram-block-attributes.c
@@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
 
 RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
 {
-    const int block_size  = qemu_real_host_page_size();
+    const int block_size  = ram_block_attributes_get_block_size();
     RamBlockAttributes *attr;
     MemoryRegion *mr = ram_block->mr;
 
-- 
2.43.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend
  2025-10-23  9:55 ` [PATCH v2 1/2] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend Chenyi Qiang
@ 2025-10-23 10:16   ` David Hildenbrand
  2025-10-23 13:47     ` Peter Xu
  2025-10-24  0:16   ` Xiaoyao Li
  1 sibling, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2025-10-23 10:16 UTC (permalink / raw)
  To: Chenyi Qiang, Peter Xu, Alexey Kardashevskiy, Paolo Bonzini,
	Philippe Mathieu-Daudé
  Cc: qemu-devel, Gao Chao, Li Xiaoyao, Farrah Chen

On 23.10.25 11:55, Chenyi Qiang wrote:

Subject should probably rather be:

"ram-block-attributes: fix interaction with hugetlb memory backends"

Maybe that can be fixed up when applying.

> Currently, CoCo VMs can perform conversion at the base page granularity,
> which is the granularity that has to be tracked. In relevant setups, the
> target page size is assumed to be equal to the host page size, thus
> fixing the block size to the host page size.
> 
> However, since private memory and shared memory have different backend
> at present, users can specify shared memory with a hugetlbfs backend
> while private memory with guest_memfd backend only supports 4K page
> size. In this scenario, ram_block->page_size is different from the host
> page size which will trigger an assertion when retrieving the block
> size.
> 
> To address this, return the host page size directly to relax the
> restriction. This changes fixes a regression of using hugetlbfs backend
> for shared memory within CoCo VMs, with or without VFIO devices' presence.
> 
> Acked-by: David Hildenbrand <david@redhat.com>
> Tested-by: Farrah Chen <farrah.chen@intel.com>
> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
> ---


-- 
Cheers

David / dhildenb



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] ram-block-attributes: Unify the retrieval of the block size
  2025-10-23  9:55 ` [PATCH v2 2/2] ram-block-attributes: Unify the retrieval of the block size Chenyi Qiang
@ 2025-10-23 10:17   ` David Hildenbrand
  2025-10-23 11:52     ` Chenyi Qiang
  2025-10-24  0:16   ` Xiaoyao Li
  1 sibling, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2025-10-23 10:17 UTC (permalink / raw)
  To: Chenyi Qiang, Peter Xu, Alexey Kardashevskiy, Paolo Bonzini,
	Philippe Mathieu-Daudé
  Cc: qemu-devel, Gao Chao, Li Xiaoyao, Farrah Chen

On 23.10.25 11:55, Chenyi Qiang wrote:
> There's an existing helper function designed to obtain the block size.
> Modify ram_block_attribute_create() to use this function for
> consistency.
> 
> Tested-by: Farrah Chen <farrah.chen@intel.com>
> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
> ---
> Changes in v2:
>    - Newly added.
> ---
>   system/ram-block-attributes.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
> index a7579de5b46..cf8f5f41966 100644
> --- a/system/ram-block-attributes.c
> +++ b/system/ram-block-attributes.c
> @@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
>   
>   RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
>   {
> -    const int block_size  = qemu_real_host_page_size();
> +    const int block_size  = ram_block_attributes_get_block_size();

Double space before the "  " can be removed while you touch this.

-- 
Cheers

David / dhildenb



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] ram-block-attributes: Unify the retrieval of the block size
  2025-10-23 10:17   ` David Hildenbrand
@ 2025-10-23 11:52     ` Chenyi Qiang
  0 siblings, 0 replies; 9+ messages in thread
From: Chenyi Qiang @ 2025-10-23 11:52 UTC (permalink / raw)
  To: David Hildenbrand, Peter Xu, Alexey Kardashevskiy, Paolo Bonzini,
	Philippe Mathieu-Daudé
  Cc: qemu-devel, Gao Chao, Li Xiaoyao, Farrah Chen



On 10/23/2025 6:17 PM, David Hildenbrand wrote:
> On 23.10.25 11:55, Chenyi Qiang wrote:
>> There's an existing helper function designed to obtain the block size.
>> Modify ram_block_attribute_create() to use this function for
>> consistency.
>>
>> Tested-by: Farrah Chen <farrah.chen@intel.com>
>> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
>> ---
>> Changes in v2:
>>    - Newly added.
>> ---
>>   system/ram-block-attributes.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
>> index a7579de5b46..cf8f5f41966 100644
>> --- a/system/ram-block-attributes.c
>> +++ b/system/ram-block-attributes.c
>> @@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
>>     RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
>>   {
>> -    const int block_size  = qemu_real_host_page_size();
>> +    const int block_size  = ram_block_attributes_get_block_size();
> 
> Double space before the "  " can be removed while you touch this.

Oops, so careless I was. To fixup this patch:

===

From 3c224dfb946feccf6f94af8aa1068cc72bf5ddc7 Mon Sep 17 00:00:00 2001
From: Chenyi Qiang <chenyi.qiang@intel.com>
Date: Thu, 23 Oct 2025 19:43:52 +0800
Subject: [PATCH] fixup! ram-block-attributes: Unify the retrieval of the block
 size

Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
---
 system/ram-block-attributes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
index cf8f5f41966..fb7c5c27467 100644
--- a/system/ram-block-attributes.c
+++ b/system/ram-block-attributes.c
@@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
 
 RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
 {
-    const int block_size  = ram_block_attributes_get_block_size();
+    const int block_size = ram_block_attributes_get_block_size();
     RamBlockAttributes *attr;
     MemoryRegion *mr = ram_block->mr;
 
-- 
2.43.5



> 



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend
  2025-10-23 10:16   ` David Hildenbrand
@ 2025-10-23 13:47     ` Peter Xu
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Xu @ 2025-10-23 13:47 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Chenyi Qiang, Alexey Kardashevskiy, Paolo Bonzini,
	Philippe Mathieu-Daudé, qemu-devel, Gao Chao, Li Xiaoyao,
	Farrah Chen

On Thu, Oct 23, 2025 at 12:16:46PM +0200, David Hildenbrand wrote:
> On 23.10.25 11:55, Chenyi Qiang wrote:
> 
> Subject should probably rather be:
> 
> "ram-block-attributes: fix interaction with hugetlb memory backends"
> 
> Maybe that can be fixed up when applying.

I also agree the old subject is slightly confusing..

I queued the two patches with all the small fixups.

Thanks,

> 
> > Currently, CoCo VMs can perform conversion at the base page granularity,
> > which is the granularity that has to be tracked. In relevant setups, the
> > target page size is assumed to be equal to the host page size, thus
> > fixing the block size to the host page size.
> > 
> > However, since private memory and shared memory have different backend
> > at present, users can specify shared memory with a hugetlbfs backend
> > while private memory with guest_memfd backend only supports 4K page
> > size. In this scenario, ram_block->page_size is different from the host
> > page size which will trigger an assertion when retrieving the block
> > size.
> > 
> > To address this, return the host page size directly to relax the
> > restriction. This changes fixes a regression of using hugetlbfs backend
> > for shared memory within CoCo VMs, with or without VFIO devices' presence.
> > 
> > Acked-by: David Hildenbrand <david@redhat.com>
> > Tested-by: Farrah Chen <farrah.chen@intel.com>
> > Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
> > ---
> 
> 
> -- 
> Cheers
> 
> David / dhildenb
> 

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend
  2025-10-23  9:55 ` [PATCH v2 1/2] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend Chenyi Qiang
  2025-10-23 10:16   ` David Hildenbrand
@ 2025-10-24  0:16   ` Xiaoyao Li
  1 sibling, 0 replies; 9+ messages in thread
From: Xiaoyao Li @ 2025-10-24  0:16 UTC (permalink / raw)
  To: Chenyi Qiang, Peter Xu, David Hildenbrand, Alexey Kardashevskiy,
	Paolo Bonzini, Philippe Mathieu-Daudé
  Cc: qemu-devel, Gao Chao, Farrah Chen

On 10/23/2025 5:55 PM, Chenyi Qiang wrote:
> Currently, CoCo VMs can perform conversion at the base page granularity,
> which is the granularity that has to be tracked. In relevant setups, the
> target page size is assumed to be equal to the host page size, thus
> fixing the block size to the host page size.
> 
> However, since private memory and shared memory have different backend
> at present, users can specify shared memory with a hugetlbfs backend
> while private memory with guest_memfd backend only supports 4K page
> size. In this scenario, ram_block->page_size is different from the host
> page size which will trigger an assertion when retrieving the block
> size.
> 
> To address this, return the host page size directly to relax the
> restriction. This changes fixes a regression of using hugetlbfs backend
> for shared memory within CoCo VMs, with or without VFIO devices' presence.
> 
> Acked-by: David Hildenbrand <david@redhat.com>
> Tested-by: Farrah Chen <farrah.chen@intel.com>
> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>

The change looks good to me.

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

> ---
> Changes in v2:
>    - Modify the commit message
>    - Remove the argument in ram_block_attributes_get_block_size()
> ---
>   system/ram-block-attributes.c | 18 ++++++++----------
>   1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
> index 68e8a027032..a7579de5b46 100644
> --- a/system/ram-block-attributes.c
> +++ b/system/ram-block-attributes.c
> @@ -22,16 +22,14 @@ OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(RamBlockAttributes,
>                                             { })
>   
>   static size_t
> -ram_block_attributes_get_block_size(const RamBlockAttributes *attr)
> +ram_block_attributes_get_block_size(void)
>   {
>       /*
>        * 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.
>        */
> -    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();
>   }
>   
>   
> @@ -40,7 +38,7 @@ ram_block_attributes_rdm_is_populated(const RamDiscardManager *rdm,
>                                         const MemoryRegionSection *section)
>   {
>       const RamBlockAttributes *attr = RAM_BLOCK_ATTRIBUTES(rdm);
> -    const size_t block_size = ram_block_attributes_get_block_size(attr);
> +    const size_t block_size = ram_block_attributes_get_block_size();
>       const uint64_t first_bit = section->offset_within_region / block_size;
>       const uint64_t last_bit =
>           first_bit + int128_get64(section->size) / block_size - 1;
> @@ -81,7 +79,7 @@ ram_block_attributes_for_each_populated_section(const RamBlockAttributes *attr,
>   {
>       unsigned long first_bit, last_bit;
>       uint64_t offset, size;
> -    const size_t block_size = ram_block_attributes_get_block_size(attr);
> +    const size_t block_size = ram_block_attributes_get_block_size();
>       int ret = 0;
>   
>       first_bit = section->offset_within_region / block_size;
> @@ -122,7 +120,7 @@ ram_block_attributes_for_each_discarded_section(const RamBlockAttributes *attr,
>   {
>       unsigned long first_bit, last_bit;
>       uint64_t offset, size;
> -    const size_t block_size = ram_block_attributes_get_block_size(attr);
> +    const size_t block_size = ram_block_attributes_get_block_size();
>       int ret = 0;
>   
>       first_bit = section->offset_within_region / block_size;
> @@ -163,7 +161,7 @@ ram_block_attributes_rdm_get_min_granularity(const RamDiscardManager *rdm,
>       const RamBlockAttributes *attr = RAM_BLOCK_ATTRIBUTES(rdm);
>   
>       g_assert(mr == attr->ram_block->mr);
> -    return ram_block_attributes_get_block_size(attr);
> +    return ram_block_attributes_get_block_size();
>   }
>   
>   static void
> @@ -265,7 +263,7 @@ ram_block_attributes_is_valid_range(RamBlockAttributes *attr, uint64_t offset,
>       g_assert(mr);
>   
>       uint64_t region_size = memory_region_size(mr);
> -    const size_t block_size = ram_block_attributes_get_block_size(attr);
> +    const size_t block_size = ram_block_attributes_get_block_size();
>   
>       if (!QEMU_IS_ALIGNED(offset, block_size) ||
>           !QEMU_IS_ALIGNED(size, block_size)) {
> @@ -322,7 +320,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
>                                         uint64_t offset, uint64_t size,
>                                         bool to_discard)
>   {
> -    const size_t block_size = ram_block_attributes_get_block_size(attr);
> +    const size_t block_size = ram_block_attributes_get_block_size();
>       const unsigned long first_bit = offset / block_size;
>       const unsigned long nbits = size / block_size;
>       const unsigned long last_bit = first_bit + nbits - 1;



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] ram-block-attributes: Unify the retrieval of the block size
  2025-10-23  9:55 ` [PATCH v2 2/2] ram-block-attributes: Unify the retrieval of the block size Chenyi Qiang
  2025-10-23 10:17   ` David Hildenbrand
@ 2025-10-24  0:16   ` Xiaoyao Li
  1 sibling, 0 replies; 9+ messages in thread
From: Xiaoyao Li @ 2025-10-24  0:16 UTC (permalink / raw)
  To: Chenyi Qiang, Peter Xu, David Hildenbrand, Alexey Kardashevskiy,
	Paolo Bonzini, Philippe Mathieu-Daudé
  Cc: qemu-devel, Gao Chao, Farrah Chen

On 10/23/2025 5:55 PM, Chenyi Qiang wrote:
> There's an existing helper function designed to obtain the block size.
> Modify ram_block_attribute_create() to use this function for
> consistency.
> 
> Tested-by: Farrah Chen <farrah.chen@intel.com>
> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

> ---
> Changes in v2:
>    - Newly added.
> ---
>   system/ram-block-attributes.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
> index a7579de5b46..cf8f5f41966 100644
> --- a/system/ram-block-attributes.c
> +++ b/system/ram-block-attributes.c
> @@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
>   
>   RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
>   {
> -    const int block_size  = qemu_real_host_page_size();
> +    const int block_size  = ram_block_attributes_get_block_size();
>       RamBlockAttributes *attr;
>       MemoryRegion *mr = ram_block->mr;
>   



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-10-24  0:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23  9:55 [PATCH v2 0/2] Fix a regression with hugetlbfs for shared memory in CoCo VMs Chenyi Qiang
2025-10-23  9:55 ` [PATCH v2 1/2] ram-block-attributes: Avoid the overkill of shared memory with hugetlbfs backend Chenyi Qiang
2025-10-23 10:16   ` David Hildenbrand
2025-10-23 13:47     ` Peter Xu
2025-10-24  0:16   ` Xiaoyao Li
2025-10-23  9:55 ` [PATCH v2 2/2] ram-block-attributes: Unify the retrieval of the block size Chenyi Qiang
2025-10-23 10:17   ` David Hildenbrand
2025-10-23 11:52     ` Chenyi Qiang
2025-10-24  0:16   ` Xiaoyao Li

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).