The vendor partition does not give dmabuf_dump enough permissions to
retrieve shared buffer information for all processes. Move it to product
partition where it can be invoked from platform's dumpstate.
Bug: 63860998
Change-Id: I73957f59943d1e49fcb59abb723aad4eeeaa4172
Signed-off-by: Erick Reyes <erickreyes@google.com>
Fixes:
system/core/libmeminfo/libdmabufinfo/tools/dmabuf_dump.cpp:109:39: error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
Test: lunch aosp_arm-eng && m dmabuf_dump
Change-Id: Ie605d9b94f5eff888f6a64801512216253a6babb
dmabuf_dump had a hard dependency on debugfs to gather the initial list
of buffers for all proceses, make it optional.
Change-Id: I1d271297c0ad6124b321a1ee8aa01d3e88ca9fed
Signed-off-by: Erick Reyes <erickreyes@google.com>
Removed dependency on libc++fs and changed liblog to shared linkage to
cope with build errors derived from the change.
Removed dmabuf_dump unnecessary dependencies and made it soc_specific.
Removed reference to std::filesystem::is_symlink to workaround the
following error when linking with the library:
ld.lld: error: undefined symbol:
std::__1::__fs::filesystem::__symlink_status(std::__1::__fs::filesystem::path
const&, std::__1::error_code*)
>>> referenced by filesystem:1743
(external/libcxx/include/filesystem:1743)
>>>
dmabufinfo.o:(android::dmabufinfo::AppendDmaBufInfo(int,
std::__1::vector<android::dmabufinfo::DmaBuffer,
std::__1::allocator<android::dmabufinfo::DmaBuffer> >*)) in archive
Bug: 63860998
Change-Id: Ieafdc87c64f153625df9e21fc8299292b2447aef
Signed-off-by: Erick Reyes <erickreyes@google.com>
Adding tool to dump the dmabuf information using the dmabufinfo library.
Test: run "dmabuf_dump" and "dmabuf_dump <pid>" on crosshatch
Bug: 63860998
Change-Id: I16fe0a701deb5086ca0e1a8ceecb70dbc17934e6
Signed-off-by: Erick Reyes <erickreyes@google.com>
The number of references to a buffer total_refs was not accounting for
a process holding multiple references to the same buffer.
Also, clarify AppendDmaBufInfo functionality in comments
Change-Id: I044a18acad1570492a925d51b9464d5b0e60ca35
Signed-off-by: Erick Reyes <erickreyes@google.com>
Add some test to verify the refcount and fd reference is correct when
the dma_buf is shared between processes.
Bug; 63860998
Test: libdmabufinfo_test
Change-Id: Id22e68e7a65820f19847b2faab11c78e6d942d92
Change the dmabufinfo library to handle multiple references to the same
buffer across PIDs by doing these changes:
- Add function AppendDmaBufInfo: appends the information for a specific
PID to an existing DmaBuffer vector
- Change the way fd/map references to a buffer belonging to a PID are
stored in DmaBuffer from vector<pid_t> to unorderedmap<pid_t, int>
- When parsing proc/%pid/{maps|fds}, look up the buffer by inode and
update the data if found
Test: builds
Bug: 63860998
Change-Id: If22feea772f182086ae3446b46d626a750674b1f
Signed-off-by: Erick Reyes <erickreyes@google.com>
This is the userspace component for the improved shared memory buffer
tracking.
A new static library called libdmabufinfo will provide APIs to parse dmabuf
debugfs entries. The library can also map and read the file descriptors
per process to cross-reference the global data per process.
This change only adds a global API to read dmabuf stats from debugfs.
Bug: 63860998
Test: dmabufinfo_test
Change-Id: Ib0deedc73337a70875e03e07d3e9a692c4c33e63
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Erick Reyes <erickreyes@google.com>
Signed-off-by: Sandeep Patil <sspatil@google.com>