LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   TRACEPOINTs in Linux Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/tracepoints-in-linux-kernel-942353/)

vzxen 04-28-2012 11:11 PM

TRACEPOINTs in Linux Kernel
 
Hi,

I am trying to learn module development in Linux Kernel and I wanted to know how to use a tracepoint already defined in the linux kernel :
http://kernel.org/doc/htmldocs/trace...-complete.html

The tracepoint I am referring to is :
trace_block_bio_complete();

As per the documentation it says that trace_block_bio_complete() is called when the Block operation is completed :
This tracepoint indicates there is no further work to do on this block IO operation bio.

But when I write a KERNEL Module for the same, its not working. Here is the code :
Code:


#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/blkdev.h>
#include <linux/blktrace_api.h>
#include <linux/percpu.h>
#include <linux/bio.h>
#include <linux/tracepoint.h>

MODULE_LICENSE("Dual BSD/GPL");

int mymod_count = 0;

static void mymod_trace_bio_complete(struct request_queue *q, struct bio *bio)
{
        if(mymod_count < 10){
                printk(KERN_INFO "%d ... \n", mymod_count);
        }
        mymod_count++;
}

static int mymod_init(void) {
       
        int ret;

        printk("<1> Starting mymod kernel module ... \n");

        ret = register_trace_block_bio_complete(mymod_trace_bio_complete);
        WARN_ON(ret);

}

static void mymod_exit(void) {
 
        printk("<1> Stopping mymod kernel module ... \n");

        unregister_trace_block_bio_complete(mymod_trace_bio_complete);
 
}

module_init(mymod_init);
module_exit(mymod_exit);

Please let me know what I am doing wrong. Also I dont know if there is any dedicated forum or mailing list where I can ask questions about kernel development.

Looking forward to any input :)

vzxen 04-30-2012 06:49 AM

Can anyone guide me to any forum which is dedicated to linux kernel programming.
I would really appreciate any help on the problem I face with the kernel module programming.


All times are GMT -5. The time now is 10:06 AM.