[LTP] [PATCH 4/7] KVM: Add async communication helper functions

Petr Vorel pvorel@suse.cz
Thu May 18 00:47:46 CEST 2023


Hi Martin,

Acked-by: Petr Vorel <pvorel@suse.cz>

>  /*
>   * Result value indicating end of test. If the test program exits using
>   * the HLT instruction with any valid result value other than KVM_TEXIT or
> diff --git a/testcases/kernel/kvm/include/kvm_guest.h b/testcases/kernel/kvm/include/kvm_guest.h
> index ec13c5845..96f246155 100644
> --- a/testcases/kernel/kvm/include/kvm_guest.h
> +++ b/testcases/kernel/kvm/include/kvm_guest.h
> @@ -64,6 +64,20 @@ void tst_brk_(const char *file, const int lineno, int result,
>  	const char *message) __attribute__((noreturn));
>  #define tst_brk(result, msg) tst_brk_(__FILE__, __LINE__, (result), (msg))

BTW (unrelated to this commit, as it was not added to this commit) tst_brk()
definition from include/tst_test.h contains also
TST_BRK_SUPPORTS_ONLY_TCONF_TBROK().

And tst_res() has also TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN().

We could rename tst_res_flags.h to tst_res.h and add there tst_brk() and
tst_res() definitions and tst_brk_() and tst_res_() signatures.

> +
>  #endif /* KVM_HOST_H_ */
> diff --git a/testcases/kernel/kvm/lib_guest.c b/testcases/kernel/kvm/lib_guest.c
> index d3b2ac3d5..f3e21d3d6 100644
> --- a/testcases/kernel/kvm/lib_guest.c
> +++ b/testcases/kernel/kvm/lib_guest.c
> @@ -155,6 +155,22 @@ void tst_brk_(const char *file, const int lineno, int result,
>  	kvm_exit();
>  }

> +void tst_signal_host(void *data)
> +{
> +	test_result->file_addr = (uintptr_t)data;
> +	test_result->result = KVM_TSYNC;
> +}
> +
> +void tst_wait_host(void *data)
> +{
> +	volatile int32_t *vres = &test_result->result;
> +
> +	tst_signal_host(data);
> +
> +	while (*vres != KVM_TNONE)
> +		;
Interesting there is no any usleep().

Kind regards,
Petr


More information about the ltp mailing list