History log of /linux-master/tools/testing/selftests/sched/cs_prctl_test.c
Revision Date Author Comments
# 6f1a214d 20-Feb-2024 Colin Ian King <colin.i.king@gmail.com>

selftests: sched: Fix spelling mistake "hiearchy" -> "hierarchy"

There is a spelling mistake in a printed message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>


# 130a8387 06-Nov-2023 Atul Kumar Pant <atulpant.linux@gmail.com>

selftests: sched: Remove initialization to 0 for a static variable

Fixes following checkpatch.pl issue:
ERROR: do not initialise statics to 0

Signed-off-by: Atul Kumar Pant <atulpant.linux@gmail.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>


# 14f4cc63 27-Mar-2023 Ivan Orlov <ivan.orlov0322@gmail.com>

selftests: sched: Add more core schedule prctl calls

The core sched kselftest makes prctl calls only with correct
parameters. This patch will extend this test with more core
schedule prctl calls with wrong parameters to increase code
coverage.

Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>


# a7151a8e 13-Feb-2023 Shuah Khan <skhan@linuxfoundation.org>

selftests/sched: fix warn_unused_result build warns

Fix the following warns by adding return check and error handling.

gcc -O2 -Wall -g -I./ -isystem .../tools/testing/selftests/../../../usr/include -Wl,-rpath=./ cs_prctl_test.c -lpthread -o .../tools/testing/selftests/sched/cs_prctl_test
cs_prctl_test.c: In function ‘create_processes’:
cs_prctl_test.c:187:17: warning: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
187 | read(proc[i].pfd[0], &proc[i].thr_tids, sizeof(int) * proc[i].num_threads);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cs_prctl_test.c: In function ‘child_func_process’:
cs_prctl_test.c:159:9: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
159 | write(ca->pfd[1], &ca->thr_tids, sizeof(int) * ca->num_threads);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>


# 1c36432b 01-Sep-2021 Li Zhijian <lizhijian@cn.fujitsu.com>

kselftests/sched: cleanup the child processes

Previously, 'make -C sched run_tests' will block forever when it occurs
something wrong where the *selftests framework* is waiting for its child
processes to exit.

[root@iaas-rpma sched]# ./cs_prctl_test

## Create a thread/process/process group hiearchy
Not a core sched system
tid=74985, / tgid=74985 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74986, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74988, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74989, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74990, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74987, / tgid=74987 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74991, / tgid=74987 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74992, / tgid=74987 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74993, / tgid=74987 / pgid=74985: ffffffffffffffff

Not a core sched system
(268) FAILED: get_cs_cookie(0) == 0

## Set a cookie on entire process group
-1 = prctl(62, 1, 0, 2, 0)
core_sched create failed -- PGID: Invalid argument
(cs_prctl_test.c:272) -
[root@iaas-rpma sched]# ps
PID TTY TIME CMD
4605 pts/2 00:00:00 bash
74986 pts/2 00:00:00 cs_prctl_test
74987 pts/2 00:00:00 cs_prctl_test
74999 pts/2 00:00:00 ps

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Chris Hyser <chris.hyser@oracle.com>
Link: https://lore.kernel.org/r/20210902024333.75983-1-lizhijian@cn.fujitsu.com


# 3673fdea 23-Aug-2021 Changcheng Deng <deng.changcheng@zte.com.cn>

kselftest:sched: remove duplicate include in cs_prctl_test.c

Clean up the following includecheck warning:

./tools/testing/selftests/sched/cs_prctl_test.c:
Include files sys/types.h and sys/wait.h are included more than
once.

No functional change.

Fixed commit header and log:
Shuah Khan <skhan@linuxfoundation.org>

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>


# 9f269900 24-Mar-2021 Chris Hyser <chris.hyser@oracle.com>

kselftest: Add test for core sched prctl interface

Provides a selftest and examples of using the interface.

[peterz: updated to not use sched_debug]
Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Don Hiatt <dhiatt@digitalocean.com>
Tested-by: Hongyu Ning <hongyu.ning@linux.intel.com>
Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210422123309.100860030@infradead.org