Commit 7fdea0d7 authored by dongseong.hwang's avatar dongseong.hwang Committed by Commit bot

ozone: drm: Add fd number to crash keys when dmabuf mmap fails.

When native GPU memory buffers were enabled we noticed many crashes
reporting mmap failing.

This CL adds fd number to crash report when dmabuf mmap fails, because we think
fd limit may cause this crash.
It's follow-up CL of https://codereview.chromium.org/2710183005/

BUG=629521

Review-Url: https://codereview.chromium.org/2725813005
Cr-Commit-Position: refs/heads/master@{#456154}
parent 31ec6380
...@@ -159,6 +159,7 @@ size_t RegisterChromeCrashKeys() { ...@@ -159,6 +159,7 @@ size_t RegisterChromeCrashKeys() {
{"mmap_params", kSmallSize}, {"mmap_params", kSmallSize},
{"buffer_size", kSmallSize}, {"buffer_size", kSmallSize},
{"errno", kSmallSize}, {"errno", kSmallSize},
{"number_of_fds", kSmallSize},
#endif #endif
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
{mac::kFirstNSException, kMediumSize}, {mac::kFirstNSException, kMediumSize},
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/debug/crash_logging.h" #include "base/debug/crash_logging.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/process/memory.h" #include "base/process/memory.h"
#include "base/process/process_metrics.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
...@@ -91,10 +92,20 @@ ClientNativePixmapDmaBuf::ClientNativePixmapDmaBuf( ...@@ -91,10 +92,20 @@ ClientNativePixmapDmaBuf::ClientNativePixmapDmaBuf(
"(addr=nullptr, length=%zu, prot=(PROT_READ | PROT_WRITE), " "(addr=nullptr, length=%zu, prot=(PROT_READ | PROT_WRITE), "
"flags=MAP_SHARED, fd=%d[valid=%d], offset=0)", "flags=MAP_SHARED, fd=%d[valid=%d], offset=0)",
map_size, dmabuf_fd_.get(), fd_valid); map_size, dmabuf_fd_.get(), fd_valid);
std::string errno_str = logging::SystemErrorCodeToString(mmap_error);
std::unique_ptr<base::ProcessMetrics> process_metrics(
base::ProcessMetrics::CreateCurrentProcessMetrics());
std::string number_of_fds =
base::StringPrintf("%d", process_metrics->GetOpenFdCount());
base::debug::ScopedCrashKey params_crash_key("mmap_params", mmap_params); base::debug::ScopedCrashKey params_crash_key("mmap_params", mmap_params);
base::debug::ScopedCrashKey size_crash_key("buffer_size", size.ToString()); base::debug::ScopedCrashKey size_crash_key("buffer_size", size.ToString());
base::debug::ScopedCrashKey errno_crash_key( base::debug::ScopedCrashKey errno_crash_key("errno", errno_str);
"errno", logging::SystemErrorCodeToString(mmap_error)); base::debug::ScopedCrashKey number_of_fds_crash_key("number_of_fds",
number_of_fds);
LOG(ERROR) << "Failed to mmap dmabuf; mmap_params: " << mmap_params
<< ", buffer_size: (" << size.ToString()
<< "), errno: " << errno_str
<< " , number_of_fds: " << number_of_fds;
if (mmap_error == ENOMEM) if (mmap_error == ENOMEM)
base::TerminateBecauseOutOfMemory(map_size); base::TerminateBecauseOutOfMemory(map_size);
CHECK(false) << "Failed to mmap dmabuf."; CHECK(false) << "Failed to mmap dmabuf.";
......
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