Re: [PATCH 2/3] locking/csd_lock: Provide an indication of ongoing CSD-lock stall

From: Rik van Riel
Date: Sat Jul 13 2024 - 13:17:06 EST


On Sat, 2024-07-13 at 22:28 +0530, neeraj.upadhyay@xxxxxxxxxx wrote:
>
> @@ -228,6 +241,7 @@ static bool
> csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, in
>   cpu = csd_lock_wait_getcpu(csd);
>   pr_alert("csd: CSD lock (#%d) got unstuck on
> CPU#%02d, CPU#%02d released the lock.\n",
>   *bug_id, raw_smp_processor_id(), cpu);
> + atomic_dec(&n_csd_lock_stuck);
>   return true;
>   }
>  

So we decrement it when it gets unstuck. Good.

> @@ -251,6 +265,8 @@ static bool
> csd_lock_wait_toolong(call_single_data_t *csd, u64 ts0, u64 *ts1, in
>   pr_alert("csd: %s non-responsive CSD lock (#%d) on CPU#%d,
> waiting %lld ns for CPU#%02d %pS(%ps).\n",
>   firsttime ? "Detected" : "Continued", *bug_id,
> raw_smp_processor_id(), (s64)ts_delta,
>   cpu, csd->func, csd->info);
> + if (firsttime)
> + atomic_dec(&n_csd_lock_stuck);
>

However, I don't see any place where it is incremented when things
get stuck, and this line decrements it when a CPU gets stuck for
the first time?

Should this be an atomic_inc?

--
All Rights Reversed.