* [kvm-unit-tests PATCH] s390x/skey: Skip the "iske" test when running under z/VM 6
@ 2019-04-11 5:53 Thomas Huth
2019-04-11 11:40 ` Christian Borntraeger
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2019-04-11 5:53 UTC (permalink / raw)
To: kvm, David Hildenbrand; +Cc: Janosch Frank
There is a known bug of z/VM 6 which causes the "iske" test to fail.
Since it is still sometimes useful to run the kvm-unit-tests in such
a nested environment, let's rather skip the "iske" test there instead
of always reporting a failure.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
s390x/skey.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 51 insertions(+), 4 deletions(-)
diff --git a/s390x/skey.c b/s390x/skey.c
index f4894f1..b1e11af 100644
--- a/s390x/skey.c
+++ b/s390x/skey.c
@@ -70,9 +70,51 @@ static void test_set(void)
skey.str.acc == ret.str.acc && skey.str.fp == ret.str.fp);
}
+static inline int stsi(void *addr, int fc, int sel1, int sel2)
+{
+ register int r0 asm("0") = (fc << 28) | sel1;
+ register int r1 asm("1") = sel2;
+ int rc = 0;
+
+ asm volatile(
+ " stsi 0(%3)\n"
+ " jz 0f\n"
+ " lhi %1,-1\n"
+ "0:\n"
+ : "+d" (r0), "+d" (rc)
+ : "d" (r1), "a" (addr)
+ : "cc", "memory");
+
+ return rc;
+}
+
+/* Returns true if we are running under z/VM 6.x */
+static bool check_for_zvm6(void)
+{
+ int dcbt; /* Descriptor block count */
+ int nr;
+ static const unsigned char zvm6[] = {
+ /* This is "z/VM 6" in EBCDIC */
+ 0xa9, 0x61, 0xe5, 0xd4, 0x40, 0x40, 0x40, 0x40, 0xf6
+ };
+
+ if (stsi(pagebuf, 3, 2, 2))
+ return false;
+
+ dcbt = pagebuf[31] & 0xf;
+
+ for (nr = 0; nr < dcbt; nr++) {
+ if (!memcmp(&pagebuf[32 + nr * 64 + 24], zvm6, sizeof(zvm6)))
+ return true;
+ }
+
+ return false;
+}
+
static void test_priv(void)
{
union skey skey;
+ bool is_zvm6 = check_for_zvm6();
memset(pagebuf, 0, PAGE_SIZE * 2);
report_prefix_push("privileged");
@@ -87,10 +129,15 @@ static void test_priv(void)
report("skey did not change on exception", skey.str.acc != 3);
report_prefix_push("iske");
- expect_pgm_int();
- enter_pstate();
- get_storage_key(page0);
- check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION);
+ if (is_zvm6) {
+ /* There is a known bug with z/VM 6, so skip the test there */
+ report_skip("not working on z/VM 6");
+ } else {
+ expect_pgm_int();
+ enter_pstate();
+ get_storage_key(page0);
+ check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION);
+ }
report_prefix_pop();
report_prefix_pop();
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [kvm-unit-tests PATCH] s390x/skey: Skip the "iske" test when running under z/VM 6
2019-04-11 5:53 [kvm-unit-tests PATCH] s390x/skey: Skip the "iske" test when running under z/VM 6 Thomas Huth
@ 2019-04-11 11:40 ` Christian Borntraeger
2019-04-11 11:46 ` Thomas Huth
0 siblings, 1 reply; 3+ messages in thread
From: Christian Borntraeger @ 2019-04-11 11:40 UTC (permalink / raw)
To: Thomas Huth, kvm, David Hildenbrand; +Cc: Janosch Frank
On 11.04.19 07:53, Thomas Huth wrote:
> There is a known bug of z/VM 6 which causes the "iske" test to fail.
> Since it is still sometimes useful to run the kvm-unit-tests in such
> a nested environment, let's rather skip the "iske" test there instead
> of always reporting a failure.
I have seen the skey test fail as well, but only on 6.3. IIRC 6.4 was good.
Do you have a bug number or an offical statement whatever (I did not found
one).
In general
Ack.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> s390x/skey.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 51 insertions(+), 4 deletions(-)
>
> diff --git a/s390x/skey.c b/s390x/skey.c
> index f4894f1..b1e11af 100644
> --- a/s390x/skey.c
> +++ b/s390x/skey.c
> @@ -70,9 +70,51 @@ static void test_set(void)
> skey.str.acc == ret.str.acc && skey.str.fp == ret.str.fp);
> }
>
> +static inline int stsi(void *addr, int fc, int sel1, int sel2)
> +{
> + register int r0 asm("0") = (fc << 28) | sel1;
> + register int r1 asm("1") = sel2;
> + int rc = 0;
> +
> + asm volatile(
> + " stsi 0(%3)\n"
> + " jz 0f\n"
> + " lhi %1,-1\n"
> + "0:\n"
> + : "+d" (r0), "+d" (rc)
> + : "d" (r1), "a" (addr)
> + : "cc", "memory");
> +
> + return rc;
> +}
> +
> +/* Returns true if we are running under z/VM 6.x */
> +static bool check_for_zvm6(void)
> +{
> + int dcbt; /* Descriptor block count */
> + int nr;
> + static const unsigned char zvm6[] = {
> + /* This is "z/VM 6" in EBCDIC */
> + 0xa9, 0x61, 0xe5, 0xd4, 0x40, 0x40, 0x40, 0x40, 0xf6
> + };
> +
> + if (stsi(pagebuf, 3, 2, 2))
> + return false;
> +
> + dcbt = pagebuf[31] & 0xf;
> +
> + for (nr = 0; nr < dcbt; nr++) {
> + if (!memcmp(&pagebuf[32 + nr * 64 + 24], zvm6, sizeof(zvm6)))
> + return true;
> + }
> +
> + return false;
> +}
> +
> static void test_priv(void)
> {
> union skey skey;
> + bool is_zvm6 = check_for_zvm6();
>
> memset(pagebuf, 0, PAGE_SIZE * 2);
> report_prefix_push("privileged");
> @@ -87,10 +129,15 @@ static void test_priv(void)
> report("skey did not change on exception", skey.str.acc != 3);
>
> report_prefix_push("iske");
> - expect_pgm_int();
> - enter_pstate();
> - get_storage_key(page0);
> - check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION);
> + if (is_zvm6) {
> + /* There is a known bug with z/VM 6, so skip the test there */
> + report_skip("not working on z/VM 6");
> + } else {
> + expect_pgm_int();
> + enter_pstate();
> + get_storage_key(page0);
> + check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION);
> + }
> report_prefix_pop();
>
> report_prefix_pop();
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [kvm-unit-tests PATCH] s390x/skey: Skip the "iske" test when running under z/VM 6
2019-04-11 11:40 ` Christian Borntraeger
@ 2019-04-11 11:46 ` Thomas Huth
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2019-04-11 11:46 UTC (permalink / raw)
To: Christian Borntraeger, kvm, David Hildenbrand; +Cc: Janosch Frank
On 11/04/2019 13.40, Christian Borntraeger wrote:
> On 11.04.19 07:53, Thomas Huth wrote:
>> There is a known bug of z/VM 6 which causes the "iske" test to fail.
>> Since it is still sometimes useful to run the kvm-unit-tests in such
>> a nested environment, let's rather skip the "iske" test there instead
>> of always reporting a failure.
>
> I have seen the skey test fail as well, but only on 6.3. IIRC 6.4 was good.
According to the information from /proc/sysinfo, we've got 6.4.0 here,
and it is failing for me on that system.
> Do you have a bug number or an offical statement whatever (I did not found
> one).
No, I only heard from Janosch that it should have been fixed in a later
version ... so I was rather assuming that it has been fixed in z/VM 7 ?
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-11 11:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-11 5:53 [kvm-unit-tests PATCH] s390x/skey: Skip the "iske" test when running under z/VM 6 Thomas Huth
2019-04-11 11:40 ` Christian Borntraeger
2019-04-11 11:46 ` Thomas Huth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox