public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] kvm: Allow running multiple iterations of a test
Date: Thu, 19 May 2022 14:52:03 +0200	[thread overview]
Message-ID: <YoY9c4I7bGX+Nkrn@yuki> (raw)
In-Reply-To: <20220506142125.15564-2-mdoucha@suse.cz>

Hi!
> This fixes running the test with "-i N" for N>1. It's a lazy fix but
> the alternative would be saving the initial CPU state in up to 3 separate
> buffers and then restoring it after each test run. And the number of buffers
> differs on different archs. And ARM64 has an extra ioctl() instead...
> 
> I also wonder whether I should implement LTP library function to free
> individual guarded buffers because I don't like calling tst_free_all()
> directly.

Well I guess that we can do that later on. It should be easy enough if
we switch to a double linked list and do a linear search, after all I
doubt that we will allocate more than a few buffers this way.

>  testcases/kernel/kvm/lib_host.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/kvm/lib_host.c b/testcases/kernel/kvm/lib_host.c
> index b8994f34e..2782e68b0 100644
> --- a/testcases/kernel/kvm/lib_host.c
> +++ b/testcases/kernel/kvm/lib_host.c
> @@ -269,16 +269,20 @@ void tst_kvm_destroy_instance(struct tst_kvm_instance *inst)
>  		SAFE_CLOSE(inst->vcpu_fd);
>  
>  	SAFE_CLOSE(inst->vm_fd);
> +	memset(inst->ram, 0, sizeof(inst->ram));
>  }
>  
>  void tst_kvm_setup(void)
>  {
> -	tst_kvm_create_instance(&test_vm, DEFAULT_RAM_SIZE);
> +
>  }
>  
>  void tst_kvm_run(void)
>  {
> +	tst_kvm_create_instance(&test_vm, DEFAULT_RAM_SIZE);
>  	tst_kvm_run_instance(&test_vm);
> +	tst_kvm_destroy_instance(&test_vm);
> +	tst_free_all();
>  }

Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-05-19 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 14:21 [LTP] [PATCH 1/2] kvm: Add VM memory access helper functions to host library Martin Doucha
2022-05-06 14:21 ` [LTP] [PATCH 2/2] kvm: Allow running multiple iterations of a test Martin Doucha
2022-05-19 12:52   ` Cyril Hrubis [this message]
2022-05-19 14:28 ` [LTP] [PATCH 1/2] kvm: Add VM memory access helper functions to host library Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoY9c4I7bGX+Nkrn@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox