diff mbox series

[kvm-unit-tests,5/5] lib: s390x: Print if a pgm happened while in SIE

Message ID 20210629133322.19193-6-frankja@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: sie and uv cleanups | expand

Commit Message

Janosch Frank June 29, 2021, 1:33 p.m. UTC
For debugging it helps if you know if the PGM happened while being in
SIE or not.

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

Comments

Cornelia Huck June 30, 2021, 9:12 a.m. UTC | #1
On Tue, Jun 29 2021, Janosch Frank <frankja@linux.ibm.com> wrote:

> For debugging it helps if you know if the PGM happened while being in
> SIE or not.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  lib/s390x/interrupt.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
> index b627942..76015b1 100644
> --- a/lib/s390x/interrupt.c
> +++ b/lib/s390x/interrupt.c
> @@ -141,10 +141,21 @@ static void print_int_regs(struct stack_frame_int *stack)
>  static void print_pgm_info(struct stack_frame_int *stack)
>  
>  {
> +	bool in_sie;
> +
> +	in_sie = (lc->pgm_old_psw.addr >= (uintptr_t)sie_entry &&
> +		  lc->pgm_old_psw.addr <= (uintptr_t)sie_exit);
> +
>  	printf("\n");
> -	printf("Unexpected program interrupt: %d on cpu %d at %#lx, ilen %d\n",
> -	       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
> -	       lc->pgm_int_id);
> +	if (!in_sie)
> +		printf("Unexpected program interrupt: %d on cpu %d at %#lx, ilen %d\n",
> +		       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
> +		       lc->pgm_int_id);
> +	else
> +		printf("Unexpected program interrupt in SIE: %d on cpu %d at %#lx, ilen %d\n",
> +		       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
> +		       lc->pgm_int_id);

Hm...

		printf("Unexpected program interrupt%s: %d on cpu %d at %#lx, ilen %d\n",
		       in_sie ? " in SIE" : "",
		       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
		       lc->pgm_int_id);

Matter of taste, I guess.
Claudio Imbrenda July 23, 2021, 5:25 p.m. UTC | #2
On Tue, 29 Jun 2021 13:33:22 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> For debugging it helps if you know if the PGM happened while being in
> SIE or not.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

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

I agree with Conny regarding the style, unless you want to extend the
SIE printf to provide more information (maybe about the guest?)

> ---
>  lib/s390x/interrupt.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
> index b627942..76015b1 100644
> --- a/lib/s390x/interrupt.c
> +++ b/lib/s390x/interrupt.c
> @@ -141,10 +141,21 @@ static void print_int_regs(struct
> stack_frame_int *stack) static void print_pgm_info(struct
> stack_frame_int *stack) 
>  {
> +	bool in_sie;
> +
> +	in_sie = (lc->pgm_old_psw.addr >= (uintptr_t)sie_entry &&
> +		  lc->pgm_old_psw.addr <= (uintptr_t)sie_exit);
> +
>  	printf("\n");
> -	printf("Unexpected program interrupt: %d on cpu %d at %#lx,
> ilen %d\n",
> -	       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
> -	       lc->pgm_int_id);
> +	if (!in_sie)
> +		printf("Unexpected program interrupt: %d on cpu %d
> at %#lx, ilen %d\n",
> +		       lc->pgm_int_code, stap(),
> lc->pgm_old_psw.addr,
> +		       lc->pgm_int_id);
> +	else
> +		printf("Unexpected program interrupt in SIE: %d on
> cpu %d at %#lx, ilen %d\n",
> +		       lc->pgm_int_code, stap(),
> lc->pgm_old_psw.addr,
> +		       lc->pgm_int_id);
> +
>  	print_int_regs(stack);
>  	dump_stack();
>  	report_summary();
diff mbox series

Patch

diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
index b627942..76015b1 100644
--- a/lib/s390x/interrupt.c
+++ b/lib/s390x/interrupt.c
@@ -141,10 +141,21 @@  static void print_int_regs(struct stack_frame_int *stack)
 static void print_pgm_info(struct stack_frame_int *stack)
 
 {
+	bool in_sie;
+
+	in_sie = (lc->pgm_old_psw.addr >= (uintptr_t)sie_entry &&
+		  lc->pgm_old_psw.addr <= (uintptr_t)sie_exit);
+
 	printf("\n");
-	printf("Unexpected program interrupt: %d on cpu %d at %#lx, ilen %d\n",
-	       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
-	       lc->pgm_int_id);
+	if (!in_sie)
+		printf("Unexpected program interrupt: %d on cpu %d at %#lx, ilen %d\n",
+		       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
+		       lc->pgm_int_id);
+	else
+		printf("Unexpected program interrupt in SIE: %d on cpu %d at %#lx, ilen %d\n",
+		       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
+		       lc->pgm_int_id);
+
 	print_int_regs(stack);
 	dump_stack();
 	report_summary();