Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751706Ab1DEB1B (ORCPT ); Mon, 4 Apr 2011 21:27:01 -0400 Received: from mail4.hitachi.co.jp ([133.145.228.5]:50414 "EHLO mail4.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751260Ab1DEB07 (ORCPT ); Mon, 4 Apr 2011 21:26:59 -0400 X-AuditID: b753bd60-a48faba000000ee4-b4-4d9a6fe0fe3a X-AuditID: b753bd60-a48faba000000ee4-b4-4d9a6fe0fe3a Message-ID: <4D9A6FDA.9030304@hitachi.com> Date: Tue, 05 Apr 2011 10:26:50 +0900 From: Masami Hiramatsu Organization: Systems Development Lab., Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: Srikar Dronamraju Cc: Peter Zijlstra , Ingo Molnar , Steven Rostedt , Linux-mm , Arnaldo Carvalho de Melo , Linus Torvalds , Jonathan Corbet , Christoph Hellwig , Thomas Gleixner , Ananth N Mavinakayanahalli , Oleg Nesterov , Andrew Morton , SystemTap , Jim Keniston , Roland McGrath , Andi Kleen , LKML Subject: Re: [PATCH v3 2.6.39-rc1-tip 18/26] 18: uprobes: commonly used filters. References: <20110401143223.15455.19844.sendpatchset@localhost6.localdomain6> <20110401143602.15455.82211.sendpatchset@localhost6.localdomain6> In-Reply-To: <20110401143602.15455.82211.sendpatchset@localhost6.localdomain6> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3160 Lines: 106 (2011/04/01 23:36), Srikar Dronamraju wrote: > Provides most commonly used filters that most users of uprobes can > reuse. However this would be useful once we can dynamically associate a > filter with a uprobe-event tracer. Hmm, would you mean that these filters are currently not used? If so, it would be better to remove this from the series, and send again with an actual user code. Thank you, > > Signed-off-by: Srikar Dronamraju > --- > include/linux/uprobes.h | 5 +++++ > kernel/uprobes.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 55 insertions(+), 0 deletions(-) > > diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h > index 26c4d78..34b989f 100644 > --- a/include/linux/uprobes.h > +++ b/include/linux/uprobes.h > @@ -65,6 +65,11 @@ struct uprobe_consumer { > struct uprobe_consumer *next; > }; > > +struct uprobe_simple_consumer { > + struct uprobe_consumer consumer; > + pid_t fvalue; > +}; > + > struct uprobe { > struct rb_node rb_node; /* node in the rb tree */ > atomic_t ref; > diff --git a/kernel/uprobes.c b/kernel/uprobes.c > index cdd52d0..c950f13 100644 > --- a/kernel/uprobes.c > +++ b/kernel/uprobes.c > @@ -1389,6 +1389,56 @@ int uprobe_post_notifier(struct pt_regs *regs) > return 0; > } > > +bool uprobes_pid_filter(struct uprobe_consumer *self, struct task_struct *t) > +{ > + struct uprobe_simple_consumer *usc; > + > + usc = container_of(self, struct uprobe_simple_consumer, consumer); > + if (t->tgid == usc->fvalue) > + return true; > + return false; > +} > + > +bool uprobes_tid_filter(struct uprobe_consumer *self, struct task_struct *t) > +{ > + struct uprobe_simple_consumer *usc; > + > + usc = container_of(self, struct uprobe_simple_consumer, consumer); > + if (t->pid == usc->fvalue) > + return true; > + return false; > +} > + > +bool uprobes_ppid_filter(struct uprobe_consumer *self, struct task_struct *t) > +{ > + pid_t pid; > + struct uprobe_simple_consumer *usc; > + > + usc = container_of(self, struct uprobe_simple_consumer, consumer); > + rcu_read_lock(); > + pid = task_tgid_vnr(t->real_parent); > + rcu_read_unlock(); > + > + if (pid == usc->fvalue) > + return true; > + return false; > +} > + > +bool uprobes_sid_filter(struct uprobe_consumer *self, struct task_struct *t) > +{ > + pid_t pid; > + struct uprobe_simple_consumer *usc; > + > + usc = container_of(self, struct uprobe_simple_consumer, consumer); > + rcu_read_lock(); > + pid = pid_vnr(task_session(t)); > + rcu_read_unlock(); > + > + if (pid == usc->fvalue) > + return true; > + return false; > +} > + > struct notifier_block uprobes_exception_nb = { > .notifier_call = uprobes_exception_notify, > .priority = 0x7ffffff0, -- Masami HIRAMATSU Software Platform Research Dept. Linux Technology Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu.pt@hitachi.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/