Re: [kvm-unit-tests PATCH 1/5] lib: s390x: vm: Add kvm and lpar vm queries

Nico Boehr
2022-01-14T13:27:57Z

On Fri, 2022-01-14 at 10:02 +0000, Janosch Frank wrote:
> This patch will likely (in parts) be replaced by Pierre's patch from
> his topology test series.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  lib/s390x/vm.c | 39 +++++++++++++++++++++++++++++++++++++++
>  lib/s390x/vm.h | 23 +++++++++++++++++++++++
>  s390x/stsi.c   | 21 +--------------------
>  3 files changed, 63 insertions(+), 20 deletions(-)
>
> diff --git a/lib/s390x/vm.c b/lib/s390x/vm.c
> index a5b92863..266a81c1 100644
> --- a/lib/s390x/vm.c
> +++ b/lib/s390x/vm.c
> @@ -26,6 +26,11 @@ bool vm_is_tcg(void)
>         if (initialized)
>                 return is_tcg;
>
> +       if (stsi_get_fc() < 3) {
> +               initialized = true;
> +               return false;

Minor nit: By setting initialized to true, you rely on the previous
initialization of is_tcg to false for subsequent calls.

You could make this more obvious by saying:

return is_tcg;