Skip to contentSkip to conversation

ptp: ocp: fix PCIe delay estimation calculation

PATCH Applied Vadim Fedorenko 4 participants 5 messages Oct 7 – Oct 8

Subsystems (4)
lore
Share & tools
lore

Vadim Fedorenko

author maintainer
#0 lore raw

PATCH 1/1 ptp: ocp: fix PCIe delay estimation calculation

The commit in fixes introduced a high cap for delayas U64_MAX value while ktime_t is actually s64. This is wrong cap as it becomes negative value and any comparison to a real delay will fail to update delay value. Use KTIME_MAX constant as correct max cap for PCIe delay.

Fixes aa05fe67bcd64 ("ptp: ocp: Improve PCIe delay estimation")
---
 drivers/ptp/ptp_ocp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ptp/ptp_ocp.c +1 -1
index 3d26ec1f7b9e..a8cba2f64b98 100644
@@ -1825,7 +1825,7 @@ ptp_ocp_watchdog(struct timer_list *t)
 static void
 ptp_ocp_estimate_pci_timing(struct ptp_ocp *bp)
 {
-	ktime_t start, end, delay = U64_MAX;
+	ktime_t start, end, delay = KTIME_MAX;
 	u32 ctrl;
 	int i;
 
Signature · 1 line
2.47.3
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

author maintainer
#2 lore raw
Quoted 13 lines · On 07/10/2026 21:44, [email protected] wrote:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.

Quoted 8 lines

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

The issue was hit in production (a negative value is observed):

# cat /sys/class/timecard/ocp0/ts_window_adjust
-3
Reviewed-by on v1 1/1
#3 lore raw
In reply to Vadim Fedorenko
Quoted 1 line

The commit in fixes introduced a high cap for delayas U64_MAX value

nit: I think delayas should be "delay as", probably not worth respining for.

Quoted 24 lines

while ktime_t is actually s64. This is wrong cap as it becomes negative value and any comparison to a real delay will fail to update delay value. Use KTIME_MAX constant as correct max cap for PCIe delay.

Fixes aa05fe67bcd64 ("ptp: ocp: Improve PCIe delay estimation")
---
 drivers/ptp/ptp_ocp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ptp/ptp_ocp.c +1 -2
index 3d26ec1f7b9e..a8cba2f64b98 100644
@@ -1825,7 +1825,7 @@ ptp_ocp_watchdog(struct timer_list *t)
 static void
 ptp_ocp_estimate_pci_timing(struct ptp_ocp *bp)
 {
-       ktime_t start, end, delay = U64_MAX;
+       ktime_t start, end, delay = KTIME_MAX;
        u32 ctrl;
        int i;
 
--
Quoted 3 lines

2.47.3

#4 lore raw
In reply to Vadim Fedorenko
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 7 Oct 2026 20:33:59 +0000 you wrote:

The commit in fixes introduced a high cap for delayas U64_MAX value while ktime_t is actually s64. This is wrong cap as it becomes negative value and any comparison to a real delay will fail to update delay value. Use KTIME_MAX constant as correct max cap for PCIe delay.

Fixes aa05fe67bcd64 ("ptp: ocp: Improve PCIe delay estimation")

[...]

Here is the summary with links:
- [net] ptp: ocp: fix PCIe delay estimation calculation

    https://git.kernel.org/netdev/net/c/f8c8bd159a9b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html