From: Siddharth Vadapalli <s-vadapalli@ti.com>
To: Aksh Garg <a-garg7@ti.com>, <netdev@vger.kernel.org>,
<davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
<andrew+netdev@lunn.ch>, <edumazet@google.com>
Cc: <linux-kernel@vger.kernel.org>, <c-vankar@ti.com>,
<danishanwar@ti.com>, <s-vadapalli@ti.com>
Subject: Re: [PATCH net v2] net: ethernet: ti: am65-cpts: fix timestamp loss due to race conditions
Date: Thu, 16 Oct 2025 17:34:56 +0530 [thread overview]
Message-ID: <809b0315205e08f3e490fd0fc6ba4496683b04b2.camel@ti.com> (raw)
In-Reply-To: <20251016115755.1123646-1-a-garg7@ti.com>
On Thu, 2025-10-16 at 17:27 +0530, Aksh Garg wrote:
> Resolve race conditions in timestamp events list handling between TX
> and RX paths causing missed timestamps.
>
> The current implementation uses a single events list for both TX and RX
> timestamps. The am65_cpts_find_ts() function acquires the lock,
> splices all events (TX as well as RX events) to a temporary list,
> and releases the lock. This function performs matching of timestamps
> for TX packets only. Before it acquires the lock again to put the
> non-TX events back to the main events list, a concurrent RX
> processing thread could acquire the lock (as observed in practice),
> find an empty events list, and fail to attach timestamp to it,
> even though a relevant event exists in the spliced list which is yet to
> be restored to the main list.
>
> Fix this by creating separate events lists to handle TX and RX
> timestamps independently.
>
> Fixes: c459f606f66df ("net: ethernet: ti: am65-cpts: Enable RX HW timestamp for PTP packets using CPTS FIFO")
> Signed-off-by: Aksh Garg <a-garg7@ti.com>
> ---
>
> Link to v1:
> https://lore.kernel.org/all/20251010150821.838902-1-a-garg7@ti.com/
>
> Changes from v1 to v2:
> - Created a helper function am65_cpts_purge_event_list() to avoid
> code duplication
> - Removed RX timestamp lookup optimization from am65_cpts_find_rx_ts(),
> which will be handled in a separate patch series
> - Fixed function name: am65_cpts_cpts_purge_events() to
> am65_cpts_purge_events()
>
> drivers/net/ethernet/ti/am65-cpts.c | 63 ++++++++++++++++++++---------
> 1 file changed, 43 insertions(+), 20 deletions(-)
Thank you for fixing the issue.
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Regards,
Siddharth.
next prev parent reply other threads:[~2025-10-16 12:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 11:57 Aksh Garg
2025-10-16 12:04 ` Siddharth Vadapalli [this message]
2025-10-21 11:00 ` patchwork-bot+netdevbpf
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=809b0315205e08f3e490fd0fc6ba4496683b04b2.camel@ti.com \
--to=s-vadapalli@ti.com \
--cc=a-garg7@ti.com \
--cc=andrew+netdev@lunn.ch \
--cc=c-vankar@ti.com \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®