From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21863 invoked by alias); 8 May 2010 15:36:10 -0000 Received: (qmail 21854 invoked by uid 22791); 8 May 2010 15:36:10 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_GF,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 08 May 2010 15:36:05 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o48Fa3i7015192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 8 May 2010 11:36:04 -0400 Received: from [10.11.8.134] (vpn-8-134.rdu.redhat.com [10.11.8.134]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o48Fa1Ma004606; Sat, 8 May 2010 11:36:01 -0400 Message-ID: <4BE585D1.50101@redhat.com> Date: Mon, 10 May 2010 17:06:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 To: Ingo Molnar CC: Masami Hiramatsu , lkml , systemtap , DLE , Ananth N Mavinakayanahalli , Tony Luck Subject: Re: [PATCH -tip 1/2] [RESEND] kprobes: Move enable/disable_kprobe() out from debugfs code References: <20100427223312.2322.60512.stgit@localhost6.localdomain6> In-Reply-To: <20100427223312.2322.60512.stgit@localhost6.localdomain6> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2010-q2/txt/msg00289.txt.bz2 Masami Hiramatsu wrote: > Move enable/disable_kprobe() API out from debugfs related code, > because these interfaces are not related to debugfs interface. Hi Ingo, Could you also merge this fix too? This fixes a compiler warning when CONFIG_KPROBES && !CONFIG_DEBUG_FS. Thank you, > > Signed-off-by: Masami Hiramatsu > Acked-by: Ananth N Mavinakayanahalli > Acked-by: Tony Luck > Cc: Ingo Molnar > --- > > kernel/kprobes.c | 132 +++++++++++++++++++++++++++--------------------------- > 1 files changed, 66 insertions(+), 66 deletions(-) > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index 0ed46f3..282035f 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -1588,6 +1588,72 @@ static void __kprobes kill_kprobe(struct kprobe *p) > arch_remove_kprobe(p); > } > > +/* Disable one kprobe */ > +int __kprobes disable_kprobe(struct kprobe *kp) > +{ > + int ret = 0; > + struct kprobe *p; > + > + mutex_lock(&kprobe_mutex); > + > + /* Check whether specified probe is valid. */ > + p = __get_valid_kprobe(kp); > + if (unlikely(p == NULL)) { > + ret = -EINVAL; > + goto out; > + } > + > + /* If the probe is already disabled (or gone), just return */ > + if (kprobe_disabled(kp)) > + goto out; > + > + kp->flags |= KPROBE_FLAG_DISABLED; > + if (p != kp) > + /* When kp != p, p is always enabled. */ > + try_to_disable_aggr_kprobe(p); > + > + if (!kprobes_all_disarmed && kprobe_disabled(p)) > + disarm_kprobe(p); > +out: > + mutex_unlock(&kprobe_mutex); > + return ret; > +} > +EXPORT_SYMBOL_GPL(disable_kprobe); > + > +/* Enable one kprobe */ > +int __kprobes enable_kprobe(struct kprobe *kp) > +{ > + int ret = 0; > + struct kprobe *p; > + > + mutex_lock(&kprobe_mutex); > + > + /* Check whether specified probe is valid. */ > + p = __get_valid_kprobe(kp); > + if (unlikely(p == NULL)) { > + ret = -EINVAL; > + goto out; > + } > + > + if (kprobe_gone(kp)) { > + /* This kprobe has gone, we couldn't enable it. */ > + ret = -EINVAL; > + goto out; > + } > + > + if (p != kp) > + kp->flags &= ~KPROBE_FLAG_DISABLED; > + > + if (!kprobes_all_disarmed && kprobe_disabled(p)) { > + p->flags &= ~KPROBE_FLAG_DISABLED; > + arm_kprobe(p); > + } > +out: > + mutex_unlock(&kprobe_mutex); > + return ret; > +} > +EXPORT_SYMBOL_GPL(enable_kprobe); > + > void __kprobes dump_kprobe(struct kprobe *kp) > { > printk(KERN_WARNING "Dumping kprobe:\n"); > @@ -1805,72 +1871,6 @@ static const struct file_operations debugfs_kprobes_operations = { > .release = seq_release, > }; > > -/* Disable one kprobe */ > -int __kprobes disable_kprobe(struct kprobe *kp) > -{ > - int ret = 0; > - struct kprobe *p; > - > - mutex_lock(&kprobe_mutex); > - > - /* Check whether specified probe is valid. */ > - p = __get_valid_kprobe(kp); > - if (unlikely(p == NULL)) { > - ret = -EINVAL; > - goto out; > - } > - > - /* If the probe is already disabled (or gone), just return */ > - if (kprobe_disabled(kp)) > - goto out; > - > - kp->flags |= KPROBE_FLAG_DISABLED; > - if (p != kp) > - /* When kp != p, p is always enabled. */ > - try_to_disable_aggr_kprobe(p); > - > - if (!kprobes_all_disarmed && kprobe_disabled(p)) > - disarm_kprobe(p); > -out: > - mutex_unlock(&kprobe_mutex); > - return ret; > -} > -EXPORT_SYMBOL_GPL(disable_kprobe); > - > -/* Enable one kprobe */ > -int __kprobes enable_kprobe(struct kprobe *kp) > -{ > - int ret = 0; > - struct kprobe *p; > - > - mutex_lock(&kprobe_mutex); > - > - /* Check whether specified probe is valid. */ > - p = __get_valid_kprobe(kp); > - if (unlikely(p == NULL)) { > - ret = -EINVAL; > - goto out; > - } > - > - if (kprobe_gone(kp)) { > - /* This kprobe has gone, we couldn't enable it. */ > - ret = -EINVAL; > - goto out; > - } > - > - if (p != kp) > - kp->flags &= ~KPROBE_FLAG_DISABLED; > - > - if (!kprobes_all_disarmed && kprobe_disabled(p)) { > - p->flags &= ~KPROBE_FLAG_DISABLED; > - arm_kprobe(p); > - } > -out: > - mutex_unlock(&kprobe_mutex); > - return ret; > -} > -EXPORT_SYMBOL_GPL(enable_kprobe); > - > static void __kprobes arm_all_kprobes(void) > { > struct hlist_head *head; > > -- Masami Hiramatsu e-mail: mhiramat@redhat.com