[igt-dev] [PATCH i-g-t] lib/igt_core: Reinitialize print mutex in child process
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Tue Sep 29 03:40:34 UTC 2020
On Mon, Sep 28, 2020 at 08:37:12PM +0300, Arkadiusz Hiler wrote:
> 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!
I'm sorry, I've transplanted that from code I'm working on and that was
not aware something got caught up.
--
Zbigniew
>
> 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