Re: [kvm-unit-tests PATCH v1 4/4] s390x: add selftest for migration

Thomas Huth
2022-04-11T15:32:03Z

On 11/04/2022 12.07, Nico Boehr wrote:
> Add a selftest to check we can do migration tests.
>
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
> s390x/Makefile | 1 +
> s390x/selftest-migration.c | 27 +++++++++++++++++++++++++++
> s390x/unittests.cfg | 4 ++++
> 3 files changed, 32 insertions(+)
> create mode 100644 s390x/selftest-migration.c
>
> diff --git a/s390x/Makefile b/s390x/Makefile
> index 62e197cb93d7..2e43e323bcb5 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -26,6 +26,7 @@ tests += $(TEST_DIR)/edat.elf
> tests += $(TEST_DIR)/mvpg-sie.elf
> tests += $(TEST_DIR)/spec_ex-sie.elf
> tests += $(TEST_DIR)/firq.elf
> +tests += $(TEST_DIR)/selftest-migration.elf
>
> pv-tests += $(TEST_DIR)/pv-diags.elf
>
> diff --git a/s390x/selftest-migration.c b/s390x/selftest-migration.c
> new file mode 100644
> index 000000000000..8884322a84ca
> --- /dev/null
> +++ b/s390x/selftest-migration.c
> @@ -0,0 +1,27 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Migration Selftest
> + *
> + * Copyright IBM Corp. 2022
> + *
> + * Authors:
> + * Nico Boehr <nrb@linux.ibm.com>
> + */
> +#include <libcflat.h>
> +
> +int main(void)
> +{
> + /* don't say migrate here otherwise we will migrate right away */
> + report_prefix_push("selftest migration");
> +
> + /* ask migrate_cmd to migrate (it listens for 'migrate') */
> + puts("Please migrate me\n");
> +
> + /* wait for migration to finish, we will read a newline */
> + (void)getchar();
> +
> + report_pass("Migrated");
> +
> + report_prefix_pop();
> + return report_summary();
> +}

Thanks for tackling this!

Having written powerpc/sprs.c in the past, I've got one question / request:

Could we turn this into a "real" test immediately? E.g. write a sane value
to all control registers that are currently not in use by the k-u-t before
migration, and then check whether the values are still in there after
migration? Maybe also some vector registers and the "guarded storage control"?
... or is this rather something for a later update?

Thomas