On Fri, 10 Jun 2022 10:49:28 +0200 Janosch Frank <frankja@xxxxxxxxxxxxx> wrote: > On 6/8/22 15:13, Nico Boehr wrote: > > diff --git a/s390x/migration-skey.c b/s390x/migration-skey.c > > new file mode 100644 > > index 000000000000..323aa83202bb [...] > > +static void test_migration(void) > > +{ > > + union skey expected_key, actual_key; > > + int i, key_to_set; > > + > > + for (i = 0; i < NUM_PAGES; i++) { > > + /* > > + * Storage keys are 7 bit, lowest bit is always returned as zero > > + * by iske > > + */ > > Maybe add: > This loop will set all 7 bits which means we set fetch protection as > well as reference and change indication for some keys. OK, done. > > > + key_to_set = i * 2; > > + set_storage_key(pagebuf[i], key_to_set, 1); > > + } > > + > > + puts("Please migrate me, then press return\n"); > > + (void)getchar(); > > + > > + for (i = 0; i < NUM_PAGES; i++) { > > + report_prefix_pushf("page %d", i); > > + > > + actual_key.val = get_storage_key(pagebuf[i]); > > iske is nice but I think it would also be interesting to check if the > actual memory protection was carried over. The iske check is enough for > now though. OK, we can add an access check later on if we think it's needed. > > > + expected_key.val = i * 2; > > + > > + /* ignore reference bit */ > > + actual_key.str.rf = 0; > > + expected_key.str.rf = 0; > > + > > + report(actual_key.val == expected_key.val, "expected_key=0x%x actual_key=0x%x", expected_key.val, actual_key.val); > > This spams the log with useless information and hence I generally try to > avoid printing large loops. > > Instead we should print all fails or a simple success message if all > comparisons were successful. OK will be in the next version.