Re: [PATCH v4 1/3] net: mvpp2: tai: add refcount for ptp worker

From: Alexander H Duyck
Date: Mon May 01 2023 - 11:04:51 EST


On Sun, 2023-04-30 at 20:06 +0300, Shmuel Hazan wrote:
> In some configurations, a single TAI can be responsible for multiple
> mvpp2 interfaces. However, the mvpp2 driver will call mvpp22_tai_stop
> and mvpp22_tai_start per interface RX timestamp disable/enable.
>
> As a result, disabling timestamping for one interface would stop the
> worker and corrupt the other interface's RX timestamps.
>
> This commit solves the issue by introducing a simpler ref count for each
> TAI instance.
>
> Due to the ref count, we need now to lock tai->refcount_lock before
> doing anything. As a result, we can't call mvpp22_tai_do_aux_work as it
> will cause a deadlock. Therefore, we will just schedule the worker to
> start immediately.
>
> Fixes: ce3497e2072e ("net: mvpp2: ptp: add support for receive timestamping")
> Signed-off-by: Shmuel Hazan <shmuel.h@xxxxxxxxx>
> ---
> v1 -> v2: lock tai->lock before touching poll_worker_refcount.
> v2 -> v3: no change
> v3 -> v4: added additional lock for poll_worker_refcount due to
> a possible deadlock.
> ---
> .../net/ethernet/marvell/mvpp2/mvpp2_tai.c | 28 +++++++++++++++++--
> 1 file changed, 25 insertions(+), 3 deletions(-)
>

So this patch looks fine to me. However you submitted this and the
other 2 for net. The other 2 patches in this series seem to be a
feature add rather than a fix. As such you may want to split up this
set and submit the other two patches for net-next instead of net.

Reviewed-by: Alexander Duyck <alexanderduyck@xxxxxx>