diff options
| author | Carolina Jubran <cjubran@nvidia.com> | 2026-11-04 20:31:58 +0200 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-11-09 17:57:30 -0800 |
| commit | 908561cc4b4db4510465f02f5323e98f2dc00fad (patch) | |
| tree | b36f191acf9405b10dea55ef204512774c3cebf5 /kernel/livepatch/patch.h | |
| parent | 2007f7e37142ebdb341949dca8098f898cc871f7 (diff) | |
net/mlx5: Use only loaded devices for PTP clock operations
The PTP periodic worker and PTP operations access PCI registers through
the function backing the PTP clock. The PTP clock remains registered
when a PCI function is suspended, so these paths can still access the
function after it has been unloaded.
To fix that, serialize clock hardware access with the clock mutex for
all clocks and fail callbacks with -EAGAIN when there is no loaded
function to service the clock. Additionally, tie the worker's lifetime
to load/unload and use the devcom lock to synchronize with peer
loads/unloads.
Since the periodic worker is stopped during unload, the free running
counter may wrap without being sampled. Reinitialize the timecounter
on load using the hardware real time clock in real time mode, or the
saved PHC time plus elapsed CLOCK_BOOTTIME in free running mode.
This provides best effort PHC continuity across unload/load. In free
running mode, elapsed time while unloaded is estimated using
CLOCK_BOOTTIME rather than the PHC's adjusted frequency.
Fixes: 8fc3e29be924 ("net/mlx5: Fix crash upon suspend/resume")
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261104183158.758314-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'kernel/livepatch/patch.h')
0 files changed, 0 insertions, 0 deletions
