Kernel Panic when schedule is called
When below program is executed i got kernel panic.
Please anybody check and let me know my mistake
I compiled and executed in kernel 2.6.18.5
-----------------snip starts----------------
typedef struct queue_test
{
struct timer_list cache_timer;
} q_test;
static q_test Q;
static int timer_starts = 0;
static int first_time =1;
static int global_value = 0;
DECLARE_WAIT_QUEUE_HEAD(queue_test_waitq);
static void queue_test_timer_handler(unsigned long a_cache)
{
printk("Timer Handler function called\n");
if (!a_cache)
{
printk("Invalid entry \n");
return;
}
printk("Wake up all queued packets\n");
wake_up(&queue_test_waitq);
printk("timer stopped\n");
printk("============================\n");
//timer_starts = 0;
global_value = 1;
}
static unsigned int queue_test_prerouting(unsigned int hook,
struct sk_buff **pskb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff *))
{
printk("Prerouting skb: %p\n", (*pskb));
return NF_ACCEPT;
}
static int check_global_value()
{
if (global_value == 1)
return 1;
else
return 0;
}
static unsigned int queue_test_forwarding(unsigned int hook,
struct sk_buff **pskb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff *))
{
u32 genid;
genid = atomic_read(&flow_cache_genid);
if (first_time)
{
first_time = 0;
printk("====================================\n");
printk("First Packet: skb: %p \n", (*pskb));
init_timer(&Q.cache_timer);
Q.cache_timer.data = 1;
Q.cache_timer.function = queue_test_timer_handler;
Q.cache_timer.expires = jiffies + (60 * 1) * HZ;
add_timer(&Q.cache_timer);
}
if (check_global_value() == 0)
{
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&queue_test_waitq, &wait);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(5);
set_current_state(TASK_RUNNING);
remove_wait_queue(&queue_test_waitq, &wait);
printk("Packet from queue\n");
}
return NF_ACCEPT;
}
static unsigned int queue_test_postrouting(unsigned int hook,
struct sk_buff **pskb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff *))
{
printk("Post Routing \n");
printk("Packet received: skb: %p \n", (*pskb));
return NF_ACCEPT;
}
static struct nf_hook_ops queue_test_ops[] =
{
{
.hook = queue_test_prerouting,
.owner = THIS_MODULE,
.pf = PF_INET,
.hooknum = NF_IP_PRE_ROUTING,
.priority = NF_IP_PRI_CONNTRACK + 1,
},
{
.hook = queue_test_forwarding,
.owner = THIS_MODULE,
.pf = PF_INET,
.hooknum = NF_IP_FORWARD,
.priority = NF_IP_PRI_FILTER + 1,
},
{
.hook = queue_test_postrouting,
.owner = THIS_MODULE,
.pf = PF_INET,
.hooknum = NF_IP_POST_ROUTING,
.priority = NF_IP_PRI_CONNTRACK_CONFIRM,
},
};
int __init queue_test_init(void)
{
int index;
int ret;
for (index = 0; index < ARRAY_SIZE(queue_test_ops); index++)
{
if ((ret = nf_register_hook(&queue_test_ops[index])) < 0)
{
return -1;
}
}
return 0;
}
void __exit queue_test_exit(void)
{
int index;
for (index = 0; index < ARRAY_SIZE(queue_test_ops); index++)
{
nf_unregister_hook(&queue_test_ops[index]);
}
}
MODULE_LICENSE("GPL") ;
module_init(queue_test_init) ;
module_exit(queue_test_exit) ;
--------------snip ends---------------
Thanks in advance..
Sathish
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- Linux Systems Administrator
- Validate an E-Mail Address with PHP, the Right Way
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- RSS Feeds
- Senior Perl Developer
- Technical Support Rep
- Introduction to MapReduce with Hadoop on Linux
- Weechat, Irssi's Little Brother
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



34 min 57 sec ago
4 hours 45 min ago
5 hours 30 min ago
5 hours 40 min ago
5 hours 45 min ago
7 hours 56 min ago
7 hours 57 min ago
8 hours 42 min ago
9 hours 30 min ago
9 hours 54 min ago