Re: [PATCH] tools/perf: Use long-running addr2line per dso
From: Tony Garnock-Jones <hidden>
Date: 2021-09-10 08:54:31
Hi Alex, Thanks for taking a look at the patch! On 9/9/21 6:52 PM, Alex Xu (Hello71) wrote:
This patch seems awfully complicated, especially considering it still uses relatively slow stdio instead of direct library calls.
It is comparable in speed to the libbfd variant, apparently: in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911815#38, Steinar Gunderson reports that the bfd and patched non-bfd versions have similar run-times. The complication is a bit of a shame, but I think it's reasonable given that it is essentially reimplementing a variant of popen(3) with bidirectional communication.
Did you look into calling elfutils instead of libbfd if the latter is not available?
No, I didn't; I don't know the domain very well, so I adapted the existing solution to run more efficiently.
On the patch specifically, why was popen changed to socketpair? It looks like it adds significant complexity, and the advanced features of socketpair are not being used (SOCK_DGRAM/SOCK_SEQPACKET, SCM_RIGHTS).
Because popen is unidirectional, and with a long-running process we need bidirectional communication. I could have used two pipes, but I figured socketpair was just sitting there and why spend the extra two fds if I didn't have to? Regards, Tony