All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Janosch Frank <frankja@linux.ibm.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
	pmorel@linux.ibm.com, david@redhat.com
Subject: Re: [kvm-unit-tests PATCH v3 2/7] s390x: Fully commit to stack save area for exceptions
Date: Thu, 4 Mar 2021 12:37:56 +0100	[thread overview]
Message-ID: <b1ecb478-e559-bb3d-b69f-3f2b4f72ddee@redhat.com> (raw)
In-Reply-To: <20210222085756.14396-3-frankja@linux.ibm.com>

On 22/02/2021 09.57, Janosch Frank wrote:
> Having two sets of macros for saving registers on exceptions makes
> maintaining harder. Also we have limited space in the lowcore to save
> stuff and by using the stack as a save area, we can stack exceptions.
> 
> So let's use the SAVE/RESTORE_REGS_STACK as the default. When we also
> move the diag308 macro over we can remove the old SAVE/RESTORE_REGS
> macros.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
[...]
> diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
> index 1a2e2cd8..31e4766d 100644
> --- a/lib/s390x/asm/interrupt.h
> +++ b/lib/s390x/asm/interrupt.h
> @@ -14,8 +14,8 @@
>   #define EXT_IRQ_SERVICE_SIG	0x2401
>   
>   void register_pgm_cleanup_func(void (*f)(void));
> -void handle_pgm_int(void);
> -void handle_ext_int(void);
> +void handle_pgm_int(struct stack_frame_int *stack);
> +void handle_ext_int(struct stack_frame_int *stack);
>   void handle_mcck_int(void);
>   void handle_io_int(void);

So handle_io_int() does not get a *stack parameter here...

>   void handle_svc_int(void);
> diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
> index 1ce36073..a59df80e 100644
> --- a/lib/s390x/interrupt.c
> +++ b/lib/s390x/interrupt.c
> @@ -56,7 +56,7 @@ void register_pgm_cleanup_func(void (*f)(void))
>   	pgm_cleanup_func = f;
>   }
>   
> -static void fixup_pgm_int(void)
> +static void fixup_pgm_int(struct stack_frame_int *stack)
>   {
>   	/* If we have an error on SIE we directly move to sie_exit */
>   	if (lc->pgm_old_psw.addr >= (uint64_t)&sie_entry &&
> @@ -76,7 +76,7 @@ static void fixup_pgm_int(void)
>   		/* Handling for iep.c test case. */
>   		if (lc->trans_exc_id & 0x80UL && lc->trans_exc_id & 0x04UL &&
>   		    !(lc->trans_exc_id & 0x08UL))
> -			lc->pgm_old_psw.addr = lc->sw_int_grs[14];
> +			lc->pgm_old_psw.addr = stack->grs0[12];

I'd maybe put a "/* GR14 */" comment at the end of the line, to make it more 
obvious which register we're aiming here at.

>   		break;
>   	case PGM_INT_CODE_SEGMENT_TRANSLATION:
>   	case PGM_INT_CODE_PAGE_TRANSLATION:
> @@ -115,7 +115,7 @@ static void fixup_pgm_int(void)
>   	/* suppressed/terminated/completed point already at the next address */
>   }
>   
> -void handle_pgm_int(void)
> +void handle_pgm_int(struct stack_frame_int *stack)
>   {
>   	if (!pgm_int_expected) {
>   		/* Force sclp_busy to false, otherwise we will loop forever */
> @@ -130,10 +130,10 @@ void handle_pgm_int(void)
>   	if (pgm_cleanup_func)
>   		(*pgm_cleanup_func)();
>   	else
> -		fixup_pgm_int();
> +		fixup_pgm_int(stack);
>   }
>   
> -void handle_ext_int(void)
> +void handle_ext_int(struct stack_frame_int *stack)
>   {
>   	if (!ext_int_expected &&
>   	    lc->ext_int_code != EXT_IRQ_SERVICE_SIG) {
> @@ -143,13 +143,13 @@ void handle_ext_int(void)
>   	}
>   
>   	if (lc->ext_int_code == EXT_IRQ_SERVICE_SIG) {
> -		lc->sw_int_crs[0] &= ~(1UL << 9);
> +		stack->crs[0] &= ~(1UL << 9);
>   		sclp_handle_ext();
>   	} else {
>   		ext_int_expected = false;
>   	}
>   
> -	if (!(lc->sw_int_crs[0] & CR0_EXTM_MASK))
> +	if (!(stack->crs[0] & CR0_EXTM_MASK))
>   		lc->ext_old_psw.mask &= ~PSW_MASK_EXT;
>   }
>   
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index ace0c0d9..35d20293 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -92,33 +92,36 @@ memsetxc:
>   
>   .section .text
>   pgm_int:
> -	SAVE_REGS
> +	SAVE_REGS_STACK
> +	lgr     %r2, %r15
>   	brasl	%r14, handle_pgm_int
> -	RESTORE_REGS
> +	RESTORE_REGS_STACK
>   	lpswe	GEN_LC_PGM_OLD_PSW
>   
>   ext_int:
> -	SAVE_REGS
> +	SAVE_REGS_STACK
> +	lgr     %r2, %r15
>   	brasl	%r14, handle_ext_int
> -	RESTORE_REGS
> +	RESTORE_REGS_STACK
>   	lpswe	GEN_LC_EXT_OLD_PSW
>   
>   mcck_int:
> -	SAVE_REGS
> +	SAVE_REGS_STACK
>   	brasl	%r14, handle_mcck_int
> -	RESTORE_REGS
> +	RESTORE_REGS_STACK
>   	lpswe	GEN_LC_MCCK_OLD_PSW
>   
>   io_int:
>   	SAVE_REGS_STACK
> +	lgr     %r2, %r15

... and here you're passing the stack pointer as a parameter, though 
handle_io_int() does not use it... well, ok, it gets reworked again in the 
next patch, but maybe you could still remove the above line when picking up 
the patch?

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


  reply	other threads:[~2021-03-04 11:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22  8:57 [kvm-unit-tests PATCH v3 0/7] s390x: Cleanup exception register save/restore and implement backtrace Janosch Frank
2021-02-22  8:57 ` [kvm-unit-tests PATCH v3 1/7] s390x: Fix fpc store address in RESTORE_REGS_STACK Janosch Frank
2021-02-22  8:57 ` [kvm-unit-tests PATCH v3 2/7] s390x: Fully commit to stack save area for exceptions Janosch Frank
2021-03-04 11:37   ` Thomas Huth [this message]
2021-03-04 15:57     ` Janosch Frank
2021-02-22  8:57 ` [kvm-unit-tests PATCH v3 3/7] s390x: Introduce and use CALL_INT_HANDLER macro Janosch Frank
2021-03-04 12:58   ` Claudio Imbrenda
2021-02-22  8:57 ` [kvm-unit-tests PATCH v3 4/7] s390x: Provide preliminary backtrace support Janosch Frank
2021-03-04 12:23   ` Thomas Huth
2021-03-04 13:02   ` Claudio Imbrenda
2021-02-22  8:57 ` [kvm-unit-tests PATCH v3 5/7] s390x: Print more information on program exceptions Janosch Frank
2021-03-04 12:24   ` Thomas Huth
2021-02-22  8:57 ` [kvm-unit-tests PATCH v3 6/7] s390x: Move diag308_load_reset to stack saving Janosch Frank
2021-03-04 12:26   ` Thomas Huth
2021-02-22  8:57 ` [kvm-unit-tests PATCH v3 7/7] s390x: Remove SAVE/RESTORE_STACK and lowcore fpc and fprs save areas Janosch Frank
2021-03-04 12:28   ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b1ecb478-e559-bb3d-b69f-3f2b4f72ddee@redhat.com \
    --to=thuth@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pmorel@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.