public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] rseq01: basic test rseq
Date: Fri, 17 Feb 2023 10:33:37 +0100	[thread overview]
Message-ID: <Y+9J8XFW5TA6L7p2@yuki> (raw)
In-Reply-To: <20230217041727.GA30450@localhost>

Hi!
> > > +#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

If that is a macro defined in a header the it does not make sense to
guard like this. We add fallback definitions instead of disabling code
this way.

> > > +#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

The sched_getcpu() would not test rseq at all on anything but glibc and
would give users false hope that rseq was actually tested even if it
was not.

If you want to make sure sched_getcpu() works fine you should write
sched_getcpu() test instead.

> > 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.

Please forget about glibc, it's not the only libc out there. The test
has to work correctly regardless the libc implementation, there are at
least five different libc variants used out there.


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2023-02-17  9:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 13:46 [LTP] [PATCH v1] rseq01: basic test rseq Wei Gao via ltp
2023-02-14 11:46 ` Cyril Hrubis
2023-02-15  2:34 ` [LTP] [PATCH v2] " Wei Gao via ltp
2023-02-16 10:58   ` Cyril Hrubis
2023-02-17  4:17     ` Wei Gao via ltp
2023-02-17  9:33       ` Cyril Hrubis [this message]
2023-02-21  1:34   ` [LTP] [PATCH v3 0/2] Move linux rseq test into ltp Wei Gao via ltp
2023-02-21  1:34     ` [LTP] [PATCH v3 1/2] rseq: Copy linux rseq test header files to ltp Wei Gao via ltp
2023-03-13 15:48       ` Cyril Hrubis
2023-03-14 13:49         ` Wei Gao via ltp
2023-03-14 16:29           ` Cyril Hrubis
2023-03-14 22:40             ` Wei Gao via ltp
2023-02-21  1:34     ` [LTP] [PATCH v3 2/2] rseq01: basic test rseq Wei Gao via ltp
2023-03-09  2:04       ` [LTP] [PATCH v4] " Wei Gao via ltp
2023-03-09  8:16         ` [LTP] [PATCH v5] " Wei Gao via ltp

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=Y+9J8XFW5TA6L7p2@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=wegao@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox