Re: [kvm-unit-tests PATCH v3 5/5] s390x: css: testing measurement block format 1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2/26/21 11:02 AM, Janosch Frank wrote:
On 2/18/21 6:26 PM, Pierre Morel wrote:
Measurement block format 1 is made available by the extended
measurement block facility and is indicated in the SCHIB by
the bit in the PMCW.

...

+void msch_with_wrong_fmt1_mbo(unsigned int schid, uint64_t mb)
+{
+	struct pmcw *pmcw = &schib.pmcw;
+	int cc;
+
+	/* Read the SCHIB for this subchannel */
+	cc = stsch(schid, &schib);
+	if (cc) {> +		report(0, "stsch: sch %08x failed with cc=%d", schid, cc);
+		return;
+	}
+
+	/* Update the SCHIB to enable the measurement block */
+	pmcw->flags |= PMCW_MBUE;
+	pmcw->flags2 |= PMCW_MBF1;
+	schib.mbo = mb;
+
+	/* Tell the CSS we want to modify the subchannel */
+	expect_pgm_int();
+	cc = msch(schid, &schib);
+	check_pgm_int_code(PGM_INT_CODE_OPERAND);

Why would you expect a PGM in a library function are PGMs normal for IO
instructions? oO

Is this a test function which should be part of your test file in
s390x/*.c or is it part of the IO library which should:

  - Abort if an initialization failed and we can assume that future tests
are now useless
  - Return an error so the test can report an error
  - Return success



Now it looks clear to me that this test belongs to the tests and not the lib. I put it there to avoid exporting the SCHIB, but after all, why not exporting the SCHIB, we may need access to it from other tests again in the future.




+}
diff --git a/s390x/css.c b/s390x/css.c
index b65aa89..576df48 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -257,6 +257,58 @@ end:
  	report_prefix_pop();
  }
+/*
+ * test_schm_fmt1:
+ * With measurement block format 1 the mesurement block is
+ * dedicated to a subchannel.
+ */
+static void test_schm_fmt1(void)
+{
+	struct measurement_block_format1 *mb1;
+
+	report_prefix_push("Format 1");
+
+	if (!test_device_sid) {
+		report_skip("No device");
+		goto end;
+	}

...

+	report(start_measure((u64)mb1, 0, true) &&
+	       mb1->ssch_rsch_count == SCHM_UPDATE_CNT,
+	       "SSCH measured %d", mb1->ssch_rsch_count);
+	report_prefix_pop();
+
+	schm(NULL, 0); /* Stop the measurement */
+	free_io_mem(mb1, sizeof(struct measurement_block_format1));
+end:
+	report_prefix_pop();
+}
+
  static struct {
  	const char *name;
  	void (*func)(void);
@@ -268,6 +320,7 @@ static struct {
  	{ "sense (ssch/tsch)", test_sense },
  	{ "measurement block (schm)", test_schm },
  	{ "measurement block format0", test_schm_fmt0 },
+	{ "measurement block format1", test_schm_fmt1 },

Output will then be:
"measurement block format1: Format 1: Report message"

Wouldn't it make more sense to put the format 0 and 1 tests into
test_schm() so we'd have:
"measurement block (schm): Format 0: Report message" ?

too much prefix push...
rationalizing will make the goto disapear...

Thanks for review
Regards,
Pierre

--
Pierre Morel
IBM Lab Boeblingen



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux