Nick Nygaard
2003-10-29 18:23:19 UTC
Hi, im still having a problem with sleep/wakeup in kernelspace:
A userspace program calls function read, and the thread goes to sleep. When
an interrupt occurs the "wake up.." message is displayed and right after
that the program is blocked (unable to terminate ctrl+c). "Awake" is never
shown.
Does anyone have an idea why wake_up call fails? ...Valentin?
The charcacter driver is for an embedded target, so debugging isnt an
opportunity :(
#include <linux/sched.h>
typedef struct {
wait_queue_head_t waitq;
} TestdriverDev;
TestdriverDev testdriverdev;
ssize_t Read(struct file *filp, char *userbuf, size_t count, loff_t *offp) {
interruptible_sleep_on(&waitq);
}
static void IntmodInterrupt(int irq, void *devid, struct pt_regs *regs) {
TestdriverDev *dev = (TestdriverDev *)devid;
printk("Trying to wake up...\n");
wake_up_interruptible(&dev->waitq);
printk("Awake\n");
}
init(...) {
requestirq(...,&testdriverdev);
}
I get exactly same behavior with sleep_on, wait_event_interruptiable and
wake_up.
Is init_waitqueue_head(&waitq) necessary when not using
DECLARE_WAIT_QUEUE_HEAD(&waitq)?
Please help.
/Nick
A userspace program calls function read, and the thread goes to sleep. When
an interrupt occurs the "wake up.." message is displayed and right after
that the program is blocked (unable to terminate ctrl+c). "Awake" is never
shown.
Does anyone have an idea why wake_up call fails? ...Valentin?
The charcacter driver is for an embedded target, so debugging isnt an
opportunity :(
#include <linux/sched.h>
typedef struct {
wait_queue_head_t waitq;
} TestdriverDev;
TestdriverDev testdriverdev;
ssize_t Read(struct file *filp, char *userbuf, size_t count, loff_t *offp) {
interruptible_sleep_on(&waitq);
}
static void IntmodInterrupt(int irq, void *devid, struct pt_regs *regs) {
TestdriverDev *dev = (TestdriverDev *)devid;
printk("Trying to wake up...\n");
wake_up_interruptible(&dev->waitq);
printk("Awake\n");
}
init(...) {
requestirq(...,&testdriverdev);
}
I get exactly same behavior with sleep_on, wait_event_interruptiable and
wake_up.
Is init_waitqueue_head(&waitq) necessary when not using
DECLARE_WAIT_QUEUE_HEAD(&waitq)?
Please help.
/Nick