diff mbox series

[3/3] selftests: vDSO: chacha: Provide default definition of HWCAP_S390_VXRS

Message ID 20250324-s390-vdso-hwcap-v1-3-cb9ad001ceba@linutronix.de (mailing list archive)
State New
Headers show
Series selftests: vDSO: chacha: Bugfixes | expand

Commit Message

Thomas Weißschuh March 24, 2025, 2:03 p.m. UTC
s390 does not provide a hwcap.h UAPI header.

Add an inline definition for the constant HWCAP_S390_VXRS until a proper
UAPI header is introduced.

Fixes: 210860e7f733 ("selftests: vDSO: check cpu caps before running chacha test")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 tools/testing/selftests/vDSO/vdso_test_chacha.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Heiko Carstens March 24, 2025, 3:55 p.m. UTC | #1
On Mon, Mar 24, 2025 at 03:03:17PM +0100, Thomas Weißschuh wrote:
> s390 does not provide a hwcap.h UAPI header.
> 
> Add an inline definition for the constant HWCAP_S390_VXRS until a proper
> UAPI header is introduced.
> 
> Fixes: 210860e7f733 ("selftests: vDSO: check cpu caps before running chacha test")
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
>  tools/testing/selftests/vDSO/vdso_test_chacha.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/testing/selftests/vDSO/vdso_test_chacha.c b/tools/testing/selftests/vDSO/vdso_test_chacha.c
> index fd5c5108b42f04ec459d39b74f33edc2ceafbba1..0ce5189718ce35b0a4d69b71559db8379b598b93 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_chacha.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_chacha.c
> @@ -19,6 +19,9 @@ static bool cpu_has_capabilities(void)
>  	return getauxval(AT_HWCAP) & HWCAP_ASIMD;
>  }
>  #elif defined(__s390x__)
> +#ifndef HWCAP_S390_VXRS
> +#define HWCAP_S390_VXRS	(1 << 11)
> +#endif
>  static bool cpu_has_capabilities(void)
>  {
>  	return getauxval(AT_HWCAP) & HWCAP_S390_VXRS;

How did this cause a problem?

Did you use something different than glibc(-devel) on your test
system? Just wondering since glibc-devel provides the define since
ages and is also required for getauxval().
Thomas Weißschuh March 25, 2025, 6:48 a.m. UTC | #2
On Mon, Mar 24, 2025 at 04:55:13PM +0100, Heiko Carstens wrote:
> On Mon, Mar 24, 2025 at 03:03:17PM +0100, Thomas Weißschuh wrote:
> > s390 does not provide a hwcap.h UAPI header.
> > 
> > Add an inline definition for the constant HWCAP_S390_VXRS until a proper
> > UAPI header is introduced.
> > 
> > Fixes: 210860e7f733 ("selftests: vDSO: check cpu caps before running chacha test")
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > ---
> >  tools/testing/selftests/vDSO/vdso_test_chacha.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/tools/testing/selftests/vDSO/vdso_test_chacha.c b/tools/testing/selftests/vDSO/vdso_test_chacha.c
> > index fd5c5108b42f04ec459d39b74f33edc2ceafbba1..0ce5189718ce35b0a4d69b71559db8379b598b93 100644
> > --- a/tools/testing/selftests/vDSO/vdso_test_chacha.c
> > +++ b/tools/testing/selftests/vDSO/vdso_test_chacha.c
> > @@ -19,6 +19,9 @@ static bool cpu_has_capabilities(void)
> >  	return getauxval(AT_HWCAP) & HWCAP_ASIMD;
> >  }
> >  #elif defined(__s390x__)
> > +#ifndef HWCAP_S390_VXRS
> > +#define HWCAP_S390_VXRS	(1 << 11)
> > +#endif
> >  static bool cpu_has_capabilities(void)
> >  {
> >  	return getauxval(AT_HWCAP) & HWCAP_S390_VXRS;
> 
> How did this cause a problem?
> 
> Did you use something different than glibc(-devel) on your test
> system? Just wondering since glibc-devel provides the define since
> ages and is also required for getauxval().

I used nolibc (from the kernel tree at tools/include/nolibc/) to make cross
platform usage of the tests easier. See also [0].
I got confused by the existence of hwcap.h in the kernel UAPI headers for
various architectures and didn't check the libc headers.
So this isn't really a bug right now, and the hwcap changes will only really be
necessary once my other work goes upstream.

[0] https://lore.kernel.org/lkml/20250217-kunit-kselftests-v1-0-42b4524c3b0a@linutronix.de/
Heiko Carstens March 25, 2025, 7:18 a.m. UTC | #3
On Tue, Mar 25, 2025 at 07:48:48AM +0100, Thomas Weißschuh wrote:
> On Mon, Mar 24, 2025 at 04:55:13PM +0100, Heiko Carstens wrote:
> > On Mon, Mar 24, 2025 at 03:03:17PM +0100, Thomas Weißschuh wrote:
> > > s390 does not provide a hwcap.h UAPI header.
> > > 
> > > Add an inline definition for the constant HWCAP_S390_VXRS until a proper
> > > UAPI header is introduced.
> > > 
> > > Fixes: 210860e7f733 ("selftests: vDSO: check cpu caps before running chacha test")
> > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > > ---
> > >  tools/testing/selftests/vDSO/vdso_test_chacha.c | 3 +++
> > >  1 file changed, 3 insertions(+)

...

> > >  #elif defined(__s390x__)
> > > +#ifndef HWCAP_S390_VXRS
> > > +#define HWCAP_S390_VXRS	(1 << 11)
> > > +#endif
> > >  static bool cpu_has_capabilities(void)
> > >  {
> > >  	return getauxval(AT_HWCAP) & HWCAP_S390_VXRS;
> > 
> > How did this cause a problem?
> > 
> > Did you use something different than glibc(-devel) on your test
> > system? Just wondering since glibc-devel provides the define since
> > ages and is also required for getauxval().
> 
> I used nolibc (from the kernel tree at tools/include/nolibc/) to make cross
> platform usage of the tests easier. See also [0].
> I got confused by the existence of hwcap.h in the kernel UAPI headers for
> various architectures and didn't check the libc headers.
> So this isn't really a bug right now, and the hwcap changes will only really be
> necessary once my other work goes upstream.

Thanks for explaining!

Acked-by: Heiko Carstens <hca@linux.ibm.com>
Thomas Weißschuh March 25, 2025, 10:54 a.m. UTC | #4
On Tue, Mar 25, 2025 at 08:18:40AM +0100, Heiko Carstens wrote:
> On Tue, Mar 25, 2025 at 07:48:48AM +0100, Thomas Weißschuh wrote:
> > On Mon, Mar 24, 2025 at 04:55:13PM +0100, Heiko Carstens wrote:
> > > On Mon, Mar 24, 2025 at 03:03:17PM +0100, Thomas Weißschuh wrote:
> > > > s390 does not provide a hwcap.h UAPI header.
> > > > 
> > > > Add an inline definition for the constant HWCAP_S390_VXRS until a proper
> > > > UAPI header is introduced.
> > > > 
> > > > Fixes: 210860e7f733 ("selftests: vDSO: check cpu caps before running chacha test")
> > > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > > > ---
> > > >  tools/testing/selftests/vDSO/vdso_test_chacha.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> 
> ...
> 
> > > >  #elif defined(__s390x__)
> > > > +#ifndef HWCAP_S390_VXRS
> > > > +#define HWCAP_S390_VXRS	(1 << 11)
> > > > +#endif
> > > >  static bool cpu_has_capabilities(void)
> > > >  {
> > > >  	return getauxval(AT_HWCAP) & HWCAP_S390_VXRS;
> > > 
> > > How did this cause a problem?
> > > 
> > > Did you use something different than glibc(-devel) on your test
> > > system? Just wondering since glibc-devel provides the define since
> > > ages and is also required for getauxval().
> > 
> > I used nolibc (from the kernel tree at tools/include/nolibc/) to make cross
> > platform usage of the tests easier. See also [0].
> > I got confused by the existence of hwcap.h in the kernel UAPI headers for
> > various architectures and didn't check the libc headers.
> > So this isn't really a bug right now, and the hwcap changes will only really be
> > necessary once my other work goes upstream.
> 
> Thanks for explaining!
> 
> Acked-by: Heiko Carstens <hca@linux.ibm.com>

Thanks!

I'll wait for some more feedback and then resend the series with some better
explanations, and without the incorrect Fixes: tags.
If there is pushback for applying any of the patches now, I'll carry them
downstream and will resubmit them as part of the later series which integrates
more of the vDSO selftests with nolibc.
diff mbox series

Patch

diff --git a/tools/testing/selftests/vDSO/vdso_test_chacha.c b/tools/testing/selftests/vDSO/vdso_test_chacha.c
index fd5c5108b42f04ec459d39b74f33edc2ceafbba1..0ce5189718ce35b0a4d69b71559db8379b598b93 100644
--- a/tools/testing/selftests/vDSO/vdso_test_chacha.c
+++ b/tools/testing/selftests/vDSO/vdso_test_chacha.c
@@ -19,6 +19,9 @@  static bool cpu_has_capabilities(void)
 	return getauxval(AT_HWCAP) & HWCAP_ASIMD;
 }
 #elif defined(__s390x__)
+#ifndef HWCAP_S390_VXRS
+#define HWCAP_S390_VXRS	(1 << 11)
+#endif
 static bool cpu_has_capabilities(void)
 {
 	return getauxval(AT_HWCAP) & HWCAP_S390_VXRS;