mbox series

[net-next,0/3] ice: lighter locking for PTP time reading

Message ID 20240226151125.45391-1-mschmidt@redhat.com (mailing list archive)
Headers show
Series ice: lighter locking for PTP time reading | expand

Message

Michal Schmidt Feb. 26, 2024, 3:11 p.m. UTC
This series removes the use of the heavy-weight PTP hardware semaphore
in the gettimex64 path. Instead, serialization of access to the time
register is done using a host-side spinlock. The timer hardware is
shared between PFs on the PCI adapter, so the spinlock must be shared
between ice_pf instances too.

Michal Schmidt (3):
  ice: add ice_adapter for shared data across PFs on the same NIC
  ice: avoid the PTP hardware semaphore in gettimex64 path
  ice: fold ice_ptp_read_time into ice_ptp_gettimex64

 drivers/net/ethernet/intel/ice/Makefile      |  3 +-
 drivers/net/ethernet/intel/ice/ice.h         |  2 +
 drivers/net/ethernet/intel/ice/ice_adapter.c | 69 ++++++++++++++++++++
 drivers/net/ethernet/intel/ice/ice_adapter.h | 28 ++++++++
 drivers/net/ethernet/intel/ice/ice_main.c    |  8 +++
 drivers/net/ethernet/intel/ice/ice_ptp.c     | 33 ++--------
 drivers/net/ethernet/intel/ice/ice_ptp_hw.c  |  3 +
 7 files changed, 116 insertions(+), 30 deletions(-)
 create mode 100644 drivers/net/ethernet/intel/ice/ice_adapter.c
 create mode 100644 drivers/net/ethernet/intel/ice/ice_adapter.h

Comments

Jacob Keller Feb. 26, 2024, 7:16 p.m. UTC | #1
On 2/26/2024 7:11 AM, Michal Schmidt wrote:
> This series removes the use of the heavy-weight PTP hardware semaphore
> in the gettimex64 path. Instead, serialization of access to the time
> register is done using a host-side spinlock. The timer hardware is
> shared between PFs on the PCI adapter, so the spinlock must be shared
> between ice_pf instances too.
> 
> Michal Schmidt (3):
>   ice: add ice_adapter for shared data across PFs on the same NIC
>   ice: avoid the PTP hardware semaphore in gettimex64 path
>   ice: fold ice_ptp_read_time into ice_ptp_gettimex64
> 

Glad to see some fix and improvement in this place. I had been
considering switching the hardware semaphore entirely to be a shared
mutex instead, but this direction also seems reasonable and fixes most
of the issues. We could actually extend this to replace the semaphore
with a mutex in order to avoid the PCIe transactions required to handle
the hardware semaphore register.
Michal Schmidt Feb. 26, 2024, 8:01 p.m. UTC | #2
On Mon, Feb 26, 2024 at 8:17 PM Jacob Keller <jacob.e.keller@intel.com> wrote:
> On 2/26/2024 7:11 AM, Michal Schmidt wrote:
> > This series removes the use of the heavy-weight PTP hardware semaphore
> > in the gettimex64 path. Instead, serialization of access to the time
> > register is done using a host-side spinlock. The timer hardware is
> > shared between PFs on the PCI adapter, so the spinlock must be shared
> > between ice_pf instances too.
> >
> > Michal Schmidt (3):
> >   ice: add ice_adapter for shared data across PFs on the same NIC
> >   ice: avoid the PTP hardware semaphore in gettimex64 path
> >   ice: fold ice_ptp_read_time into ice_ptp_gettimex64
> >
>
> Glad to see some fix and improvement in this place. I had been
> considering switching the hardware semaphore entirely to be a shared
> mutex instead, but this direction also seems reasonable and fixes most
> of the issues. We could actually extend this to replace the semaphore
> with a mutex in order to avoid the PCIe transactions required to handle
> the hardware semaphore register.

Thanks for the review. I'm glad you mentioned replacing the hw
semaphore with a mutex, because I was already going in that direction
:)
Michal