Commit c8e3fb44 authored by Maggie Chen's avatar Maggie Chen Committed by Commit Bot

Add a crash key gpu_watchdog_kill_after_power_resume for GPU watchdog V2.

Set the crash key to true in DeliberatelyTerminateToRecoverFromHang if
OnWatchdogTimeout() is called for the first time after power resume.

Bug: 949839
Change-Id: I15a734d5c8e0e641dfb3cc10c640c32edc7b0ba4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1745611Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685423}
parent ceb2cef5
...@@ -26,6 +26,8 @@ crash_reporter::CrashKeyString<20> available_physical_memory_in_mb( ...@@ -26,6 +26,8 @@ crash_reporter::CrashKeyString<20> available_physical_memory_in_mb(
"available-physical-memory-in-mb"); "available-physical-memory-in-mb");
crash_reporter::CrashKeyString<1024> current_shader_0("current-shader-0"); crash_reporter::CrashKeyString<1024> current_shader_0("current-shader-0");
crash_reporter::CrashKeyString<1024> current_shader_1("current-shader-1"); crash_reporter::CrashKeyString<1024> current_shader_1("current-shader-1");
crash_reporter::CrashKeyString<4> gpu_watchdog_kill_after_power_resume(
"gpu-watchdog-kill-after-power-resume");
} // namespace crash_keys } // namespace crash_keys
} // namespace gpu } // namespace gpu
...@@ -31,6 +31,8 @@ extern GPU_EXPORT crash_reporter::CrashKeyString<20> ...@@ -31,6 +31,8 @@ extern GPU_EXPORT crash_reporter::CrashKeyString<20>
available_physical_memory_in_mb; available_physical_memory_in_mb;
extern GPU_EXPORT crash_reporter::CrashKeyString<1024> current_shader_0; extern GPU_EXPORT crash_reporter::CrashKeyString<1024> current_shader_0;
extern GPU_EXPORT crash_reporter::CrashKeyString<1024> current_shader_1; extern GPU_EXPORT crash_reporter::CrashKeyString<1024> current_shader_1;
extern GPU_EXPORT crash_reporter::CrashKeyString<4>
gpu_watchdog_kill_after_power_resume;
} // namespace crash_keys } // namespace crash_keys
} // namespace gpu } // namespace gpu
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "gpu/config/gpu_crash_keys.h"
namespace gpu { namespace gpu {
...@@ -130,6 +131,7 @@ void GpuWatchdogThreadImplV2::OnResume() { ...@@ -130,6 +131,7 @@ void GpuWatchdogThreadImplV2::OnResume() {
in_power_suspension_ = false; in_power_suspension_ = false;
RestartWatchdogTimeoutTask(); RestartWatchdogTimeoutTask();
resume_timeticks_ = base::TimeTicks::Now(); resume_timeticks_ = base::TimeTicks::Now();
is_first_timeout_after_power_resume = true;
} }
// Running on the watchdog thread. // Running on the watchdog thread.
...@@ -162,6 +164,8 @@ void GpuWatchdogThreadImplV2::RestartWatchdogTimeoutTask() { ...@@ -162,6 +164,8 @@ void GpuWatchdogThreadImplV2::RestartWatchdogTimeoutTask() {
FROM_HERE, FROM_HERE,
base::BindOnce(&GpuWatchdogThreadImplV2::OnWatchdogTimeout, weak_ptr_), base::BindOnce(&GpuWatchdogThreadImplV2::OnWatchdogTimeout, weak_ptr_),
watchdog_timeout_ * kRestartFactor); watchdog_timeout_ * kRestartFactor);
last_on_watchdog_timeout_timeticks_ = base::TimeTicks::Now();
last_on_watchdog_timeout_time_ = base::Time::Now();
} }
} }
...@@ -202,6 +206,8 @@ void GpuWatchdogThreadImplV2::OnWatchdogTimeout() { ...@@ -202,6 +206,8 @@ void GpuWatchdogThreadImplV2::OnWatchdogTimeout() {
if (disarmed || gpu_makes_progress) { if (disarmed || gpu_makes_progress) {
last_on_watchdog_timeout_timeticks_ = base::TimeTicks::Now(); last_on_watchdog_timeout_timeticks_ = base::TimeTicks::Now();
last_on_watchdog_timeout_time_ = base::Time::Now(); last_on_watchdog_timeout_time_ = base::Time::Now();
is_first_timeout_after_power_resume = false;
task_runner()->PostDelayedTask( task_runner()->PostDelayedTask(
FROM_HERE, FROM_HERE,
base::BindOnce(&GpuWatchdogThreadImplV2::OnWatchdogTimeout, weak_ptr_), base::BindOnce(&GpuWatchdogThreadImplV2::OnWatchdogTimeout, weak_ptr_),
...@@ -253,6 +259,9 @@ void GpuWatchdogThreadImplV2::DeliberatelyTerminateToRecoverFromHang() { ...@@ -253,6 +259,9 @@ void GpuWatchdogThreadImplV2::DeliberatelyTerminateToRecoverFromHang() {
GpuWatchdogHistogram(GpuWatchdogThreadEvent::kGpuWatchdogKill); GpuWatchdogHistogram(GpuWatchdogThreadEvent::kGpuWatchdogKill);
crash_keys::gpu_watchdog_kill_after_power_resume.Set(
is_first_timeout_after_power_resume ? "1" : "0");
// Deliberately crash the process to create a crash dump. // Deliberately crash the process to create a crash dump.
*((volatile int*)0) = 0xdeadface; *((volatile int*)0) = 0xdeadface;
} }
......
...@@ -91,6 +91,9 @@ class GPU_IPC_SERVICE_EXPORT GpuWatchdogThreadImplV2 ...@@ -91,6 +91,9 @@ class GPU_IPC_SERVICE_EXPORT GpuWatchdogThreadImplV2
// The system has entered the power suspension mode. // The system has entered the power suspension mode.
bool in_power_suspension_ = false; bool in_power_suspension_ = false;
// OnWatchdogTimeout() is called for the first time after power resume.
bool is_first_timeout_after_power_resume = false;
// Chrome is running on the background on Android. Gpu is probably very slow // Chrome is running on the background on Android. Gpu is probably very slow
// or stalled. // or stalled.
bool is_backgrounded_ = false; bool is_backgrounded_ = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment