Re: [PATCH] ThreadSanitizer warnings for cThread

Marko Mäkelä <[email protected]> Wed, 14 Dec 2022 12:05:41 +0200
Newsgroups gmane.linux.vdr
Message-ID <Y5mf9VquqcpZgRc4@jyty>
Wed, Dec 14, 2022 at 10:21:10AM +0100, Klaus Schmidinger wrote:
>Is there an actual problem that requires this?
>It has been that way for many, many years, so I'd like to see more than 
>"looks problematic to me" before I dare touch this ;-).

The only problem that I am currently aware of is something specific to 
rpihddevice shutdown and not VDR itself, and so far it only occurred 
when I compiled the code with -fsanitize=undefined.

Some 15 years ago, VDR startup with softdevice (not softhddevice) would 
hang once in a few months (say, once in 100 to 300 attempts) on a 
single-core system, but I don't remember trying to analyze it back then.  
It should have been on a 2.6 kernel and NPTL (not LinuxThreads), that 
is, not too different from what we have now.

Code around thread creation and destruction is indeed tricky, and the 
current implementation could be fine, only not "in good style" according 
to ThreadSanitizer. If there is not too much thread creation and 
destruction during normal usage, any actual race conditions might only 
affect startup or shutdown.

I could give ThreadSanitizer another try, on a PC and a USB receiver 
stick, to see what it complains during normal usage, and if something 
can be fixed easily. My main motivation is to learn to use the tool, in 
order to make use of it in another (much larger) code base that will 
require some additional instrumentation due to the use of some custom 
synchronization primitives.

	Marko

_______________________________________________
vdr mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr