| Message ID | 20261024-mathieu-debug-replay-v4-v1-3-3f7f52a3b8e6@bootlin.com |
|---|---|
| State | New |
| Headers | show |
| Series | Preparatory work for sstate cache log replay | expand |
On Sat, 2026-10-24 at 14:33 +0200, Mathieu Dubois-Briand via lists.openembedded.org wrote: > When a setscene task starts, hand it the covered tasks of the same recipe > which were not yet handed to another setscene task, and pass their names > to the task through BB_SETSCENE_REPLAY_TASKS. Several setscene tasks can > cover the same task (e.g. do_populate_sysroot and do_package both cover > do_compile), so this lets metadata replay the log of each covered task > exactly once when restoring it from the sstate cache. > > AI-Generated: Uses opencode (DeepSeek V4 Flash) > Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> > --- > bin/bitbake-worker | 1 + > lib/bb/runqueue.py | 9 +++++++++ > 2 files changed, 10 insertions(+) This is a very specific piece of API, specifically tailored to what this particular task entails. I'm a bit worried that it still doesn't cover everything it should, for example a warning from another recipe that is only covered by a given sstate task and nothing else. You can pobably calculate it from BB_TASKDEPDATA already too, if you know which tasks are sstate, which I think we know. There is also the potential for multiple log output from these covered tasks, e.g. do_package and do_populate_sysroot both 'cover' on do_install so a warning from do_install will be shown by both tasks at setscene time. So we should probably handle wider tasks than just the current recipe... Cheers, Richard
On Sun Oct 25, 2026 at 3:20 PM CET, Richard Purdie wrote: > On Sat, 2026-10-24 at 14:33 +0200, Mathieu Dubois-Briand via lists.openembedded.org wrote: >> When a setscene task starts, hand it the covered tasks of the same recipe >> which were not yet handed to another setscene task, and pass their names >> to the task through BB_SETSCENE_REPLAY_TASKS. Several setscene tasks can >> cover the same task (e.g. do_populate_sysroot and do_package both cover >> do_compile), so this lets metadata replay the log of each covered task >> exactly once when restoring it from the sstate cache. >> >> AI-Generated: Uses opencode (DeepSeek V4 Flash) >> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> >> --- >> bin/bitbake-worker | 1 + >> lib/bb/runqueue.py | 9 +++++++++ >> 2 files changed, 10 insertions(+) > > This is a very specific piece of API, specifically tailored to what > this particular task entails. > Just to make sure I fully understand this: I should rather try to rely more on existing API or introduce something a bit more generic. Is that right? > I'm a bit worried that it still doesn't cover everything it should, for > example a warning from another recipe that is only covered by a given > sstate task and nothing else. Indeed. Knowing we have to replay these logs should be easy, but accessing these logs in the first place might be a bit tricky. I will have to experiment a bit and understand what is possible. > > You can pobably calculate it from BB_TASKDEPDATA already too, if you > know which tasks are sstate, which I think we know. > > There is also the potential for multiple log output from these covered > tasks, e.g. do_package and do_populate_sysroot both 'cover' on > do_install so a warning from do_install will be shown by both tasks at > setscene time. > This should not happen with the current code. But I will have to be careful when covering tasks from another recipe. In your example, only one of the two tasks should be assigned with the logs of do_install, either do_package or do_populate_sysroot, but not both. This is the point of the sq_replay_assigned set here. Also, it should be covered by my tests on the oe-core side. Thanks, Mathieu
diff --git a/bin/bitbake-worker b/bin/bitbake-worker index 61484a5c2522..0a46eea3ccb5 100755 --- a/bin/bitbake-worker +++ b/bin/bitbake-worker @@ -266,6 +266,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, extraconfigdata, runtask): the_data = databuilder.mcdata[mc] the_data.setVar("BB_WORKERCONTEXT", "1") the_data.setVar("BB_TASKDEPDATA", taskdepdata) + the_data.setVar("BB_SETSCENE_REPLAY_TASKS", " ".join(runtask.get('replaytasks', []))) the_data.setVar('BB_CURRENTTASK', taskname.replace("do_", "")) if cfg.limited_deps: the_data.setVar("BB_LIMITEDDEPS", "1") diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py index ef95eb46bf95..8bb1cb1a6e72 100644 --- a/lib/bb/runqueue.py +++ b/lib/bb/runqueue.py @@ -1939,6 +1939,8 @@ class RunQueueExecute: self.scenequeue_notcovered = set() self.tasks_notcovered = set() self.scenequeue_notneeded = set() + # Covered tasks already handed to a setscene task for log replay + self.sq_replay_assigned = set() self.setscene_tids_generator = None @@ -2297,6 +2299,12 @@ class RunQueueExecute: startevent = sceneQueueTaskStarted(task, self.stats, self.rq) bb.event.fire(startevent, self.cfgData) + # Each covered task of this recipe is assigned to exactly one + # setscene task, so its log is replayed only once. + replaytasks = {t for t in self.sqdata.sq_covered_tasks[task] + if fn_from_tid(t) == taskfn} - self.sq_replay_assigned + self.sq_replay_assigned |= replaytasks + taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] realfn = bb.cache.virtualfn2realfn(taskfn)[0] runtask = { @@ -2305,6 +2313,7 @@ class RunQueueExecute: 'taskname' : taskname, 'taskhash' : self.rqdata.get_task_hash(task), 'unihash' : self.rqdata.get_task_unihash(task), + 'replaytasks' : sorted(taskname_from_tid(t) for t in replaytasks), 'quieterrors' : True, 'appends' : self.cooker.collections[mc].get_file_appends(taskfn), 'layername' : self.cooker.collections[mc].calc_bbfile_priority(realfn)[2],
When a setscene task starts, hand it the covered tasks of the same recipe which were not yet handed to another setscene task, and pass their names to the task through BB_SETSCENE_REPLAY_TASKS. Several setscene tasks can cover the same task (e.g. do_populate_sysroot and do_package both cover do_compile), so this lets metadata replay the log of each covered task exactly once when restoring it from the sstate cache. AI-Generated: Uses opencode (DeepSeek V4 Flash) Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> --- bin/bitbake-worker | 1 + lib/bb/runqueue.py | 9 +++++++++ 2 files changed, 10 insertions(+)