From: Oleg Nesterov <oleg@redhat.com>
To: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Anton Arapov <anton@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] uprobes: Kill UPROBE_RUN_HANDLER flag
Date: Sat, 24 Nov 2012 19:02:33 +0100 [thread overview]
Message-ID: <20121124180233.GA30990@redhat.com> (raw)
In-Reply-To: <20121124180213.GA30963@redhat.com>
Simply remove UPROBE_RUN_HANDLER and the corresponding code.
It can only help if uprobe has a single consumer, and in fact
it is no longer needed after handler_chain() was changed to use
->register_rwsem, we simply can not race with uprobe_register().
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/events/uprobes.c | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 873c993..97c3874 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -83,10 +83,8 @@ static atomic_t uprobe_events = ATOMIC_INIT(0);
/* Have a copy of original instruction */
#define UPROBE_COPY_INSN 0
-/* Dont run handlers when first register/ last unregister in progress*/
-#define UPROBE_RUN_HANDLER 1
/* Can skip singlestep */
-#define UPROBE_SKIP_SSTEP 2
+#define UPROBE_SKIP_SSTEP 1
struct uprobe {
struct rb_node rb_node; /* node in the rb tree */
@@ -475,9 +473,6 @@ static void handler_chain(struct uprobe *uprobe, struct pt_regs *regs)
{
struct uprobe_consumer *uc;
- if (!test_bit(UPROBE_RUN_HANDLER, &uprobe->flags))
- return;
-
down_read(&uprobe->register_rwsem);
for (uc = uprobe->consumers; uc; uc = uc->next)
uc->handler(uc, regs);
@@ -825,13 +820,8 @@ static int register_for_each_vma(struct uprobe *uprobe, bool is_register)
static int __uprobe_register(struct uprobe *uprobe, struct uprobe_consumer *uc)
{
- int err;
-
consumer_add(uprobe, uc);
- err = register_for_each_vma(uprobe, true);
- if (!err) /* TODO: pointless unless the first consumer */
- set_bit(UPROBE_RUN_HANDLER, &uprobe->flags);
- return err;
+ return register_for_each_vma(uprobe, true);
}
static void __uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *uc)
@@ -842,12 +832,9 @@ static void __uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *u
return;
err = register_for_each_vma(uprobe, false);
- if (!uprobe->consumers) {
- clear_bit(UPROBE_RUN_HANDLER, &uprobe->flags);
- /* TODO : cant unregister? schedule a worker thread */
- if (!err)
- delete_uprobe(uprobe);
- }
+ /* TODO : cant unregister? schedule a worker thread */
+ if (!uprobe->consumers && !err)
+ delete_uprobe(uprobe);
}
/*
--
1.5.5.1
next prev parent reply other threads:[~2012-11-24 18:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-24 18:02 [PATCH 0/4] uprobes: locking changes for filtering Oleg Nesterov
2012-11-24 18:02 ` [PATCH 1/4] uprobes: Introduce uprobe->register_rwsem Oleg Nesterov
2012-12-13 14:09 ` Srikar Dronamraju
2012-11-24 18:02 ` [PATCH 2/4] uprobes: Change filter_chain() to iterate ->consumers list Oleg Nesterov
2012-12-13 14:12 ` Srikar Dronamraju
2012-11-24 18:02 ` Oleg Nesterov [this message]
2012-12-13 14:29 ` [PATCH 3/4] uprobes: Kill UPROBE_RUN_HANDLER flag Srikar Dronamraju
2012-11-24 18:02 ` [PATCH 4/4] uprobes: Kill uprobe->copy_mutex Oleg Nesterov
2012-12-13 14:30 ` Srikar Dronamraju
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=20121124180233.GA30990@redhat.com \
--to=oleg@redhat.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.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