* Re: Fwd: uprobes: register/unregister probes. [not found] ` <fe077f71-dce6-40cf-988c-cc35bf4c7ae1@o11g2000prg.googlegroups.com> @ 2011-11-24 6:48 ` Srikar Dronamraju 0 siblings, 0 replies; 7+ messages in thread From: Srikar Dronamraju @ 2011-11-24 6:48 UTC (permalink / raw) To: Peter Zijlstra, Linus Torvalds Cc: Oleg Nesterov, Andrew Morton, LKML, Linux-mm, Ingo Molnar, Andi Kleen, Christoph Hellwig, Steven Rostedt, Roland McGrath, Thomas Gleixner, Masami Hiramatsu, Arnaldo Carvalho de Melo, Anton Arapov, Ananth N Mavinakayanahalli, tulasidhard, Jim Keniston > > On Fri, 2011-11-18 at 16:37 +0530, Srikar Dronamraju wrote: > > +#define UPROBES_HASH_SZ 13 > > +/* serialize (un)register */ > > +static struct mutex uprobes_mutex[UPROBES_HASH_SZ]; > > +#define uprobes_hash(v) (&uprobes_mutex[((unsigned long)(v)) %\ > > + UPROBES_HASH_SZ]) > > Was there any reason to for using this hasing scheme, say over hash.h? There is no specific reason for choosing this hashing scheme over the current. I just say ext4_aio_mutex in fs/ext4/ext4.h and did something similar. -- Thanks and Regards Srikar -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <i0nRU-7eK-11@gated-at.bofh.it>]
[parent not found: <603b0079-5f54-4299-9a9a-a5e237ccca73@l23g2000pro.googlegroups.com>]
* Re: Fwd: uprobes: register/unregister probes. [not found] ` <603b0079-5f54-4299-9a9a-a5e237ccca73@l23g2000pro.googlegroups.com> @ 2011-11-24 7:03 ` Srikar Dronamraju 2011-11-24 9:49 ` Peter Zijlstra 2011-11-24 9:49 ` Srikar Dronamraju 1 sibling, 1 reply; 7+ messages in thread From: Srikar Dronamraju @ 2011-11-24 7:03 UTC (permalink / raw) To: Peter Zijlstra, Linus Torvalds Cc: Oleg Nesterov, Andrew Morton, LKML, Linux-mm, Ingo Molnar, Andi Kleen, Christoph Hellwig, Steven Rostedt, Roland McGrath, Thomas Gleixner, Masami Hiramatsu, Arnaldo Carvalho de Melo, Anton Arapov, Ananth N Mavinakayanahalli, Jim Keniston, tulasidhard > On Fri, 2011-11-18 at 16:37 +0530, Srikar Dronamraju wrote: > > +int register_uprobe(struct inode *inode, loff_t offset, > > + struct uprobe_consumer *consumer) > > +{ > > + struct uprobe *uprobe; > > + int ret = -EINVAL; > > + > > + if (!consumer || consumer->next) > > + return ret; > > + > > + inode = igrab(inode); > > So why are you dealing with !consumer but not with !inode? and why > does > it make sense to allow !consumer at all? > I am not sure if I got your comment correctly. I do check for inode just after the igrab. I am actually not dealing with !consumer. If the consumer is NULL, then we dont have any handler to run so why would we want to register such a probe? Also if consumer->next is Non-NULL, that means that this consumer was already used. Reusing the consumer, can result in consumers list getting broken into two. If you meant something else please clarify. -- Thanks and Regards Srikar -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fwd: uprobes: register/unregister probes. 2011-11-24 7:03 ` Srikar Dronamraju @ 2011-11-24 9:49 ` Peter Zijlstra 2011-11-24 14:51 ` Srikar Dronamraju 0 siblings, 1 reply; 7+ messages in thread From: Peter Zijlstra @ 2011-11-24 9:49 UTC (permalink / raw) To: Srikar Dronamraju Cc: Linus Torvalds, Oleg Nesterov, Andrew Morton, LKML, Linux-mm, Ingo Molnar, Andi Kleen, Christoph Hellwig, Steven Rostedt, Roland McGrath, Thomas Gleixner, Masami Hiramatsu, Arnaldo Carvalho de Melo, Anton Arapov, Ananth N Mavinakayanahalli, Jim Keniston, tulasidhard On Thu, 2011-11-24 at 12:33 +0530, Srikar Dronamraju wrote: > > On Fri, 2011-11-18 at 16:37 +0530, Srikar Dronamraju wrote: > > > +int register_uprobe(struct inode *inode, loff_t offset, > > > + struct uprobe_consumer *consumer) > > > +{ > > > + struct uprobe *uprobe; > > > + int ret = -EINVAL; > > > + > > > + if (!consumer || consumer->next) > > > + return ret; > > > + > > > + inode = igrab(inode); > > > > So why are you dealing with !consumer but not with !inode? and why > > does > > it make sense to allow !consumer at all? > > > > > I am not sure if I got your comment correctly. > > I do check for inode just after the igrab. No you don't, you check the return value of igrab(), but you crash hard when someone calls register_uprobe(.inode=NULL). > I am actually not dealing with !consumer. > If the consumer is NULL, then we dont have any handler to run so why > would we want to register such a probe? Why allow someone calling register_uprobe(.consumer=NULL) to begin with? That doesn't make any sense. > Also if consumer->next is Non-NULL, that means that this consumer was > already used. Reusing the consumer, can result in consumers list getting > broken into two. Yeah, although at that point why be nice about it? Just but a WARN_ON() in or so. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fwd: uprobes: register/unregister probes. 2011-11-24 9:49 ` Peter Zijlstra @ 2011-11-24 14:51 ` Srikar Dronamraju 2011-11-24 16:34 ` Peter Zijlstra 0 siblings, 1 reply; 7+ messages in thread From: Srikar Dronamraju @ 2011-11-24 14:51 UTC (permalink / raw) To: Peter Zijlstra Cc: Linus Torvalds, Oleg Nesterov, Andrew Morton, LKML, Linux-mm, Ingo Molnar, Andi Kleen, Christoph Hellwig, Steven Rostedt, Roland McGrath, Thomas Gleixner, Masami Hiramatsu, Arnaldo Carvalho de Melo, Anton Arapov, Ananth N Mavinakayanahalli, Jim Keniston, tulasidhard * Peter Zijlstra <peterz@infradead.org> [2011-11-24 10:49:59]: > On Thu, 2011-11-24 at 12:33 +0530, Srikar Dronamraju wrote: > > > On Fri, 2011-11-18 at 16:37 +0530, Srikar Dronamraju wrote: > > > > +int register_uprobe(struct inode *inode, loff_t offset, > > > > + struct uprobe_consumer *consumer) > > > > +{ > > > > + struct uprobe *uprobe; > > > > + int ret = -EINVAL; > > > > + > > > > + if (!consumer || consumer->next) > > > > + return ret; > > > > + > > > > + inode = igrab(inode); > > > > > > So why are you dealing with !consumer but not with !inode? and why > > > does > > > it make sense to allow !consumer at all? > > > > > > > > > I am not sure if I got your comment correctly. > > > > I do check for inode just after the igrab. > > No you don't, you check the return value of igrab(), but you crash hard > when someone calls register_uprobe(.inode=NULL). > Okay. will add a check for inode before we do the igrab. > > I am actually not dealing with !consumer. > > If the consumer is NULL, then we dont have any handler to run so why > > would we want to register such a probe? > > Why allow someone calling register_uprobe(.consumer=NULL) to begin with? > That doesn't make any sense. > > > Also if consumer->next is Non-NULL, that means that this consumer was > > already used. Reusing the consumer, can result in consumers list getting > > broken into two. > > Yeah, although at that point why be nice about it? Just but a WARN_ON() > in or so. > I thought you werent happy with prints and WARN_ON/BUG_ON unless it was really really necessary. If we were to have a WARN_ON for a wrong consumer passed, then we would need a warn_On for NULL inode too. So I think we should leave this as is. Unless I have commented, I agree to your comments sent in other threads and will resolve them accordingly. -- Thanks and Regards Srikar -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fwd: uprobes: register/unregister probes. 2011-11-24 14:51 ` Srikar Dronamraju @ 2011-11-24 16:34 ` Peter Zijlstra 0 siblings, 0 replies; 7+ messages in thread From: Peter Zijlstra @ 2011-11-24 16:34 UTC (permalink / raw) To: Srikar Dronamraju Cc: Linus Torvalds, Oleg Nesterov, Andrew Morton, LKML, Linux-mm, Ingo Molnar, Andi Kleen, Christoph Hellwig, Steven Rostedt, Roland McGrath, Thomas Gleixner, Masami Hiramatsu, Arnaldo Carvalho de Melo, Anton Arapov, Ananth N Mavinakayanahalli, Jim Keniston, tulasidhard On Thu, 2011-11-24 at 20:21 +0530, Srikar Dronamraju wrote: > > No you don't, you check the return value of igrab(), but you crash hard > > when someone calls register_uprobe(.inode=NULL). > > > > Okay. will add a check for inode before we do the igrab. No!!! its fcking pointless calling this function without a valid inode argument, don't mess about and try and deal with it. Same with the consumer thing, if you call it with a NULL consumer you're an idiot, try memcpy(NULL, foo, size), does that return -EINVAL? Also, what's the point of all this igrab() nonsense? We don't need extra references on the inode, the caller of these functions had better made sure the inode is stable and good to use, otherwise it could be freed before we do igrab() and we'd still crash. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fwd: uprobes: register/unregister probes. [not found] ` <603b0079-5f54-4299-9a9a-a5e237ccca73@l23g2000pro.googlegroups.com> 2011-11-24 7:03 ` Srikar Dronamraju @ 2011-11-24 9:49 ` Srikar Dronamraju 2011-11-24 10:00 ` Peter Zijlstra 1 sibling, 1 reply; 7+ messages in thread From: Srikar Dronamraju @ 2011-11-24 9:49 UTC (permalink / raw) To: Peter Zijlstra, Linus Torvalds Cc: Oleg Nesterov, Andrew Morton, LKML, Linux-mm, Ingo Molnar, Andi Kleen, Christoph Hellwig, Steven Rostedt, Roland McGrath, Thomas Gleixner, Masami Hiramatsu, Arnaldo Carvalho de Melo, Anton Arapov, Ananth N Mavinakayanahalli, Jim Keniston, tulasidhard > > + > > + mutex_unlock(uprobes_hash(inode)); > > + put_uprobe(uprobe); > > + > > +reg_out: > > + iput(inode); > > + return ret; > > +} > > So if this function returns an error the caller is responsible for > cleaning up consumer, otherwise we take responsibility. The caller is always responsible to cleanup the consumer. The only field we touch in the consumer is the next; thats because we use to link up the consumers. -- Thanks and Regards Srikar -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Fwd: uprobes: register/unregister probes. 2011-11-24 9:49 ` Srikar Dronamraju @ 2011-11-24 10:00 ` Peter Zijlstra 0 siblings, 0 replies; 7+ messages in thread From: Peter Zijlstra @ 2011-11-24 10:00 UTC (permalink / raw) To: Srikar Dronamraju Cc: Linus Torvalds, Oleg Nesterov, Andrew Morton, LKML, Linux-mm, Ingo Molnar, Andi Kleen, Christoph Hellwig, Steven Rostedt, Roland McGrath, Thomas Gleixner, Masami Hiramatsu, Arnaldo Carvalho de Melo, Anton Arapov, Ananth N Mavinakayanahalli, Jim Keniston, tulasidhard On Thu, 2011-11-24 at 15:19 +0530, Srikar Dronamraju wrote: > Subject: > Re: Fwd: uprobes: > register/unregister probes. > Why is this a fwd and breaking threading? -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-11-24 16:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <hYuXv-26J-3@gated-at.bofh.it>
[not found] ` <hYuXw-26J-5@gated-at.bofh.it>
[not found] ` <i0o1A-7sd-9@gated-at.bofh.it>
[not found] ` <fe077f71-dce6-40cf-988c-cc35bf4c7ae1@o11g2000prg.googlegroups.com>
2011-11-24 6:48 ` Fwd: uprobes: register/unregister probes Srikar Dronamraju
[not found] ` <i0nRU-7eK-11@gated-at.bofh.it>
[not found] ` <603b0079-5f54-4299-9a9a-a5e237ccca73@l23g2000pro.googlegroups.com>
2011-11-24 7:03 ` Srikar Dronamraju
2011-11-24 9:49 ` Peter Zijlstra
2011-11-24 14:51 ` Srikar Dronamraju
2011-11-24 16:34 ` Peter Zijlstra
2011-11-24 9:49 ` Srikar Dronamraju
2011-11-24 10:00 ` Peter Zijlstra
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 NNTP newsgroup(s).