This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Patch [2/3] Userspace probes readpage hooks
- From: Prasanna S Panchamukhi <prasanna at in dot ibm dot com>
- To: "Zhang, Yanmin" <yanmin dot zhang at intel dot com>
- Cc: systemtap at sources dot redhat dot com, "Keshavamurthy, Anil S" <anil dot s dot keshavamurthy at intel dot com>, "Mao, Bibo" <bibo dot mao at intel dot com>
- Date: Fri, 27 Jan 2006 18:42:34 +0530
- Subject: Re: Patch [2/3] Userspace probes readpage hooks
- References: <99FA2ED298A9834DB1BF5DE8BDBF24130FC9DE@pdsmsx403>
- Reply-to: prasanna at in dot ibm dot com
Yanmin,
> >>+ */
> >>+static int __kprobes uprobe_readpages(struct file *file,
> >>+ struct address_space *mapping,
> >>+ struct list_head *pages, unsigned nr_pages)
> >>+{
> >>+ int retval = 0;
> >>+ struct page *page;
> >>+ struct uprobe_module *umodule;
> >>+ struct uprobe *uprobe = NULL;
> >>+ struct hlist_node *node;
> >>+
> >>+ mutex_lock(&uprobe_mutex);
> >>+
> >>+ umodule = get_module_by_inode(file->f_dentry->d_inode);
> >>+ if (!umodule) {
> [YM] The race condition is still not resolved.
Could you please elaborate the race condition?
> >>+ if (!page)
> >>+ continue;
> It's incorrect. Some pages might be in memory and the corresponding uprobe are already inserted on the pages, so the same uprobe might be inserted more once on the same page. You could just go through pages read in by this call.
>
yes, may be we can check for valid opcode and if there is a valid opcode
then the probe is already inserted and no need to insert it again.
> >>+ goto out;
> >>+
> >>+ mutex_lock(&kprobe_mutex);
> >>+ hlist_for_each_entry(uprobe, node, &umodule->ulist_head, ulist)
> >>+ insert_readpage_uprobe(page, mapping, uprobe);
> Do all uprobe of the uprobe_module have to be inserted to the page?
yes, we need to check if there is a appropriate probe within page and
then insert them if they are not inserted.
Thanks
Prasanna
--
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Email: prasanna@in.ibm.com
Ph: 91-80-51776329