summaryrefslogtreecommitdiffstats
path: root/lib/bb/runqueue.py
AgeCommit message (Collapse)Author
2019-09-16runqueue/siggen: Optimise hash equiv queriesRichard Purdie
We only have hash equivalence for setscene tasks so only query the server for those, reducing the number of connections needed. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-28bitbake: respect force flag in runall and runonlyJoshua Watt
Specifying the force flag will now cause runall and runonly to invalidate the tasks before running them. This allows a --runall or --runonly to force the tasks to run, even if they would have otherwise been skipped, e.g.: bitbake -f --runall fetch Will run all do_fetch tasks even if they wouldn't be necessary (for example, skipped by setscene) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-21runqueue: Optimise build_taskdepdata slightlyRichard Purdie
Rather than repeatedly calling mc_from_tid() do this in the parent, removing around a million function calls. Takes time spent in this function from 40s to 36s. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-21runqueue: Further optimise holdoff tasksRichard Purdie
There are other data structures which can be reprocessed at the same time as holdoff_tasks, further improving build efficiency in various places. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-21runqueue: Optimise holdoff task handlingRichard Purdie
We don't need to process the holdoff task list until we're executing tasks which saves some data manipulation, at the cost of some data structures not being correct at all times. This saves significant amounts of time in various profile charts of larger builds. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-21runqueue: Small but critical fixRichard Purdie
We've observed do_package and do_package_setscene running in parallel. The reason is that holdoff_tasks wasn't getting updated. Looking at the code, it would seem the reason is that the task was in pending_migrations and hence changed wasn't set and holdoff_tasks wasn't updated. Fix this. It only affects builds with rehashing enabled. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-16runqueue: Ensure target_tids is filteredRichard Purdie
bitbake <target> --runonly=fetch failed as the target_tids list included entries which were no longer targeted task ids. Fix this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-15runqueue: Ensure data is handled correctlyRichard Purdie
This doesn't appear to have ill effects right now but there is a correctness issue which this so fix it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-15runqueue: Fix data corruption problemRichard Purdie
This was overwriting data in the parent which caused all kinds of odd/weird failures. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Ensure we clear the stamp cacheRichard Purdie
When the task hashes change we need to ensure the stampcache is cleared out else tasks don't rerun when they should as we're basing decisions on stale cache data. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Add missing setscene task corner caseRichard Purdie
We weren't marking this special case of setscene task as buildable leading to runqueue task failures. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Add further debug informationRichard Purdie
Further testing shows we should test some extra datastructures to help pinpoint logic errors more precisely. This adds some further data structure sanity checks. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Drop debug statement causing performance issuesRichard Purdie
This debug statement could result in a long list of tasks which when repeatedly sent over our IPC, slowed down the builds immensely. Remove it in favour of other more targeted debugging added recently, bringing back some lost performance, particularly on builds with large numbers of tasks. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Fix event timing raceRichard Purdie
The event from the task notifiing of hash equivalency should only be processed when the task completes. This can otherwise result in a race where a dependent task may run before the original task completes causing various failures. To make this work reliably, the code had to be restructured quite a bit. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Recompute holdoff tasks from scratchRichard Purdie
The changed_setscene variable here is just odd and not needed. Worse, it could prevent some tasks from being removed from the holdoff tasks list. The list is being rebuilt and should work as intended just from the other data, this is a leftover from previous versions of the code as far as I can tell. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Improve scenequeue debuggingRichard Purdie
Whilst we had good runqueue failure mode debug, it hadn't adapted to the scenequeue changes. Run the scenequeue sanity tests at the end of a build and output the results regardless of whether all setscene tasks completed or not. This *massively* improves the ability to debug runqueue problems. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Fix next_buildable_task performance problemRichard Purdie
Looking at the profile information, a lot of time is being spent in next_buildable_task. This is probably due to the generator expressions not working well with the empty test. The easiest way to improve things is to switch to using set manipulations. We also don't need to update self.buildable the way the original code did as we don't rely on that anywhere. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Wait for covered tasks to complete before trying setsceneRichard Purdie
If tasks are in the covered list of tasks for a given setscene task, it needs to wait for those to complete before we can start. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-14runqueue: Improve setscene task handling logicRichard Purdie
The previous tasks_covered and tasks_notcovered were basically unstable data structures. We couldn't always tell whether tasks should be covered or not when trying to repair the sturcture if sstate tasks reran. In the end its simpler to throw the lists away and rebuild them based upon current data rather than trying to patch it adhoc. This turns out to be simpler and much more reliable and I've much more confidence in this code. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-13runqueue: Fix corruption issueRichard Purdie
We need to copy this set, not modify the original else all kinds of weird and bad things break, mostly from circular references. We'll not go into how much sleep I lost tracking down the fallout from this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06siggen: Clean up task reference formatsRichard Purdie
Currently siggen uses the format "<filename>.<taskname>" for referencing tasks whilst runqueue uses "<filename>:<taskname>". This converts to use ":" as the separator everywhere. This is an API breaking change since the cache is affected, as are siginfo files and any custom signature handlers such as those in OE-Core. Ultimately this will let us clean up and the accessor functions from runqueue, removing all the ".rsplit(".", 1)[0]" type code currently all over the place. Once a standard is used everwhere we can update the code over time to be more optimal. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06runqueue: Clean up BB_HASHCHECK_FUNCTION APIRichard Purdie
This function uses an old API which uses offsets into lists as a communication mechanism. Update the API to use "tid" which is used universally in runqueue now. We can also add kwargs support to the funciton definition to drop some of the backwards compaiblility hoops we had to jump though with different function argument combinations. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06cooker/hashserv: Allow autostarting of a local hash server using BB_HASHSERVERichard Purdie
Its useful, particularly in the local developer model of usage, for bitbake to start and stop a hash equivalence server on local port, rather than relying on one being started by the user before the build. The new BB_HASHSERVE variable supports this. The database handling is moved internally into the hashserv code so that different threads/processes can be used for the server without errors. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06runqueue: Improve determinismRichard Purdie
Whilst this isn't strictly necessary, its helpful if the log output is consistent and its also helpful if bugs either appear or don't appear for a specific configuration. Ensuring the various iterations we make are deterministic (sorted) helps with this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06runqueue: Enable dynamic task adjustment to hash equivalencyRichard Purdie
There is a compelling usecase for tasks being able to notify runqueue that their "unihash" has changed. When this is recieved, the hashes of all subsequent tasks should be recomputed and their new hashes checked against existing setscene validity. Any newly available setscene tasks should then be executed. Making this work effectively needs several pieces. An event is added which the cooker listen for. If a new hash becomes available it can send an event to notify of this. When such an event is seen, hash recomputations are made. A setscene task can't be run until all the tasks it "covers" are stopped. The notion of "holdoff" tasks is therefore added, these are removed from the buildable list with the assumption that some setscene task will run and cover them. The workers need to be notified when taskhashes change to update their own internal siggen data stores. A new worker command is added to do this which will affect all newly spawned worker processes from that worker. An example workflow which tests this code is: Configuration: BB_SIGNATURE_HANDLER = "OEEquivHash" SSTATE_HASHEQUIV_SERVER = "http://localhost:8686" $ bitbake-hashserv & $ bitbake automake-native $ bitbake autoconf-native automake-native -c clean $ bitbake m4-native -c install -f $ bitbake automake-native with the test being whether automake-native is installed from sstate. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-02siggen: Add new unitaskhashes data variable which is cachedRichard Purdie
We need to preserve unihash task hashes between runs. Use the new SimpleCache class to create such a class within the signature generator which is loaded at init time and saved when builds complete. The default is unpopulated but metadata sig handlers can populate this cache. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-02runqueue: Improve scenequeue processing logicRichard Purdie
Rather than a special copy of the data structure which we change, compute the logic using set operations from other data we have. This means we can add tasks back into the scenequeue without having to worry about reversing operations on this variable with all the potential bugs that might involve. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-18runqueue: Fix non setscene tasks targets being lostRichard Purdie
If you specify both setscene and non-setscene tasks on the commandline, the non-setscene tasks could be missed, e.g. "bitbake X:do_patch X:do_populate_sysroot" and do_patch would fail to run. Fix the problem in runqueue and add a testcase. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-16runqueue: Optimise multiconfig with overlapping setsceneRichard Purdie
Currently if a multiconfig build contains different configurations which have overlapping sstate artefacts, it will build them multiple times. This is clearly suboptimal and not what users want/expect. This adds code to detect this and stall all but one of the setscne tasks so that once its built, it can be found by the other tasks. We take care to iterate the multiconfigs in order so try and avoid dependency loops. We also match on PN+taskname+taskhash since this is what we know sstate in OE-Core would use. There are some tasks even within a multiconfig which match hashes (mostly do_populate_lic tasks) but those have a much higher chance of circular dependency so aren't work attempting to optimise. If a deadlock does occur the build will be slower but there is code to unbreak such a deadlock so it hopefully doens't break anything. Comments are injected into the test tasks so they have different task hashes and a new test for this optimisation is added. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Abstract hash verification functionRichard Purdie
Pull the common pieces of the hash verification code into a single function and reduce code duplication. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Whitespace fixRichard Purdie
Fix some unwanted extra indentation. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Simplify some convoluted logicRichard Purdie
This was left from when task IDs complicated the code, simplify. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Complete the merge of scenequeue and normal task executionRichard Purdie
This combines the scqenequeue and normal task execution into one function and simplifies the state engine accordingly. This is the final set of cleanup to fully merge things without adding the extra noise to the previous commits. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Alter setscenewhitelist handlingRichard Purdie
Since there is now parallel execution of setscene and normal tasks, the way setscenewhitelist handling worked can't function the way it did. Paul and I never liked its error output anyway. This code tries a different approach, checking the task at execution time but printing the uncovered task list. This code may need improvement after real world usage but can work with the new task flows. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Merge the queues and execute setscene and normal tasks in parallelRichard Purdie
This is the serious functionality change in this runqueue patch series of changes. Rather than two phases of execution, the scenequeue setscene phase, followed by normal task exeuction, this change allows them to execute in parallel together. To do this we need to handle marking of tasks as covered/uncovered in a piecemeal fashion on a task by task basis rather than in a single function. The code will block normal task exeuction until any setcene task which could cover that task is executed and its status is known. There is a slight optimisation which could be possible here at the risk of races but that doesn't seem worthwhile. The state engine isn't entirely cleaned up in this commit (see FIXME) and the setscenewhitelist functionality is broken by it (see following patches) however its good enough to test with normal workflows. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Clarify scenequeue_covered vs. tasks_coveredRichard Purdie
It wasn't clear whether the variable contained just setscene covered tasks or all covered tasks. We need both sets of data so lets just have two clearly named variables. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Further scheduler buildable tasks cleanupRichard Purdie
The code for setting up buildable tasks can be simplified. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Remove pointless variableRichard Purdie
Its now clear a variable is pointless, remove it and tweak the logic so the data structure of the existing variable matches what we need. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Code simplificationRichard Purdie
Simplfy some looping code which no longer has any purpose. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Tweak comments and debug codeRichard Purdie
Add some extra comments to build_scenequeue_data() and fix the debug code so it actually works. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Simplify scenequeue unskippable calculationRichard Purdie
The existing code to compute the 'unskippable' setscene task list is overcomlicated, so replace it with something functionally equivalent but simpler and more efficient. We don't need to process all chains, just the 'top' ones to the first setscene tasks. This also makes the code more readable. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Add covered_tasks (or 'collated_deps') to scenequeue dataRichard Purdie
Its useful to have a list of all the tasks a given setscene task covers and we can easily generate this data whilst doing other data processing. This is used in later changes to runqueue rather than trying to compute it on the fly which is difficult. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15event/runqueue: Drop StampUpdate event, its pointless/unusedRichard Purdie
Whilst this class has existed for years, it doesn't have any users and has a questionable interface. Drop it to allow for further simplification and changes. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Fold remains of the scenequeue setup into RunQueueExecuteRichard Purdie
Also move the scheduler init over, apart for the builtable tasks part which need to remain called later. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Simplify _execute_runqueue logicRichard Purdie
Cleanup to the _execute_runqueue logic to reduce indentation, drop the dummy executor class concept and prepare for further changes. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Remove RunQueueExecuteScenequeue and RunQueueExecuteTasksRichard Purdie
Replace the remains of the Tasks and Scenequeue Tasks classes with simple function calls. Also drop the dummy version of the execution class to simplify further changes as its not needed. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Fix counter/task updating glitchRichard Purdie
Some tasks were not being marked as covered/notcovered since internal calls were being made without using the external call points. Fix the accounting issues by using the correct external call points. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Merge scenequeue and real task queue code togetherRichard Purdie
Merge the unique functions from the Tasks and Scenequeue Tasks classes into the common base class. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Merge stats handling together for setscene/real tasksRichard Purdie
Use a seperate stats class for scenequeue tasks and move the setup into the base class. Update references accordingly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-15runqueue: Uniquely namespace the scenequeue functionsRichard Purdie
In preparation for merging the setscene and normal task execution, uniquely namespace the scenequeue specific functions. For the one shared function, add the "sq_live" variable so we know which functions to send the results to. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>