summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-05-06 15:01:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-05 17:15:54 +0100
commita15eea5077506111e4167a2361da0306d23543f3 (patch)
tree01c8601cdd1d37c48f8ca795453cfa44b34b6527 /bitbake
parentb205abd2aee89910cc676e25825182822b02a091 (diff)
downloadpoky-a15eea5077506111e4167a2361da0306d23543f3.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: bb424e0a6d274d398f434f7df63951da9ce305b3) 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 6c41fe6d43..25e012125c 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -2443,6 +2443,11 @@ class RunQueueExecute:
2443 2443
2444 if update_tasks: 2444 if update_tasks:
2445 self.sqdone = False 2445 self.sqdone = False
2446 for tid in [t[0] for t in update_tasks]:
2447 h = pending_hash_index(tid, self.rqdata)
2448 if h in self.sqdata.hashes and tid != self.sqdata.hashes[h]:
2449 self.sq_deferred[tid] = self.sqdata.hashes[h]
2450 bb.note("Deferring %s after %s" % (tid, self.sqdata.hashes[h]))
2446 update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False) 2451 update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False)
2447 2452
2448 for (tid, harddepfail, origvalid) in update_tasks: 2453 for (tid, harddepfail, origvalid) in update_tasks:
@@ -2786,6 +2791,19 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2786 sqdata.stamppresent = set() 2791 sqdata.stamppresent = set()
2787 sqdata.valid = set() 2792 sqdata.valid = set()
2788 2793
2794 sqdata.hashes = {}
2795 sqrq.sq_deferred = {}
2796 for mc in sorted(sqdata.multiconfigs):
2797 for tid in sorted(sqdata.sq_revdeps):
2798 if mc_from_tid(tid) != mc:
2799 continue
2800 h = pending_hash_index(tid, rqdata)
2801 if h not in sqdata.hashes:
2802 sqdata.hashes[h] = tid
2803 else:
2804 sqrq.sq_deferred[tid] = sqdata.hashes[h]
2805 bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
2806
2789 update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True) 2807 update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True)
2790 2808
2791 # Compute a list of 'stale' sstate tasks where the current hash does not match the one 2809 # Compute a list of 'stale' sstate tasks where the current hash does not match the one
@@ -2850,32 +2868,20 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s
2850 2868
2851 sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary) 2869 sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary)
2852 2870
2853 sqdata.hashes = {} 2871 for tid in tids:
2854 sqrq.sq_deferred = {} 2872 if tid in sqdata.stamppresent:
2855 for mc in sorted(sqdata.multiconfigs): 2873 continue
2856 for tid in sorted(sqdata.sq_revdeps): 2874 if tid in sqdata.valid:
2857 if mc_from_tid(tid) != mc: 2875 continue
2858 continue 2876 if tid in sqdata.noexec:
2859 if tid in sqdata.stamppresent: 2877 continue
2860 continue 2878 if tid in sqrq.scenequeue_covered:
2861 if tid in sqdata.valid: 2879 continue
2862 continue 2880 if tid in sqrq.scenequeue_notcovered:
2863 if tid in sqdata.noexec: 2881 continue
2864 continue 2882 if tid in sqrq.sq_deferred:
2865 if tid in sqrq.scenequeue_notcovered: 2883 continue
2866 continue 2884 sqdata.outrightfail.add(tid)
2867 if tid in sqrq.scenequeue_covered:
2868 continue
2869
2870 h = pending_hash_index(tid, rqdata)
2871 if h not in sqdata.hashes:
2872 if tid in tids:
2873 sqdata.outrightfail.add(tid)
2874 sqdata.hashes[h] = tid
2875 else:
2876 sqrq.sq_deferred[tid] = sqdata.hashes[h]
2877 bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
2878
2879 2885
2880class TaskFailure(Exception): 2886class TaskFailure(Exception):
2881 """ 2887 """