[gcov] Avoid race conditions in parallel make
Jan Hubicka
jh@suse.cz
Sun Apr 13 14:22:00 GMT 2003
> Jan Hubicka wrote:
>
> >! /* If everything done correctly, the summaries should be
> >! computed equal for each module. */
> >! if (last_prg.runs
> >! #ifdef TARGET_HAS_F_SETLKW
> >! && last_prg.runs == local_prg.runs
> >! #endif
> >! && memcmp (&last_prg, &local_prg, sizeof (last_prg)))
> > {
> >! #ifdef TARGET_HAS_F_SETLKW
> >! fprintf (stderr, "profiling:%s:Invocation mismatch\n\
> >! Probably some files were removed\n",
> > ptr->filename);
> >+ #else
> >+ fprintf (stderr, "profiling:%s:Invocation mismatch\n\
> >+ Probably some files were removed or parallel race happent because
> >libgcc\n\
> >+ is compiled without file locking support.\n",
> >+ ptr->filename);
> >+ #endif
> > local_prg.runs = 0;
> > }
> > else
> >! memcpy (&last_prg, &local_prg, sizeof (last_prg));
> I don't think this is right.
>
> Firstly, that extra check for last_prg.runs == local_prg.runs is
> superfluous,
> the memcmp will pick it up anyway. Secondly, this will detect a difference
It is not - it is in reverse.
In the case someone else is updating the profiles in parallels, the
number of runs and summaries won't match, but still I must not abort.
> when one invocation of a program overtakes another, during the update
> of the gcov files, even though that kind of situation should be dealt with.
Yes, that is why I put the runs check there.
Honza
>
> nathan
> --
> Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
> The voices in my head said this was stupid too
> nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
>
More information about the Gcc-patches
mailing list