strace/linux/powerpc
Denys Vlasenko 3af224c5cd Use process_vm_readv instead of PTRACE_PEEKDATA to read data blocks
Currently, we use PTRACE_PEEKDATA to read things like filenames and
data passed by I/O syscalls.
PTRACE_PEEKDATA gets one word per syscall. This is VERY expensive.
For example, in order to print fstat syscall, we need to perform
more than twenty trips into kernel to fetch one struct stat!

Kernel 3.2 got a new syscall, process_vm_readv(), which can be used to
copy data blocks out of process' address space.

This change uses it in umoven() and umovestr() functions if possible,
with fallback to old method if process_vm_readv() fails.
If it returns ENOSYS, we don't try to use it anymore, eliminating
overhead of trying it on older kernels.

Result of "time strace -oLOG ls -l /usr/lib >/dev/null":
before patch: 0.372s
After patch:  0.262s

* util.c (process_vm_readv): Wrapper to call process_vm_readv syscall.
(umoven): Use process_vm_readv for block reads of tracee memory.
(umovestr): Likewise.
* linux/syscall.h: Declare new function sys_process_vm_readv.
* process.c (sys_process_vm_readv): Decoder for new syscall.
* linux/i386/syscallent.h: Add process_vm_readv, process_vm_writev syscalls.
* linux/x86_64/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-28 01:46:33 +01:00
..
errnoent1.h Add biarch support for powerpc64 2010-07-13 19:13:03 +02:00
ioctlent1.h linux/ioctlent: unify them all 2011-03-14 15:32:38 +00:00
ioctlent.h.in linux/ioctlent: unify them all 2011-03-14 15:32:38 +00:00
signalent1.h Add biarch support for powerpc64 2010-07-13 19:13:03 +02:00
syscallent1.h Add biarch support for powerpc64 2010-07-13 19:13:03 +02:00
syscallent.h Use process_vm_readv instead of PTRACE_PEEKDATA to read data blocks 2012-01-28 01:46:33 +01:00