From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3053 invoked by alias); 13 Dec 2005 20:55:06 -0000 Received: (qmail 3037 invoked by uid 22791); 13 Dec 2005 20:55:05 -0000 X-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Received: from fmr21.intel.com (HELO scsfmr001.sc.intel.com) (143.183.121.13) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 13 Dec 2005 20:55:01 +0000 Received: from scsfmr100.sc.intel.com (scsfmr100.sc.intel.com [10.3.253.9]) by scsfmr001.sc.intel.com (8.12.10/8.12.10/d: major-outer.mc,v 1.1 2004/09/17 17:50:56 root Exp $) with ESMTP id jBDKsfvf012722; Tue, 13 Dec 2005 20:54:41 GMT Received: from unix-os.sc.intel.com (unix-os.sc.intel.com [172.25.110.7]) by scsfmr100.sc.intel.com (8.12.10/8.12.10/d: major-inner.mc,v 1.2 2004/09/17 18:05:01 root Exp $) with ESMTP id jBDE5YKC008879; Tue, 13 Dec 2005 14:05:34 GMT Received: (from askeshav@localhost) by unix-os.sc.intel.com (8.11.6/8.11.2) id jBDKsel19380; Tue, 13 Dec 2005 12:54:40 -0800 Message-Id: <20051213203900.908870934@csdlinux-2.jf.intel.com> References: <20051213203547.649087523@csdlinux-2.jf.intel.com> Date: Tue, 13 Dec 2005 21:16:00 -0000 From: Anil S Keshavamurthy To: ananth@in.ibm.com, akpm@osdl.org, paulmck@us.ibm.com Cc: linux-kernel@vger.kernel.org, systemtap@sources.redhat.com, Anil S Keshavamurthy Subject: [patch 1/4] Kprobes - Enable funcions only for required arch Content-Disposition: inline; filename=cleanup_inst_slot.patch X-Scanned-By: MIMEDefang 2.52 on 10.3.253.9 X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2005-q4/txt/msg00426.txt.bz2 [PATCH] Kprobes - Enable funcions only for required arch Kernel/kprobes.c defines get_insn_slot() and free_insn_slot() which are currently required _only_ for x86_64 and powerpc (which has no-exec support). FYI, get{free}_insn_slot() functions manages the memory page which is mapped as executable, required for instruction emulation. This patch moves those two functions under __ARCH_WANT_KPROBES_INSN_SLOT and defines __ARCH_WANT_KPROBES_INSN_SLOT in arch specific kprobes.h file. Signed-off-by: Anil S Keshavamurthy ------------------------------------------------------------------ include/asm-powerpc/kprobes.h | 2 ++ include/asm-x86_64/kprobes.h | 2 ++ kernel/kprobes.c | 2 ++ 3 files changed, 6 insertions(+) Index: linux-2.6.15-rc5-mm2/include/asm-powerpc/kprobes.h =================================================================== --- linux-2.6.15-rc5-mm2.orig/include/asm-powerpc/kprobes.h +++ linux-2.6.15-rc5-mm2/include/asm-powerpc/kprobes.h @@ -29,6 +29,8 @@ #include #include +#define __ARCH_WANT_KPROBES_INSN_SLOT + struct pt_regs; typedef unsigned int kprobe_opcode_t; Index: linux-2.6.15-rc5-mm2/include/asm-x86_64/kprobes.h =================================================================== --- linux-2.6.15-rc5-mm2.orig/include/asm-x86_64/kprobes.h +++ linux-2.6.15-rc5-mm2/include/asm-x86_64/kprobes.h @@ -27,6 +27,8 @@ #include #include +#define __ARCH_WANT_KPROBES_INSN_SLOT + struct pt_regs; typedef u8 kprobe_opcode_t; Index: linux-2.6.15-rc5-mm2/kernel/kprobes.c =================================================================== --- linux-2.6.15-rc5-mm2.orig/kernel/kprobes.c +++ linux-2.6.15-rc5-mm2/kernel/kprobes.c @@ -52,6 +52,7 @@ static DEFINE_SPINLOCK(kprobe_lock); /* DEFINE_SPINLOCK(kretprobe_lock); /* Protects kretprobe_inst_table */ static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL; +#ifdef __ARCH_WANT_KPROBES_INSN_SLOT /* * kprobe->ainsn.insn points to the copy of the instruction to be * single-stepped. x86_64, POWER4 and above have no-exec support and @@ -151,6 +152,7 @@ void __kprobes free_insn_slot(kprobe_opc } } } +#endif /* We have preemption disabled.. so it is safe to use __ versions */ static inline void set_kprobe_instance(struct kprobe *kp) --