diff mbox series

[kvm-unit-tests,1/6] s390x: uv-guest: Add invalid share location test

Message ID 20210316091654.1646-2-frankja@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: uv: Extend guest test and add host test | expand

Commit Message

Janosch Frank March 16, 2021, 9:16 a.m. UTC
Let's also test sharing unavailable memory.

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

Comments

Thomas Huth April 19, 2021, 11:24 a.m. UTC | #1
On 16/03/2021 10.16, Janosch Frank wrote:
> Let's also test sharing unavailable memory.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>   s390x/uv-guest.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
> index 99544442..a13669ab 100644
> --- a/s390x/uv-guest.c
> +++ b/s390x/uv-guest.c
> @@ -15,6 +15,7 @@
>   #include <asm/interrupt.h>
>   #include <asm/facility.h>
>   #include <asm/uv.h>
> +#include <sclp.h>
>   
>   static unsigned long page;
>   
> @@ -99,6 +100,10 @@ static void test_sharing(void)
>   	uvcb.header.len = sizeof(uvcb);
>   	cc = uv_call(0, (u64)&uvcb);
>   	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "share");
> +	uvcb.paddr = get_ram_size() + PAGE_SIZE;
> +	cc = uv_call(0, (u64)&uvcb);
> +	report(cc == 1 && uvcb.header.rc == 0x101, "invalid memory");

Would it make sense to add a #define for 0x101 ?

Anyway:
Reviewed-by: Thomas Huth <thuth@redhat.com>
Janosch Frank April 19, 2021, 11:45 a.m. UTC | #2
On 4/19/21 1:24 PM, Thomas Huth wrote:
> On 16/03/2021 10.16, Janosch Frank wrote:
>> Let's also test sharing unavailable memory.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>   s390x/uv-guest.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
>> index 99544442..a13669ab 100644
>> --- a/s390x/uv-guest.c
>> +++ b/s390x/uv-guest.c
>> @@ -15,6 +15,7 @@
>>   #include <asm/interrupt.h>
>>   #include <asm/facility.h>
>>   #include <asm/uv.h>
>> +#include <sclp.h>
>>   
>>   static unsigned long page;
>>   
>> @@ -99,6 +100,10 @@ static void test_sharing(void)
>>   	uvcb.header.len = sizeof(uvcb);
>>   	cc = uv_call(0, (u64)&uvcb);
>>   	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "share");
>> +	uvcb.paddr = get_ram_size() + PAGE_SIZE;
>> +	cc = uv_call(0, (u64)&uvcb);
>> +	report(cc == 1 && uvcb.header.rc == 0x101, "invalid memory");
> 
> Would it make sense to add a #define for 0x101 ?
> 

The RCs change meaning with each UV call so we can only re-use a small
number of constants which wouldn't gain us a lot.

> Anyway:
> Reviewed-by: Thomas Huth <thuth@redhat.com>

Thanks!
Thomas Huth April 20, 2021, 8:48 a.m. UTC | #3
On 19/04/2021 13.45, Janosch Frank wrote:
> On 4/19/21 1:24 PM, Thomas Huth wrote:
>> On 16/03/2021 10.16, Janosch Frank wrote:
>>> Let's also test sharing unavailable memory.
>>>
>>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>>> ---
>>>    s390x/uv-guest.c | 5 +++++
>>>    1 file changed, 5 insertions(+)
>>>
>>> diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
>>> index 99544442..a13669ab 100644
>>> --- a/s390x/uv-guest.c
>>> +++ b/s390x/uv-guest.c
>>> @@ -15,6 +15,7 @@
>>>    #include <asm/interrupt.h>
>>>    #include <asm/facility.h>
>>>    #include <asm/uv.h>
>>> +#include <sclp.h>
>>>    
>>>    static unsigned long page;
>>>    
>>> @@ -99,6 +100,10 @@ static void test_sharing(void)
>>>    	uvcb.header.len = sizeof(uvcb);
>>>    	cc = uv_call(0, (u64)&uvcb);
>>>    	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "share");
>>> +	uvcb.paddr = get_ram_size() + PAGE_SIZE;
>>> +	cc = uv_call(0, (u64)&uvcb);
>>> +	report(cc == 1 && uvcb.header.rc == 0x101, "invalid memory");
>>
>> Would it make sense to add a #define for 0x101 ?
>>
> 
> The RCs change meaning with each UV call so we can only re-use a small
> number of constants which wouldn't gain us a lot.

Ok, fair point. A define just for one spot does not make too much sense, indeed.

  Thomas
Claudio Imbrenda April 20, 2021, 1:40 p.m. UTC | #4
On Tue, 16 Mar 2021 09:16:49 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> Let's also test sharing unavailable memory.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

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

> ---
>  s390x/uv-guest.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
> index 99544442..a13669ab 100644
> --- a/s390x/uv-guest.c
> +++ b/s390x/uv-guest.c
> @@ -15,6 +15,7 @@
>  #include <asm/interrupt.h>
>  #include <asm/facility.h>
>  #include <asm/uv.h>
> +#include <sclp.h>
>  
>  static unsigned long page;
>  
> @@ -99,6 +100,10 @@ static void test_sharing(void)
>  	uvcb.header.len = sizeof(uvcb);
>  	cc = uv_call(0, (u64)&uvcb);
>  	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED,
> "share");
> +	uvcb.paddr = get_ram_size() + PAGE_SIZE;
> +	cc = uv_call(0, (u64)&uvcb);
> +	report(cc == 1 && uvcb.header.rc == 0x101, "invalid memory");
> +	uvcb.paddr = page;
>  	report_prefix_pop();
>  
>  	report_prefix_push("unshare");
Cornelia Huck April 21, 2021, 11:04 a.m. UTC | #5
On Tue, 16 Mar 2021 09:16:49 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> Let's also test sharing unavailable memory.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  s390x/uv-guest.c | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
diff mbox series

Patch

diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
index 99544442..a13669ab 100644
--- a/s390x/uv-guest.c
+++ b/s390x/uv-guest.c
@@ -15,6 +15,7 @@ 
 #include <asm/interrupt.h>
 #include <asm/facility.h>
 #include <asm/uv.h>
+#include <sclp.h>
 
 static unsigned long page;
 
@@ -99,6 +100,10 @@  static void test_sharing(void)
 	uvcb.header.len = sizeof(uvcb);
 	cc = uv_call(0, (u64)&uvcb);
 	report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "share");
+	uvcb.paddr = get_ram_size() + PAGE_SIZE;
+	cc = uv_call(0, (u64)&uvcb);
+	report(cc == 1 && uvcb.header.rc == 0x101, "invalid memory");
+	uvcb.paddr = page;
 	report_prefix_pop();
 
 	report_prefix_push("unshare");