diff mbox series

[kvm-unit-tests,v8,5/6] s390x: lib: fix program interrupt handler if sclp_busy was set

Message ID 20200120184256.188698-6-imbrenda@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: SCLP Unit test | expand

Commit Message

Claudio Imbrenda Jan. 20, 2020, 6:42 p.m. UTC
Fix the program interrupt handler for the case where sclp_busy is set.

The interrupt handler will attempt to write an error message on the
console using the SCLP, and will wait for sclp_busy to become false
before doing so. If an exception happenes between setting the flag and
the SCLP call, or if the call itself raises an exception, we need to
clear the flag so we can successfully print the error message.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/interrupt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Thomas Huth Jan. 21, 2020, 6:19 a.m. UTC | #1
On 20/01/2020 19.42, Claudio Imbrenda wrote:
> Fix the program interrupt handler for the case where sclp_busy is set.
> 
> The interrupt handler will attempt to write an error message on the
> console using the SCLP, and will wait for sclp_busy to become false
> before doing so. If an exception happenes between setting the flag and
> the SCLP call, or if the call itself raises an exception, we need to
> clear the flag so we can successfully print the error message.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  lib/s390x/interrupt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
> index 05f30be..ccb376a 100644
> --- a/lib/s390x/interrupt.c
> +++ b/lib/s390x/interrupt.c
> @@ -106,10 +106,13 @@ static void fixup_pgm_int(void)
>  
>  void handle_pgm_int(void)
>  {
> -	if (!pgm_int_expected)
> +	if (!pgm_int_expected) {
> +		/* Force sclp_busy to false, otherwise we will loop forever */
> +		sclp_handle_ext();
>  		report_abort("Unexpected program interrupt: %d at %#lx, ilen %d\n",
>  			     lc->pgm_int_code, lc->pgm_old_psw.addr,
>  			     lc->pgm_int_id);
> +	}
>  
>  	pgm_int_expected = false;
>  	fixup_pgm_int();
> 

Acked-by: Thomas Huth <thuth@redhat.com>
David Hildenbrand Jan. 21, 2020, 9:18 a.m. UTC | #2
On 20.01.20 19:42, Claudio Imbrenda wrote:
> Fix the program interrupt handler for the case where sclp_busy is set.
> 
> The interrupt handler will attempt to write an error message on the
> console using the SCLP, and will wait for sclp_busy to become false
> before doing so. If an exception happenes between setting the flag and
> the SCLP call, or if the call itself raises an exception, we need to
> clear the flag so we can successfully print the error message.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  lib/s390x/interrupt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
> index 05f30be..ccb376a 100644
> --- a/lib/s390x/interrupt.c
> +++ b/lib/s390x/interrupt.c
> @@ -106,10 +106,13 @@ static void fixup_pgm_int(void)
>  
>  void handle_pgm_int(void)
>  {
> -	if (!pgm_int_expected)
> +	if (!pgm_int_expected) {
> +		/* Force sclp_busy to false, otherwise we will loop forever */
> +		sclp_handle_ext();
>  		report_abort("Unexpected program interrupt: %d at %#lx, ilen %d\n",
>  			     lc->pgm_int_code, lc->pgm_old_psw.addr,
>  			     lc->pgm_int_id);
> +	}
>  
>  	pgm_int_expected = false;
>  	fixup_pgm_int();
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
index 05f30be..ccb376a 100644
--- a/lib/s390x/interrupt.c
+++ b/lib/s390x/interrupt.c
@@ -106,10 +106,13 @@  static void fixup_pgm_int(void)
 
 void handle_pgm_int(void)
 {
-	if (!pgm_int_expected)
+	if (!pgm_int_expected) {
+		/* Force sclp_busy to false, otherwise we will loop forever */
+		sclp_handle_ext();
 		report_abort("Unexpected program interrupt: %d at %#lx, ilen %d\n",
 			     lc->pgm_int_code, lc->pgm_old_psw.addr,
 			     lc->pgm_int_id);
+	}
 
 	pgm_int_expected = false;
 	fixup_pgm_int();