summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-15 10:43:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-22 10:12:33 +0000
commit826011d497cab1dcd69629cd0781e443c1ae522c (patch)
treebb9649b0c8f86b106144a5d8bdd4587dd53e7d4c /bitbake
parent0922cef2f411b7932337164c66acfbc38073d537 (diff)
downloadpoky-826011d497cab1dcd69629cd0781e443c1ae522c.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: 4316e9f60ce5fd250a16586a1772dcc0adfeb932) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit bb424e0a6d274d398f434f7df63951da9ce305b3) Signed-off-by: Fabio Berton <fabio.berton@criticaltechworks.com> Signed-off-by: Steve Sakoman <steve@sakoman.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 a437aeef90..9efd1c86f9 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -2496,6 +2496,11 @@ class RunQueueExecute:
2496 2496
2497 if update_tasks: 2497 if update_tasks:
2498 self.sqdone = False 2498 self.sqdone = False
2499 for tid in [t[0] for t in update_tasks]:
2500 h = pending_hash_index(tid, self.rqdata)
2501 if h in self.sqdata.hashes and tid != self.sqdata.hashes[h]:
2502 self.sq_deferred[tid] = self.sqdata.hashes[h]
2503 bb.note("Deferring %s after %s" % (tid, self.sqdata.hashes[h]))
2499 update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False) 2504 update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False)
2500 2505
2501 for (tid, harddepfail, origvalid) in update_tasks: 2506 for (tid, harddepfail, origvalid) in update_tasks:
@@ -2836,6 +2841,19 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2836 sqdata.stamppresent = set() 2841 sqdata.stamppresent = set()
2837 sqdata.valid = set() 2842 sqdata.valid = set()
2838 2843
2844 sqdata.hashes = {}
2845 sqrq.sq_deferred = {}
2846 for mc in sorted(sqdata.multiconfigs):
2847 for tid in sorted(sqdata.sq_revdeps):
2848 if mc_from_tid(tid) != mc:
2849 continue
2850 h = pending_hash_index(tid, rqdata)
2851 if h not in sqdata.hashes:
2852 sqdata.hashes[h] = tid
2853 else:
2854 sqrq.sq_deferred[tid] = sqdata.hashes[h]
2855 bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
2856
2839 update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True) 2857 update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True)
2840 2858
2841def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True): 2859def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True):
@@ -2876,32 +2894,20 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s
2876 2894
2877 sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary) 2895 sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary)
2878 2896
2879 sqdata.hashes = {} 2897 for tid in tids:
2880 sqrq.sq_deferred = {} 2898 if tid in sqdata.stamppresent:
2881 for mc in sorted(sqdata.multiconfigs): 2899 continue
2882 for tid in sorted(sqdata.sq_revdeps): 2900 if tid in sqdata.valid:
2883 if mc_from_tid(tid) != mc: 2901 continue
2884 continue 2902 if tid in sqdata.noexec:
2885 if tid in sqdata.stamppresent: 2903 continue
2886 continue 2904 if tid in sqrq.scenequeue_covered:
2887 if tid in sqdata.valid: 2905 continue
2888 continue 2906 if tid in sqrq.scenequeue_notcovered:
2889 if tid in sqdata.noexec: 2907 continue
2890 continue 2908 if tid in sqrq.sq_deferred:
2891 if tid in sqrq.scenequeue_notcovered: 2909 continue
2892 continue 2910 sqdata.outrightfail.add(tid)
2893 if tid in sqrq.scenequeue_covered:
2894 continue
2895
2896 h = pending_hash_index(tid, rqdata)
2897 if h not in sqdata.hashes:
2898 if tid in tids:
2899 sqdata.outrightfail.add(tid)
2900 sqdata.hashes[h] = tid
2901 else:
2902 sqrq.sq_deferred[tid] = sqdata.hashes[h]
2903 bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
2904
2905 2911
2906class TaskFailure(Exception): 2912class TaskFailure(Exception):
2907 """ 2913 """