summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2020-06-19 05:12:21 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-06-19 05:12:21 +0000
commitd9f4e5566922f8dd7a20c2c6b4cd0dd83ad57564 (patch)
tree20442e4baf7f7a4ce24121ec599e0005efd2c731
parente457efa35f1bbe694c3970f19d0cbe0e5db2b657 (diff)
parenta3d995a3327542997ebb958d21bbc98878aef281 (diff)
downloadplatform_system_bpf-d9f4e5566922f8dd7a20c2c6b4cd0dd83ad57564.tar.gz
platform_system_bpf-d9f4e5566922f8dd7a20c2c6b4cd0dd83ad57564.tar.bz2
platform_system_bpf-d9f4e5566922f8dd7a20c2c6b4cd0dd83ad57564.zip
waitForProgsLoaded() - reduce log spaminess am: 2d12844a4e am: a3d995a332
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/11920083 Change-Id: I5c3a220e21e59297828c9c3a52d0b18a8f54a04a
-rw-r--r--libbpf_android/Loader.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp
index 5a65c1b..da6a109 100644
--- a/libbpf_android/Loader.cpp
+++ b/libbpf_android/Loader.cpp
@@ -665,12 +665,21 @@ int loadProg(const char* elfPath, bool* isCritical) {
return ret;
}
+static bool waitSecondsForProgsLoaded(int seconds) {
+ bool ok =
+ android::base::WaitForProperty("bpf.progs_loaded", "1", std::chrono::seconds(seconds));
+ if (!ok) ALOGW("Waited %ds for bpf.progs_loaded, still waiting...", seconds);
+ return ok;
+}
+
void waitForProgsLoaded() {
if (!android::bpf::isBpfSupported()) return;
- while (!android::base::WaitForProperty("bpf.progs_loaded", "1", std::chrono::seconds(5))) {
- ALOGW("Waited 5s for bpf.progs_loaded, still waiting...");
- }
+ if (waitSecondsForProgsLoaded(5)) return;
+ if (waitSecondsForProgsLoaded(10)) return;
+ if (waitSecondsForProgsLoaded(20)) return;
+ while (!waitSecondsForProgsLoaded(60))
+ ; // loop until success
}
} // namespace bpf