Main Page | Modules | Directories | File List | Globals | Related Pages

stp_tasklet.c

00001 /* Framework for putting a jprobe in a tasklet. */
00002 /* Useful for testing probes in interrupt context. */
00003 /* Doesn't do anything useful as is.  Put test code in the inst func */
00004 
00005 #define HASH_TABLE_BITS 8
00006 #define HASH_TABLE_SIZE (1<<HASH_TABLE_BITS)
00007 #define BUCKETS 16 /* largest histogram width */
00008 
00009 #define STP_NETLINK_ONLY
00010 #define STP_NUM_STRINGS 1
00011 
00012 #include "runtime.h"
00013 #include "probes.c"
00014 
00015 MODULE_DESCRIPTION("test jprobes of tasklets");
00016 MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>");
00017 
00018 void inst__rcu_process_callbacks(struct rcu_ctrlblk *rcp,
00019                                  struct rcu_state *rsp, struct rcu_data *rdp)
00020 {
00021   _stp_log ("interrupt=%d\n", in_interrupt());
00022   jprobe_return();
00023 }
00024 
00025 static struct jprobe stp_probes[] = {
00026   {
00027     .kp.addr =  (kprobe_opcode_t *)"__rcu_process_callbacks",
00028     .entry = (kprobe_opcode_t *) inst__rcu_process_callbacks
00029   },
00030 };
00031 #define MAX_STP_PROBES (sizeof(stp_probes)/sizeof(struct jprobe))
00032 
00033 
00034 static int init_stp(void)
00035 {
00036   int ret;
00037 
00038   if (_stp_netlink_open() < 0)
00039     return -1;
00040   ret = _stp_register_jprobes (stp_probes, MAX_STP_PROBES);
00041   _stp_log ("instrumentation is enabled...\n");
00042   return ret;
00043 }
00044 
00045 static void probe_exit (void)
00046 {
00047   _stp_unregister_jprobes (stp_probes, MAX_STP_PROBES);
00048   _stp_log ("EXIT\n");
00049 
00050 }
00051 static void cleanup_stp(void)
00052 {
00053   _stp_netlink_close();
00054 }
00055 
00056 module_init(init_stp);
00057 module_exit(cleanup_stp);
00058 MODULE_LICENSE("GPL");
00059