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

From: Jakub Kicinski <[email-masked]>
Date: Thu, 20 Apr 2023 20:20:03 -0700

On Wed, 19 Apr 2023 18:14:55 +0300 Shmuel Hazan wrote:
> +static void mvpp22_tai_stop_unlocked(struct mvpp2_tai *tai)
> +{
> +	tai->poll_worker_refcount--;
> +	if (tai->poll_worker_refcount)
> +		return;
> +	ptp_cancel_worker_sync(tai->ptp_clock);

How can you cancel it _sync() when the work takes the same
lock you're already holding? 

https://elixir.bootlin.com/linux/v6.3-rc7/source/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c#L246

>  void mvpp22_tai_stop(struct mvpp2_tai *tai)
>  {
> -	ptp_cancel_worker_sync(tai->ptp_clock);
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&tai->lock, flags);
> +	mvpp22_tai_stop_unlocked(tai);

-- 
pw-bot: cr