All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] lib: s390x: add smp_cpu_setup_cur_psw_mask
@ 2022-11-28 12:38 Claudio Imbrenda
  2022-11-28 15:10 ` Janis Schoetterl-Glausch
  0 siblings, 1 reply; 3+ messages in thread
From: Claudio Imbrenda @ 2022-11-28 12:38 UTC (permalink / raw)
  To: kvm; +Cc: frankja, nrb, seiden, scgl, thuth

Since a lot of code starts new CPUs using the current PSW mask, add a
wrapper to streamline the operation and hopefully make the code of the
tests more readable.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/smp.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h
index f4ae973d..0bcb1999 100644
--- a/lib/s390x/smp.h
+++ b/lib/s390x/smp.h
@@ -47,4 +47,13 @@ void smp_setup(void);
 int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status);
 struct lowcore *smp_get_lowcore(uint16_t idx);
 
+static inline void smp_cpu_setup_cur_psw_mask(uint16_t idx, void *addr)
+{
+	struct psw psw = {
+		.mask = extract_psw_mask(),
+		.addr = (unsigned long)addr,
+	};
+	smp_cpu_setup(idx, psw);
+}
+
 #endif
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] lib: s390x: add smp_cpu_setup_cur_psw_mask
  2022-11-28 12:38 [PATCH v1 1/1] lib: s390x: add smp_cpu_setup_cur_psw_mask Claudio Imbrenda
@ 2022-11-28 15:10 ` Janis Schoetterl-Glausch
  2022-11-28 15:47   ` Claudio Imbrenda
  0 siblings, 1 reply; 3+ messages in thread
From: Janis Schoetterl-Glausch @ 2022-11-28 15:10 UTC (permalink / raw)
  To: Claudio Imbrenda, kvm; +Cc: frankja, nrb, seiden, thuth

On Mon, 2022-11-28 at 13:38 +0100, Claudio Imbrenda wrote:
> Since a lot of code starts new CPUs using the current PSW mask, add a
> wrapper to streamline the operation and hopefully make the code of the
> tests more readable.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  lib/s390x/smp.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h
> index f4ae973d..0bcb1999 100644
> --- a/lib/s390x/smp.h
> +++ b/lib/s390x/smp.h
> @@ -47,4 +47,13 @@ void smp_setup(void);
>  int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status);
>  struct lowcore *smp_get_lowcore(uint16_t idx);
>  
> +static inline void smp_cpu_setup_cur_psw_mask(uint16_t idx, void *addr)
> +{
> +	struct psw psw = {
> +		.mask = extract_psw_mask(),
> +		.addr = (unsigned long)addr,
> +	};
> +	smp_cpu_setup(idx, psw);
> +}
> +
>  #endif

Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>

Although I would have expected you to also use the function.

I'm wondering if just improving the ergonomics of creating a psw would suffice
#define PSW(m, a) ((struct psw){ .mask = (uint64_t)m, .addr = (uint64_t)a })

Then it would look like

smp_cpu_setup(idx, PSW(extract_psw_mask(), addr))

and the macro might come in handy in other situations, too, but I haven't surveyed the code.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] lib: s390x: add smp_cpu_setup_cur_psw_mask
  2022-11-28 15:10 ` Janis Schoetterl-Glausch
@ 2022-11-28 15:47   ` Claudio Imbrenda
  0 siblings, 0 replies; 3+ messages in thread
From: Claudio Imbrenda @ 2022-11-28 15:47 UTC (permalink / raw)
  To: Janis Schoetterl-Glausch; +Cc: kvm, frankja, nrb, seiden, thuth

On Mon, 28 Nov 2022 16:10:32 +0100
Janis Schoetterl-Glausch <scgl@linux.ibm.com> wrote:

> On Mon, 2022-11-28 at 13:38 +0100, Claudio Imbrenda wrote:
> > Since a lot of code starts new CPUs using the current PSW mask, add a
> > wrapper to streamline the operation and hopefully make the code of the
> > tests more readable.
> > 
> > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> > ---
> >  lib/s390x/smp.h | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h
> > index f4ae973d..0bcb1999 100644
> > --- a/lib/s390x/smp.h
> > +++ b/lib/s390x/smp.h
> > @@ -47,4 +47,13 @@ void smp_setup(void);
> >  int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status);
> >  struct lowcore *smp_get_lowcore(uint16_t idx);
> >  
> > +static inline void smp_cpu_setup_cur_psw_mask(uint16_t idx, void *addr)
> > +{
> > +	struct psw psw = {
> > +		.mask = extract_psw_mask(),
> > +		.addr = (unsigned long)addr,
> > +	};
> > +	smp_cpu_setup(idx, psw);
> > +}
> > +
> >  #endif  
> 
> Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
> 
> Although I would have expected you to also use the function.
> 
> I'm wondering if just improving the ergonomics of creating a psw would suffice
> #define PSW(m, a) ((struct psw){ .mask = (uint64_t)m, .addr = (uint64_t)a })
> 
> Then it would look like
> 
> smp_cpu_setup(idx, PSW(extract_psw_mask(), addr))
> 
> and the macro might come in handy in other situations, too, but I haven't surveyed the code.

hmmm, this is actually not a bad idea at all

then it would be possible to also define

#define PSW_CUR_MASK(a) PSW(extract_psw_mask(), (a))

and have the code like this:

smp_cpu_setup(idx, PSW_CUR_MASK(addr));

I think I will do it like that (and also send a second patch where I
actually put it to use)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-28 15:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 12:38 [PATCH v1 1/1] lib: s390x: add smp_cpu_setup_cur_psw_mask Claudio Imbrenda
2022-11-28 15:10 ` Janis Schoetterl-Glausch
2022-11-28 15:47   ` Claudio Imbrenda

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.