From: Masami Hiramatsu <mhiramat@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Masami Hiramatsu <mhiramat@redhat.com>,
lkml <linux-kernel@vger.kernel.org>,
systemtap <systemtap@sources.redhat.com>,
DLE <dle-develop@lists.sourceforge.net>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH -tip 1/2] [RESEND] kprobes: Move enable/disable_kprobe() out from debugfs code
Date: Mon, 10 May 2010 17:06:00 -0000 [thread overview]
Message-ID: <4BE585D1.50101@redhat.com> (raw)
In-Reply-To: <20100427223312.2322.60512.stgit@localhost6.localdomain6>
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 <mhiramat@redhat.com>
> Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Acked-by: Tony Luck <tony.luck@intel.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> ---
>
> 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
next prev parent reply other threads:[~2010-05-08 15:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-28 11:52 Masami Hiramatsu
2010-04-28 11:56 ` [PATCH -tip 2/2] [BUGFIX] kprobes/x86: Fix removed int3 checking order Masami Hiramatsu
2010-04-28 17:30 ` Ananth N Mavinakayanahalli
2010-04-28 17:54 ` Masami Hiramatsu
2010-04-30 19:45 ` Ananth N Mavinakayanahalli
2010-05-10 14:27 ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2010-05-11 16:15 ` tip-bot for Masami Hiramatsu
2010-05-10 17:06 ` Masami Hiramatsu [this message]
2010-05-10 17:29 ` [PATCH -tip 1/2] [RESEND] kprobes: Move enable/disable_kprobe() out from debugfs code Ingo Molnar
2010-05-10 17:47 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BE585D1.50101@redhat.com \
--to=mhiramat@redhat.com \
--cc=ananth@in.ibm.com \
--cc=dle-develop@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=systemtap@sources.redhat.com \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).