Commit 3c229a60 authored by Kimiyuki Onaka's avatar Kimiyuki Onaka Committed by Commit Bot

Add DumpKernelCrash interface

This interface receives the content of /sys/fs/pstore/dmesg-ramoops-0 for crash reporting of kernel crashes of ARCVM.
The CL to send the ramoops file is ag/12946959.

Bug: 139650101
Test: tast run arc.KernelCrash.\*
Change-Id: Ie38d4054f5a4c4d0cb4d45e53d825bb1be21dbf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505708Reviewed-by: default avatarRyo Hashimoto <hashimoto@chromium.org>
Reviewed-by: default avatarMiriam Zimmerman <mutexlox@chromium.org>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kimiyuki Onaka <kimiyuki@google.com>
Cr-Commit-Position: refs/heads/master@{#828628}
parent e4ff017e
......@@ -71,6 +71,15 @@ void RunNativeCrashReporter(const std::string& exec_name,
LOG(ERROR) << "Failed to run crash_reporter";
}
// Runs crash_reporter to save the kernel crash info.
void RunKernelCrashReporter(base::ScopedFD ramoops_fd,
std::vector<std::string> args) {
args.push_back("--arc_kernel");
if (!RunCrashReporter(args, ramoops_fd.get()))
LOG(ERROR) << "Failed to run crash_reporter";
}
} // namespace
namespace arc {
......@@ -135,6 +144,16 @@ void ArcCrashCollectorBridge::DumpNativeCrash(const std::string& exec_name,
CreateCrashReporterArgs()));
}
void ArcCrashCollectorBridge::DumpKernelCrash(
mojo::ScopedHandle ramoops_handle) {
base::ThreadPool::PostTask(
FROM_HERE, {base::WithBaseSyncPrimitives()},
base::BindOnce(
&RunKernelCrashReporter,
mojo::UnwrapPlatformHandle(std::move(ramoops_handle)).TakeFD(),
CreateCrashReporterArgs()));
}
void ArcCrashCollectorBridge::SetBuildProperties(
const std::string& device,
const std::string& board,
......
......@@ -43,6 +43,7 @@ class ArcCrashCollectorBridge
int32_t pid,
int64_t timestamp,
mojo::ScopedHandle minidump_fd) override;
void DumpKernelCrash(mojo::ScopedHandle ramoops_handle) override;
void SetBuildProperties(
const std::string& device,
const std::string& board,
......
......@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Next MinVersion: 5
// Next MinVersion: 6
module arc.mojom;
// Next Method ID: 3
// Next Method ID: 4
interface CrashCollectorHost {
// Sends a dump for a non-native crash of the given |type|. The host reads
// the dump from |pipe|, or rejects the dump by closing |pipe|. Note that
......@@ -25,6 +25,9 @@ interface CrashCollectorHost {
int32 pid,
int64 timestamp,
handle minidump_fd);
// Sends a dump for a kernel crash.
[MinVersion=5] DumpKernelCrash@3(handle ramoops_handle);
};
// Next Method ID: 2
......
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