Commit graph

11 commits

Author SHA1 Message Date
Erick Reyes
9bb8e0d704 libmeminfo: change dmabuf_dump from soc_specific to product_specific
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>
2019-02-11 19:16:58 -08:00
Treehugger Robot
38c143e8c0 Merge "meminfo: make dmabuf_dump dependency on debugfs optional" 2019-02-10 14:55:19 +00:00
Treehugger Robot
2d31b4b023 Merge "libmeminfo: make libdmabufinfo and dmabuf_dump vendor available" 2019-02-10 14:54:53 +00:00
Colin Cross
0a92453a14 Fix 32-bit dmabuf_dump build
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
2019-02-07 21:35:03 -08:00
Erick Reyes
c4cac8f17f meminfo: make dmabuf_dump dependency on debugfs optional
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>
2019-02-06 18:47:38 -08:00
Erick Reyes
2f6792e286 libmeminfo: make libdmabufinfo and dmabuf_dump vendor available
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>
2019-02-06 18:47:31 -08:00
Erick Reyes
fd79d4305a meminfo: add tools/dmabufinfo_dump to dmabufinfo
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>
2019-02-06 15:26:05 -08:00
Erick Reyes
e3518d41d8 meminfo: Fix dmabufinfo total ref accounting
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>
2019-02-06 15:26:05 -08:00
Chenbo Feng
d45427725f Add more tests to libdmabufinfo
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
2019-02-01 03:50:13 +00:00
Erick Reyes
302a259fa9 meminfo: handle multiple buffer references in dmabufinfo
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>
2019-01-29 17:52:34 -08:00
Erick Reyes
d2918fe218 meminfo: Add memtrack dmabufinfo library
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>
2019-01-28 14:16:23 -08:00