2010-04-01 21:50:54

by Luck, Tony

[permalink] [raw]
Subject: Re: [GIT PULL] "perf probe" updates, kprobes jump optimization, for v2.6.34

On Mon, Mar 1, 2010 at 11:41 AM, Ingo Molnar <[email protected]> wrote:
> Please pull the latest perf-probes-for-linus git tree from:

Since this went in I'm seeing:

kernel/kprobes.c:719: warning: ?arm_kprobe? defined but not used

from the arch/ia64/configs/zx1_defconfig build on ia64

Looks to be because that config ends up with:

CONFIG_KPROBES=y

together with

# CONFIG_DEBUG_FS is not set

-Tony


2010-04-02 14:28:43

by Masami Hiramatsu

[permalink] [raw]
Subject: Re: [GIT PULL] "perf probe" updates, kprobes jump optimization, for v2.6.34

Hi Tony,

Tony Luck wrote:
> On Mon, Mar 1, 2010 at 11:41 AM, Ingo Molnar <[email protected]> wrote:
>> Please pull the latest perf-probes-for-linus git tree from:
>
> Since this went in I'm seeing:
>
> kernel/kprobes.c:719: warning: ?arm_kprobe? defined but not used
>
> from the arch/ia64/configs/zx1_defconfig build on ia64
>
> Looks to be because that config ends up with:
>
> CONFIG_KPROBES=y
>
> together with
>
> # CONFIG_DEBUG_FS is not set

Ah, thank you for reporting!
Hmm, it seems that the place of definitions of enable_kprobe/disable_kprobe
which call arm_kprobe/disarm_kprobe, are incorrect, because those functions
are just API and don't depend on debugfs.
I'll fix that.


Thank you,

>
> -Tony
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Masami Hiramatsu
e-mail: [email protected]

2010-04-06 22:18:17

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH -tip] kprobes: Move enable/disable_kprobe() out from debugfs code

Move enable/disable_kprobe() API out from debugfs related code,
because these interfaces are not related to debugfs interface.

Signed-off-by: Masami Hiramatsu <[email protected]>
Reported-by: Tony Luck <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Ananth N Mavinakayanahalli <[email protected]>
---

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: [email protected]

Subject: Re: [PATCH -tip] kprobes: Move enable/disable_kprobe() out from debugfs code

On Tue, Apr 06, 2010 at 06:24:52PM -0400, Masami Hiramatsu wrote:
> Move enable/disable_kprobe() API out from debugfs related code,
> because these interfaces are not related to debugfs interface.
>
> Signed-off-by: Masami Hiramatsu <[email protected]>
> Reported-by: Tony Luck <[email protected]>

Acked-by: Ananth N Mavinakayanahalli <[email protected]>

2010-04-07 14:54:28

by Luck, Tony

[permalink] [raw]
Subject: RE: [PATCH -tip] kprobes: Move enable/disable_kprobe() out from debugfs code

>On Tue, Apr 06, 2010 at 06:24:52PM -0400, Masami Hiramatsu wrote:
>> Move enable/disable_kprobe() API out from debugfs related code,
>> because these interfaces are not related to debugfs interface.
>>
>> Signed-off-by: Masami Hiramatsu <[email protected]>
>> Reported-by: Tony Luck <[email protected]
>
>Acked-by: Ananth N Mavinakayanahalli <[email protected]>

Fixes my build warnings.

Acked-by: Tony Luck <[email protected]>