forked from RIKEN-SysSoft/ihk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I8870ae0ce75624fa587e21c9fd24e68c33f0ef34 Fujitsu: POSTK_DEBUG_ARCH_DEP_29 Refs: #1352
- Loading branch information
1 parent
d5dc163
commit ec2472d
Showing
10 changed files
with
307 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#/bin/sh | ||
|
||
USELTP=1 | ||
USEOSTEST=0 | ||
|
||
. ../../../../mckernel/test/common.sh | ||
|
||
issue=1352 | ||
tid=01 | ||
|
||
arch=`uname -p` | ||
if [ "${arch}" == "x86_64" ]; then | ||
sudo tail -n 30 /var/log/messages > ./msg_after_mcreboot.txt | ||
fi | ||
|
||
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 *******************************" | ||
$MCEXEC $LTPBIN/$tp 2>&1 | tee $tp.txt | ||
ok=`grep TPASS $tp.txt | wc -l` | ||
ng=`grep TFAIL $tp.txt | wc -l` | ||
if [ $ng = 0 ]; then | ||
echo "*** ${tname} PASSED ($ok)" | ||
else | ||
echo "*** ${tname} FAILED (ok=$ok ng=%ng)" | ||
fi | ||
let tid++ | ||
echo "" | ||
done | ||
|
||
if [ "${arch}" == "x86_64" ]; then | ||
tname=`printf "C${issue}T%02d" ${tid}` | ||
echo "*** ${tname} start *******************************" | ||
grep "TSC_.*:" ./msg_after_mcreboot.txt | ||
ok=`grep "TSC_OK" ./msg_after_mcreboot.txt | wc -l` | ||
ng=`grep "TSC_NG" ./msg_after_mcreboot.txt | wc -l` | ||
if [ $ok = 2 ]; then | ||
echo "*** ${tname} PASSED ($ok)" | ||
else | ||
echo "*** ${tname} FAILED (ok=$ok ng=%ng)" | ||
fi | ||
let tid++ | ||
echo "" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CFLAGS=-g | ||
LDFLAGS= | ||
|
||
TARGET= | ||
|
||
all: $(TARGET) | ||
|
||
test: all | ||
./C1352.sh | ||
clean: | ||
rm -f $(TARGET) *.o *.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
【Issue#1352 動作確認】 | ||
□ テスト内容 | ||
1. ns_per_tscを用いるfutexの既存処理に影響しないことを確認 | ||
以下のLTPがPASSすることを確認 | ||
- futex_wait01 | ||
- futex_wait02 | ||
- futex_wait03 | ||
- futex_wait04 | ||
- futex_wait_bitset01 | ||
- futex_wait_bitset02 | ||
- futex_wake01 | ||
- futex_wake02 | ||
- futex_wake03 | ||
|
||
2. MSR_PLATFORM_INFO から取得したratioの確認 (x86_64アーキテクチャのみで実施) | ||
MSR_PLATFORM_INFOから取得したratioと、kernelが保持している | ||
tsc_khz の値を比較し、誤差が±0.01%の範囲内であることを確認する | ||
また、ratioから算出されたns_per_tscが、tsc_khzから算出された | ||
tscと一致することを確認する | ||
|
||
□ 実行手順 | ||
1. 下記の手順でテストを実行する | ||
$ cd <ihk> | ||
$ patch -p0 < test/issues/1352/comp_ratio_to_tsc_khz.patch | ||
(build mckernel) | ||
$ cd test/issues/1352 | ||
$ 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していることを確認。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
*** C1352T01 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 | ||
*** C1352T01 PASSED (4) | ||
|
||
*** C1352T02 start ******************************* | ||
futex_wait02 1 TPASS : futex_wait() woken up | ||
*** C1352T02 PASSED (1) | ||
|
||
*** C1352T03 start ******************************* | ||
futex_wait03 1 TPASS : futex_wait() woken up | ||
*** C1352T03 PASSED (1) | ||
|
||
*** C1352T04 start ******************************* | ||
futex_wait04 1 TPASS : futex_wait() returned -1: errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable | ||
*** C1352T04 PASSED (1) | ||
|
||
*** C1352T05 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 101746us, expected 100010us | ||
|
||
Summary: | ||
passed 1 | ||
failed 0 | ||
skipped 0 | ||
warnings 0 | ||
*** C1352T05 PASSED (0) | ||
|
||
*** C1352T06 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 102127us, expected 100010us | ||
|
||
Summary: | ||
passed 1 | ||
failed 0 | ||
skipped 0 | ||
warnings 0 | ||
*** C1352T06 PASSED (0) | ||
|
||
*** C1352T07 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 | ||
*** C1352T07 PASSED (6) | ||
|
||
*** C1352T08 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 | ||
*** C1352T08 PASSED (0) | ||
|
||
*** C1352T09 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 | ||
*** C1352T09 PASSED (11) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git linux/driver/smp/arch/x86_64/smp-arch-driver.c linux/driver/smp/arch/x86_64/smp-arch-driver.c | ||
index 6838980..a3001eb 100644 | ||
--- linux/driver/smp/arch/x86_64/smp-arch-driver.c | ||
+++ linux/driver/smp/arch/x86_64/smp-arch-driver.c | ||
@@ -369,6 +369,24 @@ unsigned long calc_ns_per_tsc(void) | ||
ratio = (msr >> 8) & 0xFF; | ||
|
||
ret = 10000 / ratio; | ||
+ | ||
+ /* THIS IS TEST-CODE FOR ISSUE_1352 */ | ||
+ /* check if ratio is nearly equal tsc_khz */ | ||
+ unsigned long ratio_khz = ratio * 100000; | ||
+ unsigned long expect_tsc = 1000000000L / tsc_khz; // calc by tsc_khz | ||
+ if ((ratio_khz > tsc_khz * 0.9999) && (ratio_khz < tsc_khz * 1.0001)) { | ||
+ printk("TSC_OK: ratio is nearly equal to tsc_khz\n"); | ||
+ } | ||
+ else { | ||
+ printk("TSC_NG: ratio is NOT correct\n"); | ||
+ } | ||
+ if (expect_tsc == ret) { | ||
+ printk("TSC_OK: ns_per_tsc value is as expected\n"); | ||
+ } | ||
+ else { | ||
+ printk("TSC_NG: ns_per_tsc value is NOT as expected\n"); | ||
+ } | ||
+ | ||
} | ||
else { | ||
ret = 1000000000L / tsc_khz; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
*** C1352T01 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 | ||
*** C1352T01 PASSED (4) | ||
|
||
*** C1352T02 start ******************************* | ||
futex_wait02 1 TPASS : futex_wait() woken up | ||
*** C1352T02 PASSED (1) | ||
|
||
*** C1352T03 start ******************************* | ||
futex_wait03 1 TPASS : futex_wait() woken up | ||
*** C1352T03 PASSED (1) | ||
|
||
*** C1352T04 start ******************************* | ||
futex_wait04 1 TPASS : futex_wait() returned -1: errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable | ||
*** C1352T04 PASSED (1) | ||
|
||
*** C1352T05 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 144495us, expected 100010us | ||
|
||
Summary: | ||
passed 1 | ||
failed 0 | ||
skipped 0 | ||
warnings 0 | ||
*** C1352T05 PASSED (0) | ||
|
||
*** C1352T06 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 144501us, expected 100010us | ||
|
||
Summary: | ||
passed 1 | ||
failed 0 | ||
skipped 0 | ||
warnings 0 | ||
*** C1352T06 PASSED (0) | ||
|
||
*** C1352T07 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 | ||
*** C1352T07 PASSED (6) | ||
|
||
*** C1352T08 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 | ||
*** C1352T08 PASSED (12) | ||
|
||
*** C1352T09 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 | ||
*** C1352T09 PASSED (11) | ||
|
||
*** C1352T10 start ******************************* | ||
Sep 15 14:43:12 wallaby12 kernel: TSC_OK: ratio is nearly equal to tsc_khz | ||
Sep 15 14:43:12 wallaby12 kernel: TSC_OK: ns_per_tsc value is as expected | ||
*** C1352T10 PASSED (2) | ||
|