summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/gpuservice/gpumem/GpuMem.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/services/gpuservice/gpumem/GpuMem.cpp b/services/gpuservice/gpumem/GpuMem.cpp
index c78322e979..3aa862f31f 100644
--- a/services/gpuservice/gpumem/GpuMem.cpp
+++ b/services/gpuservice/gpumem/GpuMem.cpp
@@ -43,18 +43,21 @@ void GpuMem::initialize() {
// Make sure bpf programs are loaded
bpf::waitForProgsLoaded();
- int fd = bpf::bpfFdGet(kGpuMemTotalProgPath, BPF_F_RDONLY);
+ errno = 0;
+ int fd = bpf::retrieveProgram(kGpuMemTotalProgPath);
if (fd < 0) {
- ALOGE("Failed to retrieve pinned program from %s", kGpuMemTotalProgPath);
+ ALOGE("Failed to retrieve pinned program from %s [%d(%s)]", kGpuMemTotalProgPath, errno,
+ strerror(errno));
return;
}
// Attach the program to the tracepoint, and the tracepoint is automatically enabled here.
+ errno = 0;
int count = 0;
while (bpf_attach_tracepoint(fd, kGpuMemTraceGroup, kGpuMemTotalTracepoint) < 0) {
if (++count > kGpuWaitTimeout) {
- ALOGE("Failed to attach bpf program to %s/%s tracepoint", kGpuMemTraceGroup,
- kGpuMemTotalTracepoint);
+ ALOGE("Failed to attach bpf program to %s/%s tracepoint [%d(%s)]", kGpuMemTraceGroup,
+ kGpuMemTotalTracepoint, errno, strerror(errno));
return;
}
// Retry until GPU driver loaded or timeout.
@@ -62,9 +65,11 @@ void GpuMem::initialize() {
}
// Use the read-only wrapper BpfMapRO to properly retrieve the read-only map.
+ errno = 0;
auto map = bpf::BpfMapRO<uint64_t, uint64_t>(kGpuMemTotalMapPath);
if (!map.isValid()) {
- ALOGE("Failed to create bpf map from %s", kGpuMemTotalMapPath);
+ ALOGE("Failed to create bpf map from %s [%d(%s)]", kGpuMemTotalMapPath, errno,
+ strerror(errno));
return;
}
setGpuMemTotalMap(map);