Subject: Re: [TEST] txtimestamp.sh pains after netdev foundation migration

From: Willem de Bruijn <[email-masked]>
Date: Thu, 08 Jan 2026 16:19:06 -0500

Jakub Kicinski wrote:
> On Thu, 08 Jan 2026 14:02:15 -0500 Willem de Bruijn wrote:
> > Increasing tolerance should work.
> > 
> > The current values are pragmatic choices to be so low as to minimize
> > total test runtime, but high enough to avoid flakes. Well..
> > 
> > If increasing tolerance, we also need to increase the time the test
> > waits for all notifications to arrive, cfg_sleep_usec.
> 
> To be clear the theory is that we got scheduled out between taking the
> USR timestamp and sending the packet. But once the packet is in the
> kernel it seems to flow, so AFAIU cfg_sleep_usec can remain untouched.
> 
> Thinking about it more - maybe what blocks us is the print? Maybe under
> vng there's a non-trivial chance that a print to stderr ends up
> blocking on serial and schedules us out? I mean maybe we should:
> 
> diff --git a/tools/testing/selftests/net/txtimestamp.c b/tools/testing/selftests/net/txtimestamp.c
> index abcec47ec2e6..e2273fdff495 100644
> --- a/tools/testing/selftests/net/txtimestamp.c
> +++ b/tools/testing/selftests/net/txtimestamp.c
> @@ -207,12 +207,10 @@ static void __print_timestamp(const char *name, struct timespec *cur,
>         fprintf(stderr, "\n");
>  }
>  
> -static void print_timestamp_usr(void)
> +static void record_timestamp_usr(void)
>  {
>         if (clock_gettime(CLOCK_REALTIME, &ts_usr))
>                 error(1, errno, "clock_gettime");
> -
> -       __print_timestamp("  USR", &ts_usr, 0, 0);
>  }
>  
>  static void check_timestamp_usr(void)
> @@ -636,8 +634,6 @@ static void do_test(int family, unsigned int report_opt)
>                         fill_header_udp(buf + off, family == PF_INET);
>                 }
>  
> -               print_timestamp_usr();
> -
>                 iov.iov_base = buf;
>                 iov.iov_len = total_len;
>  
> @@ -692,10 +688,14 @@ static void do_test(int family, unsigned int report_opt)
>  
>                 }
>  
> +               record_timestamp_usr();
>                 val = sendmsg(fd, &msg, 0);
>                 if (val != total_len)
>                         error(1, errno, "send");
>  
> +               /* Avoid I/O between taking ts_usr and sendmsg() */
> +               __print_timestamp("  USR", &ts_usr, 0, 0);
> +
>                 check_timestamp_usr();
>  
>                 /* wait for all errors to be queued, else ACKs arrive OOO */

Definitely worth including.

Could it be helpful to schedule at RR or FIFO prio. Depends on the
reason for descheduling. And it only affects priority within the VM.

I'm having trouble reproducing it in vng both locally and on 
netdev-virt.

At this point, an initial obviously correct patch and observe how
much that mitigates the issue is likely the fastest way forward.