mbox series

[v7,0/4] KVM: selftests: Add LoongArch support

Message ID 20240202041046.3405779-1-maobibo@loongson.cn (mailing list archive)
Headers show
Series KVM: selftests: Add LoongArch support | expand

Message

bibo mao Feb. 2, 2024, 4:10 a.m. UTC
This patchset adds KVM selftests for LoongArch system, currently only
some common test cases are supported and pass to run. These testcase
are listed as following:
        demand_paging_test
        dirty_log_perf_test
        dirty_log_test
        guest_print_test
        hardware_disable_test
        kvm_binary_stats_test
        kvm_create_max_vcpus
        kvm_page_table_test
        memslot_modification_stress_test
        memslot_perf_test
        set_memory_region_test

This patchset originally is posted from zhaotianrui, I continue to work
on his efforts.

---
Changes in v7:
1. Refine code to add LoongArch support in test case 
set_memory_region_test.

Changes in v6:
1. Refresh the patch based on latest kernel 6.8-rc1, add LoongArch
support about testcase set_memory_region_test.
2. Add hardware_disable_test test case.
3. Drop modification about macro DEFAULT_GUEST_TEST_MEM, it is problem
of LoongArch binutils, this issue is raised to LoongArch binutils owners.

Changes in v5:
1. In LoongArch kvm self tests, the DEFAULT_GUEST_TEST_MEM could be
0x130000000, it is different from the default value in memstress.h.
So we Move the definition of DEFAULT_GUEST_TEST_MEM into LoongArch
ucall.h, and add 'ifndef' condition for DEFAULT_GUEST_TEST_MEM
in memstress.h.

Changes in v4:
1. Remove the based-on flag, as the LoongArch KVM patch series
have been accepted by Linux kernel, so this can be applied directly
in kernel.

Changes in v3:
1. Improve implementation of LoongArch VM page walk.
2. Add exception handler for LoongArch.
3. Add dirty_log_test, dirty_log_perf_test, guest_print_test
test cases for LoongArch.
4. Add __ASSEMBLER__ macro to distinguish asm file and c file.
5. Move ucall_arch_do_ucall to the header file and make it as
static inline to avoid function calls.
6. Change the DEFAULT_GUEST_TEST_MEM base addr for LoongArch.

Changes in v2:
1. We should use ".balign 4096" to align the assemble code with 4K in
exception.S instead of "align 12".
2. LoongArch only supports 3 or 4 levels page tables, so we remove the
hanlders for 2-levels page table.
3. Remove the DEFAULT_LOONGARCH_GUEST_STACK_VADDR_MIN and use the common
DEFAULT_GUEST_STACK_VADDR_MIN to allocate stack memory in guest.
4. Reorganize the test cases supported by LoongArch.
5. Fix some code comments.
6. Add kvm_binary_stats_test test case into LoongArch KVM selftests.

---
Tianrui Zhao (4):
  KVM: selftests: Add KVM selftests header files for LoongArch
  KVM: selftests: Add core KVM selftests support for LoongArch
  KVM: selftests: Add ucall test support for LoongArch
  KVM: selftests: Add test cases for LoongArch

 tools/testing/selftests/kvm/Makefile          |  16 +
 .../selftests/kvm/include/kvm_util_base.h     |   5 +
 .../kvm/include/loongarch/processor.h         | 133 +++++++
 .../selftests/kvm/include/loongarch/ucall.h   |  20 ++
 .../selftests/kvm/lib/loongarch/exception.S   |  59 ++++
 .../selftests/kvm/lib/loongarch/processor.c   | 332 ++++++++++++++++++
 .../selftests/kvm/lib/loongarch/ucall.c       |  38 ++
 .../selftests/kvm/set_memory_region_test.c    |   2 +-
 8 files changed, 604 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/kvm/include/loongarch/processor.h
 create mode 100644 tools/testing/selftests/kvm/include/loongarch/ucall.h
 create mode 100644 tools/testing/selftests/kvm/lib/loongarch/exception.S
 create mode 100644 tools/testing/selftests/kvm/lib/loongarch/processor.c
 create mode 100644 tools/testing/selftests/kvm/lib/loongarch/ucall.c


base-commit: 6764c317b6bb91bd806ef79adf6d9c0e428b191e

Comments

bibo mao Feb. 28, 2024, 8:51 a.m. UTC | #1
ping.

Can it be merged for 6.9?

Regards
Bibo Mao

On 2024/2/2 下午12:10, Bibo Mao wrote:
> This patchset adds KVM selftests for LoongArch system, currently only
> some common test cases are supported and pass to run. These testcase
> are listed as following:
>          demand_paging_test
>          dirty_log_perf_test
>          dirty_log_test
>          guest_print_test
>          hardware_disable_test
>          kvm_binary_stats_test
>          kvm_create_max_vcpus
>          kvm_page_table_test
>          memslot_modification_stress_test
>          memslot_perf_test
>          set_memory_region_test
> 
> This patchset originally is posted from zhaotianrui, I continue to work
> on his efforts.
> 
> ---
> Changes in v7:
> 1. Refine code to add LoongArch support in test case
> set_memory_region_test.
> 
> Changes in v6:
> 1. Refresh the patch based on latest kernel 6.8-rc1, add LoongArch
> support about testcase set_memory_region_test.
> 2. Add hardware_disable_test test case.
> 3. Drop modification about macro DEFAULT_GUEST_TEST_MEM, it is problem
> of LoongArch binutils, this issue is raised to LoongArch binutils owners.
> 
> Changes in v5:
> 1. In LoongArch kvm self tests, the DEFAULT_GUEST_TEST_MEM could be
> 0x130000000, it is different from the default value in memstress.h.
> So we Move the definition of DEFAULT_GUEST_TEST_MEM into LoongArch
> ucall.h, and add 'ifndef' condition for DEFAULT_GUEST_TEST_MEM
> in memstress.h.
> 
> Changes in v4:
> 1. Remove the based-on flag, as the LoongArch KVM patch series
> have been accepted by Linux kernel, so this can be applied directly
> in kernel.
> 
> Changes in v3:
> 1. Improve implementation of LoongArch VM page walk.
> 2. Add exception handler for LoongArch.
> 3. Add dirty_log_test, dirty_log_perf_test, guest_print_test
> test cases for LoongArch.
> 4. Add __ASSEMBLER__ macro to distinguish asm file and c file.
> 5. Move ucall_arch_do_ucall to the header file and make it as
> static inline to avoid function calls.
> 6. Change the DEFAULT_GUEST_TEST_MEM base addr for LoongArch.
> 
> Changes in v2:
> 1. We should use ".balign 4096" to align the assemble code with 4K in
> exception.S instead of "align 12".
> 2. LoongArch only supports 3 or 4 levels page tables, so we remove the
> hanlders for 2-levels page table.
> 3. Remove the DEFAULT_LOONGARCH_GUEST_STACK_VADDR_MIN and use the common
> DEFAULT_GUEST_STACK_VADDR_MIN to allocate stack memory in guest.
> 4. Reorganize the test cases supported by LoongArch.
> 5. Fix some code comments.
> 6. Add kvm_binary_stats_test test case into LoongArch KVM selftests.
> 
> ---
> Tianrui Zhao (4):
>    KVM: selftests: Add KVM selftests header files for LoongArch
>    KVM: selftests: Add core KVM selftests support for LoongArch
>    KVM: selftests: Add ucall test support for LoongArch
>    KVM: selftests: Add test cases for LoongArch
> 
>   tools/testing/selftests/kvm/Makefile          |  16 +
>   .../selftests/kvm/include/kvm_util_base.h     |   5 +
>   .../kvm/include/loongarch/processor.h         | 133 +++++++
>   .../selftests/kvm/include/loongarch/ucall.h   |  20 ++
>   .../selftests/kvm/lib/loongarch/exception.S   |  59 ++++
>   .../selftests/kvm/lib/loongarch/processor.c   | 332 ++++++++++++++++++
>   .../selftests/kvm/lib/loongarch/ucall.c       |  38 ++
>   .../selftests/kvm/set_memory_region_test.c    |   2 +-
>   8 files changed, 604 insertions(+), 1 deletion(-)
>   create mode 100644 tools/testing/selftests/kvm/include/loongarch/processor.h
>   create mode 100644 tools/testing/selftests/kvm/include/loongarch/ucall.h
>   create mode 100644 tools/testing/selftests/kvm/lib/loongarch/exception.S
>   create mode 100644 tools/testing/selftests/kvm/lib/loongarch/processor.c
>   create mode 100644 tools/testing/selftests/kvm/lib/loongarch/ucall.c
> 
> 
> base-commit: 6764c317b6bb91bd806ef79adf6d9c0e428b191e
>
bibo mao March 14, 2024, 3:03 a.m. UTC | #2
Paolo, Sean

ping again -:)

There is little materials for Loongarch. Can I apply merge privilege for 
Loongarch kvm if you are not convenient to give the review comments?

Regards
Bibo Mao

On 2024/2/2 下午12:10, Bibo Mao wrote:
> This patchset adds KVM selftests for LoongArch system, currently only
> some common test cases are supported and pass to run. These testcase
> are listed as following:
>          demand_paging_test
>          dirty_log_perf_test
>          dirty_log_test
>          guest_print_test
>          hardware_disable_test
>          kvm_binary_stats_test
>          kvm_create_max_vcpus
>          kvm_page_table_test
>          memslot_modification_stress_test
>          memslot_perf_test
>          set_memory_region_test
> 
> This patchset originally is posted from zhaotianrui, I continue to work
> on his efforts.
> 
> ---
> Changes in v7:
> 1. Refine code to add LoongArch support in test case
> set_memory_region_test.
> 
> Changes in v6:
> 1. Refresh the patch based on latest kernel 6.8-rc1, add LoongArch
> support about testcase set_memory_region_test.
> 2. Add hardware_disable_test test case.
> 3. Drop modification about macro DEFAULT_GUEST_TEST_MEM, it is problem
> of LoongArch binutils, this issue is raised to LoongArch binutils owners.
> 
> Changes in v5:
> 1. In LoongArch kvm self tests, the DEFAULT_GUEST_TEST_MEM could be
> 0x130000000, it is different from the default value in memstress.h.
> So we Move the definition of DEFAULT_GUEST_TEST_MEM into LoongArch
> ucall.h, and add 'ifndef' condition for DEFAULT_GUEST_TEST_MEM
> in memstress.h.
> 
> Changes in v4:
> 1. Remove the based-on flag, as the LoongArch KVM patch series
> have been accepted by Linux kernel, so this can be applied directly
> in kernel.
> 
> Changes in v3:
> 1. Improve implementation of LoongArch VM page walk.
> 2. Add exception handler for LoongArch.
> 3. Add dirty_log_test, dirty_log_perf_test, guest_print_test
> test cases for LoongArch.
> 4. Add __ASSEMBLER__ macro to distinguish asm file and c file.
> 5. Move ucall_arch_do_ucall to the header file and make it as
> static inline to avoid function calls.
> 6. Change the DEFAULT_GUEST_TEST_MEM base addr for LoongArch.
> 
> Changes in v2:
> 1. We should use ".balign 4096" to align the assemble code with 4K in
> exception.S instead of "align 12".
> 2. LoongArch only supports 3 or 4 levels page tables, so we remove the
> hanlders for 2-levels page table.
> 3. Remove the DEFAULT_LOONGARCH_GUEST_STACK_VADDR_MIN and use the common
> DEFAULT_GUEST_STACK_VADDR_MIN to allocate stack memory in guest.
> 4. Reorganize the test cases supported by LoongArch.
> 5. Fix some code comments.
> 6. Add kvm_binary_stats_test test case into LoongArch KVM selftests.
> 
> ---
> Tianrui Zhao (4):
>    KVM: selftests: Add KVM selftests header files for LoongArch
>    KVM: selftests: Add core KVM selftests support for LoongArch
>    KVM: selftests: Add ucall test support for LoongArch
>    KVM: selftests: Add test cases for LoongArch
> 
>   tools/testing/selftests/kvm/Makefile          |  16 +
>   .../selftests/kvm/include/kvm_util_base.h     |   5 +
>   .../kvm/include/loongarch/processor.h         | 133 +++++++
>   .../selftests/kvm/include/loongarch/ucall.h   |  20 ++
>   .../selftests/kvm/lib/loongarch/exception.S   |  59 ++++
>   .../selftests/kvm/lib/loongarch/processor.c   | 332 ++++++++++++++++++
>   .../selftests/kvm/lib/loongarch/ucall.c       |  38 ++
>   .../selftests/kvm/set_memory_region_test.c    |   2 +-
>   8 files changed, 604 insertions(+), 1 deletion(-)
>   create mode 100644 tools/testing/selftests/kvm/include/loongarch/processor.h
>   create mode 100644 tools/testing/selftests/kvm/include/loongarch/ucall.h
>   create mode 100644 tools/testing/selftests/kvm/lib/loongarch/exception.S
>   create mode 100644 tools/testing/selftests/kvm/lib/loongarch/processor.c
>   create mode 100644 tools/testing/selftests/kvm/lib/loongarch/ucall.c
> 
> 
> base-commit: 6764c317b6bb91bd806ef79adf6d9c0e428b191e
>