Re: [PATCH v6 3/6] accel/kvm: Report the loss of a large memory page

David Hildenbrand
2025-01-30T12:02:14Z

On 27.01.25 22:31, “William Roche wrote:
> From: William Roche <william.roche@oracle.com>
>
> In case of a large page impacted by a memory error, provide an
> information about the impacted large page before the memory
> error injection message.
>
> This message would also appear on ras enabled ARM platforms, with
> the introduction of an x86 similar error injection message.
>
> In the case of a large page impacted, we now report:
> Memory Error on large page from <backend>: +<fd_offset> +<page_size>
>
> Signed-off-by: William Roche <william.roche@oracle.com>
> ---
> accel/kvm/kvm-all.c | 11 +++++++++++
> include/exec/cpu-common.h | 9 +++++++++
> system/physmem.c | 21 +++++++++++++++++++++
> target/arm/kvm.c | 3 +++
> 4 files changed, 44 insertions(+)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index f89568bfa3..08e14f8960 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -1296,6 +1296,17 @@ static void kvm_unpoison_all(void *param)
> void kvm_hwpoison_page_add(ram_addr_t ram_addr)
> {
> HWPoisonPage *page;
> + struct RAMBlockInfo rb_info;
> +
> + if (qemu_ram_block_location_info_from_addr(ram_addr, &rb_info)) {
> + size_t ps = rb_info.page_size;

Empty line missing.

> + if (ps > TARGET_PAGE_SIZE) {
> + uint64_t offset = ram_addr - rb_info.offset;

Empty line missing.

Don't you have to align the fd_offset also down?

I suggest doing the alignment already when calculating "uint64_t offset"

--
Cheers,

David / dhildenb