From: Vyacheslav Cherkashin Date: Fri, 14 Dec 2012 10:29:07 +0000 (+0400) Subject: add flag for retprobe X-Git-Tag: Tizen_SDK_2.3~716^2~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc7b10145c5110ce7763e0774dac1e0e0ece299c;p=kernel%2Fswap-modules.git add flag for retprobe --- diff --git a/driver/new_dpf.h b/driver/new_dpf.h index 9e0319b..5fbe3b5 100644 --- a/driver/new_dpf.h +++ b/driver/new_dpf.h @@ -339,6 +339,7 @@ struct proc_probes *get_file_probes(const inst_us_proc_t *task_inst_info) us_proc_ip_t *ip = &p_libs->p_ips[k]; unsigned long offset = ip->offset & PAGE_MASK; struct page_probes *page_p_tmp, *page_p = NULL; + ip->flags |= FLAG_RETPROBE; head = &tmp_page_probes_table[hash_ptr(offset, tmp_hash_bits)]; hlist_for_each_entry(page_p_tmp, node, head, hlist) { diff --git a/driver/storage.h b/driver/storage.h index 279e371..2eaa852 100644 --- a/driver/storage.h +++ b/driver/storage.h @@ -150,6 +150,10 @@ extern int event_mask; // process pid to instrument extern unsigned int inst_pid; +enum FLAG_PROBE { + FLAG_RETPROBE = (1 << 0) +}; + typedef struct { struct list_head list; @@ -158,6 +162,8 @@ typedef struct struct jprobe jprobe; struct kretprobe retprobe; unsigned long offset; + + enum FLAG_PROBE flags; } us_proc_ip_t; typedef struct diff --git a/driver/us_proc_inst.c b/driver/us_proc_inst.c index 8cdab8d..2892014 100644 --- a/driver/us_proc_inst.c +++ b/driver/us_proc_inst.c @@ -1894,18 +1894,20 @@ static int register_usprobe(struct task_struct *task, us_proc_ip_t *ip, int atom return ret; } - // Mr_Nobody: comment for valencia - ip->retprobe.kp.tgid = task->tgid; - if (ip->retprobe.handler == NULL) { - ip->retprobe.handler = (kretprobe_handler_t)uretprobe_event_handler; - DPRINTF("Set default ret event handler for %x\n", ip->offset); - } + if (ip->flags & FLAG_RETPROBE) { + // Mr_Nobody: comment for valencia + ip->retprobe.kp.tgid = task->tgid; + if (ip->retprobe.handler == NULL) { + ip->retprobe.handler = (kretprobe_handler_t)uretprobe_event_handler; + DPRINTF("Set default ret event handler for %x\n", ip->offset); + } - ip->retprobe.priv_arg = ip; - ret = dbi_register_uretprobe(task, &ip->retprobe, atomic); - if (ret) { - EPRINTF ("dbi_register_uretprobe() failure %d", ret); - return ret; + ip->retprobe.priv_arg = ip; + ret = dbi_register_uretprobe(task, &ip->retprobe, atomic); + if (ret) { + EPRINTF ("dbi_register_uretprobe() failure %d", ret); + return ret; + } } ip->installed = 1; @@ -1916,7 +1918,10 @@ static int register_usprobe(struct task_struct *task, us_proc_ip_t *ip, int atom static int unregister_usprobe(struct task_struct *task, us_proc_ip_t * ip, int atomic, int not_rp2) { dbi_unregister_ujprobe(task, &ip->jprobe, atomic); - dbi_unregister_uretprobe(task, &ip->retprobe, atomic, not_rp2); + + if (ip->flags & FLAG_RETPROBE) { + dbi_unregister_uretprobe(task, &ip->retprobe, atomic, not_rp2); + } ip->installed = 0;