Re: side effects of calling interruptible_sleep_on_timeout()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/25/2012 03:36 AM, Philipp Ittershagen wrote:

> Hi Devendra,
> 
> On Tue, Apr 24, 2012 at 03:24:23PM +0530, devendra rawat wrote:
>>    Hi,
>>    A switch driver is causing soft lockup on Montavista Linux Kernel
>>    2.6.10 system.
>>    While browsing through the code of the driver. I came across a snippet
>>    where after disabling the interrupts
>>    a call is made to interruptible_sleep_on_timeout().
>>    The code snippet is like
>>    cli();
>>    init_waitqueue_head(&queue);
>>            interruptible_sleep_on_timeout(&queue, USEC_TO_JIFFIES(usec));
>>            thread_check_signals();
>>    sti();
>>    I need to know the side effect of this sort of code, can it be
>>    responsible for the softlockup of the system ? Its a PowerPC based
>>    system.
> 
> you cannot call sleep functions after disabling interrupts, because no
> interrupt will arrive for the scheduler to see the timeout and resume your
> task.
> 


Yes, that's right. Also, in general, sleeping inside atomic sections (eg.,
sections with interrupts disabled or preempt disabled) is wrong. There is a
config option in the kernel that you can use to enable
sleep-inside-atomic-section-checking (CONFIG_DEBUG_ATOMIC_SLEEP I believe),
which can help you pin-point such bugs easily.
 
Regards,
Srivatsa S. Bhat


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux