Re: [PATCH] 2-ptrace_multi

From: Renzo Davoli
Date: Fri May 19 2006 - 05:07:06 EST


On Thu, May 18, 2006 at 07:23:13PM -0700, Ulrich Drepper wrote:
> On 5/18/06, Renzo Davoli <renzo@xxxxxxxxxxx> wrote:
> >e.g. To virtualize a write you'd have to call PTRACE_PEEKDATA for each
> >word of the buffer, very many hundreds cycles lost.
>
> No, this is not how programs should do it. Just open /proc/PID/mem
> and use pread() with an offset corresponding to the address. Now,
> repeat your timings using this technique.

That would be faster to access the memory but:
- the manager has to keep one open file per controlled process
- when the Virtual Machine manager has to access the ptraced memory and
access its registers and finally restart the process, needs three system
calls instead of just one. (one pread/pwrite to /proc/PID/mem + at least one
ptrace PEEK/POKEUSR and a ptrace SYSCALL or SYSVM).
For a Virtual Machine manager three syscalls instead of one makes the
difference. The gap will be not so large with respect to the figures
of my previous message but there will be for sure.
- the read/write of several words of memory using ptrace do exist
implemented in an horribly tricky way for sparc/sparc64 (addr2 is taken
out from a register as an extra argument which is not part of ptrace
definition, see arch/sparc/kernel/ptrace.c). Our proposal gives also a
clean and efficient and general interface for the same feature.

renzo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/