Re: [PATCH bpf] selftests/bpf: Relax time_tai test for equal timestamps in tai_forward

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 12, 2023 at 1:53 PM YiFei Zhu <zhuyifei@xxxxxxxxxx> wrote:
>
> On Tue, Dec 12, 2023 at 1:39 PM Yonghong Song <yonghong.song@xxxxxxxxx> wrote:
> >
> >
> > On 12/12/23 10:29 AM, YiFei Zhu wrote:
> > > We're observing test flakiness on an arm64 platform which might not
> > > have timestamps as precise as x86. The test log looks like:
> > >
> > >    test_time_tai:PASS:tai_open 0 nsec
> > >    test_time_tai:PASS:test_run 0 nsec
> > >    test_time_tai:PASS:tai_ts1 0 nsec
> > >    test_time_tai:PASS:tai_ts2 0 nsec
> > >    test_time_tai:FAIL:tai_forward unexpected tai_forward: actual 1702348135471494160 <= expected 1702348135471494160
> > >    test_time_tai:PASS:tai_gettime 0 nsec
> > >    test_time_tai:PASS:tai_future_ts1 0 nsec
> > >    test_time_tai:PASS:tai_future_ts2 0 nsec
> > >    test_time_tai:PASS:tai_range_ts1 0 nsec
> > >    test_time_tai:PASS:tai_range_ts2 0 nsec
> > >    #199     time_tai:FAIL
> > >
> > > This patch changes ASSERT_GT to ASSERT_GE in the tai_forward assertion
> > > so that equal timestamps are permitted.
> > >
> > > Fixes: 64e15820b987 ("selftests/bpf: Add BPF-helper test for CLOCK_TAI access")
> > > Signed-off-by: YiFei Zhu <zhuyifei@xxxxxxxxxx>
> > > ---
> > >   tools/testing/selftests/bpf/prog_tests/time_tai.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/tools/testing/selftests/bpf/prog_tests/time_tai.c b/tools/testing/selftests/bpf/prog_tests/time_tai.c
> > > index a31119823666..f45af1b0ef2c 100644
> > > --- a/tools/testing/selftests/bpf/prog_tests/time_tai.c
> > > +++ b/tools/testing/selftests/bpf/prog_tests/time_tai.c
> > > @@ -56,7 +56,7 @@ void test_time_tai(void)
> > >       ASSERT_NEQ(ts2, 0, "tai_ts2");
> > >
> > >       /* TAI is moving forward only */
> > > -     ASSERT_GT(ts2, ts1, "tai_forward");
> > > +     ASSERT_GE(ts2, ts1, "tai_forward");
> >
> > Can we guard the new change with arm64 specific macro?
>
> Problem with this is that I'm not sure what other architectures could
> be affected. AFAICT from the test, what it cares about is that time is
> moving forwards rather than going backwards, so I thought GE is good
> enough for what it's testing for.
>

Agreed. I think having architecture-specific GE vs GT here will just
add more complexity than necessary without providing any added safety.
So I applied the patch to bpf-next as is, thanks.

> >
> > >
> > >       /* Check for future */
> > >       ret = clock_gettime(CLOCK_TAI, &now_tai);





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux