diff mbox series

[kvm-unit-tests,8/8] lib: s390x: uv: Add rc 0x100 query error handling

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

Commit Message

Janosch Frank Aug. 13, 2021, 7:36 a.m. UTC
Let's not get bitten by an extension of the query struct and handle
the rc 0x100 error properly which does indicate that the UV has more
data for us.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 lib/s390x/uv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Claudio Imbrenda Aug. 13, 2021, 8:50 a.m. UTC | #1
On Fri, 13 Aug 2021 07:36:15 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> Let's not get bitten by an extension of the query struct and handle
> the rc 0x100 error properly which does indicate that the UV has more
> data for us.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  lib/s390x/uv.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c
> index fd9de944..c5c69c47 100644
> --- a/lib/s390x/uv.c
> +++ b/lib/s390x/uv.c
> @@ -49,6 +49,8 @@ int uv_setup(void)
>  	if (!test_facility(158))
>  		return 0;
>  
> -	assert(!uv_call(0, (u64)&uvcb_qui));
> +	uv_call(0, (u64)&uvcb_qui);
> +
> +	assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc ==
> 0x100); return 1;
>  }
Thomas Huth Aug. 18, 2021, 9:30 a.m. UTC | #2
On 13/08/2021 09.36, Janosch Frank wrote:
> Let's not get bitten by an extension of the query struct and handle
> the rc 0x100 error properly which does indicate that the UV has more
> data for us.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>   lib/s390x/uv.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c
> index fd9de944..c5c69c47 100644
> --- a/lib/s390x/uv.c
> +++ b/lib/s390x/uv.c
> @@ -49,6 +49,8 @@ int uv_setup(void)
>   	if (!test_facility(158))
>   		return 0;
>   
> -	assert(!uv_call(0, (u64)&uvcb_qui));
> +	uv_call(0, (u64)&uvcb_qui);
> +
> +	assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100);

Don't you want to continue to check the return code of the uv_call() function?

  Thomas
Janosch Frank Aug. 18, 2021, 9:57 a.m. UTC | #3
On 8/18/21 11:30 AM, Thomas Huth wrote:
> On 13/08/2021 09.36, Janosch Frank wrote:
>> Let's not get bitten by an extension of the query struct and handle
>> the rc 0x100 error properly which does indicate that the UV has more
>> data for us.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>   lib/s390x/uv.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c
>> index fd9de944..c5c69c47 100644
>> --- a/lib/s390x/uv.c
>> +++ b/lib/s390x/uv.c
>> @@ -49,6 +49,8 @@ int uv_setup(void)
>>   	if (!test_facility(158))
>>   		return 0;
>>   
>> -	assert(!uv_call(0, (u64)&uvcb_qui));
>> +	uv_call(0, (u64)&uvcb_qui);
>> +
>> +	assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100);
> 
> Don't you want to continue to check the return code of the uv_call() function?
> 
>   Thomas
> 

The rc==0x100 case is a cc==1 and the rc==1 is a cc==0 so I had to
delete the check.

Those smaller patches are already upstream btw.
diff mbox series

Patch

diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c
index fd9de944..c5c69c47 100644
--- a/lib/s390x/uv.c
+++ b/lib/s390x/uv.c
@@ -49,6 +49,8 @@  int uv_setup(void)
 	if (!test_facility(158))
 		return 0;
 
-	assert(!uv_call(0, (u64)&uvcb_qui));
+	uv_call(0, (u64)&uvcb_qui);
+
+	assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100);
 	return 1;
 }