Re: [kvm-unit-tests PATCH v2 4/4] lib: s390x: snippet: Add function to create a guest of specific length

Christoph Schlameuss
2026-04-21T15:30:35Z

On Mon Apr 20, 2026 at 10:44 AM CEST, Janosch Frank wrote:
> While 1MB is certainly enough to store the guest code, it's often not
> enough for memory tests. Let's add a separate function to allow
> arbitrary guest sizes.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Nico Boehr <nrb@linux.ibm.com>

Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>

> ---
> lib/s390x/snippet.h | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/lib/s390x/snippet.h b/lib/s390x/snippet.h
> index 94688f49..05c9a2d4 100644
> --- a/lib/s390x/snippet.h
> +++ b/lib/s390x/snippet.h
> @@ -123,10 +123,14 @@ static inline void snippet_pv_init(struct vm *vm, const char *gbin,
> }
>
> /* Allocates and sets up a snippet based guest */
> -static inline void snippet_setup_guest(struct vm *vm, bool is_pv)
> +static inline void snippet_setup_guest_len(struct vm *vm, bool is_pv,
> + unsigned long len)
> {
> + /* Guest sizes are specified in megabyte chunks */
> + assert(!(len & ~HPAGE_MASK));
> +
> /* Initialize the vm struct and allocate control blocks */
> - sie_guest_create(vm, SZ_1M);
> + sie_guest_create(vm, len);
>
> if (is_pv) {
> /* FMT4 needs a ESCA */
> @@ -141,6 +145,12 @@ static inline void snippet_setup_guest(struct vm *vm, bool is_pv)
> }
> }
>
> +/* Allocates and sets up a snippet based guest */
> +static inline void snippet_setup_guest(struct vm *vm, bool is_pv)
> +{
> + snippet_setup_guest_len(vm, is_pv, SZ_1M);
> +}
> +
> static inline void snippet_destroy_guest(struct vm *vm)
> {
> sie_guest_destroy(vm);