diff mbox series

[kvm-unit-tests,1/9] s390x: uv: Tolerate 0x100 query return code

Message ID 20210922071811.1913-2-frankja@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Cleanup and maintenance 2 | expand

Commit Message

Janosch Frank Sept. 22, 2021, 7:18 a.m. UTC
RC 0x100 is not an error but a notice that we could have gotten more
data from the Ultravisor if we had asked for it. So let's tolerate
them in our tests.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/uv-guest.c | 4 ++--
 s390x/uv-host.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Claudio Imbrenda Sept. 22, 2021, 9:12 a.m. UTC | #1
On Wed, 22 Sep 2021 07:18:03 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> RC 0x100 is not an error but a notice that we could have gotten more
> data from the Ultravisor if we had asked for it. So let's tolerate
> them in our tests.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  s390x/uv-guest.c | 4 ++--
>  s390x/uv-host.c  | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
> index f05ae4c3..e7446e03 100644
> --- a/s390x/uv-guest.c
> +++ b/s390x/uv-guest.c
> @@ -70,8 +70,8 @@ static void test_query(void)
>  	report(cc == 1 && uvcb.header.rc == UVC_RC_INV_LEN, "length");
>  
>  	uvcb.header.len = sizeof(uvcb);
> -	cc = uv_call(0, (u64)&uvcb);
> -	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "successful query");
> +	uv_call(0, (u64)&uvcb);
> +	report(uvcb.header.rc == UVC_RC_EXECUTED || uvcb.header.rc
> == 0x100, "successful query");

if you want to be even more pedantic:
	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED ||
		cc == 1 && uvcb.header.rc == 0x100, ... 

>  
>  	/*
>  	 * These bits have been introduced with the very first
> diff --git a/s390x/uv-host.c b/s390x/uv-host.c
> index 28035707..66a11160 100644
> --- a/s390x/uv-host.c
> +++ b/s390x/uv-host.c
> @@ -401,7 +401,7 @@ static void test_query(void)
>  
>  	uvcb_qui.header.len = sizeof(uvcb_qui);
>  	uv_call(0, (uint64_t)&uvcb_qui);
> -	report(uvcb_qui.header.rc == UVC_RC_EXECUTED, "successful query");
> +	report(uvcb_qui.header.rc == UVC_RC_EXECUTED || uvcb_qui.header.rc == 0x100, "successful query");

same here

>  
>  	for (i = 0; cmds[i].name; i++)
>  		report(uv_query_test_call(cmds[i].call_bit), "%s", cmds[i].name);
Janosch Frank Sept. 22, 2021, 11:36 a.m. UTC | #2
On 9/22/21 11:12 AM, Claudio Imbrenda wrote:
> On Wed, 22 Sep 2021 07:18:03 +0000
> Janosch Frank <frankja@linux.ibm.com> wrote:
> 
>> RC 0x100 is not an error but a notice that we could have gotten more
>> data from the Ultravisor if we had asked for it. So let's tolerate
>> them in our tests.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>  s390x/uv-guest.c | 4 ++--
>>  s390x/uv-host.c  | 2 +-
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
>> index f05ae4c3..e7446e03 100644
>> --- a/s390x/uv-guest.c
>> +++ b/s390x/uv-guest.c
>> @@ -70,8 +70,8 @@ static void test_query(void)
>>  	report(cc == 1 && uvcb.header.rc == UVC_RC_INV_LEN, "length");
>>  
>>  	uvcb.header.len = sizeof(uvcb);
>> -	cc = uv_call(0, (u64)&uvcb);
>> -	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "successful query");
>> +	uv_call(0, (u64)&uvcb);
>> +	report(uvcb.header.rc == UVC_RC_EXECUTED || uvcb.header.rc
>> == 0x100, "successful query");
> 
> if you want to be even more pedantic:
> 	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED ||
> 		cc == 1 && uvcb.header.rc == 0x100, ... 

Yeah I pondered about that but at the end I chose to drop the cc check

> 
>>  
>>  	/*
>>  	 * These bits have been introduced with the very first
>> diff --git a/s390x/uv-host.c b/s390x/uv-host.c
>> index 28035707..66a11160 100644
>> --- a/s390x/uv-host.c
>> +++ b/s390x/uv-host.c
>> @@ -401,7 +401,7 @@ static void test_query(void)
>>  
>>  	uvcb_qui.header.len = sizeof(uvcb_qui);
>>  	uv_call(0, (uint64_t)&uvcb_qui);
>> -	report(uvcb_qui.header.rc == UVC_RC_EXECUTED, "successful query");
>> +	report(uvcb_qui.header.rc == UVC_RC_EXECUTED || uvcb_qui.header.rc == 0x100, "successful query");
> 
> same here
> 
>>  
>>  	for (i = 0; cmds[i].name; i++)
>>  		report(uv_query_test_call(cmds[i].call_bit), "%s", cmds[i].name);
>
Thomas Huth Sept. 27, 2021, 3:19 p.m. UTC | #3
On 22/09/2021 13.36, Janosch Frank wrote:
> On 9/22/21 11:12 AM, Claudio Imbrenda wrote:
>> On Wed, 22 Sep 2021 07:18:03 +0000
>> Janosch Frank <frankja@linux.ibm.com> wrote:
>>
>>> RC 0x100 is not an error but a notice that we could have gotten more
>>> data from the Ultravisor if we had asked for it. So let's tolerate
>>> them in our tests.
>>>
>>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>>> ---
>>>   s390x/uv-guest.c | 4 ++--
>>>   s390x/uv-host.c  | 2 +-
>>>   2 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
>>> index f05ae4c3..e7446e03 100644
>>> --- a/s390x/uv-guest.c
>>> +++ b/s390x/uv-guest.c
>>> @@ -70,8 +70,8 @@ static void test_query(void)
>>>   	report(cc == 1 && uvcb.header.rc == UVC_RC_INV_LEN, "length");
>>>   
>>>   	uvcb.header.len = sizeof(uvcb);
>>> -	cc = uv_call(0, (u64)&uvcb);
>>> -	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "successful query");
>>> +	uv_call(0, (u64)&uvcb);
>>> +	report(uvcb.header.rc == UVC_RC_EXECUTED || uvcb.header.rc
>>> == 0x100, "successful query");
>>
>> if you want to be even more pedantic:
>> 	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED ||
>> 		cc == 1 && uvcb.header.rc == 0x100, ...
> 
> Yeah I pondered about that but at the end I chose to drop the cc check

Well, but we're in the kvm-unit-tests here where we check for the exact 
behavior of the system ... so I'd vote for keeping/extening the cc checking, 
even if it's more code to read in the end.

  Thomas
diff mbox series

Patch

diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
index f05ae4c3..e7446e03 100644
--- a/s390x/uv-guest.c
+++ b/s390x/uv-guest.c
@@ -70,8 +70,8 @@  static void test_query(void)
 	report(cc == 1 && uvcb.header.rc == UVC_RC_INV_LEN, "length");
 
 	uvcb.header.len = sizeof(uvcb);
-	cc = uv_call(0, (u64)&uvcb);
-	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "successful query");
+	uv_call(0, (u64)&uvcb);
+	report(uvcb.header.rc == UVC_RC_EXECUTED || uvcb.header.rc == 0x100, "successful query");
 
 	/*
 	 * These bits have been introduced with the very first
diff --git a/s390x/uv-host.c b/s390x/uv-host.c
index 28035707..66a11160 100644
--- a/s390x/uv-host.c
+++ b/s390x/uv-host.c
@@ -401,7 +401,7 @@  static void test_query(void)
 
 	uvcb_qui.header.len = sizeof(uvcb_qui);
 	uv_call(0, (uint64_t)&uvcb_qui);
-	report(uvcb_qui.header.rc == UVC_RC_EXECUTED, "successful query");
+	report(uvcb_qui.header.rc == UVC_RC_EXECUTED || uvcb_qui.header.rc == 0x100, "successful query");
 
 	for (i = 0; cmds[i].name; i++)
 		report(uv_query_test_call(cmds[i].call_bit), "%s", cmds[i].name);