Re: [PATCH] KVM: selftests: Fix build on architectures other than x86_64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 30, 2024 at 8:10 PM Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> The recent addition of support for testing with the x86 specific quirk
> KVM_X86_QUIRK_SLOT_ZAP_ALL disabled in the generic memslot tests broke the
> build of the KVM selftests for all other architectures:
>
> In file included from include/kvm_util.h:8,
>                  from include/memstress.h:13,
>                  from memslot_modification_stress_test.c:21:
> memslot_modification_stress_test.c: In function ‘main’:
> memslot_modification_stress_test.c:176:38: error: ‘KVM_X86_QUIRK_SLOT_ZAP_ALL’ undeclared (first use in this function)
>   176 |                                      KVM_X86_QUIRK_SLOT_ZAP_ALL);
>       |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Add __x86_64__ guard defines to avoid building the relevant code on other
> architectures.
>
> Fixes: 61de4c34b51c ("KVM: selftests: Test memslot move in memslot_perf_test with quirk disabled")
> Fixes: 218f6415004a ("KVM: selftests: Allow slot modification stress test with quirk disabled")
> Reported-by: Aishwarya TCV <aishwarya.tcv@xxxxxxx>
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>

Queued, thanks.  Sorry for the disruption.

Paolo

> ---
> This is obviously disruptive for testing of KVM changes on non-x86
> architectures.
> ---
>  tools/testing/selftests/kvm/memslot_modification_stress_test.c | 2 ++
>  tools/testing/selftests/kvm/memslot_perf_test.c                | 6 ++++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/memslot_modification_stress_test.c b/tools/testing/selftests/kvm/memslot_modification_stress_test.c
> index e3343f0df9e1..c81a84990eab 100644
> --- a/tools/testing/selftests/kvm/memslot_modification_stress_test.c
> +++ b/tools/testing/selftests/kvm/memslot_modification_stress_test.c
> @@ -169,12 +169,14 @@ int main(int argc, char *argv[])
>                 case 'i':
>                         p.nr_iterations = atoi_positive("Number of iterations", optarg);
>                         break;
> +#ifdef __x86_64__
>                 case 'q':
>                         p.disable_slot_zap_quirk = true;
>
>                         TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
>                                      KVM_X86_QUIRK_SLOT_ZAP_ALL);
>                         break;
> +#endif
>                 case 'h':
>                 default:
>                         help(argv[0]);
> diff --git a/tools/testing/selftests/kvm/memslot_perf_test.c b/tools/testing/selftests/kvm/memslot_perf_test.c
> index 893366982f77..989ffe0d047f 100644
> --- a/tools/testing/selftests/kvm/memslot_perf_test.c
> +++ b/tools/testing/selftests/kvm/memslot_perf_test.c
> @@ -113,7 +113,9 @@ static_assert(ATOMIC_BOOL_LOCK_FREE == 2, "atomic bool is not lockless");
>  static sem_t vcpu_ready;
>
>  static bool map_unmap_verify;
> +#ifdef __x86_64__
>  static bool disable_slot_zap_quirk;
> +#endif
>
>  static bool verbose;
>  #define pr_info_v(...)                         \
> @@ -579,8 +581,10 @@ static bool test_memslot_move_prepare(struct vm_data *data,
>         uint32_t guest_page_size = data->vm->page_size;
>         uint64_t movesrcgpa, movetestgpa;
>
> +#ifdef __x86_64__
>         if (disable_slot_zap_quirk)
>                 vm_enable_cap(data->vm, KVM_CAP_DISABLE_QUIRKS2, KVM_X86_QUIRK_SLOT_ZAP_ALL);
> +#endif
>
>         movesrcgpa = vm_slot2gpa(data, data->nslots - 1);
>
> @@ -971,11 +975,13 @@ static bool parse_args(int argc, char *argv[],
>                 case 'd':
>                         map_unmap_verify = true;
>                         break;
> +#ifdef __x86_64__
>                 case 'q':
>                         disable_slot_zap_quirk = true;
>                         TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
>                                      KVM_X86_QUIRK_SLOT_ZAP_ALL);
>                         break;
> +#endif
>                 case 's':
>                         targs->nslots = atoi_paranoid(optarg);
>                         if (targs->nslots <= 1 && targs->nslots != -1) {
>
> ---
> base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
> change-id: 20240930-kvm-build-breakage-a542f46d78f9
>
> Best regards,
> --
> Mark Brown <broonie@xxxxxxxxxx>
>






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux