* [LTP] [PATCH] arm64: add tst_atomic_add_return
@ 2017-01-25 21:13 Yury Norov
2017-01-27 10:02 ` Jan Stancek
0 siblings, 1 reply; 5+ messages in thread
From: Yury Norov @ 2017-01-25 21:13 UTC (permalink / raw)
To: ltp
The patch fixes build of LTP, at least with gcc 5.3.
The implementation is taken from kernel v4.9.
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
include/tst_atomic.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/include/tst_atomic.h b/include/tst_atomic.h
index 799d735..35a3b34 100644
--- a/include/tst_atomic.h
+++ b/include/tst_atomic.h
@@ -131,6 +131,27 @@ static inline int tst_atomic_add_return(int i, int *v)
return val;
}
+
+#elif defined (__aarch64__)
+static inline int tst_atomic_add_return(int i, int *v)
+{
+ unsigned long tmp;
+ int result;
+
+ __asm__ __volatile__(
+" prfm pstl1strm, %2 \n"
+"1: ldxr %w0, %2 \n"
+" add %w0, %w0, %w3 \n"
+" stlxr %w1, %w0, %2 \n"
+" cbnz %w1, 1b \n"
+" dmb ish \n"
+ : "=&r" (result), "=&r" (tmp), "+Q" (*v)
+ : "Ir" (i)
+ : "memory");
+
+ return result;
+}
+
#else /* HAVE_SYNC_ADD_AND_FETCH == 1 */
# error Your compiler does not provide __sync_add_and_fetch and LTP\
implementation is missing for your architecture.
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH] arm64: add tst_atomic_add_return
2017-01-25 21:13 [LTP] [PATCH] arm64: add tst_atomic_add_return Yury Norov
@ 2017-01-27 10:02 ` Jan Stancek
2017-01-27 12:21 ` Jan Stancek
0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2017-01-27 10:02 UTC (permalink / raw)
To: ltp
----- Original Message -----
> From: "Yury Norov" <ynorov@caviumnetworks.com>
> To: ltp@lists.linux.it
> Sent: Wednesday, 25 January, 2017 10:13:42 PM
> Subject: [LTP] [PATCH] arm64: add tst_atomic_add_return
>
> The patch fixes build of LTP, at least with gcc 5.3.
> The implementation is taken from kernel v4.9.
>
> Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
> ---
> include/tst_atomic.h | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
Hi,
looks good to me, I'm getting a system to test this as well.
Regards,
Jan
>
> diff --git a/include/tst_atomic.h b/include/tst_atomic.h
> index 799d735..35a3b34 100644
> --- a/include/tst_atomic.h
> +++ b/include/tst_atomic.h
> @@ -131,6 +131,27 @@ static inline int tst_atomic_add_return(int i, int *v)
>
> return val;
> }
> +
> +#elif defined (__aarch64__)
> +static inline int tst_atomic_add_return(int i, int *v)
> +{
> + unsigned long tmp;
> + int result;
> +
> + __asm__ __volatile__(
> +" prfm pstl1strm, %2 \n"
> +"1: ldxr %w0, %2 \n"
> +" add %w0, %w0, %w3 \n"
> +" stlxr %w1, %w0, %2 \n"
> +" cbnz %w1, 1b \n"
> +" dmb ish \n"
> + : "=&r" (result), "=&r" (tmp), "+Q" (*v)
> + : "Ir" (i)
> + : "memory");
> +
> + return result;
> +}
> +
> #else /* HAVE_SYNC_ADD_AND_FETCH == 1 */
> # error Your compiler does not provide __sync_add_and_fetch and LTP\
> implementation is missing for your architecture.
> --
> 2.7.4
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] arm64: add tst_atomic_add_return
2017-01-27 10:02 ` Jan Stancek
@ 2017-01-27 12:21 ` Jan Stancek
2017-01-30 11:43 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2017-01-27 12:21 UTC (permalink / raw)
To: ltp
----- Original Message -----
> From: "Jan Stancek" <jstancek@redhat.com>
> To: "Yury Norov" <ynorov@caviumnetworks.com>
> Cc: ltp@lists.linux.it
> Sent: Friday, 27 January, 2017 11:02:03 AM
> Subject: Re: [LTP] [PATCH] arm64: add tst_atomic_add_return
>
>
>
>
>
> ----- Original Message -----
> > From: "Yury Norov" <ynorov@caviumnetworks.com>
> > To: ltp@lists.linux.it
> > Sent: Wednesday, 25 January, 2017 10:13:42 PM
> > Subject: [LTP] [PATCH] arm64: add tst_atomic_add_return
> >
> > The patch fixes build of LTP, at least with gcc 5.3.
> > The implementation is taken from kernel v4.9.
> >
> > Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
> > ---
> > include/tst_atomic.h | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
>
> Hi,
>
> looks good to me, I'm getting a system to test this as well.
Forced my config to use new tst_atomic_return and ran few tests.
There were no issues.
@Cyril: would you like to try this too on some SuSe distros
or can I go ahead and push it?
Regards,
Jan
>
> Regards,
> Jan
>
> >
> > diff --git a/include/tst_atomic.h b/include/tst_atomic.h
> > index 799d735..35a3b34 100644
> > --- a/include/tst_atomic.h
> > +++ b/include/tst_atomic.h
> > @@ -131,6 +131,27 @@ static inline int tst_atomic_add_return(int i, int *v)
> >
> > return val;
> > }
> > +
> > +#elif defined (__aarch64__)
> > +static inline int tst_atomic_add_return(int i, int *v)
> > +{
> > + unsigned long tmp;
> > + int result;
> > +
> > + __asm__ __volatile__(
> > +" prfm pstl1strm, %2 \n"
> > +"1: ldxr %w0, %2 \n"
> > +" add %w0, %w0, %w3 \n"
> > +" stlxr %w1, %w0, %2 \n"
> > +" cbnz %w1, 1b \n"
> > +" dmb ish \n"
> > + : "=&r" (result), "=&r" (tmp), "+Q" (*v)
> > + : "Ir" (i)
> > + : "memory");
> > +
> > + return result;
> > +}
> > +
> > #else /* HAVE_SYNC_ADD_AND_FETCH == 1 */
> > # error Your compiler does not provide __sync_add_and_fetch and LTP\
> > implementation is missing for your architecture.
> > --
> > 2.7.4
> >
> >
> > --
> > Mailing list info: https://lists.linux.it/listinfo/ltp
> >
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] arm64: add tst_atomic_add_return
2017-01-27 12:21 ` Jan Stancek
@ 2017-01-30 11:43 ` Cyril Hrubis
2017-01-30 12:11 ` Jan Stancek
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2017-01-30 11:43 UTC (permalink / raw)
To: ltp
Hi!
> @Cyril: would you like to try this too on some SuSe distros
> or can I go ahead and push it?
I've tried it on SLES12 SP2 on aarch64, everything seems to work fine,
go ahead and push it.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] arm64: add tst_atomic_add_return
2017-01-30 11:43 ` Cyril Hrubis
@ 2017-01-30 12:11 ` Jan Stancek
0 siblings, 0 replies; 5+ messages in thread
From: Jan Stancek @ 2017-01-30 12:11 UTC (permalink / raw)
To: ltp
----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: "Yury Norov" <ynorov@caviumnetworks.com>, ltp@lists.linux.it
> Sent: Monday, 30 January, 2017 12:43:03 PM
> Subject: Re: [LTP] [PATCH] arm64: add tst_atomic_add_return
>
> Hi!
> > @Cyril: would you like to try this too on some SuSe distros
> > or can I go ahead and push it?
>
> I've tried it on SLES12 SP2 on aarch64, everything seems to work fine,
> go ahead and push it.
Pushed.
Regards,
Jan
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-01-30 12:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-25 21:13 [LTP] [PATCH] arm64: add tst_atomic_add_return Yury Norov
2017-01-27 10:02 ` Jan Stancek
2017-01-27 12:21 ` Jan Stancek
2017-01-30 11:43 ` Cyril Hrubis
2017-01-30 12:11 ` Jan Stancek
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.