From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
To: Nico Boehr <nrb@linux.ibm.com>, kvm@vger.kernel.org
Cc: frankja@linux.ibm.com, imbrenda@linux.ibm.com, thuth@redhat.com
Subject: Re: [kvm-unit-tests PATCH v3 1/1] s390x: add parallel skey migration test
Date: Wed, 14 Dec 2022 19:27:15 +0100 [thread overview]
Message-ID: <6116d3af273718915c0f57356ab6d09a8293600a.camel@linux.ibm.com> (raw)
In-Reply-To: <20221214123814.651451-2-nrb@linux.ibm.com>
On Wed, 2022-12-14 at 13:38 +0100, Nico Boehr wrote:
> Right now, we have a test which sets storage keys, then migrates the VM
> and - after migration finished - verifies the skeys are still there.
>
> Add a new version of the test which changes storage keys while the
> migration is in progress. This is achieved by adding a command line
> argument to the existing migration-skey test.
>
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Indentation should be fixed IMO, feel free to ignore the rest.
> ---
> s390x/migration-skey.c | 218 +++++++++++++++++++++++++++++++++++++----
> s390x/unittests.cfg | 15 ++-
> 2 files changed, 210 insertions(+), 23 deletions(-)
>
> diff --git a/s390x/migration-skey.c b/s390x/migration-skey.c
> index a91eb6b5a63e..0f862cc9d821 100644
> --- a/s390x/migration-skey.c
> +++ b/s390x/migration-skey.c
>
[...]
> +/*
> + * Verify storage keys on pagebuf.
> + * Storage keys must have been set by set_test_pattern on pagebuf before.
> + * set_test_pattern must have been called with the same seed value.
> + *
> + * If storage keys match the expected result, will return a verify_result
> + * with verify_failed false. All other fields are then invalid.
> + * If there is a mismatch, returned struct will have verify_failed true and will
> + * be filled with the details on the first mismatch encountered.
> + */
> +static struct verify_result verify_test_pattern(unsigned char seed)
> +{
> + union skey expected_key, actual_key;
> + struct verify_result result = {
> + .verify_failed = true
> + };
> + uint8_t *cur_page;
> + unsigned long i;
>
> for (i = 0; i < NUM_PAGES; i++) {
> - actual_key.val = get_storage_key(pagebuf[i]);
> - expected_key.val = i * 2;
> + cur_page = pagebuf + i * PAGE_SIZE;
> + actual_key.val = get_storage_key(cur_page);
> + expected_key.val = (i ^ seed) * 2;
>
> /*
> * The PoP neither gives a guarantee that the reference bit is
> @@ -51,27 +105,153 @@ static void test_migration(void)
> actual_key.str.rf = 0;
> expected_key.str.rf = 0;
>
> - /* don't log anything when key matches to avoid spamming the log */
> if (actual_key.val != expected_key.val) {
> - key_mismatches++;
> - report_fail("page %d expected_key=0x%x actual_key=0x%x", i, expected_key.val, actual_key.val);
I feel like setting verify_failed here also would be nicer. Could also do
return (struct verify_result) {
...
}
Just a suggestion.
> + result.expected_key.val = expected_key.val;
> + result.actual_key.val = actual_key.val;
> + result.page_mismatch_idx = i;
> + result.page_mismatch_addr = (unsigned long)cur_page;
> + return result;
> }
> }
>
> - report(!key_mismatches, "skeys after migration match");
> + result.verify_failed = false;
> + return result;
> +}
> +
> +static void report_verify_result(struct verify_result * const result)
Why const? Why not also pointer to const?
> +{
> + if (result->verify_failed)
> + report_fail("page skey mismatch: first page idx = %lu, addr = 0x%lx, "
> + "expected_key = 0x%x, actual_key = 0x%x",
Indent is off here.
I have a slight preference for %02x for the keys. Just a suggestion.
> + result->page_mismatch_idx, result->page_mismatch_addr,
> + result->expected_key.val, result->actual_key.val);
> + else
> + report_pass("skeys match");
> +}
> +
>
[...]
> -int main(void)
> +int main(int argc, char **argv)
> {
> report_prefix_push("migration-skey");
>
> - if (test_facility(169))
> + if (test_facility(169)) {
> report_skip("storage key removal facility is active");
> - else
> - test_migration();
> + goto error;
> + }
>
> - migrate_once();
> + parse_args(argc, argv);
> +
> + switch (arg_test_to_run) {
break statements should be indented.
> + case TEST_SEQUENTIAL:
> + test_skey_migration_sequential();
> + break;
> + case TEST_PARALLEL:
> + test_skey_migration_parallel();
> + break;
> + default:
> + print_usage();
> + break;
> + }
>
> +error:
> + migrate_once();
> report_prefix_pop();
> return report_summary();
> }
[...]
next prev parent reply other threads:[~2022-12-14 18:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 12:38 [kvm-unit-tests PATCH v3 0/1] s390x: test storage keys during migration Nico Boehr
2022-12-14 12:38 ` [kvm-unit-tests PATCH v3 1/1] s390x: add parallel skey migration test Nico Boehr
2022-12-14 13:42 ` Claudio Imbrenda
2022-12-14 18:27 ` Nina Schoetterl-Glausch [this message]
2022-12-15 9:59 ` Nico Boehr
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=6116d3af273718915c0f57356ab6d09a8293600a.camel@linux.ibm.com \
--to=nsg@linux.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=thuth@redhat.com \
/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