[vlc-devel] [PATCH 01/12] input item: expose locked version of GetMeta()

Rémi Denis-Courmont remi at remlab.net
Sun Oct 21 12:08:33 CEST 2018

Le maanantaina 15. lokakuuta 2018, 11.32.32 EEST Thomas Guillem a écrit :
> On Fri, Oct 12, 2018, at 21:44, Rémi Denis-Courmont wrote:
> > Le perjantaina 12. lokakuuta 2018, 0.14.39 EEST Romain Vimont a écrit :
> > > In order to sort the playlist correctly, the input items must be locked
> > > across several calls to GetMeta() (among others).
> > 
> > Taking multiple locks from the same class simultaneously is a terrible
> > idea
> > that will defeat lock dependency checkers (no that we use any, but we
> > probably should).
> > 
> > And it is theoretically only possible if there is an order, which this
> > patch suspiciously fails to define.
> Indeed, the playlist test fails in the _Sort() test with tsan: 
> "lock-order-inversion".

I do not know how reliable tsan lock inversion detection is. Without some 
integration with the VLC mutex functions, it seems dubious that it would work 
very well.

I tried to use userspace lockdep, but it failed miserably because:

1) It exposes POSIX thread symbols for preloading, which messes run-time 
linking of libvlccore and crashes. There are no ways to get lockdep 
functionality *only* and hook that manually.

2) It does not support recursive locks. VLC uses and abuses them.

In addition, it cannot initialize static mutex without parameters, which is 
incompatible with POSIX and VLC styles. Lastly, it is GPLv2-only so you cannot 
redistribute the build.

The whole thing is over 5000 lines of code, so I am not exactly eager to 
reimplement all of it manually.

Реми Дёни-Курмон

More information about the vlc-devel mailing list