[igt-dev] [PATCH i-g-t] lib/igt_core: Reinitialize print mutex in child process
Arkadiusz Hiler
arek at hiler.eu
Mon Sep 28 17:37:12 UTC 2020
On Mon, Sep 28, 2020 at 06:29:20PM +0300, Petri Latvala wrote:
> On Mon, Sep 28, 2020 at 03:15:02PM +0200, Zbigniew Kempczyński wrote:
> > IGT are prone to deadlock in igt_log() in following scenario:
> >
> > 1. Parent process creates additional thread which for example
> > is doing endless loop
> > 2. Thread sometimes is logging to console using igt_info().
> > This locks and unlocks print_mutex.
> > 3. If in the meantime parent process will spawn it can be
> > spawned with print_mutex locked. If in the child process
> > it will do igt_info() it will deadlock.
> >
> > We should reinitialize print_mutex in child process to avoid
> > use inherited value.
> >
> > Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> > Cc: Petri Latvala <petri.latvala at intel.com>
> > ---
>
> Are you able to type up a unit test in lib/tests/ that reproduces this
> deadlock?
>
> Code LGTM, Arek, do you spot anything amiss with this?
Other than the random whitespace changes the patch looks good. Thanks!
Mixing threading and forking is always 'fun' and people rarely think
about it upfront. I won't be surprised if we will find more things like
this :-)
--
Cheers,
Arek
More information about the igt-dev
mailing list