Re: Sleeping thread not receive signal until it wakes up

2007-03-10 Thread Luong Ngo
On 3/10/07, Sergey Vlasov <[EMAIL PROTECTED]> wrote: On Fri, 9 Mar 2007 16:10:29 -0800 Luong Ngo wrote: > Thanks Parav, adding singal_allow(SIGALRM) wakeup the blocking > interruptible_sleep_on and checking the signal_pending would return > true now. This means that there is also a bug in your

Re: Sleeping thread not receive signal until it wakes up

2007-03-10 Thread Sergey Vlasov
On Fri, 9 Mar 2007 16:10:29 -0800 Luong Ngo wrote: > Thanks Parav, adding singal_allow(SIGALRM) wakeup the blocking > interruptible_sleep_on and checking the signal_pending would return > true now. This means that there is also a bug in your userspace program - somehow when it invokes ioctl(),

Re: Sleeping thread not receive signal until it wakes up

2007-03-10 Thread Sergey Vlasov
On Fri, 9 Mar 2007 16:10:29 -0800 Luong Ngo wrote: Thanks Parav, adding singal_allow(SIGALRM) wakeup the blocking interruptible_sleep_on and checking the signal_pending would return true now. This means that there is also a bug in your userspace program - somehow when it invokes ioctl(), it

Re: Sleeping thread not receive signal until it wakes up

2007-03-10 Thread Luong Ngo
On 3/10/07, Sergey Vlasov [EMAIL PROTECTED] wrote: On Fri, 9 Mar 2007 16:10:29 -0800 Luong Ngo wrote: Thanks Parav, adding singal_allow(SIGALRM) wakeup the blocking interruptible_sleep_on and checking the signal_pending would return true now. This means that there is also a bug in your

Re: Sleeping thread not receive signal until it wakes up

2007-03-09 Thread Luong Ngo
On 3/8/07, Parav K Pandit <[EMAIL PROTECTED]> wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luong Ngo Sent: Friday, March 09, 2007 8:54 AM To: Robert Hancock Cc: linux-kernel; [EMAIL PROTECTED] Subject: Re: Sleeping thread not receive

Re: Sleeping thread not receive signal until it wakes up

2007-03-09 Thread Luong Ngo
On 3/9/07, Sergey Vlasov <[EMAIL PROTECTED]> wrote: On Thu, 8 Mar 2007 14:52:07 -0800 Luong Ngo wrote: [...] > static irqreturn board_isr(int irq, void *dev_id, struct pt_regs* regs) > { > spin_lock(>lock); >if (dev->irqMask & (1 << irqBit)) { > // Set the interrupt event mask >

Re: Sleeping thread not receive signal until it wakes up

2007-03-09 Thread Sergey Vlasov
On Thu, 8 Mar 2007 14:52:07 -0800 Luong Ngo wrote: [...] > static irqreturn board_isr(int irq, void *dev_id, struct pt_regs* regs) > { > spin_lock(>lock); >if (dev->irqMask & (1 << irqBit)) { > // Set the interrupt event mask > dev->irqEvent |= (1 << irqBit); > > // Disable this

Re: Sleeping thread not receive signal until it wakes up

2007-03-09 Thread Sergey Vlasov
On Thu, 8 Mar 2007 14:52:07 -0800 Luong Ngo wrote: [...] static irqreturn board_isr(int irq, void *dev_id, struct pt_regs* regs) { spin_lock(dev-lock); if (dev-irqMask (1 irqBit)) { // Set the interrupt event mask dev-irqEvent |= (1 irqBit); // Disable this irq, it

Re: Sleeping thread not receive signal until it wakes up

2007-03-09 Thread Luong Ngo
On 3/9/07, Sergey Vlasov [EMAIL PROTECTED] wrote: On Thu, 8 Mar 2007 14:52:07 -0800 Luong Ngo wrote: [...] static irqreturn board_isr(int irq, void *dev_id, struct pt_regs* regs) { spin_lock(dev-lock); if (dev-irqMask (1 irqBit)) { // Set the interrupt event mask

Re: Sleeping thread not receive signal until it wakes up

2007-03-09 Thread Luong Ngo
On 3/8/07, Parav K Pandit [EMAIL PROTECTED] wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luong Ngo Sent: Friday, March 09, 2007 8:54 AM To: Robert Hancock Cc: linux-kernel; [EMAIL PROTECTED] Subject: Re: Sleeping thread not receive signal until

RE: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Parav K Pandit
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luong Ngo Sent: Friday, March 09, 2007 8:54 AM To: Robert Hancock Cc: linux-kernel; [EMAIL PROTECTED] Subject: Re: Sleeping thread not receive signal until it wakes up On 3/8/07, Robert Hancock <[EM

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Luong Ngo
On 3/8/07, Robert Hancock <[EMAIL PROTECTED]> wrote: Luong Ngo wrote: > Hi Thomas and Dick, > I appreciate all the responses. They are very good information to me. > Actually, it wasn't me working on the driver but it's been there long > time. I thought I just need to add the signal and signal

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Robert Hancock
Luong Ngo wrote: Hi Thomas and Dick, I appreciate all the responses. They are very good information to me. Actually, it wasn't me working on the driver but it's been there long time. I thought I just need to add the signal and signal handling part, not expecting it would lead me to the driver

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Luong Ngo
On 3/8/07, Thomas Gleixner <[EMAIL PROTECTED]> wrote: On Thu, 2007-03-08 at 08:01 -0500, linux-os (Dick Johnson) wrote: > > Anything kernel configuration I need to be aware of to enable > > preemption in kernel? > > > > > > Thank you, > > LNgo > > > > First, in the ioctl, if you need spin-locks,

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Thomas Gleixner
On Thu, 2007-03-08 at 08:01 -0500, linux-os (Dick Johnson) wrote: > > Anything kernel configuration I need to be aware of to enable > > preemption in kernel? > > > > > > Thank you, > > LNgo > > > > First, in the ioctl, if you need spin-locks, you need to use >

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread linux-os \(Dick Johnson\)
On Wed, 7 Mar 2007, Luong Ngo wrote: > On 3/7/07, linux-os (Dick Johnson) <[EMAIL PROTECTED]> wrote: >> >>> >>> On 3/7/07, linux-os (Dick Johnson) <[EMAIL PROTECTED]> wrote: On Wed, 7 Mar 2007, Luong Ngo wrote: > Hi all, > > I am having this problem. I have a process

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Luong Ngo
On 3/8/07, Thomas Gleixner [EMAIL PROTECTED] wrote: On Thu, 2007-03-08 at 08:01 -0500, linux-os (Dick Johnson) wrote: Anything kernel configuration I need to be aware of to enable preemption in kernel? Thank you, LNgo First, in the ioctl, if you need spin-locks, you need to use

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Robert Hancock
Luong Ngo wrote: Hi Thomas and Dick, I appreciate all the responses. They are very good information to me. Actually, it wasn't me working on the driver but it's been there long time. I thought I just need to add the signal and signal handling part, not expecting it would lead me to the driver

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Luong Ngo
On 3/8/07, Robert Hancock [EMAIL PROTECTED] wrote: Luong Ngo wrote: Hi Thomas and Dick, I appreciate all the responses. They are very good information to me. Actually, it wasn't me working on the driver but it's been there long time. I thought I just need to add the signal and signal

RE: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Parav K Pandit
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luong Ngo Sent: Friday, March 09, 2007 8:54 AM To: Robert Hancock Cc: linux-kernel; [EMAIL PROTECTED] Subject: Re: Sleeping thread not receive signal until it wakes up On 3/8/07, Robert Hancock [EMAIL

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread linux-os \(Dick Johnson\)
On Wed, 7 Mar 2007, Luong Ngo wrote: On 3/7/07, linux-os (Dick Johnson) [EMAIL PROTECTED] wrote: On 3/7/07, linux-os (Dick Johnson) [EMAIL PROTECTED] wrote: On Wed, 7 Mar 2007, Luong Ngo wrote: Hi all, I am having this problem. I have a process with 2 threads created. One of the

Re: Sleeping thread not receive signal until it wakes up

2007-03-08 Thread Thomas Gleixner
On Thu, 2007-03-08 at 08:01 -0500, linux-os (Dick Johnson) wrote: Anything kernel configuration I need to be aware of to enable preemption in kernel? Thank you, LNgo First, in the ioctl, if you need spin-locks, you need to use spin_lock_irqsave/spin_unlock/irqrestore. The ones

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Luong Ngo
On 3/7/07, Lee Revell <[EMAIL PROTECTED]> wrote: On 3/7/07, linux-os (Dick Johnson) <[EMAIL PROTECTED]> wrote: > Interruptible_sleep_on is interruptible, but for your task to > actually be awakened and your alarm handler to get some CPU, > it needs to be scheduled. If the BKL (big kernel lock)

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Luong Ngo
On 3/7/07, linux-os (Dick Johnson) <[EMAIL PROTECTED]> wrote: > > On 3/7/07, linux-os (Dick Johnson) <[EMAIL PROTECTED]> wrote: >> >> On Wed, 7 Mar 2007, Luong Ngo wrote: >> >>> Hi all, >>> >>> I am having this problem. I have a process with 2 threads created. One >>> of the thread will keep

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Lee Revell
On 3/7/07, linux-os (Dick Johnson) <[EMAIL PROTECTED]> wrote: Interruptible_sleep_on is interruptible, but for your task to actually be awakened and your alarm handler to get some CPU, it needs to be scheduled. If the BKL (big kernel lock) is held, it won't be scheduled until it is released.

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Jan Engelhardt
On Mar 7 2007 08:19, linux-os (Dick Johnson) wrote: > >Later versions of the kernel lock the kernel when an ioctl() is >entered. This means that if you sleep in the ioctl(), nothing >will get scheduled. Later versions of the kernel also have an ->unlocked_ioctl method, which is probably better

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread linux-os \(Dick Johnson\)
> > On 3/7/07, linux-os (Dick Johnson) <[EMAIL PROTECTED]> wrote: >> >> On Wed, 7 Mar 2007, Luong Ngo wrote: >> >>> Hi all, >>> >>> I am having this problem. I have a process with 2 threads created. One >>> of the thread will keep calling IOCTL to get information from the >>> kernel and will be

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Luong Ngo
Hi Dick, Thanks for your response. In my ioctl in the kernel, I use interruptible_sleep_on to sleep on a queue and will be wake up by the the ISR routine when interrupt happens, so isn't interruptible_sleep_on supposed to be interruptable, from its name? I am using kernel 2.6.14. Thanks again,

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Sergey Vlasov
On Tue, 6 Mar 2007 21:31:37 -0800 Luong Ngo wrote: > I am having this problem. I have a process with 2 threads created. One > of the thread will keep calling IOCTL to get information from the > kernel and will be blocked if there is no new information. If there is > information retured, the

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread linux-os \(Dick Johnson\)
On Wed, 7 Mar 2007, Luong Ngo wrote: > Hi all, > > I am having this problem. I have a process with 2 threads created. One > of the thread will keep calling IOCTL to get information from the > kernel and will be blocked if there is no new information. If there is > information retured, the

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread linux-os \(Dick Johnson\)
On Wed, 7 Mar 2007, Luong Ngo wrote: Hi all, I am having this problem. I have a process with 2 threads created. One of the thread will keep calling IOCTL to get information from the kernel and will be blocked if there is no new information. If there is information retured, the thread will

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Sergey Vlasov
On Tue, 6 Mar 2007 21:31:37 -0800 Luong Ngo wrote: I am having this problem. I have a process with 2 threads created. One of the thread will keep calling IOCTL to get information from the kernel and will be blocked if there is no new information. If there is information retured, the thread

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Luong Ngo
Hi Dick, Thanks for your response. In my ioctl in the kernel, I use interruptible_sleep_on to sleep on a queue and will be wake up by the the ISR routine when interrupt happens, so isn't interruptible_sleep_on supposed to be interruptable, from its name? I am using kernel 2.6.14. Thanks again,

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread linux-os \(Dick Johnson\)
On 3/7/07, linux-os (Dick Johnson) [EMAIL PROTECTED] wrote: On Wed, 7 Mar 2007, Luong Ngo wrote: Hi all, I am having this problem. I have a process with 2 threads created. One of the thread will keep calling IOCTL to get information from the kernel and will be blocked if there is no

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Jan Engelhardt
On Mar 7 2007 08:19, linux-os (Dick Johnson) wrote: Later versions of the kernel lock the kernel when an ioctl() is entered. This means that if you sleep in the ioctl(), nothing will get scheduled. Later versions of the kernel also have an -unlocked_ioctl method, which is probably better than

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Lee Revell
On 3/7/07, linux-os (Dick Johnson) [EMAIL PROTECTED] wrote: Interruptible_sleep_on is interruptible, but for your task to actually be awakened and your alarm handler to get some CPU, it needs to be scheduled. If the BKL (big kernel lock) is held, it won't be scheduled until it is released. You

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Luong Ngo
On 3/7/07, linux-os (Dick Johnson) [EMAIL PROTECTED] wrote: On 3/7/07, linux-os (Dick Johnson) [EMAIL PROTECTED] wrote: On Wed, 7 Mar 2007, Luong Ngo wrote: Hi all, I am having this problem. I have a process with 2 threads created. One of the thread will keep calling IOCTL to get

Re: Sleeping thread not receive signal until it wakes up

2007-03-07 Thread Luong Ngo
On 3/7/07, Lee Revell [EMAIL PROTECTED] wrote: On 3/7/07, linux-os (Dick Johnson) [EMAIL PROTECTED] wrote: Interruptible_sleep_on is interruptible, but for your task to actually be awakened and your alarm handler to get some CPU, it needs to be scheduled. If the BKL (big kernel lock) is

Sleeping thread not receive signal until it wakes up

2007-03-06 Thread Luong Ngo
Hi all, I am having this problem. I have a process with 2 threads created. One of the thread will keep calling IOCTL to get information from the kernel and will be blocked if there is no new information. If there is information retured, the thread will be checked to see if any error happens and

Sleeping thread not receive signal until it wakes up

2007-03-06 Thread Luong Ngo
Hi all, I am having this problem. I have a process with 2 threads created. One of the thread will keep calling IOCTL to get information from the kernel and will be blocked if there is no new information. If there is information retured, the thread will be checked to see if any error happens and