[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <809b0315205e08f3e490fd0fc6ba4496683b04b2.camel@ti.com>
Date: Thu, 16 Oct 2025 17:34:56 +0530
From: Siddharth Vadapalli <s-vadapalli@...com>
To: Aksh Garg <a-garg7@...com>, <netdev@...r.kernel.org>,
<davem@...emloft.net>, <kuba@...nel.org>, <pabeni@...hat.com>,
<andrew+netdev@...n.ch>, <edumazet@...gle.com>
CC: <linux-kernel@...r.kernel.org>, <c-vankar@...com>, <danishanwar@...com>,
<s-vadapalli@...com>
Subject: Re: [PATCH net v2] net: ethernet: ti: am65-cpts: fix timestamp loss
due to race conditions
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@...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@...com>
Regards,
Siddharth.
Powered by blists - more mailing lists