Skip to contentSkip to conversation

clock_gettime04: print more info to help debugging

PATCH New Li Wang 2 participants 8 messages Mar 8, 2021 – Mar 9, 2021

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 clock_gettime04: print more info to help debugging

We get some sporadically failures like below, but we don't know which loop it comes from. So adding more prints to help locate issue.

tst_test.c:1286: TINFO: Timeout per run is 0h 05m 00s
vdso_helpers.c:76: TINFO: Couldn't find vdso_gettime64()
clock_gettime04.c:157: TPASS: CLOCK_REALTIME: Difference between successive readings is reasonable clock_gettime04.c:150: TFAIL: CLOCK_REALTIME_COARSE: Difference between successive readings greater than 5 ms (1): 8 clock_gettime04.c:157: TPASS: CLOCK_MONOTONIC: Difference between successive readings is reasonable clock_gettime04.c:150: TFAIL: CLOCK_MONOTONIC_COARSE: Difference between successive readings greater than 5 ms (0): 5 clock_gettime04.c:157: TPASS: CLOCK_MONOTONIC_RAW: Difference between successive readings is reasonable clock_gettime04.c:157: TPASS: CLOCK_BOOTTIME: Difference between successive readings is reasonable

Btw, it occurs on a x86_64 (not virtualized) with kernel 5.11.0.

---
 testcases/kernel/syscalls/clock_gettime/clock_gettime04.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +3 -0
index 5f8264cc6..4dc9093c7 100644
@@ -108,6 +108,9 @@ static void run(unsigned int i)
 			if (tv->clock_gettime == my_gettimeofday && clks[i] != CLOCK_REALTIME)
 				continue;
 
+			if (tv->clock_gettime && count == 10000)
+				tst_res(TINFO, "%s", tv->desc);
+
 			ret = tv->clock_gettime(clks[i], tst_ts_get(&ts));
 			if (ret) {
 				/*
Signature · 1 line
2.21.3
#1 lore raw

PATCH 1/1 clock_gettime04: print more info to help debugging

Quoted 24 lines · Li Wang

We get some sporadically failures like below, but we don't know which loop it comes from. So adding more prints to help locate issue.

tst_test.c:1286: TINFO: Timeout per run is 0h 05m 00s
vdso_helpers.c:76: TINFO: Couldn't find vdso_gettime64()
clock_gettime04.c:157: TPASS: CLOCK_REALTIME: Difference between successive readings is reasonable clock_gettime04.c:150: TFAIL: CLOCK_REALTIME_COARSE: Difference between successive readings greater than 5 ms (1): 8 clock_gettime04.c:157: TPASS: CLOCK_MONOTONIC: Difference between successive readings is reasonable clock_gettime04.c:150: TFAIL: CLOCK_MONOTONIC_COARSE: Difference between successive readings greater than 5 ms (0): 5 clock_gettime04.c:157: TPASS: CLOCK_MONOTONIC_RAW: Difference between successive readings is reasonable clock_gettime04.c:157: TPASS: CLOCK_BOOTTIME: Difference between successive readings is reasonable

Btw, it occurs on a x86_64 (not virtualized) with kernel 5.11.0.

---
 testcases/kernel/syscalls/clock_gettime/clock_gettime04.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +0 -0
index 5f8264cc6..4dc9093c7 100644

testcases/kernel/syscalls/clock_gettime/clock_gettime04.c static void run(unsigned int i) · line 111

Quoted 4 lines
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +1 -0
@@ -108,6 +108,9 @@ static void run(unsigned int i)
 			if (tv->clock_gettime == my_gettimeofday && clks[i] != CLOCK_REALTIME)
 				continue;
 
+			if (tv->clock_gettime && count == 10000)

clock_gettime will always be valid here, isn't it ?

testcases/kernel/syscalls/clock_gettime/clock_gettime04.c static void run(unsigned int i) · line 113

Quoted 2 lines
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +2 -0
+				tst_res(TINFO, "%s", tv->desc);
+

I think you just need to add this to setup(), same is done for various tests already.

        tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
Signature · 1 line
viresh
author
#2 lore raw

PATCH 1/1 clock_gettime04: print more info to help debugging

Quoted 34 lines · Viresh Kumar
Quoted 6 lines · Li Wang

We get some sporadically failures like below, but we don't know which loop it comes from. So adding more prints to help locate issue.

tst_test.c:1286: TINFO: Timeout per run is 0h 05m 00s vdso_helpers.c:76: TINFO: Couldn't find vdso_gettime64() clock_gettime04.c:157: TPASS: CLOCK_REALTIME: Difference between

successive readings is reasonable

Quoted 1 line

clock_gettime04.c:150: TFAIL: CLOCK_REALTIME_COARSE: Difference

between successive readings greater than 5 ms (1): 8

Quoted 1 line

clock_gettime04.c:157: TPASS: CLOCK_MONOTONIC: Difference between

successive readings is reasonable

Quoted 1 line

clock_gettime04.c:150: TFAIL: CLOCK_MONOTONIC_COARSE: Difference

between successive readings greater than 5 ms (0): 5

Quoted 1 line

clock_gettime04.c:157: TPASS: CLOCK_MONOTONIC_RAW: Difference between

successive readings is reasonable

Quoted 1 line

clock_gettime04.c:157: TPASS: CLOCK_BOOTTIME: Difference between

successive readings is reasonable

Review

Quoted 9 lines

Btw, it occurs on a x86_64 (not virtualized) with kernel 5.11.0.

---
 testcases/kernel/syscalls/clock_gettime/clock_gettime04.c | 3 +++
 1 file changed, 3 insertions(+)
(quoted diff) +0 -0

b/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c

testcases/kernel/syscalls/clock_gettime/clock_gettime04.c static void run(unsigned int i) · line 108

Quoted 5 lines

index 5f8264cc6..4dc9093c7 100644

testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +0 -0
@@ -108,6 +108,9 @@ static void run(unsigned int i)
                      if (tv->clock_gettime == my_gettimeofday &&

clks[i] != CLOCK_REALTIME)

Quoted 6 lines

testcases/kernel/syscalls/clock_gettime/clock_gettime04.c static void run(unsigned int i) · line 111

Quoted 3 lines
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +1 -0
                              continue;
 
+                     if (tv->clock_gettime && count == 10000)

clock_gettime will always be valid here, isn't it ?

Yes, but that's not harmful. If you remove all entries of varaints[] you can still get PASS from the test, that's something strange to us. So I just add this check there.

Quoted 7 lines

testcases/kernel/syscalls/clock_gettime/clock_gettime04.c static void run(unsigned int i) · line 113

Quoted 3 lines
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +2 -0
+                             tst_res(TINFO, "%s", tv->desc);
+

I think you just need to add this to setup(), same is done for various tests already.

No, that will only print the first entry instruct variants because you're using two iterations in the run(), the second loop 'j' is to traverse the variants[] actually.

Quoted 7 lines
        tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);

--
viresh

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210308/603d0d14/attachment.htm>
#3 lore raw

PATCH 1/1 clock_gettime04: print more info to help debugging

Quoted 1 line · Li Wang

Yes, but that's not harmful.

But is useless.

Quoted 3 lines

If you remove all entries of varaints[] you can
still get PASS from the test, that's something strange to us. So I just add this check there.

Yes, that would happen because we will not run the inner loop in that case and even the condition you are adding will not run at all.

This wasn't designed to run with empty variants list and so we don't verify that variants structure is empty or not and so it passes.

Quoted 3 lines

No, that will only print the first entry instruct variants because you're using two iterations in the run(), the second loop 'j' is to traverse the variants[] actually.

Ahh, my bad. I didn't read the code properly. Sorry about that.

Now that I had a look again, with what you are adding here we will start printing another line for each variant and it will be printed just once at the beginning of the loop of 10000 iterations. Right ?

I am not sure how that will help you get more info out, to me it is still very much unreadable. Can you show the final output as well ?

What about adding tv->desc to all the existing print messages instead ? Or maybe just the TFAIL ones? So we print everything in a single line only ?

Signature · 1 line
viresh
author
#4 lore raw

PATCH 1/1 clock_gettime04: print more info to help debugging

Quoted 7 lines · Viresh Kumar
Quoted 1 line · Li Wang

Yes, but that's not harmful.

But is useless.

Quoted 2 lines

If you remove all entries of varaints[] you can
still get PASS from the test, that's something strange to us. So I just

Quoted 9 lines

add

Quoted 1 line

this check there.

Yes, that would happen because we will not run the inner loop in that case and even the condition you are adding will not run at all.

This wasn't designed to run with empty variants list and so we don't verify that variants structure is empty or not and so it passes.

Indeed. I agree to remove 'tv->clock_gettime' check.

Quoted 11 lines
Quoted 4 lines

No, that will only print the first entry instruct variants because you're using two iterations in the run(), the second loop 'j' is to traverse the variants[] actually.

Ahh, my bad. I didn't read the code properly. Sorry about that.

Now that I had a look again, with what you are adding here we will start printing another line for each variant and it will be printed just once at the beginning of the loop of 10000 iterations. Right ?

Right.

Quoted 4 lines

I am not sure how that will help you get more info out, to me it is still very much unreadable. Can you show the final output as well ?

# ./clock_gettime04
tst_test.c:1288: TINFO: Timeout per run is 0h 05m 00s
clock_gettime04.c:84: TINFO: Running in a virtual machine, multiply the
delta by 10.
vdso_helpers.c:76: TINFO: Couldn't find vdso_gettime64()
clock_gettime04.c:158: TPASS: CLOCK_REALTIME: Difference between successive
readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_REALTIME_COARSE: Difference between
successive readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC: Difference between
successive readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC_COARSE: Difference between
successive readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC_RAW: Difference between
successive readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_BOOTTIME: Difference between successive
readings is reasonable

After my patch:

# ./clock_gettime04
tst_test.c:1288: TINFO: Timeout per run is 0h 05m 00s
clock_gettime04.c:84: TINFO: Running in a virtual machine, multiply the
delta by 10.
vdso_helpers.c:76: TINFO: Couldn't find vdso_gettime64()
clock_gettime04.c:112: TINFO: vDSO or syscall with libc spec
clock_gettime04.c:112: TINFO: syscall with old kernel spec
clock_gettime04.c:112: TINFO: vDSO with old kernel spec
clock_gettime04.c:112: TINFO: gettimeofday
clock_gettime04.c:160: TPASS: CLOCK_REALTIME: Difference between successive
readings is reasonable
clock_gettime04.c:112: TINFO: vDSO or syscall with libc spec
clock_gettime04.c:112: TINFO: syscall with old kernel spec
clock_gettime04.c:112: TINFO: vDSO with old kernel spec
clock_gettime04.c:160: TPASS: CLOCK_REALTIME_COARSE: Difference between
successive readings is reasonable
clock_gettime04.c:112: TINFO: vDSO or syscall with libc spec
clock_gettime04.c:112: TINFO: syscall with old kernel spec
clock_gettime04.c:112: TINFO: vDSO with old kernel spec
clock_gettime04.c:160: TPASS: CLOCK_MONOTONIC: Difference between
successive readings is reasonable
clock_gettime04.c:112: TINFO: vDSO or syscall with libc spec
clock_gettime04.c:112: TINFO: syscall with old kernel spec
clock_gettime04.c:112: TINFO: vDSO with old kernel spec
clock_gettime04.c:160: TPASS: CLOCK_MONOTONIC_COARSE: Difference between
successive readings is reasonable
clock_gettime04.c:112: TINFO: vDSO or syscall with libc spec
clock_gettime04.c:112: TINFO: syscall with old kernel spec
clock_gettime04.c:112: TINFO: vDSO with old kernel spec
clock_gettime04.c:160: TPASS: CLOCK_MONOTONIC_RAW: Difference between
successive readings is reasonable
clock_gettime04.c:112: TINFO: vDSO or syscall with libc spec
clock_gettime04.c:112: TINFO: syscall with old kernel spec
clock_gettime04.c:112: TINFO: vDSO with old kernel spec
clock_gettime04.c:160: TPASS: CLOCK_BOOTTIME: Difference between successive
readings is reasonable
Quoted 5 lines

What about adding tv->desc to all the existing print messages instead ? Or maybe just the TFAIL ones? So we print everything in a single line only ?

But that still not good enough.
e.g
In PASS status, we missing some details.

Quoted 5 lines

--
viresh

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210308/aae2314a/attachment.htm>
#5 lore raw

PATCH 1/1 clock_gettime04: print more info to help debugging

Quoted 21 lines · Li Wang
# ./clock_gettime04
tst_test.c:1288: TINFO: Timeout per run is 0h 05m 00s
clock_gettime04.c:84: TINFO: Running in a virtual machine, multiply the
delta by 10.
vdso_helpers.c:76: TINFO: Couldn't find vdso_gettime64()
clock_gettime04.c:158: TPASS: CLOCK_REALTIME: Difference between successive
readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_REALTIME_COARSE: Difference between
successive readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC: Difference between
successive readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC_COARSE: Difference between
successive readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC_RAW: Difference between
successive readings is reasonable
clock_gettime04.c:158: TPASS: CLOCK_BOOTTIME: Difference between successive
readings is reasonable

After my patch:

Quoted 9 lines
# ./clock_gettime04
tst_test.c:1288: TINFO: Timeout per run is 0h 05m 00s
clock_gettime04.c:84: TINFO: Running in a virtual machine, multiply the
delta by 10.
vdso_helpers.c:76: TINFO: Couldn't find vdso_gettime64()
clock_gettime04.c:112: TINFO: vDSO or syscall with libc spec
clock_gettime04.c:112: TINFO: syscall with old kernel spec
clock_gettime04.c:112: TINFO: vDSO with old kernel spec
clock_gettime04.c:112: TINFO: gettimeofday

The above doesn't look nice TBH.

Quoted 4 lines

clock_gettime04.c:160: TPASS: CLOCK_REALTIME: Difference between successive readings is reasonable

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

What about adding tv->desc to all the existing print messages instead ? Or maybe just the TFAIL ones? So we print everything in a single line only ?

But that still not good enough.
e.g
In PASS status, we missing some details.

Hmm, so there are two loops we are running here. One is for each CLOCK and one for each variant. And the final PASS message only talks about the CLOCK type and there is nothing about variants..

Lets decide how we want the output message to look and then code can be changed accordingly.

Option 1: Just like what we have right now.

clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC: Difference between successive readings is reasonable

Option 2: Separate line for each variant.

clock_gettime04.c:158: TPASS: vDSO or syscall with libc spec: CLOCK_MONOTONIC: Difference between successive readings is reasonable

clock_gettime04.c:158: TPASS: syscall with old kernel spec  : CLOCK_MONOTONIC: Difference between successive readings is reasonable
clock_gettime04.c:158: TPASS: vDSO with old kernel spec     : CLOCK_MONOTONIC: Difference between successive readings is reasonable
clock_gettime04.c:158: TPASS: gettimeofday                  : CLOCK_MONOTONIC: Difference between successive readings is reasonable

Option 3: Same as option 2 but different formatting

clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC: Difference between successive readings is reasonable for following variants:
- vDSO or syscall with libc spec
- syscall with old kernel spec
- vDSO with old kernel spec
- gettimeofday

Any other option here ?

For the FAIL messages, I think just adding tv->desc is good enough.

Signature · 1 line
viresh
author
#6 lore raw

PATCH 1/1 clock_gettime04: print more info to help debugging

Viresh Kumar <[email protected]> wrote:

...

Quoted 9 lines

Option 3: Same as option 2 but different formatting

clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC: Difference between successive readings is reasonable for following variants:
- vDSO or syscall with libc spec
- syscall with old kernel spec
- vDSO with old kernel spec
- gettimeofday

Any other option here ?

Quoted 1 line

I think no.

Quoted 3 lines

For the FAIL messages, I think just adding tv->desc is good enough.

+1, I prefer to go with Option3 + 'tv->desc for FAIL'.

Would you mind formatting a patch, or I can do that?

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210308/45e21897/attachment.htm>
#7 lore raw

PATCH 1/1 clock_gettime04: print more info to help debugging

Quoted 19 lines · Li Wang

Viresh Kumar <[email protected]> wrote:

...

Quoted 9 lines

Option 3: Same as option 2 but different formatting

clock_gettime04.c:158: TPASS: CLOCK_MONOTONIC: Difference between successive readings is reasonable for following variants:
- vDSO or syscall with libc spec
- syscall with old kernel spec
- vDSO with old kernel spec
- gettimeofday

Any other option here ?

Quoted 1 line

I think no.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

For the FAIL messages, I think just adding tv->desc is good enough.

+1, I prefer to go with Option3 + 'tv->desc for FAIL'.

Would you mind formatting a patch, or I can do that?

Since you started it, I will let you finish it as well :)

Thanks.

Signature · 1 line
viresh