[LTP] [PATCH v2] rseq01: basic test rseq

Wei Gao wegao@suse.com
Fri Feb 17 05:17:27 CET 2023


On Thu, Feb 16, 2023 at 11:58:22AM +0100, Cyril Hrubis wrote:
> Hi!
> > Add basic check for the newly added glibc API in LTP.
> > This test references the glibc test case tst-rseq.c.
> > 
> > Signed-off-by: Wei Gao <wegao@suse.com>
> > ---
> > +#if defined(HAVE_SYS_RSEQ_H) && defined(RSEQ_SIG)
>                                              ^
> 					     Where is this macro
> 					     defined?
RSEQ_SIG is arch specific macro , following are result in my test system:

find / -name "*.h" | xargs grep RSEQ_SIG
/usr/include/x86_64-linux-gnu/bits/rseq.h:#define RSEQ_SIG        0x53053053

dpkg -S /usr/include/x86_64-linux-gnu/bits/rseq.h
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/rseq.h

> > +#include <stdio.h>
> > +#include <sched.h>
> > +#include "lapi/rseq.h"
> > +
> > +static void run(void)
> > +{
> > +	check_rseq_available();
> > +
> > +	TST_EXP_PASS(!(sched_getcpu() >= 0));
> 
> This does not actually check anything useful.
This case used to test against glibc's implementation, correct me if i am wrong.
Once i saw following commit in glibc, so i think we can use sched_getcpu 
do some sanity check for rseq implementation in glibc. 
1d350aa060 Linux: Use rseq to accelerate sched_getcpu

> 
> Very basic test would register rqseq, then loop over available CPUs, pin
> a process to the CPU and check that rqsed did register the buffers. The
> very basic test would look like:
> 
> https://github.com/torvalds/linux/blob/master/tools/testing/selftests/rseq/basic_test.c
> 

Thanks for your feedback, i have a question on test direction, which one is our target?

1) Check system call ONLY regardless glibc version/implementation then we move linux kernel test(as above link you mentioned) into our test.

2) Check glibc's implemenation for rseq(from 2.35), such as 1.check sched_getcpu, 2.check glibc API 
how to disable rseq feature which support automaticly from glibc start. (e3e589829d nptl: Add glibc.pthread.rseq tunable to control rseq registration). Then our target is move glibc test case to our test.

> > +}
> > +
> > +static struct tst_test test = {
> > +	.test_all = run,
> > +	.needs_root = 1,
> > +};
> > -- 
> > 2.35.3
> > 
> > 
> > -- 
> > Mailing list info: https://lists.linux.it/listinfo/ltp
> 
> -- 
> Cyril Hrubis
> chrubis@suse.cz


More information about the ltp mailing list