From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Ferenc Fejes <ferenc.fejes@ericsson.com>
Cc: "vinicius.gomes@intel.com" <vinicius.gomes@intel.com>,
"marton12050@gmail.com" <marton12050@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"peti.antal99@gmail.com" <peti.antal99@gmail.com>
Subject: Re: igc: missing HW timestamps at TX
Date: Tue, 16 Aug 2022 09:33:14 +0000 [thread overview]
Message-ID: <20220816093314.hqfnzangzamjdpkl@skbuf> (raw)
In-Reply-To: <1016fb1e514ff38ebfd22c52e2d848a7e8bc8d1a.camel@ericsson.com>
Hi Ferenc,
On Mon, Aug 15, 2022 at 06:47:31AM +0000, Ferenc Fejes wrote:
> I just played with those a little. Looks like the --cpu-mask the one it
> helps in my case. For example I checked the CPU core of the
> igc_ptp_tx_work:
>
> # bpftrace -e 'kprobe:igc_ptp_tx_work { printf("%d\n", cpu); exit(); }'
> Attaching 1 probe...
> 0
I think this print is slightly irrelevant in the grand scheme, or at
least not very stable. Because schedule_work() is implemented as
"queue_work(system_wq, work)", and queue_work() is implemented as
"queue_work_on(WORK_CPU_UNBOUND, wq, work)", it means that the work item
associated with igc_ptp_tx_work() is not bound to any requested CPU.
So unless the prints are taken from the actual test rather than just
done once before it, which percpu kthread worker executes it from within
the pool might vary. In turn, __queue_work() selects the CPU based on
raw_smp_processor_id() on which the caller is located (in this case, the
IRQ handler). So it will depend upon the tsync interrupt affinity,
basically.
>
> Looks like its running on core 0, so I run the isochro:
> taskset -c 0 isochron ... --cpu-mask $((1 << 0)) - no lost timestamps
> taskset -c 1 isochron ... --cpu-mask $((1 << 0)) - no lost timestamps
> taskset -c 0 isochron ... --cpu-mask $((1 << 1)) - losing timestamps
> taskset -c 1 isochron ... --cpu-mask $((1 << 1)) - losing timestamps
(...)
> Maybe this is what helps in my case? With funccount tracer I checked
> that when the sender thread and igc_ptp_tx_work running on the same
> core, the worker called exactly as many times as many packets I sent.
>
> However if the worker running on different core, funccount show some
> random number (less than the packets sent) and in that case I also lost
> timestamps.
Thanks.
Note that if igc_ptp_tx_work runs well on the same CPU (0) as the
isochron sender thread, but *not* that well on the other CPU,
I think a simple explanation (for now) might have to do with dynamic
frequency scaling of the CPUs (CONFIG_CPU_FREQ). If the CPU is kept busy
by the sender thread, the governor will increase the CPU frequency and
the tsync interrupt will be processed quicker, and this will unclog the
"single skb in flight" limitation quicker. If the CPU is mostly idle and
woken up only from time to time by a tsync interrupt, then the "single
skb in flight" limitation will kick in more often, and the isochron
thread will have its TX timestamp requests silently dropped in that
meantime until the idle CPU ramps up to execute its scheduled work item.
To prove my point you can try to compile a kernel with CONFIG_CPU_FREQ=n.
Makes sense?
next prev parent reply other threads:[~2022-08-16 10:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-17 14:42 igc: missing HW timestamps at TX Ferenc Fejes
2022-07-17 14:46 ` Ferenc Fejes
2022-07-18 14:46 ` Vinicius Costa Gomes
2022-07-19 7:40 ` Ferenc Fejes
2022-08-11 8:54 ` Ferenc Fejes
2022-08-11 13:33 ` Vinicius Costa Gomes
2022-08-12 14:13 ` Ferenc Fejes
2022-08-12 20:16 ` Vladimir Oltean
2022-08-15 6:47 ` Ferenc Fejes
2022-08-15 22:04 ` Vinicius Costa Gomes
2022-08-16 9:33 ` Vladimir Oltean [this message]
2022-08-17 7:44 ` Ferenc Fejes
2022-08-15 21:39 ` Vinicius Costa Gomes
2022-08-15 22:26 ` Vladimir Oltean
2022-08-15 23:07 ` Vinicius Costa Gomes
2022-08-16 8:51 ` Kurt Kanzenbach
2022-08-16 20:45 ` Vinicius Costa Gomes
2022-08-17 6:10 ` Kurt Kanzenbach
2022-08-17 19:24 ` Vinicius Costa Gomes
2022-08-16 9:10 ` Vladimir Oltean
2022-08-16 18:11 ` Vinicius Costa Gomes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220816093314.hqfnzangzamjdpkl@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=ferenc.fejes@ericsson.com \
--cc=marton12050@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=peti.antal99@gmail.com \
--cc=vinicius.gomes@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox