LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-28-2012, 11:11 PM   #1
vzxen
Member
 
Registered: Jul 2010
Posts: 126

Rep: Reputation: 4
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
 
Old 04-30-2012, 06:49 AM   #2
vzxen
Member
 
Registered: Jul 2010
Posts: 126

Original Poster
Rep: Reputation: 4
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: This week at LWN: On the value of static tracepoints LXer Syndicated Linux News 0 05-14-2009 02:50 AM
LXer: Howto: build Linux kernel module against installed kernel w/o full kernel source tree LXer Syndicated Linux News 0 09-03-2006 08:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration