Re: [RFC] [PATCH 3/7] Execution out of line (XOL)

2010-01-15 Thread Srikar Dronamraju
* Peter Zijlstra pet...@infradead.org [2010-01-15 10:07:35]:

 On Thu, 2010-01-14 at 14:43 -0800, Jim Keniston wrote:
  
  Yeah, there's not a lot of context there.  I hope it will make more
  sense if you read section 1.1 of Documentation/uprobes.txt (patch #6).
  Or look at get_insn_slot() in kprobes, and understand that we're trying
  to do something similar in uprobes, where the instruction copies have to
  reside in the user address space of the probed process.
 
 That's not the point, changelogs shoulnd not be this cryptic. They
 should be stand alone and descriptive of what, why and how.
 
 If you can't be bothered writing such for something you want reviewed
 for inclusion then I might not be bothered looking at them at all.
 

Okay shall add to the Changelog with the information providing the
context for this patch.



Re: [RFC] [PATCH 3/7] Execution out of line (XOL)

2010-01-15 Thread Jim Keniston

On Fri, 2010-01-15 at 10:07 +0100, Peter Zijlstra wrote:
 On Thu, 2010-01-14 at 14:43 -0800, Jim Keniston wrote:
  
  Yeah, there's not a lot of context there.  I hope it will make more
  sense if you read section 1.1 of Documentation/uprobes.txt (patch #6).
  Or look at get_insn_slot() in kprobes, and understand that we're trying
  to do something similar in uprobes, where the instruction copies have to
  reside in the user address space of the probed process.
 
 That's not the point, changelogs shoulnd not be this cryptic. They
 should be stand alone and descriptive of what, why and how.

Point taken.

 
 If you can't be bothered writing such for something you want reviewed
 for inclusion then I might not be bothered looking at them at all.
 

We appreciate your persistence wrt this patch set. :-}

Jim



Re: [RFC] [PATCH 3/7] Execution out of line (XOL)

2010-01-14 Thread Peter Zijlstra
On Mon, 2010-01-11 at 17:55 +0530, Srikar Dronamraju wrote:
 Execution out of line (XOL)
 
 Slot allocation mechanism for Execution Out of Line strategy in User
 space breakpointing Inftrastructure. (XOL)
 
 This patch provides slot allocation mechanism for execution out of
 line strategy for use with user space breakpoint infrastructure.
 This patch requires utrace support in kernel.
 
 This patch provides five functions xol_get_insn_slot(),
 xol_free_insn_slot(), xol_put_area(), xol_get_area() and
 xol_validate_vaddr().
 
 Current slot allocation mechanism:
 1. Allocate one dedicated slot per user breakpoint.
 2. If the allocated vma is completely used, expand current vma.
 3. If we cant expand the vma, allocate a new vma.


Say what?

I see the text, but non of it makes any sense at all.



Re: [RFC] [PATCH 3/7] Execution out of line (XOL)

2010-01-14 Thread Jim Keniston

On Thu, 2010-01-14 at 12:08 +0100, Peter Zijlstra wrote:
 On Mon, 2010-01-11 at 17:55 +0530, Srikar Dronamraju wrote:
  Execution out of line (XOL)
  
  Slot allocation mechanism for Execution Out of Line strategy in User
  space breakpointing Inftrastructure. (XOL)
  
  This patch provides slot allocation mechanism for execution out of
  line strategy for use with user space breakpoint infrastructure.
  This patch requires utrace support in kernel.
  
  This patch provides five functions xol_get_insn_slot(),
  xol_free_insn_slot(), xol_put_area(), xol_get_area() and
  xol_validate_vaddr().
  
  Current slot allocation mechanism:
  1. Allocate one dedicated slot per user breakpoint.
  2. If the allocated vma is completely used, expand current vma.
  3. If we cant expand the vma, allocate a new vma.
 
 
 Say what?
 
 I see the text, but non of it makes any sense at all.
 

Yeah, there's not a lot of context there.  I hope it will make more
sense if you read section 1.1 of Documentation/uprobes.txt (patch #6).
Or look at get_insn_slot() in kprobes, and understand that we're trying
to do something similar in uprobes, where the instruction copies have to
reside in the user address space of the probed process.

Jim



[RFC] [PATCH 3/7] Execution out of line (XOL)

2010-01-11 Thread Srikar Dronamraju
Execution out of line (XOL)

Slot allocation mechanism for Execution Out of Line strategy in User
space breakpointing Inftrastructure. (XOL)

This patch provides slot allocation mechanism for execution out of
line strategy for use with user space breakpoint infrastructure.
This patch requires utrace support in kernel.

This patch provides five functions xol_get_insn_slot(),
xol_free_insn_slot(), xol_put_area(), xol_get_area() and
xol_validate_vaddr().

Current slot allocation mechanism:
1. Allocate one dedicated slot per user breakpoint.
2. If the allocated vma is completely used, expand current vma.
3. If we cant expand the vma, allocate a new vma.

Signed-off-by: Jim Keniston jkeni...@us.ibm.com
Signed-off-by: Srikar Dronamraju sri...@linux.vnet.ibm.com
---
 arch/Kconfig|4 
 include/linux/ubp_xol.h |   56 
 kernel/Makefile |1 
 kernel/ubp_xol.c|  644 
 4 files changed, 705 insertions(+)

Index: new_uprobes.git/arch/Kconfig
===
--- new_uprobes.git.orig/arch/Kconfig
+++ new_uprobes.git/arch/Kconfig
@@ -102,6 +102,10 @@ config USER_RETURN_NOTIFIER
 config HAVE_UBP
def_bool n
 
+config UBP_XOL
+   def_bool y
+   depends on UBP  UTRACE
+
 config HAVE_IOREMAP_PROT
bool
 
Index: new_uprobes.git/include/linux/ubp_xol.h
===
--- /dev/null
+++ new_uprobes.git/include/linux/ubp_xol.h
@@ -0,0 +1,56 @@
+#ifndef _LINUX_XOL_H
+#define _LINUX_XOL_H
+/*
+ * User-space BreakPoint support (ubp) -- Allocation of instruction
+ * slots for execution out of line (XOL)
+ * include/linux/ubp_xol.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) IBM Corporation, 2009
+ */
+
+
+#if defined(CONFIG_UBP_XOL)
+extern unsigned long xol_get_insn_slot(struct ubp_bkpt *ubp, void *xol_area);
+extern void xol_free_insn_slot(unsigned long, void *xol_area);
+extern int xol_validate_vaddr(struct pid *pid, unsigned long vaddr,
+   void *xol_area);
+extern void *xol_get_area(struct pid *pid);
+extern void xol_put_area(void *xol_area);
+#else /* CONFIG_UBP_XOL */
+static inline unsigned long xol_get_insn_slot(struct ubp_bkpt *ubp,
+   void *xol_area)
+{
+   return 0;
+}
+static inline void xol_free_insn_slot(unsigned long slot_addr, void *xol_area)
+{
+}
+static inline int xol_validate_vaddr(struct pid *pid, unsigned long vaddr,
+   void *xol_area)
+{
+   return -ENOSYS;
+}
+static inline void *xol_get_area(struct pid *pid)
+{
+   return NULL;
+}
+static inline void xol_put_area(void *xol_area)
+{
+}
+#endif /* CONFIG_UBP_XOL */
+
+#endif  /* _LINUX_XOL_H */
Index: new_uprobes.git/kernel/Makefile
===
--- new_uprobes.git.orig/kernel/Makefile
+++ new_uprobes.git/kernel/Makefile
@@ -103,6 +103,7 @@ obj-$(CONFIG_PERF_EVENTS) += perf_event.
 obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
 obj-$(CONFIG_USER_RETURN_NOTIFIER) += user-return-notifier.o
 obj-$(CONFIG_UBP) += ubp_core.o
+obj-$(CONFIG_UBP_XOL) += ubp_xol.o
 
 ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
 # According to Alan Modra a...@linuxcare.com.au, the -fno-omit-frame-pointer 
is
Index: new_uprobes.git/kernel/ubp_xol.c
===
--- /dev/null
+++ new_uprobes.git/kernel/ubp_xol.c
@@ -0,0 +1,644 @@
+/*
+ * User-space BreakPoint support (ubp) -- Allocation of instruction
+ * slots for execution out of line (XOL)
+ * kernel/ubp_xol.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a