All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [s390x vDSO Bug?] clock_gettime(CLOCK_MONOTONIC_RAW, ...) gets abnormal ts value
@ 2021-03-23  6:21 Li Wang
  2021-03-23  7:11   ` [LTP] " Heiko Carstens
  0 siblings, 1 reply; 25+ messages in thread
From: Li Wang @ 2021-03-23  6:21 UTC (permalink / raw)
  To: ltp

Hi linux-s390 experts,

We observed that LTP/clock_gettime04 always FAIL on s390x with
kernel-v5.12-rc3.
To simply show the problem, I rewrite the LTP reproducer as a simple C
below.
Maybe it's a new bug introduced from the kernel-5.12 series branch?

PASS:
------------
# uname -r
5.11.0-*.s390x

# grep TIME_NS /boot/config-5.11.0-*.s390x
no TIME_NS enabled

## ./test-timer
vdso_ts_nsec = 898169901815, vdso_ts.tv_sec = 898, vdso_ts.tv_nsec =
169901815
sys_ts_nsec  = 898169904269, sys_ts.tv_sec  = 898, sys_ts.tv_nsec  =
169904269
===> PASS

FAIL:
----------
# uname -r
5.12.0-0.rc3.*.s390x

# grep TIME_NS /boot/config-5.12.0-0.rc3.s390x
CONFIG_TIME_NS=y
CONFIG_GENERIC_VDSO_TIME_NS=y

# ./test-timer
vdso_ts_nsec = 4484351380985507, vdso_ts.tv_sec = 4484351, vdso_ts.tv_nsec
= 380985507
sys_ts_nsec  = 1446923235377, sys_ts.tv_sec  = 1446, sys_ts.tv_nsec  =
923235377
===> FAIL


# cat test-timer.c

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <asm/unistd_64.h>

long long ts_to_ns(struct timespec ts)
{
        return (ts.tv_sec * 1000000000 + ts.tv_nsec);
}

int main(void)
{
        long long vdso_ts_nsec, sys_ts_nsec;

        struct timespec vdso_ts, sys_ts;

        clock_gettime(CLOCK_MONOTONIC_RAW, &vdso_ts); //vdso way
        syscall(__NR_clock_gettime, CLOCK_MONOTONIC_RAW, &sys_ts);

        vdso_ts_nsec = ts_to_ns(vdso_ts);
        sys_ts_nsec  = ts_to_ns(sys_ts);


        printf("vdso_ts_nsec = %lld, vdso_ts.tv_sec = %ld, vdso_ts.tv_nsec
= %ld\n", vdso_ts_nsec, vdso_ts.tv_sec, vdso_ts.tv_nsec);
        printf("sys_ts_nsec  = %lld, sys_ts.tv_sec  = %ld, sys_ts.tv_nsec
 = %ld\n", sys_ts_nsec, sys_ts.tv_sec, sys_ts.tv_nsec);

        if ((vdso_ts_nsec - sys_ts_nsec) > 1000000)
                printf("===> FAIL\n");
        else
                printf("===> PASS\n");

        return 0;
}

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210323/05629b65/attachment.htm>

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2021-03-25 17:58 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23  6:21 [LTP] [s390x vDSO Bug?] clock_gettime(CLOCK_MONOTONIC_RAW, ...) gets abnormal ts value Li Wang
2021-03-23  7:11 ` Heiko Carstens
2021-03-23  7:11   ` [LTP] " Heiko Carstens
2021-03-23 13:48   ` Heiko Carstens
2021-03-23 13:48     ` [LTP] " Heiko Carstens
2021-03-23 21:58   ` [PATCH 0/3] s390 vdso fixes Heiko Carstens
2021-03-23 21:58     ` [LTP] " Heiko Carstens
2021-03-23 21:58     ` [PATCH 1/3] s390/vdso: fix tod clock steering Heiko Carstens
2021-03-23 21:58       ` [LTP] " Heiko Carstens
2021-03-24  9:50       ` Heiko Carstens
2021-03-24  9:50         ` [LTP] " Heiko Carstens
2021-03-23 21:58     ` [PATCH 2/3] s390/vdso: fix arch_data access for __arch_get_hw_counter() Heiko Carstens
2021-03-23 21:58       ` [LTP] " Heiko Carstens
2021-03-24  5:53       ` Heiko Carstens
2021-03-24  5:53         ` [LTP] " Heiko Carstens
2021-03-23 21:58     ` [PATCH 3/3] lib/vdso: remove struct arch_vdso_data from vdso data struct Heiko Carstens
2021-03-23 21:58       ` [LTP] " Heiko Carstens
2021-03-25 17:55       ` Thomas Gleixner
2021-03-25 17:55         ` [LTP] " Thomas Gleixner
2021-03-25 17:57         ` Thomas Gleixner
2021-03-25 17:57           ` [LTP] " Thomas Gleixner
2021-03-25  8:56     ` [LTP] [PATCH 0/3] s390 vdso fixes Li Wang
2021-03-25 12:33       ` Heiko Carstens
2021-03-25 12:33         ` [LTP] " Heiko Carstens
2021-03-25 14:11         ` Li Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.