summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-16 07:19:37 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-16 22:17:48 +0100
commit4de5c296dbdbf161ffcd3cd4671930e770fe740d (patch)
tree2e13c4be4c5a57cd5c0a36560c707b0e8b8743c4 /bitbake
parent0004786a1592bc509f097f76ccc5ede7bf987c77 (diff)
downloadpoky-4de5c296dbdbf161ffcd3cd4671930e770fe740d.tar.gz
bitbake: runqueue: Improve multiconfig deferred task issues
The previous patches have exposed new issues with this code path, the issues being around what should happen when the hash of a task changes and the task is or is not on the deferred task list. Rather than rebuilding the deferred task list during each rehash event, build it once at the start of a build. This avoids the problem of tasks being added back after they have run and also avoids problems of always ensuring the same task is deferred. It also allows the 'outrightfail' codepath to be handled separately as the conditions are subtly differnt. One significant win for the new approch is the build is not continually printing out lists of deferred tasks, that list remains fairly static from the start of the build. Logic is added in to ensure a rehashed task with a hash matching other deferred tasks is deferred along with them as a small optimization. An interesting test case for this code was reported by Mark Hatle with four multiconfigs, each the same apart from TMPDIR and running a build of: bitbake buildtools-tarball mc:{one,two,three,four}:core-image-minimal which is interesting in that the build of buildtools partially overlaps core-image-minimal and the build has a rehash event for qemuwrapper-cross even without any external hash equivalence server or preexisting data. (Bitbake rev: 1775bcb95f61af21712bc1ba5098a49df8f21128) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit bb424e0a6d274d398f434f7df63951da9ce305b3) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/runqueue.py58
1 files changed, 32 insertions, 26 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index f679813095..5ccf755f1a 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -2450,6 +2450,11 @@ class RunQueueExecute:
2450 2450
2451 if update_tasks: 2451 if update_tasks:
2452 self.sqdone = False 2452 self.sqdone = False
2453 for tid in [t[0] for t in update_tasks]:
2454 h = pending_hash_index(tid, self.rqdata)
2455 if h in self.sqdata.hashes and tid != self.sqdata.hashes[h]:
2456 self.sq_deferred[tid] = self.sqdata.hashes[h]
2457 bb.note("Deferring %s after %s" % (tid, self.sqdata.hashes[h]))
2453 update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False) 2458 update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False)
2454 2459
2455 for (tid, harddepfail, origvalid) in update_tasks: 2460 for (tid, harddepfail, origvalid) in update_tasks:
@@ -2793,6 +2798,19 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2793 sqdata.stamppresent = set() 2798 sqdata.stamppresent = set()
2794 sqdata.valid = set() 2799 sqdata.valid = set()
2795 2800
2801 sqdata.hashes = {}
2802 sqrq.sq_deferred = {}
2803 for mc in sorted(sqdata.multiconfigs):
2804 for tid in sorted(sqdata.sq_revdeps):
2805 if mc_from_tid(tid) != mc:
2806 continue
2807 h = pending_hash_index(tid, rqdata)
2808 if h not in sqdata.hashes:
2809 sqdata.hashes[h] = tid
2810 else:
2811 sqrq.sq_deferred[tid] = sqdata.hashes[h]
2812 bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
2813
2796 update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True) 2814 update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True)
2797 2815
2798 # Compute a list of 'stale' sstate tasks where the current hash does not match the one 2816 # Compute a list of 'stale' sstate tasks where the current hash does not match the one
@@ -2857,32 +2875,20 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s
2857 2875
2858 sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary) 2876 sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary)
2859 2877
2860 sqdata.hashes = {} 2878 for tid in tids:
2861 sqrq.sq_deferred = {} 2879 if tid in sqdata.stamppresent:
2862 for mc in sorted(sqdata.multiconfigs): 2880 continue
2863 for tid in sorted(sqdata.sq_revdeps): 2881 if tid in sqdata.valid:
2864 if mc_from_tid(tid) != mc: 2882 continue
2865 continue 2883 if tid in sqdata.noexec:
2866 if tid in sqdata.stamppresent: 2884 continue
2867 continue 2885 if tid in sqrq.scenequeue_covered:
2868 if tid in sqdata.valid: 2886 continue
2869 continue 2887 if tid in sqrq.scenequeue_notcovered:
2870 if tid in sqdata.noexec: 2888 continue
2871 continue 2889 if tid in sqrq.sq_deferred:
2872 if tid in sqrq.scenequeue_notcovered: 2890 continue
2873 continue 2891 sqdata.outrightfail.add(tid)
2874 if tid in sqrq.scenequeue_covered:
2875 continue
2876
2877 h = pending_hash_index(tid, rqdata)
2878 if h not in sqdata.hashes:
2879 if tid in tids:
2880 sqdata.outrightfail.add(tid)
2881 sqdata.hashes[h] = tid
2882 else:
2883 sqrq.sq_deferred[tid] = sqdata.hashes[h]
2884 bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
2885
2886 2892
2887class TaskFailure(Exception): 2893class TaskFailure(Exception):
2888 """ 2894 """