dump mm_event trace into bugreport

This patch creates a pixel owned tracing instance apart from
main tracer(i.e., /d/tracing/instances/pixel-trace) so that
we will keep a certain mount of data without interference from
others(e.g., traceur, atrace and so on). It's important to not
lose the information to investigate problems at bugreport.

This CL also adds dumpstatez and bugreport property hooks to
stop/restart the trace during bugreport to keep more old trace.

Allow dumpstate read mm_event trace from /d/tracing/instances/
pixel-trace/trace. With that, it could dump the trace into
bugreport file.

Bug: 116825025
Test: confirm with adb bugreport/bugreport via power menu shortcut/
volume up/down/power key combination. They includes traces in
dumpstate_board.txt with kernel turns on CONFIG_MM_EVENT_STAT.
Signed-off-by: Minchan Kim <minchan@google.com>

Change-Id: I699f362089b61247b2937accbd331327563b1e0c
This commit is contained in:
Minchan Kim
2018-10-01 10:12:42 +09:00
parent dd7fd6d35a
commit e11ea911bc
4 changed files with 30 additions and 0 deletions

View File

@@ -264,6 +264,8 @@ Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports");
DumpTouch(fd);
RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"});
DumpFileToFd(fd, "Pixel trace", "/d/tracing/instances/pixel-trace/trace");
// Timeout after 3s
RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "/vendor/bin/timeout 3 cat /d/tzdbg/qsee_log"});
RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in /sys/class/power_supply/*/uevent ; do echo \"\n------ $f\" ; cat $f ; done"});

View File

@@ -858,3 +858,24 @@ on property:sys.retaildemo.enabled=1
setprop persist.vendor.charge.stop.level 35
setprop persist.vendor.charge.start.level 30
on property:sys.boot_completed=1
# Create pixel-trace.
# At this moment, only mm_event is available. If others want to put more,
# it should get hard review from pixel-perf-team.
mkdir /sys/kernel/debug/tracing/instances/pixel-trace 600
write /sys/kernel/debug/tracing/instances/pixel-trace/buffer_size_kb 64
write /sys/kernel/debug/tracing/instances/pixel-trace/events/mm_event/enable 1
# turns off tracing right before bugreporting to keep more traces
on property:init.svc.dumpstatez=running
write /d/tracing/instances/pixel-trace/tracing_on 0
on property:init.svc.dumpstatez=stopped
write /d/tracing/instances/pixel-trace/tracing_on 1
on property:init.svc.bugreport=running
write /d/tracing/instances/pixel-trace/tracing_on 0
on property:init.svc.bugreport=stopped
write /d/tracing/instances/pixel-trace/tracing_on 1

View File

@@ -8,6 +8,10 @@ init_daemon_domain(hal_dumpstate_impl)
allow hal_dumpstate_impl vendor_shell_exec:file rx_file_perms;
allow hal_dumpstate_impl vendor_toolbox_exec:file rx_file_perms;
# Allow to read pixel-trace trace file
allow hal_dumpstate_impl debugfs_tracing_instances:dir search;
allow hal_dumpstate_impl debugfs_tracing_instances:file r_file_perms;
userdebug_or_eng(`
# smlog_dump
domain_auto_trans(hal_dumpstate_impl, smlog_dump_exec, smlog_dump)

View File

@@ -30,3 +30,6 @@ set_prop(vendor_init, vendor_charge_prop)
dontaudit vendor_init unlabeled:dir getattr;
dontaudit vendor_init unlabeled:file getattr;
allow vendor_init debugfs_tracing_instances:dir create_dir_perms;
allow vendor_init debugfs_tracing_instances:file w_file_perms;