<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Viresh,</div></div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small">Seems this patch involved a new regression:(.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Viresh Kumar <<a href="mailto:viresh.kumar@linaro.org">viresh.kumar@linaro.org</a>> wrote:<br></div><div dir="ltr" class="gmail_attr"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail_default" style="font-size:small">...</span><br>
<br>
+typedef int (*mysyscall)(clockid_t clk_id, void *ts);<br>
+<br>
+int syscall_supported_by_kernel(mysyscall func)<br>
+{<br>
+ int ret;<br>
+<br>
+ ret = func(0, NULL); </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ if (ret == -1 && errno == ENOSYS)<br>
+ return 0;<br>
+<br>
+ return 1;<br>
+}<br>
<span class="gmail_default" style="font-size:small">...</span> }<br>
<br>
int tst_clock_gettime(clockid_t clk_id, struct timespec *ts)<br>
{<br>
- return tst_syscall(__NR_clock_gettime, clk_id, ts);<br>
+ struct tst_ts tts = { 0, };<br>
+ static mysyscall func;<br>
+ int ret;<br>
+<br>
+#if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL)<br>
+ if (!func && syscall_supported_by_kernel(sys_clock_gettime64)) {<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small"><div><span class="gmail_default">To invoke sys_clock_gettime64 here makes no chance to choose </span>the correct syscall version since tst_syscall() will exit directly when getting ENOSYS.</div><div><span class="gmail_default"><br>We got many tests TCONF like the mmap18 did as below:</span></div><div><span class="gmail_default">-------------------<br># uname -rm<br>5.8.0-rc2+ aarch64<br># ./mmap18<br>tst_test.c:1247: INFO: Timeout per run is 0h 05m 00s<br>../include/tst_timer.h:214: CONF: syscall(403) __NR_clock_gettime64 not supported</span></div><div><span class="gmail_default"><br></span></div><div><span class="gmail_default">the function call trace:</span></div><div><span class="gmail_default">-----------------------------</span></div><div><span class="gmail_default"><div><div class="gmail_default">testrun()</div><div class="gmail_default">get_time_ms</div><div class="gmail_default">...</div></div><div><div class="gmail_default">tst_clock_gettime</div><div class="gmail_default">syscall_supported_by_kernel</div><div class="gmail_default">sys_clock_gettime64</div><div class="gmail_default">tst_syscall(__NR_clock_gettime64, ...)</div></div><div><span class="gmail_default"><br></span></div><br>---- syscalls/regen.sh -----<br>#define tst_syscall(NR, ...) ({ \\<br> int tst_ret; \\<br> if (NR == __LTP__NR_INVALID_SYSCALL) { \\<br> errno = ENOSYS; \\<br> tst_ret = -1; \\<br> } else { \\<br> tst_ret = syscall(NR, ##__VA_ARGS__); \\<br> } \\<br> if (tst_ret == -1 && errno == ENOSYS) { \\<br> tst_brk(TCONF, "syscall(%d) " #NR " not supported", NR); \\<br> } \\<br> tst_ret; \\<br>})</span></div></div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ func = sys_clock_gettime64;<br>
+ tts.type = TST_KERN_TIMESPEC;<br>
+ }<br>
+#endif<br>
+<br>
+ if (!func && syscall_supported_by_kernel(sys_clock_gettime)) {<br>
+ func = sys_clock_gettime;<br>
+ tts.type = TST_KERN_OLD_TIMESPEC;<br>
+ }<br>
+<br>
+ if (!func) {<br>
+ tst_res(TCONF, "clock_gettime() not available");<br>
+ errno = ENOSYS;<br>
+ return -1;<br>
+ }<br>
+<br>
+ ret = func(clk_id, tst_ts_get(&tts));<br>
+ ts->tv_sec = tst_ts_get_sec(tts);<br>
+ ts->tv_nsec = tst_ts_get_nsec(tts);<br>
+ return ret;<br>
}<br>
<span class="gmail_default" style="font-size:small"></span></blockquote><div><br></div><div> </div></div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>