summaryrefslogtreecommitdiffstats
path: root/bootstat
Commit message (Collapse)AuthorAgeFilesLines
* Report non-empty system boot reason when bootloader reason is emptyWei Wang2019-05-221-11/+2
| | | | | | Bug: 133321647 Test: build Change-Id: Icd3ea4b69ef2ad040926e2b0e121a8f5f1c1b658
* bootstat: add 3 pmic off reasons to known setJone Chou2019-05-031-0/+3
| | | | | | | | | | | | | | | | regular expression: - "reboot,pmic_off_fault,.*" (175) - "reboot,pmic_off_s3rst,.*" (176) - "reboot,pmic_off_other,.*" (177) regex is dependent on: https://android-review.googlesource.com/947976 Test: none Bug: 116838876 Bug: 128929506 Change-Id: I7fae9ecee536f790c8f493c3f5e5f75b03efb1d6 Signed-off-by: Jone Chou <jonechou@google.com>
* bootstat: Allow regex matches for boot reasonsMark Salyzyn2019-05-012-32/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the matching string contains a [, \ or *, then it is also checked with a regex match. Exact match is always tried firsts. If we do not find an exact string match, switch to iterate through the entire list for regex strings to find a match. This allows us to scale with details without consuming a large number of enums, permitting details that we do not necessarily want resolution on to propagate to TRON. The hierarchical nature of the boot reason <reason>,<subreason>,<detail>... can cause scenarios where the <detail> does not matter to TRON, but does matter to bugreport collection. Add a bootstat --boot_reason_enum function to expose and test the kBootReasonMap matchihg algorithm. Add a kBootReasonMap test that exhaustively tests all built-in entries, and an example of one regex entry. New regex entries added to bootstat.cpp will need a series of exact match examples added into filter_kBootReasonMap() function. Test: boot_reason_test.sh kBootReasonMap (or all tests) Bug: 116838876 Bug: 128929506 Change-Id: I3f7b5de22f99195b7ce99672a212174365960b3f Merged-In: I3f7b5de22f99195b7ce99672a212174365960b3f
* bootstat: add 4 reboot reasons to known setJone Chou2019-03-201-0/+4
| | | | | | | | | | | | | - reboot,rtc - reboot,dm-verity_device_corrupted - reboot,dm-verity_enforcing - reboot,keys_clear Test: none Bug: 128929506 Bug: 128929604 Change-Id: I5438c236abb67b74c7b9d717930c0ea69f70540d Signed-off-by: Jone Chou <jonechou@google.com>
* bootstat: add recovery,quiescent and reboot,quiescent to known setMark Salyzyn2019-03-111-0/+2
| | | | | | | | | Reserve recovery,quiescent and reboot,quiescent to known reboot reasons. Test: none Bug: 120624642 Change-Id: I78c52f6db447c9d3980a3f2007471bc7aa60e25f
* bootstat: add salyzyn as ownerMark Salyzyn2019-02-281-0/+1
| | | | | Test: none Change-Id: I1d8874dfb5cc9efaed5ad85702a054f1c2a7766f
* bootstat: local GetProperty use libbaseMark Salyzyn2019-02-111-38/+23
| | | | | | | | | | | | | libbase GetProperty collects the properties properly, which also allow for content greater than 128 bytes in length. Replace internal GetProperty and SetProperty helpers with libbase version. Test: unit tests Bug: 121161069 Bug: 124114707 Change-Id: Ic0829955705ebaa19d747bb3f6942f4b9786316a
* bootstat: crash when parsing ro.boot.boottimeMark Salyzyn2019-02-081-0/+1
| | | | | | | | | | If ro.boot.boottime is malformed or truncated, it will crash bootstat operations. Test: compile Bug: 121161069 Bug: 124114707 Change-Id: Ie2edcffb6d54a8e0c7f2e9a89ae4b29cce246d75
* bootstat: Update boot reason property earlierWei Wang2019-02-081-4/+11
| | | | | | | | | | | | | | | | | | | bootstat updates boot reason upon boot_complete, however users of the updated properties e.g. getLastShutdownReason from PowerManager could be called before boot_complete. This introduces a inconsistency and racing for those APIs. In this CL, we change boot reason to be updated at the same time when zygote starts where persist properties have been loaded already. Also the initialization of bootloader's boot reason is pulled into post-fs where all kernel command line arguments have been parsed in init already. Bug: 122696730 Bug: 119509425 Test: trigger thermal shutdown and see warnings Test: verify boot reason properties updated correctly post boot Change-Id: Ia393b98ea072bc0ae6e4110d111393b34be0ee5d Signed-off-by: Wei Wang <wvw@google.com>
* switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn2018-11-141-1/+0
| | | | | | Test: compile Bug: 119313545 Change-Id: I4f7ad84743e974b4b4d1d7256088f6c8b749a237
* bootstat: smpl -> reboot,powerlossMark Salyzyn2018-09-261-3/+4
| | | | | | | | | smpl anywhere in boot loader reason string will match and convert to reboot,powerloss when propagated to system boot reason. Test: compile Bug: 63736262 Change-Id: I156bfefd05d2bab480408cf6bb1dc4c61c8983f9
* bootstat: uvlo -> reboot,undervoltageMark Salyzyn2018-09-261-2/+3
| | | | | | | | | uvlo anywhere in boot loader reason string will match and convert to reboot,undervoltage when propagated to system boot reason. Test: compile Bug: 63736262 Change-Id: I14b0b7e8185aa4fb519efdb6cb1306718e9de69c
* bootstat: duplicate boot reason entriesMark Salyzyn2018-08-071-3/+3
| | | | | | | | | Selected visually obvious non-compliant boot reasons to allow for future re-use of a later formerly duplicated entry. Test: compile Bug: 112157996 Change-Id: I3c6b449d36f9e4b745214dd7840b1dc1258bf483
* Merge "bootstat: record reboot reason history in ↵Mark Salyzyn2018-07-022-111/+207
|\ | | | | | | | | | | | | | | persist.sys.boot.reason.history" am: 70025585ff Change-Id: Ife1200808d84f198441821f0af9d0b11e22780fa
| * Merge "bootstat: record reboot reason history in ↵Treehugger Robot2018-07-022-111/+207
| |\ | | | | | | | | | persist.sys.boot.reason.history"
| | * bootstat: record reboot reason history in persist.sys.boot.reason.historyMark Salyzyn2018-06-292-111/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Retain the last four reboot reasons from latest to oldest, adding a detail of UTC epoch time for each. Beef up boot_reason_test.sh to deal with multi-line content. Test: boot_reason_test.sh Bug: 110925971 Change-Id: Ie2600434b95a885693f005a363ee38d9eba18ee7
* | | Merge "bootstat: kpdpwr actually means reboot,longkey"Mark Salyzyn2018-07-021-0/+2
|\| | | | | | | | | | | | | | | | | am: 50d874b873 Change-Id: Ic8e4655df0d55a8a3a356e3ca72ea3e7680cfdad
| * | bootstat: kpdpwr actually means reboot,longkeyMark Salyzyn2018-06-281-0/+2
| |/ | | | | | | | | | | Test: compile Bug: 71809701 Change-Id: I812777645b988f9627bcf62e7ef70cc2085d9106
* | resolve merge conflicts of 8c6f7ec06039fb2d67b5624ee7c9bcd7c43db412 to ↵Elliott Hughes2018-06-162-82/+1
|\| | | | | | | | | | | | | | | stage-aosp-master BUG: None Test: I solemnly swear I tested this conflict resolution. Change-Id: Ibd2adc272b69d9752f04bee5901fc7590aaaf93a
| * bootstat: remove the only caller of liblogcat.Elliott Hughes2018-06-152-82/+1
| | | | | | | | | | | | | | | | | | | | We need to make progress both on adding the real interface for battery level and cleaning up logging. This stands in the way of both. Bug: http://b/77725702 Test: builds Change-Id: Ia457e497606c2c7965d6895baebb26eef17857c9 Merged-In: Ia457e497606c2c7965d6895baebb26eef17857c9
* | resolve merge conflicts of ca57890a8049c0100d91f9974f446ad904b4cec4 to ↵Mark Salyzyn2018-06-142-40/+54
|\| | | | | | | | | | | | | | | stage-aosp-master Bug: 86671991 Test: I solemnly swear I tested this conflict resolution. Change-Id: Ia49d1a9311f6a7a84dd96c31f79ecdc3143084b2
| * bootstat: clear persist.sys.boot.reason once readMark Salyzyn2018-06-142-40/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To ensure a surprise reboot does not take the last boot reason on face value especially if coming from more than one boot sessions ago. We shift and clear the value from persist.sys.boot.reason to sys.boot.reason.last and establish a correct last reboot reason in the canonical sys.boot.reason property. This effectively deprecates persist.sys.boot.reason as an API. They should have been using sys.boot.reason instead for a correctly determined reasoning. Test: boot_reason_test.sh Bug: 86671991 Merged-In: If85750704445088fd62978679ab3a30744c46abb Change-Id: If85750704445088fd62978679ab3a30744c46abb
* | Merge "bootstat: Remove the CAP_SYSLOG capability"Luis Hector Chavez2018-06-121-19/+2
|\| | | | | | | | | | | am: cefd4e56ad Change-Id: I0a0627228434d0284b4f535942c97121d9773e14
| * Merge "bootstat: Remove the CAP_SYSLOG capability"Treehugger Robot2018-06-121-19/+2
| |\
| | * bootstat: Remove the CAP_SYSLOG capabilityLuis Hector Chavez2018-06-111-19/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change removes the CAP_SYSLOG file based capability from bootstat, since the intention is that it should not be accessing the logs in the long term. In order to avoid bitrot, the fallback code that depends on CAP_SYSLOG has also been removed. Bug: 62845925 Test: system/core/bootstat/boot_reason_test.sh Change-Id: I899be44ef3ac1c4d81072f801d55c928ae09bb15
* | | Merge "bootstat: ppdone_timeout kernel panic"Mark Salyzyn2018-06-121-0/+1
|\| | | | | | | | | | | | | | | | | am: e5aa7ee753 Change-Id: Idbedd218104a272458192123ddf889d5d9fb379b
| * | bootstat: ppdone_timeout kernel panicMark Salyzyn2018-06-081-0/+1
| |/ | | | | | | | | | | | | | | | | Add kernel_panic,_sde_encoder_phys_cmd_handle_ppdone_timeout to help track occurrences. Test: compile Bug: 67728931 Change-Id: I3306ae2936dc4355902e838d9ac8d8b11837348d
| * Fix performance degradation from BootSequence atomTej Singh2018-06-042-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (partial cherry pick from commit fe3e762b6de94ab43b3019d38cdc2abfad3a786c) Adding the boot sequence reported atom in ag/3518079 caused the duration of bootstat to increase, as seen in b/72864061. I isolated the cause down to calling BootReasonStrToReason. However, this function also gets called in ReportBootReason, so I created another function that does the parsing and sets the system boot reason property, and made RecordBootReason and statsd logging get that property. Bug: 72864061 Test: rebooted phone, verified boot events were received in adb shell logcat -b stats and verified adb shell bootstat -p printed correct values. Ran timing tests as well on walleye with 20 boots: before this change, the average was ~150-160ms. After, it was ~80ms. Change-Id: I92dbc9880328835647be7d9d50c7861b42f27bdb Merged-In: I92dbc9880328835647be7d9d50c7861b42f27bdb
* | Merge changes Iecedc3b1,I28987f08 am: dc17e9efa0Mark Salyzyn2018-06-042-3/+14
|\| | | | | | | | | | | am: 0d18efbdf8 Change-Id: I97fbc26deaad32ad6719ef8496722872b7928595
| * bootstat: refine boot reasonsMark Salyzyn2018-06-042-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Received some clarity as to some of the boot reasons. List of boot reasons and new translations to Canonical boot reason: - "power_key" -> "cold,powerkey" (existing) - "usb" -> "cold,charger" (existing) - "rtc" -> "cold,rtc" (existing) - "wdt" -> "reboot" (changed) - "wdt_by_pass_pwk" -> "warm" (changed) - "tool_by_pass_pwd" -> "reboot,tool" (changed) - "2sec_reboot" -> "cold,rtc,2sec" (changed) - "unknown" -> "reboot,unknown" (existing) - "kernel_panic" (existing) - "reboot" (existing) - "watchdog" (existing) Add the new string to enums for the new Boot Reason. Test: boot_reason_test.sh (on affected device) Bug: 74595769 Bug: 63736262 Change-Id: Iecedc3b1f7c47f26d0c77b1f316f745c6d2c1256
| * bootstat: shutdown reports rebootMark Salyzyn2018-06-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices report the following canonical boot reason for all shutdown operations: reboot,kernel_power_off_charging__reboot_system because shutdown switches to a charging kernel, and reboots into the system when the user presses the power button. Thus last kernel messages arrives as: <0>.(0)[53:pmic_thread]reboot: Restarting system with command \ 'kernel power off charging reboot system' -> "shutdown" (w/o last boot reason) -> "shutdown,<subreason>" (w/last boot reason) The reboot reason from that charging instance propagates as a fortified boot reason blocking interpretation of the last boot reason that manages shutdown canonical boot reason determination. The fix is to change reboot,kernel_power_off_charging__reboot_system to shutdown, so that it is viewed as a blunt reason that can be overridden by last boot reason. We added the above boot reason to kBootReasonMap because the Bit Error Handler can use it to reconstruct if there is any damage to the last kernel messages content. The sad thing is that the enum will never propagate as we are filtering it out and reporting "shutdown" instead. Of course, we are now covered for a can not happen. Test: boot_reason_test.sh Bug: 74595769 Bug: 63736262 Change-Id: I28987f0871af7d967cc4bbbffed43bd42349acdd
* | Merge "bootstat: Add kernel_panic,modem + related others" am: 7c4d393c24Mark Salyzyn2018-06-041-0/+8
|\| | | | | | | | | | | am: cd9c084084 Change-Id: I709e9ade848b8caf160dd560fdb7bb10f1767c7a
| * bootstat: Add kernel_panic,modem + related othersMark Salyzyn2018-06-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found a kernel modem driver report: Kernel panic - not syncing: subsys-restart: Resetting the SoC - modem crashed. Which translates to the canonical boot reason, a wordy: kernel_panic,subsys-restart:_resetting_the_soc_-_modem_crashed. Shortening and ber matching the string, plus others that are possible, to be more succinct, so added kernel_panic,{modem|adsp|dsps|wcnss}. Test: build Bug: 80553005 Change-Id: I969e1da896cd15b82e2fe11ceb77a5f54dfcfbc8
* | Merge "bootstat: test reboot rescueparty" am: 035a1c7a0bandroid-build-prod (mdb)2018-05-071-2/+17
|\| | | | | | | | | | | am: 0bb59a9d57 Change-Id: I07678150969bcd0b82c8356ad2aa5ca335265e1f
| * bootstat: test reboot rescuepartyMark Salyzyn2018-05-071-2/+17
| | | | | | | | | | | | | | | | | | This test fails on most devices, gives us a report of devices that do not propagate the boot reason via the bootloader. This should become a bootloader required test. Test: boot_reason_test.sh optional_rescueparty Change-Id: Ibdc7b23b025e5d89d659ff08083b2e071343923c
* | Merge "bootstat: add reboot,rescueparty" am: 708364e650android-build-prod (mdb)2018-05-031-1/+1
|\| | | | | | | | | | | am: d44f72ddb5 Change-Id: I3c9aab04ee860b467e7a10d3c83c2ddd021ddecd
| * bootstat: add reboot,rescuepartyMark Salyzyn2018-05-031-1/+1
| | | | | | | | | | | | | | Reserve this for Android system use. Test: none Change-Id: Iaf29f0fcd1fe68962cf1109843d6452d0ab42e3c
* | Merge "llkd: bootstat: propagate detailed livelock canonical boot reason" ↵Mark Salyzyn2018-04-201-0/+3
|\| | | | | | | | | | | | | | | am: 481a8125a6 am: 0033edc469 Change-Id: Id05e8ca453e6f761aaa540eadddcd0e18fe28efd
| * llkd: bootstat: propagate detailed livelock canonical boot reasonMark Salyzyn2018-04-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Report kernel_panic,sysrq,livelock,<state> reboot reason via last dmesg (pstore console). Add ro.llk.killtest property, which will allow reliable ABA platforms to drop kill test and go directly to kernel panic. This should also allow some manual unit testing of the canonical boot reason report. New canonical boot reasons from llkd are: - kernel_panic,sysrq,livelock,alarm llkd itself locked up (Hail Mary) - kernel_panic,sysrq,livelock,driver uninterrruptible D state - kernel_panic,sysrq,livelock,zombie uninterrruptible Z state Manual test assumptions: - llkd is built by the platform and landed on system partition - unit test is built and landed in /data/nativetest (could land in /data/nativetest64, adjust test correspondingly) - llkd not enabled, ro.llk.enable and ro.llk.killtest are not set by platform allowing test to adjust all the configuration properties and start llkd. - or, llkd is enabled, ro.llk.enable is true, and killtest is disabled, ro.llk.killtest is false, setup by the platform. This breaks the go/apct generic operations of the unit test for llk.zombie and llk.driver as kernel panic results requiring manual intervention otherwise. If test moves to go/apct, then we will be forced to bypass these tests under this condition (but allow them to run if ro.llk.killtest is "off" so specific testing above/below can be run). for i in driver zombie; do adb shell su root setprop ro.llk.killtest off adb shell /data/nativetest/llkd_unit_test/llkd_unit_test --gtest_filter=llkd.${i} adb wait-for-device adb shell su root setprop ro.llk.killtest off sleep 60 adb shell getprop sys.boot.reason adb shell /data/nativetest/llkd_unit_test/llkd_unit_test --gtest_filter=llkd.${i} done Test: llkd_unit_test (see test assumptions) Bug: 33808187 Bug: 72838192 Change-Id: I2b24875376ddfdbc282ba3da5c5b3567de85dbc0
| * Make bootstat container-friendlyLuis Hector Chavez2018-04-161-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows bootstat to read the ro.boot.boottime_offset property, which is set on devices where Android runs in a container. This is because the CLOCK_BOOTTIME clock is not reset when (from Android's perspective) the device restarts, since the host OS does not restart itself. Bug: 77273909 Test: CtsBootStatsTestCases Change-Id: Ifb792864394be0b4686cc9d555c0afced856f4b4 Merged-In: Ifb792864394be0b4686cc9d555c0afced856f4b4
* | Merge "Make bootstat container-friendly" into pi-devLuis Hector Chavez2018-04-161-7/+23
|\ \ | | | | | | | | | | | | | | | am: 4807bc214f Change-Id: I2104e73d62ac6111314d6a63343aa28bde87053b
| * | Make bootstat container-friendlyLuis Hector Chavez2018-04-161-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows bootstat to read the ro.boot.boottime_offset property, which is set on devices where Android runs in a container. This is because the CLOCK_BOOTTIME clock is not reset when (from Android's perspective) the device restarts, since the host OS does not restart itself. Bug: 77273909 Test: CtsBootStatsTestCases Change-Id: Ifb792864394be0b4686cc9d555c0afced856f4b4
* | | Merge "bootstat: refine "Kernel panic - not syncing"" am: 3b353ed41cMark Salyzyn2018-03-232-16/+212
|\ \ \ | | |/ | |/| | | | | | | | | | am: cf63c66865 Change-Id: I102019c09fb52fc3963ded5f08097283b00587bd
| * | bootstat: refine "Kernel panic - not syncing"Mark Salyzyn2018-03-222-16/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide some easy kernel panic subreasons mined from last kmesg, generates a canonical boot reason (system boot reason) that may aid triage. Notably report kernel_panic,hung if [khungtaskd] triggers on a livelock condition, forms a signals on the dashboards. Helper function getSubreason modified to optionally enable checking for a single quote resulting in a refactoring to ease maintenance of the termination detection in the face of single bit errors heuristics. Test: boot_reason_test.sh Bug: 63736262 Bug: 33808187 Change-Id: I7fdd1e57e7a26095738175074306f0d2d59b1d69
* | | Merge changes Ibf543273,Id56946b6 am: 7c681665f0Mark Salyzyn2018-03-202-38/+72
|\| | | | | | | | | | | | | | | | | am: f6d3c609ee Change-Id: Ifb3bc66b8776f2f4871b409f382d0f55b83180a6
| * | bootstat: allow kernel_panic,sysrq to propagate subreasonMark Salyzyn2018-03-201-35/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow for a daemon to write to last kmsg to propagate a detailed subreason to kernel_panic,sysrq actions. A minor refactor moves common code into a helper function getSubreason for retrieval and bit error correction operations. A sysrq crash generally produces a kernel-provided message: SysRq : Trigger a crash which is used to generate a canonical boot reason kernel_panic,sysrq. A user daemon could write to /dev/kmsg just prior to the sysrq with SysRq : Trigger a crash : '<subreason>' to change the canonical boot reason to kernel_panic,sysrq,<subreason>. Administration added pending kBootReasonMap entries present in TRON. Test: manual echo into /dev/kmsg and /proc/sysrq-trigger and check Test: boot_reason_test.sh Bug: 33808187 Bug: 63736262 Change-Id: Ibf5432737e5a3449ebe40a8c6cf2d3e912ed6bbc
| * | bootstat: test error out only on first bad bootloader reasonMark Salyzyn2018-03-201-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hopefully the quick property test is first, setting the stage for ignoring future failures. This solves a problem with multiple test failures directly attributed to a CTS compliance issue with the bootloader's boot reason. One test fails, the remainder get a pass on this one issue. Test: boot_reason_test.sh Bug: 63736262 Change-Id: Id56946b6f2f3a33d65bd1830543838f153290759
* | | Merge changes If35518c0,I04bede0b am: bda0a3e637Mark Salyzyn2018-03-172-3/+12
|\| | | | | | | | | | | | | | | | | am: bbdddfa030 Change-Id: I28e587ea4e0818fcdecea35f78d71c5e7b617605
| * | bootstat: add support for suppressing needle match on outputMark Salyzyn2018-03-161-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For aliasReasons allow one to optionally suppress needle for output member using a <bang> (!) character prefix. Test: boot_reason_test.sh Bug: 63736262 Bug: 74595769 Change-Id: If35518c08cf909c6c78a16275e9d8dfd0ff839a9
| * | bootstat: usb and rtc refinementMark Salyzyn2018-03-162-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For all known cases, if usb is present in the bootloader reason, then it is actually reporting a cold,charger canonical boot reason. This signifies that the device was powered down, and was woken up by the charger being connected. For all known cases, if rtc is present in the bootloader reason, then it is actually reporting a cold,rtc canonical boot reason. This signifies that the device was powered down, and was woken up by the rtc clock. Test: boot_reason_test.sh Bug: 74595769 Bug: 63736262 Change-Id: I04bede0b7ccaa1b859943f7def93521a8f7b25c6