2022-09-06 03:15:00

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 1/3] perf bench syscall: Introduce bench_syscall_common()

In the current code, there is only a basic syscall benchmark via getppid,
this is not enough. Introduce bench_syscall_common() so that we can add
more syscalls to benchmark. This is preparation for later patch.

Signed-off-by: Tiezhu Yang <[email protected]>
---
tools/perf/bench/syscall.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/tools/perf/bench/syscall.c b/tools/perf/bench/syscall.c
index 9b75101..746fd71 100644
--- a/tools/perf/bench/syscall.c
+++ b/tools/perf/bench/syscall.c
@@ -30,25 +30,41 @@ static const char * const bench_syscall_usage[] = {
NULL
};

-int bench_syscall_basic(int argc, const char **argv)
+static int bench_syscall_common(int argc, const char **argv, int syscall)
{
struct timeval start, stop, diff;
unsigned long long result_usec = 0;
+ const char *name = NULL;
int i;

argc = parse_options(argc, argv, options, bench_syscall_usage, 0);

gettimeofday(&start, NULL);

- for (i = 0; i < loops; i++)
- getppid();
+ for (i = 0; i < loops; i++) {
+ switch (syscall) {
+ case __NR_getppid:
+ getppid();
+ break;
+ default:
+ break;
+ }
+ }

gettimeofday(&stop, NULL);
timersub(&stop, &start, &diff);

+ switch (syscall) {
+ case __NR_getppid:
+ name = "getppid()";
+ break;
+ default:
+ break;
+ }
+
switch (bench_format) {
case BENCH_FORMAT_DEFAULT:
- printf("# Executed %'d getppid() calls\n", loops);
+ printf("# Executed %'d %s calls\n", loops, name);

result_usec = diff.tv_sec * 1000000;
result_usec += diff.tv_usec;
@@ -79,3 +95,8 @@ int bench_syscall_basic(int argc, const char **argv)

return 0;
}
+
+int bench_syscall_basic(int argc, const char **argv)
+{
+ return bench_syscall_common(argc, argv, __NR_getppid);
+}
--
2.1.0


2022-09-20 08:15:31

by kernel test robot

[permalink] [raw]
Subject: [perf bench syscall] 30463f9f35: perf-test.perf.make_fail


Greeting,

FYI, we noticed the following commit (built with gcc-11):

commit: 30463f9f35e37cbab112e0bbe41ce3b577e7714f ("[PATCH 1/3] perf bench syscall: Introduce bench_syscall_common()")
url: https://github.com/intel-lab-lkp/linux/commits/Tiezhu-Yang/perf-Add-more-syscalls-to-benchmark/20220906-110930
base: https://git.kernel.org/cgit/linux/kernel/git/acme/linux.git perf/core
patch link: https://lore.kernel.org/lkml/[email protected]

in testcase: perf-test
version: perf-test-x86_64-git-1_20220520
with following parameters:

type: lkp

test-description: The internal Perf Test suite.


on test machine: 8 threads 1 sockets Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz (Kaby Lake) with 32G memory

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):


If you fix the issue, kindly add following tag
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/r/[email protected]


CC bench/syscall.o
CC arch/common.o
bench/syscall.c: In function ‘bench_syscall_common’:
bench/syscall.c:46:8: error: ‘__NR_getppid’ undeclared (first use in this function); did you mean ‘__getpgid’?
46 | case __NR_getppid:
| ^~~~~~~~~~~~
| __getpgid
bench/syscall.c:46:8: note: each undeclared identifier is reported only once for each function it appears in
bench/syscall.c: In function ‘bench_syscall_basic’:
bench/syscall.c:101:42: error: ‘__NR_getppid’ undeclared (first use in this function); did you mean ‘__getpgid’?
101 | return bench_syscall_common(argc, argv, __NR_getppid);
| ^~~~~~~~~~~~
| __getpgid
bench/syscall.c:102:1: error: control reaches end of non-void function [-Werror=return-type]
102 | }
| ^
cc1: all warnings being treated as errors
make[4]: *** [/usr/src/perf_selftests-x86_64-rhel-8.3-func-30463f9f35e37cbab112e0bbe41ce3b577e7714f/tools/build/Makefile.build:97: bench/syscall.o] Error 1
make[3]: *** [/usr/src/perf_selftests-x86_64-rhel-8.3-func-30463f9f35e37cbab112e0bbe41ce3b577e7714f/tools/build/Makefile.build:139: bench] Error 2
make[3]: *** Waiting for unfinished jobs....

...

LD util/perf-in.o
make[2]: *** [Makefile.perf:660: perf-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.perf:240: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/usr/src/perf_selftests-x86_64-rhel-8.3-func-30463f9f35e37cbab112e0bbe41ce3b577e7714f/tools/perf'
failed to setup linux perf



To reproduce:

git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
sudo bin/lkp install job.yaml # job file is attached in this email
bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run
sudo bin/lkp run generated-yaml-file

# if come across any failure that blocks the test,
# please remove ~/.lkp and /lkp dir to run from a clean state.



--
0-DAY CI Kernel Test Service
https://01.org/lkp



Attachments:
(No filename) (3.16 kB)
config-6.0.0-rc3-00037-g30463f9f35e3 (169.94 kB)
job-script (5.59 kB)
dmesg.xz (29.32 kB)
perf-test (20.45 kB)
job.yaml (4.51 kB)
reproduce (206.00 B)
Download all attachments