From: William Roche <willia.roche@xxxxxxxxxx> Hello David, Here is an new version of our code and an updated description of the patch set: --- This set of patches fixes several problems with hardware memory errors impacting hugetlbfs memory backed VMs and the generic memory recovery on VM reset. When using hugetlbfs large pages, any large page location being impacted by an HW memory error results in poisoning the entire page, suddenly making a large chunk of the VM memory unusable. The main problem that currently exists in Qemu is the lack of backend file repair before resetting the VM memory, resulting in the impacted memory to be silently unusable even after a VM reboot. In order to fix this issue, we take into account the page size of the impacted memory block when dealing with the associated poisoned page location. Using the page size information we also try to regenerate the memory calling ram_block_discard_range() on VM reset when running qemu_ram_remap(). So that a poisoned memory backed by a hugetlbfs file is regenerated with a hole punched in this file. A new page is loaded when the location is first touched. In case of a discard failure we fall back to remapping the memory location. We also have to reset the memory settings and honor the 'prealloc' attribute. This memory setting is performed by a new remap notification mechanism calling host_memory_backend_ram_remapped() function when a region of a memory block is remapped. We also enrich the messages used to report a memory error relayed to the VM, providing an identification of memory page and its size in case of a large page impacted. ---- About patch 3/7, I still think that generating an additional message in the kvm_hwpoison_page_add() function creates a cleaner code without the need to repeat it for x86 and ARM. The message would be displayed before all the injection messages issued because of the large page failure. But we could go with this version if you prefer the existing message to be enriched. About patch 7/7, I could merge it with your patch 6/7 if you agree. v3 -> v4: . Fixed some commit messages typos . Enhanced some code comments . Changed the discard fall back conditions to consider only anonymous memory . Fixed missing some variable name changes in intermediary patches. . Modify the error message given when an error is injected to report the case of a large page . use snprintf() to generate this message . Adding this same type of message in the ARM case too This code is scripts/checkpatch.pl clean 'make check' runs fine on both x86 and Arm. David Hildenbrand (3): numa: Introduce and use ram_block_notify_remap() hostmem: Factor out applying settings hostmem: Handle remapping of RAM William Roche (4): hwpoison_page_list and qemu_ram_remap are based on pages system/physmem: poisoned memory discard on reboot accel/kvm: Report the loss of a large memory page system/physmem: Memory settings applied on remap notification accel/kvm/kvm-all.c | 2 +- backends/hostmem.c | 189 +++++++++++++++++++++++--------------- hw/core/numa.c | 11 +++ include/exec/cpu-common.h | 3 +- include/exec/ramlist.h | 3 + include/sysemu/hostmem.h | 1 + system/physmem.c | 88 +++++++++++++----- target/arm/kvm.c | 13 +++ target/i386/kvm/kvm.c | 18 +++- 9 files changed, 225 insertions(+), 103 deletions(-) -- 2.43.5