These patches are all simple fixes with no strong dependency though, I hope that making them a patchset will be more convenient for merge.
The patchset are based on v6.12-rc2.
Chunyan Zhang (4): riscv: Remove unused GENERATING_ASM_OFFSETS riscv: Remove duplicated GET_RM selftest/mm: Fix typo in virtual_address_range selftests/mm: skip virtual_address_range tests on riscv
arch/riscv/kernel/asm-offsets.c | 2 -- arch/riscv/kernel/traps_misaligned.c | 2 -- tools/testing/selftests/mm/Makefile | 2 ++ tools/testing/selftests/mm/run_vmtests.sh | 10 ++++++---- tools/testing/selftests/mm/virtual_address_range.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)
The macro is not used in the current version of kernel, it looks like can be removed to avoid a build warning:
../arch/riscv/kernel/asm-offsets.c: At top level: ../arch/riscv/kernel/asm-offsets.c:7: warning: macro "GENERATING_ASM_OFFSETS" is not used [-Wunused-macros] 7 | #define GENERATING_ASM_OFFSETS
Fixes: 9639a44394b9 ("RISC-V: Provide a cleaner raw_smp_processor_id()") Reviewed-by: Alexandre Ghiti alexghiti@rivosinc.com Tested-by: Alexandre Ghiti alexghiti@rivosinc.com Signed-off-by: Chunyan Zhang zhangchunyan@iscas.ac.cn --- V1: https://lore.kernel.org/lkml/20240816101912.1049329-1-zhangchunyan@iscas.ac.... --- arch/riscv/kernel/asm-offsets.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c index e94180ba432f..c2f3129a8e5c 100644 --- a/arch/riscv/kernel/asm-offsets.c +++ b/arch/riscv/kernel/asm-offsets.c @@ -4,8 +4,6 @@ * Copyright (C) 2017 SiFive */
-#define GENERATING_ASM_OFFSETS - #include <linux/kbuild.h> #include <linux/mm.h> #include <linux/sched.h>
The macro GET_RM defined twice in this file, one can be removed.
Reviewed-by: Alexandre Ghiti alexghiti@rivosinc.com Signed-off-by: Chunyan Zhang zhangchunyan@iscas.ac.cn --- V1: https://lore.kernel.org/lkml/20240909095557.446745-1-zhangchunyan@iscas.ac.c... --- arch/riscv/kernel/traps_misaligned.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c index d4fd8af7aaf5..1b9867136b61 100644 --- a/arch/riscv/kernel/traps_misaligned.c +++ b/arch/riscv/kernel/traps_misaligned.c @@ -136,8 +136,6 @@ #define REG_PTR(insn, pos, regs) \ (ulong *)((ulong)(regs) + REG_OFFSET(insn, pos))
-#define GET_RM(insn) (((insn) >> 12) & 7) - #define GET_RS1(insn, regs) (*REG_PTR(insn, SH_RS1, regs)) #define GET_RS2(insn, regs) (*REG_PTR(insn, SH_RS2, regs)) #define GET_RS1S(insn, regs) (*REG_PTR(RVC_RS1S(insn), 0, regs))
The function name should be *hint* address, so correct it.
Reviewed-by: Charlie Jenkins charlie@rivosinc.com Signed-off-by: Chunyan Zhang zhangchunyan@iscas.ac.cn --- V1: https://lore.kernel.org/linux-mm/ZuOuedBpS7i3T%2Fo0@ghost/T/ --- tools/testing/selftests/mm/virtual_address_range.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c index 4e4c1e311247..2a2b69e91950 100644 --- a/tools/testing/selftests/mm/virtual_address_range.c +++ b/tools/testing/selftests/mm/virtual_address_range.c @@ -64,7 +64,7 @@ #define NR_CHUNKS_HIGH NR_CHUNKS_384TB #endif
-static char *hind_addr(void) +static char *hint_addr(void) { int bits = HIGH_ADDR_SHIFT + rand() % (63 - HIGH_ADDR_SHIFT);
@@ -185,7 +185,7 @@ int main(int argc, char *argv[]) }
for (i = 0; i < NR_CHUNKS_HIGH; i++) { - hint = hind_addr(); + hint = hint_addr(); hptr[i] = mmap(hint, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
On Tue, 08 Oct 2024 02:41:40 PDT (-0700), zhangchunyan@iscas.ac.cn wrote:
The function name should be *hint* address, so correct it.
Reviewed-by: Charlie Jenkins charlie@rivosinc.com Signed-off-by: Chunyan Zhang zhangchunyan@iscas.ac.cn
V1: https://lore.kernel.org/linux-mm/ZuOuedBpS7i3T%2Fo0@ghost/T/
tools/testing/selftests/mm/virtual_address_range.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c index 4e4c1e311247..2a2b69e91950 100644 --- a/tools/testing/selftests/mm/virtual_address_range.c +++ b/tools/testing/selftests/mm/virtual_address_range.c @@ -64,7 +64,7 @@ #define NR_CHUNKS_HIGH NR_CHUNKS_384TB #endif
-static char *hind_addr(void) +static char *hint_addr(void) { int bits = HIGH_ADDR_SHIFT + rand() % (63 - HIGH_ADDR_SHIFT);
@@ -185,7 +185,7 @@ int main(int argc, char *argv[]) }
for (i = 0; i < NR_CHUNKS_HIGH; i++) {
hint = hind_addr();
hptr[i] = mmap(hint, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);hint = hint_addr();
Acked-by: Palmer Dabbelt palmer@rivosinc.com
In case that helps, but this has nothing to do with RISC-V so you might need to re-send it so someone else notices. Though +Andrew, in case that's enough...
RISC-V doesn't currently have the behavior of restricting the virtual address space which virtual_address_range tests check, this will cause the tests fail. So lets disable the whole test suite for riscv64 for now, not build it and run_vmtests.sh will skip it if it is not present.
Reviewed-by: Charlie Jenkins charlie@rivosinc.com Signed-off-by: Chunyan Zhang zhangchunyan@iscas.ac.cn --- V1: https://lore.kernel.org/linux-mm/ZuOuedBpS7i3T%2Fo0@ghost/T/ --- tools/testing/selftests/mm/Makefile | 2 ++ tools/testing/selftests/mm/run_vmtests.sh | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 02e1204971b0..76a378c5c141 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -115,7 +115,9 @@ endif
ifneq (,$(filter $(ARCH),arm64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64 s390)) TEST_GEN_FILES += va_high_addr_switch +ifneq ($(ARCH),riscv64) TEST_GEN_FILES += virtual_address_range +endif TEST_GEN_FILES += write_to_hugetlbfs endif
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index c5797ad1d37b..4493bfd1911c 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -347,10 +347,12 @@ if [ $VADDR64 -ne 0 ]; then # allows high virtual address allocation requests independent # of platform's physical memory.
- prev_policy=$(cat /proc/sys/vm/overcommit_memory) - echo 1 > /proc/sys/vm/overcommit_memory - CATEGORY="hugevm" run_test ./virtual_address_range - echo $prev_policy > /proc/sys/vm/overcommit_memory + if [ -x ./virtual_address_range ]; then + prev_policy=$(cat /proc/sys/vm/overcommit_memory) + echo 1 > /proc/sys/vm/overcommit_memory + CATEGORY="hugevm" run_test ./virtual_address_range + echo $prev_policy > /proc/sys/vm/overcommit_memory + fi
# va high address boundary switch test ARCH_ARM64="arm64"
On Tue, 08 Oct 2024 02:41:41 PDT (-0700), zhangchunyan@iscas.ac.cn wrote:
RISC-V doesn't currently have the behavior of restricting the virtual address space which virtual_address_range tests check, this will cause the tests fail. So lets disable the whole test suite for riscv64 for now, not build it and run_vmtests.sh will skip it if it is not present.
Reviewed-by: Charlie Jenkins charlie@rivosinc.com Signed-off-by: Chunyan Zhang zhangchunyan@iscas.ac.cn
V1: https://lore.kernel.org/linux-mm/ZuOuedBpS7i3T%2Fo0@ghost/T/
tools/testing/selftests/mm/Makefile | 2 ++ tools/testing/selftests/mm/run_vmtests.sh | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 02e1204971b0..76a378c5c141 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -115,7 +115,9 @@ endif
ifneq (,$(filter $(ARCH),arm64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64 s390)) TEST_GEN_FILES += va_high_addr_switch +ifneq ($(ARCH),riscv64) TEST_GEN_FILES += virtual_address_range +endif TEST_GEN_FILES += write_to_hugetlbfs endif
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index c5797ad1d37b..4493bfd1911c 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -347,10 +347,12 @@ if [ $VADDR64 -ne 0 ]; then # allows high virtual address allocation requests independent # of platform's physical memory.
- prev_policy=$(cat /proc/sys/vm/overcommit_memory)
- echo 1 > /proc/sys/vm/overcommit_memory
- CATEGORY="hugevm" run_test ./virtual_address_range
- echo $prev_policy > /proc/sys/vm/overcommit_memory
if [ -x ./virtual_address_range ]; then
prev_policy=$(cat /proc/sys/vm/overcommit_memory)
echo 1 > /proc/sys/vm/overcommit_memory
CATEGORY="hugevm" run_test ./virtual_address_range
echo $prev_policy > /proc/sys/vm/overcommit_memory
fi
# va high address boundary switch test ARCH_ARM64="arm64"
Acked-by: Palmer Dabbelt palmer@rivosinc.com
(I'm taking the first two as they're RISC-V bits)
Hi Andrew,
On Fri, 25 Oct 2024 at 02:00, Palmer Dabbelt palmer@dabbelt.com wrote:
On Tue, 08 Oct 2024 02:41:41 PDT (-0700), zhangchunyan@iscas.ac.cn wrote:
RISC-V doesn't currently have the behavior of restricting the virtual address space which virtual_address_range tests check, this will cause the tests fail. So lets disable the whole test suite for riscv64 for now, not build it and run_vmtests.sh will skip it if it is not present.
Reviewed-by: Charlie Jenkins charlie@rivosinc.com Signed-off-by: Chunyan Zhang zhangchunyan@iscas.ac.cn
V1: https://lore.kernel.org/linux-mm/ZuOuedBpS7i3T%2Fo0@ghost/T/
tools/testing/selftests/mm/Makefile | 2 ++ tools/testing/selftests/mm/run_vmtests.sh | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 02e1204971b0..76a378c5c141 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -115,7 +115,9 @@ endif
ifneq (,$(filter $(ARCH),arm64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64 s390)) TEST_GEN_FILES += va_high_addr_switch +ifneq ($(ARCH),riscv64) TEST_GEN_FILES += virtual_address_range +endif TEST_GEN_FILES += write_to_hugetlbfs endif
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index c5797ad1d37b..4493bfd1911c 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -347,10 +347,12 @@ if [ $VADDR64 -ne 0 ]; then # allows high virtual address allocation requests independent # of platform's physical memory.
prev_policy=$(cat /proc/sys/vm/overcommit_memory)
echo 1 > /proc/sys/vm/overcommit_memory
CATEGORY="hugevm" run_test ./virtual_address_range
echo $prev_policy > /proc/sys/vm/overcommit_memory
if [ -x ./virtual_address_range ]; then
prev_policy=$(cat /proc/sys/vm/overcommit_memory)
echo 1 > /proc/sys/vm/overcommit_memory
CATEGORY="hugevm" run_test ./virtual_address_range
echo $prev_policy > /proc/sys/vm/overcommit_memory
fi # va high address boundary switch test ARCH_ARM64="arm64"
Acked-by: Palmer Dabbelt palmer@rivosinc.com
(I'm taking the first two as they're RISC-V bits)
Could you please pick up the last two through your tree?
Thanks, Chunyan
On Tue, 08 Oct 2024 02:41:37 PDT (-0700), zhangchunyan@iscas.ac.cn wrote:
These patches are all simple fixes with no strong dependency though, I hope that making them a patchset will be more convenient for merge.
It doesn't: there's two RISC-V fixes and two MM cleanups, which makes stuff likely to get lost. I'll take the first two, but you might need to resend the others.
The patchset are based on v6.12-rc2.
Chunyan Zhang (4): riscv: Remove unused GENERATING_ASM_OFFSETS riscv: Remove duplicated GET_RM selftest/mm: Fix typo in virtual_address_range selftests/mm: skip virtual_address_range tests on riscv
arch/riscv/kernel/asm-offsets.c | 2 -- arch/riscv/kernel/traps_misaligned.c | 2 -- tools/testing/selftests/mm/Makefile | 2 ++ tools/testing/selftests/mm/run_vmtests.sh | 10 ++++++---- tools/testing/selftests/mm/virtual_address_range.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)
Hello:
This series was applied to riscv/linux.git (fixes) by Palmer Dabbelt palmer@rivosinc.com:
On Tue, 8 Oct 2024 17:41:37 +0800 you wrote:
These patches are all simple fixes with no strong dependency though, I hope that making them a patchset will be more convenient for merge.
The patchset are based on v6.12-rc2.
Chunyan Zhang (4): riscv: Remove unused GENERATING_ASM_OFFSETS riscv: Remove duplicated GET_RM selftest/mm: Fix typo in virtual_address_range selftests/mm: skip virtual_address_range tests on riscv
[...]
Here is the summary with links: - [V2,1/4] riscv: Remove unused GENERATING_ASM_OFFSETS https://git.kernel.org/riscv/c/cb873b28bc2a - [V2,2/4] riscv: Remove duplicated GET_RM https://git.kernel.org/riscv/c/4c6b61b5d35e - [V2,3/4] selftest/mm: Fix typo in virtual_address_range (no matching commit) - [V2,4/4] selftests/mm: skip virtual_address_range tests on riscv (no matching commit)
You are awesome, thank you!
Hello:
This series was applied to riscv/linux.git (fixes) by Andrew Morton akpm@linux-foundation.org:
On Tue, 8 Oct 2024 17:41:37 +0800 you wrote:
These patches are all simple fixes with no strong dependency though, I hope that making them a patchset will be more convenient for merge.
The patchset are based on v6.12-rc2.
Chunyan Zhang (4): riscv: Remove unused GENERATING_ASM_OFFSETS riscv: Remove duplicated GET_RM selftest/mm: Fix typo in virtual_address_range selftests/mm: skip virtual_address_range tests on riscv
[...]
Here is the summary with links: - [V2,1/4] riscv: Remove unused GENERATING_ASM_OFFSETS (no matching commit) - [V2,2/4] riscv: Remove duplicated GET_RM (no matching commit) - [V2,3/4] selftest/mm: Fix typo in virtual_address_range https://git.kernel.org/riscv/c/e847f8cd96ae - [V2,4/4] selftests/mm: skip virtual_address_range tests on riscv https://git.kernel.org/riscv/c/4175eff0e007
You are awesome, thank you!
linux-kselftest-mirror@lists.linaro.org