Re: [PATCH V3 (RESEND) 0/3] arm64: Enable vmemmap mapping from device memory
Hi I also tested the addional cases on arm64 1, 4k page size + devdax + --map=mem 2, 64k page size + devdax + --map=mem 3, 4k page size + devdax + --map=dev 4, 64k page size + devdax + --map=dev case 4 is important to verify Anshuman's this series. Host kernel: 5.7-rc3 guest kernel: 5.7-rc5 with this series ndctl: https://github.com/pmem/ndctl/tree/c7767834871 <https://github.com/pmem/ndctl/tree/c7767834871f7ce50a2abe1da946e9e16fb08eda> On the guest: 1. ./ndctl/.libs/ndctl create-namespace -e namespace0.0 --mode=devdax --map=dev -s 1g -f -v -a 64K echo dax0.0 > /sys/bus/dax/drivers/device_dax/unbind echo dax0.0 > /sys/bus/dax/drivers/kmem/new_id The 1g block was added 2. echo 0 > /sys/devices/system/memory/memory10/online modprobe -r dax_pmem The 1g block was removed Some minor fix should be applied which is not relevant to this series itself. e.g numa id --- Cheers, Justin (Jia He) On 2020/6/18 9:15, Anshuman Khandual wrote: This series enables vmemmap backing memory allocation from device memory ranges on arm64. But before that, it enables vmemmap_populate_basepages() and vmemmap_alloc_block_buf() to accommodate struct vmem_altmap based alocation requests. This series applies on 5.8-rc1. Pending Question: altmap_alloc_block_buf() does not have any other remaining users in the tree after this change. Should it be converted into a static function and it's declaration be dropped from the header (include/linux/mm.h). Avoided doing so because I was not sure if there are any off-tree users or not. Changes in V3: - Dropped comment from free_hotplug_page_range() per Robin - Modified comment in unmap_hotplug_range() per Robin - Enabled altmap support in vmemmap_alloc_block_buf() per Robin Changes in V2: (https://lkml.org/lkml/2020/3/4/475) - Rebased on latest hot-remove series (v14) adding P4D page table support Changes in V1: (https://lkml.org/lkml/2020/1/23/12) - Added an WARN_ON() in unmap_hotplug_range() when altmap is provided without the page table backing memory being freed Changes in RFC V2: (https://lkml.org/lkml/2019/10/21/11) - Changed the commit message on 1/2 patch per Will - Changed the commit message on 2/2 patch as well - Rebased on arm64 memory hot remove series (v10) RFC V1: (https://lkml.org/lkml/2019/6/28/32) Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Tony Luck Cc: Fenghua Yu Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: David Hildenbrand Cc: Mike Rapoport Cc: Michal Hocko Cc: "Matthew Wilcox (Oracle)" Cc: "Kirill A. Shutemov" Cc: Andrew Morton Cc: Dan Williams Cc: Pavel Tatashin Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linux-arm-ker...@lists.infradead.org Cc: linux-i...@vger.kernel.org Cc: linux-ri...@lists.infradead.org Cc: x...@kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux...@kvack.org Cc: linux-ker...@vger.kernel.org Anshuman Khandual (3): mm/sparsemem: Enable vmem_altmap support in vmemmap_populate_basepages() mm/sparsemem: Enable vmem_altmap support in vmemmap_alloc_block_buf() arm64/mm: Enable vmem_altmap support for vmemmap mappings arch/arm64/mm/mmu.c | 59 ++- arch/ia64/mm/discontig.c | 2 +- arch/powerpc/mm/init_64.c | 10 +++ arch/riscv/mm/init.c | 2 +- arch/x86/mm/init_64.c | 12 include/linux/mm.h| 8 -- mm/sparse-vmemmap.c | 38 - 7 files changed, 87 insertions(+), 44 deletions(-) --
Re: [PATCH V3 0/3] arm64: Enable vmemmap mapping from device memory
Hi On 2020/3/31 13:09, Anshuman Khandual wrote: This series enables vmemmap backing memory allocation from device memory ranges on arm64. But before that, it enables vmemmap_populate_basepages() and vmemmap_alloc_block_buf() to accommodate struct vmem_altmap based alocation requests. I verified no obvious regression after this patch series. Host: ThunderX2(armv8a server), kernel v5.4 qemu:v3.1, -M virt \ -object memory-backend-file,id=mem1,share=on,mem-path=/tmp2/nvdimm.img,size=4G,align=2M \ -device nvdimm,id=nvdimm1,memdev=mem1,label-size=2M Guest: kernel v5.7.0-rc5 with this patch series. Tested case: - 4K PAGESIZE, boot, mount w/ -o dax, mount w/o -o dax, basic io - 64K PAGESIZE,boot, mount w/ -o dax, mount w/o -o dax, basic io Not tested: - 16K pagesize due to my hardware limiation(can't run 16K pgsz kernel) - hot-add/remove nvdimm device from qemu due to no fully support on arm64 qemu yet - Host nvdimm device hotplug Hence from above result, Tested-by: Jia He This series applies after latest (v14) arm64 memory hot remove series (https://lkml.org/lkml/2020/3/3/1746) on Linux 5.6. Pending Question: altmap_alloc_block_buf() does not have any other remaining users in the tree after this change. Should it be converted into a static function and it's declaration be dropped from the header (include/linux/mm.h). Avoided doing so because I was not sure if there are any off-tree users or not. Changes in V3: - Dropped comment from free_hotplug_page_range() per Robin - Modified comment in unmap_hotplug_range() per Robin - Enabled altmap support in vmemmap_alloc_block_buf() per Robin Changes in V2: (https://lkml.org/lkml/2020/3/4/475) - Rebased on latest hot-remove series (v14) adding P4D page table support Changes in V1: (https://lkml.org/lkml/2020/1/23/12) - Added an WARN_ON() in unmap_hotplug_range() when altmap is provided without the page table backing memory being freed Changes in RFC V2: (https://lkml.org/lkml/2019/10/21/11) - Changed the commit message on 1/2 patch per Will - Changed the commit message on 2/2 patch as well - Rebased on arm64 memory hot remove series (v10) RFC V1: (https://lkml.org/lkml/2019/6/28/32) Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Tony Luck Cc: Fenghua Yu Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: David Hildenbrand Cc: Mike Rapoport Cc: Michal Hocko Cc: "Matthew Wilcox (Oracle)" Cc: "Kirill A. Shutemov" Cc: Andrew Morton Cc: Dan Williams Cc: Pavel Tatashin Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc:linux-arm-ker...@lists.infradead.org Cc:linux-i...@vger.kernel.org Cc:linux-ri...@lists.infradead.org Cc:x...@kernel.org Cc:linuxppc-dev@lists.ozlabs.org Cc:linux...@kvack.org Cc:linux-ker...@vger.kernel.org Anshuman Khandual (3): mm/sparsemem: Enable vmem_altmap support in vmemmap_populate_basepages() mm/sparsemem: Enable vmem_altmap support in vmemmap_alloc_block_buf() arm64/mm: Enable vmem_altmap support for vmemmap mappings arch/arm64/mm/mmu.c | 59 ++- arch/ia64/mm/discontig.c | 2 +- arch/powerpc/mm/init_64.c | 10 +++ arch/riscv/mm/init.c | 2 +- arch/x86/mm/init_64.c | 12 include/linux/mm.h| 8 -- mm/sparse-vmemmap.c | 38 - 7 files changed, 87 insertions(+), 44 deletions(-) -- --- Cheers, Justin (Jia He)
[PATCH] powerpc/time: use get_tb instead of get_vtb in running_clock
Virtual time base(vtb) is a register which increases only in guest. Any exit from guest to host will stop the vtb(saved and restored by kvm). But if there is an IO causes guest exits to host, the guest's watchdog (watchdog_timer_fn -> is_softlockup -> get_timestamp -> running_clock) needs to also include the time elapsed in host. get_vtb is not correct in this case. Also, the TB_OFFSET is well saved and restored by qemu after commit [1]. So we can use get_tb here. [1] http://git.qemu.org/?p=qemu.git;a=commit;h=42043e4f1 Signed-off-by: Jia He <hejia...@gmail.com> --- arch/powerpc/kernel/time.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index fe6f3a2..c542dd3 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -695,16 +695,15 @@ notrace unsigned long long sched_clock(void) unsigned long long running_clock(void) { /* -* Don't read the VTB as a host since KVM does not switch in host -* timebase into the VTB when it takes a guest off the CPU, reading the -* VTB would result in reading 'last switched out' guest VTB. +* Use get_tb instead of get_vtb for guest since the TB_OFFSET has been +* well saved/restored when qemu does suspend/resume. * * Host kernels are often compiled with CONFIG_PPC_PSERIES checked, it * would be unsafe to rely only on the #ifdef above. */ if (firmware_has_feature(FW_FEATURE_LPAR) && cpu_has_feature(CPU_FTR_ARCH_207S)) - return mulhdu(get_vtb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift; + return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift; /* * This is a next best approximation without a VTB. -- 2.9.3
[PATCH] powerpc: Fix LPCR_VRMASD definition
Fixes: a4b349540a ("powerpc/mm: Cleanup LPCR defines") Signed-off-by: Jia He <hejia...@gmail.com> --- arch/powerpc/include/asm/reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 9e1499f..93ec25e 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -337,7 +337,7 @@ #define LPCR_DPFD_SH 52 #define LPCR_DPFD(ASM_CONST(7) << LPCR_DPFD_SH) #define LPCR_VRMASD_SH 47 -#define LPCR_VRMASD (ASM_CONST(1) << LPCR_VRMASD_SH) +#define LPCR_VRMASD (ASM_CONST(0x1f) << LPCR_VRMASD_SH) #define LPCR_VRMA_L ASM_CONST(0x0008) #define LPCR_VRMA_LP0ASM_CONST(0x0001) #define LPCR_VRMA_LP1ASM_CONST(0x8000) -- 2.5.5