public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Alexander Kanavin <alexander.kanavin@linux.intel.com>
To: Mark Hatle <mark.hatle@windriver.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [PATCHv2 2/2] rpm: run binary package generation via thread pools
Date: Thu, 8 Jun 2017 20:23:45 +0300	[thread overview]
Message-ID: <3ed4da32-b4c2-69f1-c93f-9cc5ffb83dd6@linux.intel.com> (raw)
In-Reply-To: <5cac68b8-6bf7-4453-d75a-45d8b9887d99@windriver.com>

On 06/08/2017 07:55 PM, Mark Hatle wrote:
>> +@@ -565,8 +559,8 @@ static rpmRC packageBinary(rpmSpec spec, Package pkg, const char *cookie, int ch
>> + 	headerCopyTags(spec->packages->header, pkg->header, copyTags);
>> + 	
>> + 	headerPutString(pkg->header, RPMTAG_RPMVERSION, VERSION);
>> +-	headerPutString(pkg->header, RPMTAG_BUILDHOST, buildHost());
>> +-	headerPutUint32(pkg->header, RPMTAG_BUILDTIME, getBuildTime(), 1);
>> ++	headerPutString(pkg->header, RPMTAG_BUILDHOST, buildHost);
>> ++	headerPutUint32(pkg->header, RPMTAG_BUILDTIME, &buildTime, 1);
>
> I don't see what the advantage of this change over the current approach is --
> unless the first call is in a thread so the variable can clash.  If that is the
> case, it may make more sense to ensure that these two are run very early in the
> build process before it threads.

They're run from threads, and they do clash, and I had spent a whole day 
tracing data corruption coredumps back to these two.

This is explained in the commit message:

"Their use is causing difficult to diagnoze data races when building 
multiple packages in parallel..."

And I had changed the code so that they're run early in the build 
process, and just once. See below...


>> +@@ -629,6 +623,8 @@ static struct binaryPackageTaskData* runBinaryPackageTasks(rpmSpec spec, const c
>> +     struct binaryPackageTaskData *tasks = NULL;
>> +     struct binaryPackageTaskData *task = NULL;
>> +     struct binaryPackageTaskData *prev = NULL;
>> ++    rpm_time_t buildTime = getBuildTime();
>> ++    char *host = buildHost();
>> +
>> +     for (Package pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
>> +         task = rcalloc(1, sizeof(*task));


^^^^ right there.

Please read the code more carefully :-)


Alex


  reply	other threads:[~2017-06-08 17:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 14:42 [PATCHv2 0/2] Multi-threaded RPM support Alexander Kanavin
2017-06-08 14:42 ` [PATCHv2 1/2] package_rpm.bbclass: use multithreaded xz compression Alexander Kanavin
2017-06-08 14:42 ` [PATCHv2 2/2] rpm: run binary package generation via thread pools Alexander Kanavin
2017-06-08 16:55   ` Mark Hatle
2017-06-08 17:23     ` Alexander Kanavin [this message]
2017-06-08 20:29       ` Mark Hatle
2017-06-09  9:02         ` Alexander Kanavin
2017-06-09 11:18           ` Alexander Kanavin
2017-06-08 21:15 ` [PATCHv2 0/2] Multi-threaded RPM support Leonardo Sandoval
2017-06-09  9:13   ` Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ed4da32-b4c2-69f1-c93f-9cc5ffb83dd6@linux.intel.com \
    --to=alexander.kanavin@linux.intel.com \
    --cc=mark.hatle@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox