Re: [PATCH v1 0/5] virtio-mem: s390x support
This series has been successfully tested along with the QEMU's series. Virtio-mem devices could be resized, plugged and unplugged seamlessly. The memory information displayed is correct and reboot doesn't cause any issue. Tested-by: Mario Casquero On Tue, Sep 10, 2024 at 9:16 PM David Hildenbrand wrote: > > Let's finally add s390x support for virtio-mem; my last RFC was sent > 4 years ago, and a lot changed in the meantime. > > This is based on mm/stable. > > I sent out the QEMU part earlier today [1], that contains some more details > and a usage example on s390x (last patch). > > There is not too much in here: The biggest part is querying a new diag(500) > STORAGE_LIMIT hypercall to obtain the proper "max_physmem_end". Once this > and the QEMU part will go upstream, it will get documented in [2] > > The last two patches are not strictly required but certainly nice-to-have. > > Note that -- in contrast to standby memory -- virtio-mem memory must be > configured to be automatically onlined as soon as hotplugged. The easiest > approach is using the "memhp_default_state=" kernel parameter or by using > proper udev rules. More details can be found at [3]. > > I have reviving+upstreaming a systemd service to handle configuring > that on my todo list, but for some reason I keep getting distracted ... > > I tested various things, including: > * Various memory hotplug/hotunplug combinations > * Device hotplug/hotunplug > * /proc/iomem output > * reboot > * kexec > * kdump: make sure we don't hotplug memory > > One remaining work item is kdump support for virtio-mem memory. I > am working on a prototype that will be fairly straight forward, > because the virtio-mem driver already supports a special kdump mode and > dracut will already include it in the initrd as default. With > holiday and conferences coming up I rather sent this out now. > > [1] https://lkml.kernel.org/r/20240910175809.2135596-1-da...@redhat.com > [2] https://gitlab.com/davidhildenbrand/s390x-os-virt-spec > [3] https://virtio-mem.gitlab.io/user-guide/user-guide-linux.html > > Cc: Heiko Carstens > Cc: Vasily Gorbik > Cc: Alexander Gordeev > Cc: Christian Borntraeger > Cc: Sven Schnelle > Cc: Thomas Huth > Cc: Cornelia Huck > Cc: Janosch Frank > Cc: Claudio Imbrenda > Cc: "Michael S. Tsirkin" > Cc: Jason Wang > Cc: Xuan Zhuo > Cc: "Eugenio Pérez" > Cc: Andrew Morton > > David Hildenbrand (5): > s390/kdump: implement is_kdump_kernel() > s390/physmem_info: query diag500(STORAGE_LIMIT) to support QEMU/KVM > memory devices > virtio-mem: s390x support > lib/Kconfig.debug: default STRICT_DEVMEM to "y" on s390x > s390/sparsemem: reduce section size to 128 MiB > > arch/s390/boot/physmem_info.c| 46 ++-- > arch/s390/include/asm/kexec.h| 4 +++ > arch/s390/include/asm/physmem_info.h | 3 ++ > arch/s390/include/asm/sparsemem.h| 2 +- > arch/s390/kernel/crash_dump.c| 6 > drivers/virtio/Kconfig | 12 > lib/Kconfig.debug| 2 +- > 7 files changed, 64 insertions(+), 11 deletions(-) > > -- > 2.46.0 > >
Re: [PATCH v1 0/2] selftests/mm: hugetlb_fault_after_madv improvements
This series has been successfully tested. Now when executing the hugetlb_fault_after_madv selftest the benefits of both patches could be observed. # ./hugetlb_fault_after_madv TAP version 13 1..1 # [INFO] detected default hugetlb page size: 1024 KiB ok 1 SIGBUS behavior # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 Tested-by: Mario Casquero On Thu, Sep 26, 2024 at 5:20 PM David Hildenbrand wrote: > > Mario brought to my attention that the hugetlb_fault_after_madv test > is currently always skipped on s390x. > > Let's adjust the test to be independent of the default hugetlb page size > and while at it, also improve the test output. > > Cc: Andrew Morton > Cc: Shuah Khan > Cc: Mario Casquero > Cc: Breno Leitao > > David Hildenbrand (2): > selftests/mm: hugetlb_fault_after_madv: use default hguetlb page size > selftests/mm: hugetlb_fault_after_madv: improve test output > > .../selftests/mm/hugetlb_fault_after_madv.c | 48 --- > 1 file changed, 42 insertions(+), 6 deletions(-) > > -- > 2.46.1 >
Re: [PATCH 1/2] selftests: khugepaged: fix the shmem collapse failure
This patch has been successfully tested. All the khugepaged shmem tests passed. # ./khugepaged khugepaged:shmem Save THP and khugepaged settings... OK Allocate huge page on fault... OK Split huge PMD on MADV_DONTNEED... OK Run test: collapse_full (khugepaged:shmem) Collapse multiple fully populated PTE table OK Run test: collapse_single_pte_entry (khugepaged:shmem) Collapse PTE table with single PTE entry present OK Run test: collapse_full_of_compound (khugepaged:shmem) Allocate huge page... OK Split huge page leaving single PTE page table full of compound pages... OK Collapse PTE table full of compound pages OK Restore THP and khugepaged settings... OK Tested-by: Mario Casquero On Thu, Jun 12, 2025 at 5:55 AM Baolin Wang wrote: > > When running the khugepaged selftest for shmem (./khugepaged all:shmem), > I encountered the following test failures: > " > Run test: collapse_full (khugepaged:shmem) > Collapse multiple fully populated PTE table Fail > ... > Run test: collapse_single_pte_entry (khugepaged:shmem) > Collapse PTE table with single PTE entry present Fail > ... > Run test: collapse_full_of_compound (khugepaged:shmem) > Allocate huge page... OK > Split huge page leaving single PTE page table full of compound pages... OK > Collapse PTE table full of compound pages Fail > " > > The reason for the failure is that, it will set MADV_NOHUGEPAGE to prevent > khugepaged from continuing to scan shmem VMA after khugepaged finishes > scanning in the wait_for_scan() function. Moreover, shmem requires a refault > to establish PMD mappings. > > However, after commit 2b0f922323cc, PMD mappings are prevented if the VMA is > set with MADV_NOHUGEPAGE flag, so shmem cannot establish PMD mappings during > refault. > > To fix this issue, we can set the MADV_NOHUGEPAGE flag after the shmem > refault. > With this fix, the shmem test case passes. > > Fixes: 2b0f922323cc ("mm: don't install PMD mappings when THPs are disabled > by the hw/process/vma") > Signed-off-by: Baolin Wang > --- > tools/testing/selftests/mm/khugepaged.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/mm/khugepaged.c > b/tools/testing/selftests/mm/khugepaged.c > index 8a4d34cce36b..d462f62d8116 100644 > --- a/tools/testing/selftests/mm/khugepaged.c > +++ b/tools/testing/selftests/mm/khugepaged.c > @@ -561,8 +561,6 @@ static bool wait_for_scan(const char *msg, char *p, int > nr_hpages, > usleep(TICK); > } > > - madvise(p, nr_hpages * hpage_pmd_size, MADV_NOHUGEPAGE); > - > return timeout == -1; > } > > @@ -585,6 +583,7 @@ static void khugepaged_collapse(const char *msg, char *p, > int nr_hpages, > if (ops != &__anon_ops) > ops->fault(p, 0, nr_hpages * hpage_pmd_size); > > + madvise(p, nr_hpages * hpage_pmd_size, MADV_NOHUGEPAGE); > if (ops->check_huge(p, expect ? nr_hpages : 0)) > success("OK"); > else > -- > 2.43.5 > >