diff mbox series

[kvm-unit-tests,v2,4/8] s390x: lib: css: separate wait for IRQ and check I/O completion

Message ID 1616665147-32084-5-git-send-email-pmorel@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series Testing SSCH, CSCH and HSCH for errors | expand

Commit Message

Pierre Morel March 25, 2021, 9:39 a.m. UTC
We will may want to check the result of an I/O without waiting
for an interrupt.
For example because we do not handle interrupt.
Let's separate waiting for interrupt and the I/O complretion check.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 lib/s390x/css.h     |  1 +
 lib/s390x/css_lib.c | 13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

Comments

Claudio Imbrenda March 25, 2021, 3:24 p.m. UTC | #1
On Thu, 25 Mar 2021 10:39:03 +0100
Pierre Morel <pmorel@linux.ibm.com> wrote:

> We will may want to check the result of an I/O without waiting
> for an interrupt.
> For example because we do not handle interrupt.
> Let's separate waiting for interrupt and the I/O complretion check.
                                                   ^^^^^^^^^^^
                                                   completion

> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>

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

> ---
>  lib/s390x/css.h     |  1 +
>  lib/s390x/css_lib.c | 13 ++++++++++---
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/s390x/css.h b/lib/s390x/css.h
> index 0058355..5d1e1f0 100644
> --- a/lib/s390x/css.h
> +++ b/lib/s390x/css.h
> @@ -317,6 +317,7 @@ int css_residual_count(unsigned int schid);
>  
>  void enable_io_isc(uint8_t isc);
>  int wait_and_check_io_completion(int schid);
> +int check_io_completion(int schid);
>  
>  /*
>   * CHSC definitions
> diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
> index f5c4f37..1e5c409 100644
> --- a/lib/s390x/css_lib.c
> +++ b/lib/s390x/css_lib.c
> @@ -487,18 +487,25 @@ struct ccw1 *ccw_alloc(int code, void *data,
> int count, unsigned char flags) }
>  
>  /* wait_and_check_io_completion:
> + * @schid: the subchannel ID
> + */
> +int wait_and_check_io_completion(int schid)
> +{
> +	wait_for_interrupt(PSW_MASK_IO);
> +	return check_io_completion(schid);
> +}
> +
> +/* check_io_completion:
>   * @schid: the subchannel ID
>   *
>   * Makes the most common check to validate a successful I/O
>   * completion.
>   * Only report failures.
>   */
> -int wait_and_check_io_completion(int schid)
> +int check_io_completion(int schid)
>  {
>  	int ret = 0;
>  
> -	wait_for_interrupt(PSW_MASK_IO);
> -
>  	report_prefix_push("check I/O completion");
>  
>  	if (lowcore_ptr->io_int_param != schid) {
Pierre Morel March 25, 2021, 4:23 p.m. UTC | #2
On 3/25/21 4:24 PM, Claudio Imbrenda wrote:
> On Thu, 25 Mar 2021 10:39:03 +0100
> Pierre Morel <pmorel@linux.ibm.com> wrote:
> 
>> We will may want to check the result of an I/O without waiting
>> for an interrupt.
>> For example because we do not handle interrupt.
>> Let's separate waiting for interrupt and the I/O complretion check.
>                                                     ^^^^^^^^^^^
>                                                     completion

completed :)

> 
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> 
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

Thanks,
Pierre
Thomas Huth March 29, 2021, 8:21 a.m. UTC | #3
On 25/03/2021 10.39, Pierre Morel wrote:
> We will may want to check the result of an I/O without waiting
> for an interrupt.
> For example because we do not handle interrupt.
> Let's separate waiting for interrupt and the I/O complretion check.
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>   lib/s390x/css.h     |  1 +
>   lib/s390x/css_lib.c | 13 ++++++++++---
>   2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/s390x/css.h b/lib/s390x/css.h
> index 0058355..5d1e1f0 100644
> --- a/lib/s390x/css.h
> +++ b/lib/s390x/css.h
> @@ -317,6 +317,7 @@ int css_residual_count(unsigned int schid);
>   
>   void enable_io_isc(uint8_t isc);
>   int wait_and_check_io_completion(int schid);
> +int check_io_completion(int schid);
>   
>   /*
>    * CHSC definitions
> diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
> index f5c4f37..1e5c409 100644
> --- a/lib/s390x/css_lib.c
> +++ b/lib/s390x/css_lib.c
> @@ -487,18 +487,25 @@ struct ccw1 *ccw_alloc(int code, void *data, int count, unsigned char flags)
>   }
>   
>   /* wait_and_check_io_completion:
> + * @schid: the subchannel ID
> + */
> +int wait_and_check_io_completion(int schid)
> +{
> +	wait_for_interrupt(PSW_MASK_IO);
> +	return check_io_completion(schid);
> +}
> +
> +/* check_io_completion:
>    * @schid: the subchannel ID
>    *
>    * Makes the most common check to validate a successful I/O
>    * completion.
>    * Only report failures.
>    */
> -int wait_and_check_io_completion(int schid)
> +int check_io_completion(int schid)
>   {
>   	int ret = 0;
>   
> -	wait_for_interrupt(PSW_MASK_IO);
> -
>   	report_prefix_push("check I/O completion");
>   
>   	if (lowcore_ptr->io_int_param != schid) {
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>
Pierre Morel March 29, 2021, 11 a.m. UTC | #4
On 3/29/21 10:21 AM, Thomas Huth wrote:
> On 25/03/2021 10.39, Pierre Morel wrote:
>> We will may want to check the result of an I/O without waiting
>> for an interrupt.
>> For example because we do not handle interrupt.
>> Let's separate waiting for interrupt and the I/O complretion check.
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> ---
>>   lib/s390x/css.h     |  1 +
>>   lib/s390x/css_lib.c | 13 ++++++++++---
>>   2 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/s390x/css.h b/lib/s390x/css.h
>> index 0058355..5d1e1f0 100644
>> --- a/lib/s390x/css.h
>> +++ b/lib/s390x/css.h
>> @@ -317,6 +317,7 @@ int css_residual_count(unsigned int schid);
>>   void enable_io_isc(uint8_t isc);
>>   int wait_and_check_io_completion(int schid);
>> +int check_io_completion(int schid);
>>   /*
>>    * CHSC definitions
>> diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
>> index f5c4f37..1e5c409 100644
>> --- a/lib/s390x/css_lib.c
>> +++ b/lib/s390x/css_lib.c
>> @@ -487,18 +487,25 @@ struct ccw1 *ccw_alloc(int code, void *data, int 
>> count, unsigned char flags)
>>   }
>>   /* wait_and_check_io_completion:
>> + * @schid: the subchannel ID
>> + */
>> +int wait_and_check_io_completion(int schid)
>> +{
>> +    wait_for_interrupt(PSW_MASK_IO);
>> +    return check_io_completion(schid);
>> +}
>> +
>> +/* check_io_completion:
>>    * @schid: the subchannel ID
>>    *
>>    * Makes the most common check to validate a successful I/O
>>    * completion.
>>    * Only report failures.
>>    */
>> -int wait_and_check_io_completion(int schid)
>> +int check_io_completion(int schid)
>>   {
>>       int ret = 0;
>> -    wait_for_interrupt(PSW_MASK_IO);
>> -
>>       report_prefix_push("check I/O completion");
>>       if (lowcore_ptr->io_int_param != schid) {
>>
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 

Thanks,
Pierre
Cornelia Huck March 30, 2021, 11:57 a.m. UTC | #5
On Thu, 25 Mar 2021 10:39:03 +0100
Pierre Morel <pmorel@linux.ibm.com> wrote:

> We will may want to check the result of an I/O without waiting
> for an interrupt.
> For example because we do not handle interrupt.

It's more because we may poll the subchannel state without enabling I/O
interrupts, no?

> Let's separate waiting for interrupt and the I/O complretion check.
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>  lib/s390x/css.h     |  1 +
>  lib/s390x/css_lib.c | 13 ++++++++++---
>  2 files changed, 11 insertions(+), 3 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Pierre Morel March 30, 2021, 12:57 p.m. UTC | #6
On 3/30/21 1:57 PM, Cornelia Huck wrote:
> On Thu, 25 Mar 2021 10:39:03 +0100
> Pierre Morel <pmorel@linux.ibm.com> wrote:
> 
>> We will may want to check the result of an I/O without waiting
>> for an interrupt.
>> For example because we do not handle interrupt.
> 
> It's more because we may poll the subchannel state without enabling I/O
> interrupts, no?

absolutely.
may be I just replace with your rewording :)

"
We will may want to check the result of an I/O without waiting
for an interrupt because we may poll the subchannel state without 
enabling I/O interrupts.
"

> 
>> Let's separate waiting for interrupt and the I/O complretion check.
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> ---
>>   lib/s390x/css.h     |  1 +
>>   lib/s390x/css_lib.c | 13 ++++++++++---
>>   2 files changed, 11 insertions(+), 3 deletions(-)
> 
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> 

Thanks,
Pierre
Pierre Morel April 1, 2021, 8:24 a.m. UTC | #7
On 3/25/21 10:39 AM, Pierre Morel wrote:
> We will may want to check the result of an I/O without waiting
> for an interrupt.
> For example because we do not handle interrupt.
> Let's separate waiting for interrupt and the I/O complretion check.
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>   lib/s390x/css.h     |  1 +
>   lib/s390x/css_lib.c | 13 ++++++++++---
>   2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/s390x/css.h b/lib/s390x/css.h
> index 0058355..5d1e1f0 100644
> --- a/lib/s390x/css.h
> +++ b/lib/s390x/css.h
> @@ -317,6 +317,7 @@ int css_residual_count(unsigned int schid);
>   
>   void enable_io_isc(uint8_t isc);
>   int wait_and_check_io_completion(int schid);
> +int check_io_completion(int schid);
>   
>   /*
>    * CHSC definitions
> diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
> index f5c4f37..1e5c409 100644
> --- a/lib/s390x/css_lib.c
> +++ b/lib/s390x/css_lib.c
> @@ -487,18 +487,25 @@ struct ccw1 *ccw_alloc(int code, void *data, int count, unsigned char flags)
>   }
>   
>   /* wait_and_check_io_completion:
> + * @schid: the subchannel ID
> + */
> +int wait_and_check_io_completion(int schid)
> +{
> +	wait_for_interrupt(PSW_MASK_IO);
> +	return check_io_completion(schid);
> +}
> +
> +/* check_io_completion:
>    * @schid: the subchannel ID
>    *
>    * Makes the most common check to validate a successful I/O
>    * completion.
>    * Only report failures.
>    */
> -int wait_and_check_io_completion(int schid)
> +int check_io_completion(int schid)
>   {
>   	int ret = 0;
>   
> -	wait_for_interrupt(PSW_MASK_IO);
> -
>   	report_prefix_push("check I/O completion");
>   
>   	if (lowcore_ptr->io_int_param != schid) {
> 

Hum, sorry, it seems I forgot here --^ to move the check on io_int_param 
inside the interrupt routine.
I change this for the next spin

regards,
Pierre
diff mbox series

Patch

diff --git a/lib/s390x/css.h b/lib/s390x/css.h
index 0058355..5d1e1f0 100644
--- a/lib/s390x/css.h
+++ b/lib/s390x/css.h
@@ -317,6 +317,7 @@  int css_residual_count(unsigned int schid);
 
 void enable_io_isc(uint8_t isc);
 int wait_and_check_io_completion(int schid);
+int check_io_completion(int schid);
 
 /*
  * CHSC definitions
diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
index f5c4f37..1e5c409 100644
--- a/lib/s390x/css_lib.c
+++ b/lib/s390x/css_lib.c
@@ -487,18 +487,25 @@  struct ccw1 *ccw_alloc(int code, void *data, int count, unsigned char flags)
 }
 
 /* wait_and_check_io_completion:
+ * @schid: the subchannel ID
+ */
+int wait_and_check_io_completion(int schid)
+{
+	wait_for_interrupt(PSW_MASK_IO);
+	return check_io_completion(schid);
+}
+
+/* check_io_completion:
  * @schid: the subchannel ID
  *
  * Makes the most common check to validate a successful I/O
  * completion.
  * Only report failures.
  */
-int wait_and_check_io_completion(int schid)
+int check_io_completion(int schid)
 {
 	int ret = 0;
 
-	wait_for_interrupt(PSW_MASK_IO);
-
 	report_prefix_push("check I/O completion");
 
 	if (lowcore_ptr->io_int_param != schid) {