* [PATCH -tip] kprobes: Move enable/disable_kprobe() out from debugfs code
[not found] <4BB5FED3.4020809@redhat.com>
@ 2010-04-06 22:17 ` Masami Hiramatsu
2010-04-07 1:43 ` Ananth N Mavinakayanahalli
0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2010-04-06 22:17 UTC (permalink / raw)
To: Ingo Molnar, lkml
Cc: Tony Luck, Ingo Molnar, Ananth N Mavinakayanahalli, systemtap, DLE
Move enable/disable_kprobe() API out from debugfs related code,
because these interfaces are not related to debugfs interface.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Reported-by: Tony Luck <tony.luck@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -tip] kprobes: Move enable/disable_kprobe() out from debugfs code
2010-04-06 22:17 ` [PATCH -tip] kprobes: Move enable/disable_kprobe() out from debugfs code Masami Hiramatsu
@ 2010-04-07 1:43 ` Ananth N Mavinakayanahalli
2010-04-07 14:54 ` Luck, Tony
0 siblings, 1 reply; 3+ messages in thread
From: Ananth N Mavinakayanahalli @ 2010-04-07 1:43 UTC (permalink / raw)
To: Masami Hiramatsu; +Cc: Ingo Molnar, lkml, Tony Luck, systemtap, DLE
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 <mhiramat@redhat.com>
> Reported-by: Tony Luck <tony.luck@intel.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH -tip] kprobes: Move enable/disable_kprobe() out from debugfs code
2010-04-07 1:43 ` Ananth N Mavinakayanahalli
@ 2010-04-07 14:54 ` Luck, Tony
0 siblings, 0 replies; 3+ messages in thread
From: Luck, Tony @ 2010-04-07 14:54 UTC (permalink / raw)
To: ananth, Masami Hiramatsu; +Cc: Ingo Molnar, lkml, systemtap, DLE
>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 <mhiramat@redhat.com>
>> Reported-by: Tony Luck <tony.luck@intel.com
>
>Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Fixes my build warnings.
Acked-by: Tony Luck <tony.luck@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-07 14:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <4BB5FED3.4020809@redhat.com>
2010-04-06 22:17 ` [PATCH -tip] kprobes: Move enable/disable_kprobe() out from debugfs code Masami Hiramatsu
2010-04-07 1:43 ` Ananth N Mavinakayanahalli
2010-04-07 14:54 ` Luck, Tony
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).