[Mesa-dev] [PATCH 1/2] st/va: release held locks in error paths

Emil Velikov emil.l.velikov at gmail.com
Fri Jan 19 15:00:04 UTC 2018


On 19 January 2018 at 14:46, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> On Tuesday, 2018-01-16 18:35:40 +0000, Emil Velikov wrote:
>> On 15 January 2018 at 22:03, Grazvydas Ignotas <notasas at gmail.com> wrote:
>> > Found with the help of following Coccinelle semantic patch:
>> > // <smpl>
>> > @@
>> > expression E;
>> > @@
>> >
>> >   \(pthread_mutex_lock\|mtx_lock\|simple_mtx_lock\)(E)
>> >   ...
>> > (
>> >   \(pthread_mutex_unlock\|mtx_unlock\|simple_mtx_unlock\)(E);
>> >   ...
>> >   return ...;
>> > |
>> > + maybe need_unlock(E);
>> >   return ...;
>> > )
>> > // </smpl>
>> >
>> > Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
>> Grazvydas please add the stable tag, if you haven't pushed the patch.
>>
>> Thinking out loud: Should have these the Coccinelle bits in-tree. This
>> way we can check and address such issues quicker ;-)
>
> Agreed; sadly I don't think it can be integrated into the build systems
> easily, but we could have a $mesa/bin/cocci/ folder with all our scripts,
> and build it with something like:
>  $ cd $(mktemp -d)
>  $ CC=$mesa/bin/cocci-check meson $mesa
>  $ ninja
>
> (bonus: would work with any other build system that respects $CC)
>
> Now, someone *just* needs to write that `cocci-check` script to set up
> everything and run all the cocci scripts in the folder :P
>
> I'll give it a stab if/when I have some time, but I'm happy for anyone
> to take this up :)

That's roughly what I was thinking although I was about to keep it one
step at a time.
 1. Get people to add cocci patches
 2. Write a 'master' script to run them all (+ generate patches and send out?)
 3. Integrate 2) into CI/build process/other

Emil


More information about the mesa-dev mailing list