19/05/2026 11:17, Robin Jarry:
> Bruce Richardson, May 18, 2026 at 17:28:
> > On Mon, May 18, 2026 at 05:25:43PM +0200, Thomas Monjalon wrote:
> >> 18/05/2026 17:14, Robin Jarry:
> >> > Thomas Monjalon, May 18, 2026 at 17:07:
> >> > > @@ -246,10 +246,9 @@ static inline void 
> >> > > rte_spinlock_recursive_unlock(rte_spinlock_recursive_t *slr)
> >> > >        __rte_no_thread_safety_analysis
> >> > >  {
> >> > >        if (--(slr->count) == 0) {
> >> > 
> >> > This code is completely broken. Any thread can unlock without any check.
> >> 
> >> Maybe, but I don't intend to fix recursive unlock in this patch.
> >> The subject is "remove volatile qualifier" (and unblock GCC 16).
> >> 
> > As with regular mutexes, threads should not go around unlocking when not
> > holding the lock. Therefore, I think this is fine. [With regular spinlocks
> > we can't check since we don't track threads, therefore I think we just need
> > to assume a well-behaved app.]
> 
> Ok, fair enough :)
> 
> As Stephen suggested, maybe we could add some assertions?
> 
>  static inline void rte_spinlock_recursive_unlock(rte_spinlock_recursive_t 
> *slr)
>         __rte_no_thread_safety_analysis
>  {
> +       RTE_ASSERT(rte_atomic_load_explicit(&slr->user, 
> rte_memory_order_relaxed) == rte_gettid());
> +       RTE_ASSERT(slr->count > 0);
> +

OK I add it as a separate patch in v3.


Reply via email to