Rework usage of the control PF pointer in struct ice_adapter, so that it is always has a consistent state, since it is global for an adapter. Utilize RCU for reading the pointer value and atomic operations for changing it. Zero out the ctrl_pf pointer when the control PF is removed.
Previous version: https://lore.kernel.org/intel-wired-lan/[email protected]/ v1->v2: Rebase onto the latest dev-queue branch v2->v3: Cosmetic fixes v3->v4: Add the rw_semaphore to protect the ctrl_pf v4->v5: Split patches into smaller self-contained parts, tighten potential race condition windows, annotate RCU-related code v5->v6: Rebase on top of the latest dev-queue, remove absorbed changes Sergey Temerkhanov (7): ice: Protect the control PF pointer with RCU and a rwsem ice: Cache struct ice_hw pointer for split register reads ice: Reject PTP access without a control PF ice: Clear the control PF pointer when the control PF is removed ice: Document control PF lock ordering ice: Annotate PTP control PF lock handoff ice: Release control PF lock before RCU wait drivers/net/ethernet/intel/ice/ice.h | 42 +++- drivers/net/ethernet/intel/ice/ice_adapter.c | 1 + drivers/net/ethernet/intel/ice/ice_adapter.h | 5 +- drivers/net/ethernet/intel/ice/ice_dpll.h | 18 +- drivers/net/ethernet/intel/ice/ice_ptp.c | 189 +++++++++++++----- drivers/net/ethernet/intel/ice/ice_ptp.h | 11 +- drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 78 +++++++- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 6 +- drivers/net/ethernet/intel/ice/ice_txclk.c | 20 +- .../net/ethernet/intel/ice/virt/virtchnl.c | 5 +- 10 files changed, 293 insertions(+), 82 deletions(-) -- 2.53.0
