schedule: Skip save_fp_regs when the process ends
Change-Id: I32ff71a0dfcd7196d2c9e6cc1d68210933470bbb Fujitsu: POSTK_DEBUG_ARCH_DEP_106 Refs: #1354
This commit is contained in:
committed by
Masamichi Takagi
parent
a4b83dc6d4
commit
de0e07f29e
@ -3416,15 +3416,11 @@ void schedule(void)
|
||||
}
|
||||
|
||||
/* Take care of floating point registers except for idle process */
|
||||
#ifdef POSTK_DEBUG_ARCH_DEP_66 /* Fixed not to save fp_regs when the process ends */
|
||||
if (prev && (prev != &cpu_local_var(idle) && prev->status != PS_EXITED)) {
|
||||
/* Not to save fp_regs when the process ends */
|
||||
if (prev && (prev != &cpu_local_var(idle)
|
||||
&& prev->status != PS_EXITED)) {
|
||||
save_fp_regs(prev);
|
||||
}
|
||||
#else /* POSTK_DEBUG_ARCH_DEP_66 */
|
||||
if (prev && prev != &cpu_local_var(idle)) {
|
||||
save_fp_regs(prev);
|
||||
}
|
||||
#endif /* POSTK_DEBUG_ARCH_DEP_66 */
|
||||
|
||||
if (next != &cpu_local_var(idle)) {
|
||||
restore_fp_regs(next);
|
||||
|
||||
30
test/issues/1354/1354_check.patch
Normal file
30
test/issues/1354/1354_check.patch
Normal file
@ -0,0 +1,30 @@
|
||||
diff --git arch/arm64/kernel/cpu.c arch/arm64/kernel/cpu.c
|
||||
index d749024..759fc4e 100644
|
||||
--- arch/arm64/kernel/cpu.c
|
||||
+++ arch/arm64/kernel/cpu.c
|
||||
@@ -1504,6 +1504,10 @@ out:
|
||||
void
|
||||
save_fp_regs(struct thread *thread)
|
||||
{
|
||||
+ /* THIS IS PATCH FOR TEST */
|
||||
+ if (thread->status == PS_EXITED) {
|
||||
+ kprintf("%s: thread is going to exit. (NOT_FIXED)\n", __func__);
|
||||
+ }
|
||||
if (thread == &cpu_local_var(idle)) {
|
||||
return;
|
||||
}
|
||||
diff --git arch/x86_64/kernel/cpu.c arch/x86_64/kernel/cpu.c
|
||||
index 2ba5bd3..7512daa 100644
|
||||
--- arch/x86_64/kernel/cpu.c
|
||||
+++ arch/x86_64/kernel/cpu.c
|
||||
@@ -1725,6 +1725,10 @@ out:
|
||||
void
|
||||
save_fp_regs(struct thread *thread)
|
||||
{
|
||||
+ /* THIS IS PATCH FOR TEST */
|
||||
+ if (thread->status == PS_EXITED) {
|
||||
+ kprintf("%s: thread is going to exit. (NOT_FIXED)\n", __func__);
|
||||
+ }
|
||||
if (check_and_allocate_fp_regs(thread) != 0) {
|
||||
// alloc error
|
||||
return;
|
||||
31
test/issues/1354/C1354.sh
Executable file
31
test/issues/1354/C1354.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#/bin/sh
|
||||
|
||||
USELTP=1
|
||||
USEOSTEST=0
|
||||
|
||||
. ../../common.sh
|
||||
|
||||
issue=1354
|
||||
tid=01
|
||||
|
||||
for tp in futex_wait01 futex_wait02 futex_wait03 futex_wait04 \
|
||||
futex_wait_bitset01 futex_wait_bitset02 \
|
||||
futex_wake01 futex_wake02 futex_wake03
|
||||
do
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
${IHKOSCTL} 0 clear_kmsg
|
||||
|
||||
$MCEXEC $LTPBIN/$tp 2>&1 | tee $tp.txt
|
||||
ok=`grep TPASS $tp.txt | wc -l`
|
||||
ng1=`grep TFAIL $tp.txt | wc -l`
|
||||
ng2=`${IHKOSCTL} 0 kmsg | grep NOT_FIXED | wc -l`
|
||||
if [ $ng1 = 0 -a $ng2 = 0 ]; then
|
||||
echo "*** ${tname} PASSED ($ok)"
|
||||
else
|
||||
echo "*** ${tname} FAILED (ok=$ok ng1=$ng1 ng2=$ng2)"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
done
|
||||
|
||||
11
test/issues/1354/Makefile
Normal file
11
test/issues/1354/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
CFLAGS=-g
|
||||
LDFLAGS=
|
||||
|
||||
TARGET=
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
test: all
|
||||
./C1354.sh
|
||||
clean:
|
||||
rm -f $(TARGET) *.o *.txt
|
||||
34
test/issues/1354/README
Normal file
34
test/issues/1354/README
Normal file
@ -0,0 +1,34 @@
|
||||
【Issue#1354 動作確認】
|
||||
□ テスト内容
|
||||
1. 終了しようとしているスレッドがfp_regsの退避を行っていないことを確認
|
||||
fp_regsの退避を行うsave_fp_regsに、スレッドが終了しようとしているかどうかを
|
||||
判定するパッチを適用する
|
||||
コンテキストスイッチが発生する下記のLTPを実施し、パッチによる検出ログが
|
||||
kmsgに出力されていないことを確認する
|
||||
- futex_wait01
|
||||
- futex_wait02
|
||||
- futex_wait03
|
||||
- futex_wait04
|
||||
- futex_wait_bitset01
|
||||
- futex_wait_bitset02
|
||||
- futex_wake01
|
||||
- futex_wake02
|
||||
- futex_wake03
|
||||
|
||||
□ 実行手順
|
||||
1. 下記の手順でテストを実行する
|
||||
$ cd <mckernel>
|
||||
$ patch -p0 < test/issues/1354/1354_check.patch
|
||||
(build mckernel)
|
||||
$ cd test/issues/1354
|
||||
$ make test
|
||||
|
||||
McKernelのインストール先や、OSTEST, LTPの配置場所は、
|
||||
$HOME/.mck_test_config を参照している
|
||||
.mck_test_config は、McKernelをビルドした際に生成されるmck_test_config.sample ファイルを
|
||||
$HOMEにコピーし、適宜編集する
|
||||
|
||||
□ 実行結果
|
||||
x86_64_result.log aarch64_result.log 参照
|
||||
すべての項目をPASSしていることを確認。
|
||||
|
||||
72
test/issues/1354/aarch64_result.log
Normal file
72
test/issues/1354/aarch64_result.log
Normal file
@ -0,0 +1,72 @@
|
||||
*** C1354T01 start *******************************
|
||||
futex_wait01 1 TPASS : futex_wait(): errno=ETIMEDOUT(110): Connection timed out
|
||||
futex_wait01 2 TPASS : futex_wait(): errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable
|
||||
futex_wait01 3 TPASS : futex_wait(): errno=ETIMEDOUT(110): Connection timed out
|
||||
futex_wait01 4 TPASS : futex_wait(): errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable
|
||||
*** C1354T01 PASSED (4)
|
||||
|
||||
*** C1354T02 start *******************************
|
||||
futex_wait02 1 TPASS : futex_wait() woken up
|
||||
*** C1354T02 PASSED (1)
|
||||
|
||||
*** C1354T03 start *******************************
|
||||
futex_wait03 1 TPASS : futex_wait() woken up
|
||||
*** C1354T03 PASSED (1)
|
||||
|
||||
*** C1354T04 start *******************************
|
||||
futex_wait04 1 TPASS : futex_wait() returned -1: errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable
|
||||
*** C1354T04 PASSED (1)
|
||||
|
||||
*** C1354T05 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
futex_wait_bitset.h:17: INFO: testing futex_wait_bitset() timeout with CLOCK_MONOTONIC
|
||||
futex_wait_bitset.h:59: PASS: futex_wait_bitset() waited 101638us, expected 100010us
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1354T05 PASSED (0)
|
||||
|
||||
*** C1354T06 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
futex_wait_bitset.h:17: INFO: testing futex_wait_bitset() timeout with CLOCK_REALTIME
|
||||
futex_wait_bitset.h:59: PASS: futex_wait_bitset() waited 101593us, expected 100010us
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1354T06 PASSED (0)
|
||||
|
||||
*** C1354T07 start *******************************
|
||||
futex_wake01 1 TPASS : futex_wake() returned 0
|
||||
futex_wake01 2 TPASS : futex_wake() returned 0
|
||||
futex_wake01 3 TPASS : futex_wake() returned 0
|
||||
futex_wake01 4 TPASS : futex_wake() returned 0
|
||||
futex_wake01 5 TPASS : futex_wake() returned 0
|
||||
futex_wake01 6 TPASS : futex_wake() returned 0
|
||||
*** C1354T07 PASSED (6)
|
||||
|
||||
*** C1354T08 start *******************************
|
||||
futex_wake02 1 TBROK : futex_wake02.c:79: pthread_create(): EAGAIN/EWOULDBLOCK
|
||||
futex_wake02 2 TBROK : futex_wake02.c:79: Remaining cases broken
|
||||
futex_wake02 0 TINFO : Child process returned TBROK
|
||||
*** C1354T08 PASSED (0)
|
||||
|
||||
*** C1354T09 start *******************************
|
||||
futex_wake03 1 TPASS : futex_wake() woken up 1 childs
|
||||
futex_wake03 2 TPASS : futex_wake() woken up 2 childs
|
||||
futex_wake03 3 TPASS : futex_wake() woken up 3 childs
|
||||
futex_wake03 4 TPASS : futex_wake() woken up 4 childs
|
||||
futex_wake03 5 TPASS : futex_wake() woken up 5 childs
|
||||
futex_wake03 6 TPASS : futex_wake() woken up 6 childs
|
||||
futex_wake03 7 TPASS : futex_wake() woken up 7 childs
|
||||
futex_wake03 8 TPASS : futex_wake() woken up 8 childs
|
||||
futex_wake03 9 TPASS : futex_wake() woken up 9 childs
|
||||
futex_wake03 10 TPASS : futex_wake() woken up 10 childs
|
||||
futex_wake03 11 TPASS : futex_wake() woken up 0 children
|
||||
*** C1354T09 PASSED (11)
|
||||
|
||||
81
test/issues/1354/x86_64_result.log
Normal file
81
test/issues/1354/x86_64_result.log
Normal file
@ -0,0 +1,81 @@
|
||||
*** C1354T01 start *******************************
|
||||
futex_wait01 1 TPASS : futex_wait(): errno=ETIMEDOUT(110): Connection timed out
|
||||
futex_wait01 2 TPASS : futex_wait(): errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable
|
||||
futex_wait01 3 TPASS : futex_wait(): errno=ETIMEDOUT(110): Connection timed out
|
||||
futex_wait01 4 TPASS : futex_wait(): errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable
|
||||
*** C1354T01 PASSED (4)
|
||||
|
||||
*** C1354T02 start *******************************
|
||||
futex_wait02 1 TPASS : futex_wait() woken up
|
||||
*** C1354T02 PASSED (1)
|
||||
|
||||
*** C1354T03 start *******************************
|
||||
futex_wait03 1 TPASS : futex_wait() woken up
|
||||
*** C1354T03 PASSED (1)
|
||||
|
||||
*** C1354T04 start *******************************
|
||||
futex_wait04 1 TPASS : futex_wait() returned -1: errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable
|
||||
*** C1354T04 PASSED (1)
|
||||
|
||||
*** C1354T05 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
futex_wait_bitset.h:17: INFO: testing futex_wait_bitset() timeout with CLOCK_MONOTONIC
|
||||
futex_wait_bitset.h:59: PASS: futex_wait_bitset() waited 144790us, expected 100010us
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1354T05 PASSED (0)
|
||||
|
||||
*** C1354T06 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
futex_wait_bitset.h:17: INFO: testing futex_wait_bitset() timeout with CLOCK_REALTIME
|
||||
futex_wait_bitset.h:59: PASS: futex_wait_bitset() waited 144805us, expected 100010us
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1354T06 PASSED (0)
|
||||
|
||||
*** C1354T07 start *******************************
|
||||
futex_wake01 1 TPASS : futex_wake() returned 0
|
||||
futex_wake01 2 TPASS : futex_wake() returned 0
|
||||
futex_wake01 3 TPASS : futex_wake() returned 0
|
||||
futex_wake01 4 TPASS : futex_wake() returned 0
|
||||
futex_wake01 5 TPASS : futex_wake() returned 0
|
||||
futex_wake01 6 TPASS : futex_wake() returned 0
|
||||
*** C1354T07 PASSED (6)
|
||||
|
||||
*** C1354T08 start *******************************
|
||||
futex_wake02 1 TPASS : futex_wake() woken up 1 threads
|
||||
futex_wake02 2 TPASS : futex_wake() woken up 2 threads
|
||||
futex_wake02 3 TPASS : futex_wake() woken up 3 threads
|
||||
futex_wake02 4 TPASS : futex_wake() woken up 4 threads
|
||||
futex_wake02 5 TPASS : futex_wake() woken up 5 threads
|
||||
futex_wake02 6 TPASS : futex_wake() woken up 6 threads
|
||||
futex_wake02 7 TPASS : futex_wake() woken up 7 threads
|
||||
futex_wake02 8 TPASS : futex_wake() woken up 8 threads
|
||||
futex_wake02 9 TPASS : futex_wake() woken up 9 threads
|
||||
futex_wake02 10 TPASS : futex_wake() woken up 10 threads
|
||||
futex_wake02 11 TPASS : futex_wake() woken up 0 threads
|
||||
futex_wake02 0 TINFO : Child process returned TPASS
|
||||
*** C1354T08 PASSED (12)
|
||||
|
||||
*** C1354T09 start *******************************
|
||||
futex_wake03 1 TPASS : futex_wake() woken up 1 childs
|
||||
futex_wake03 2 TPASS : futex_wake() woken up 2 childs
|
||||
futex_wake03 3 TPASS : futex_wake() woken up 3 childs
|
||||
futex_wake03 4 TPASS : futex_wake() woken up 4 childs
|
||||
futex_wake03 5 TPASS : futex_wake() woken up 5 childs
|
||||
futex_wake03 6 TPASS : futex_wake() woken up 6 childs
|
||||
futex_wake03 7 TPASS : futex_wake() woken up 7 childs
|
||||
futex_wake03 8 TPASS : futex_wake() woken up 8 childs
|
||||
futex_wake03 9 TPASS : futex_wake() woken up 9 childs
|
||||
futex_wake03 10 TPASS : futex_wake() woken up 10 childs
|
||||
futex_wake03 11 TPASS : futex_wake() woken up 0 children
|
||||
*** C1354T09 PASSED (11)
|
||||
|
||||
Reference in New Issue
Block a user