This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
x86_64 kprobes wart removal
- From: Jim Keniston <jkenisto at us dot ibm dot com>
- To: SystemTAP <systemtap at sources dot redhat dot com>
- Date: 07 Apr 2005 15:01:36 -0700
- Subject: x86_64 kprobes wart removal
- Organization:
This email is for x86_64 kprobes wonks. Remember get_insn_slot() and
free_insn_slot()? These functions are a constant headache because they
can sleep. That's because get_insn_slot() occasionally has to allocate
a readable, writable, executable page to hold the instruction-copy for a
new kprobe. That's because x86_64 won't single-step (or otherwise
execute) an instruction on a page that isn't mapped executable.
I propose the following alternative:
- Allocate one executable page at the beginning of time. [See note 1.]
- Store the instruction copy in the kprobe object, as in other
arhcitectures.
- When it comes time to single-step an instruction, just copy the
instruction from the kprobe object to the executable page.
- In resume_execution, adjust copy_rip accordingly.
Note 1: If we go to per-CPU locking, we may need to allocate enough
space for NR_CPUS instructions. Also, we still want to use Roland's
trick of allocating the memory close to where the modules live.
I don't have a patch yet, but does that sound like the right approach?
I wish I'd thought of this a year ago. :-}
Jim