Re: Query on workqueue

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

 



If you have to wait for the IRQ to be finished, do NOT use work queue, which belongs to bottom half. Just write your own IRQ handler, do sth there and register your handler.

-daveti


> On Jan 13, 2015, at 8:51 AM, Victor Ascroft <victorascroft@xxxxxxxxx> wrote:
> 
> Hello,
> 
> Is it ok to use wait_for_completion in a workqueue? 
> 
> static void my_work(struct work_struct *work)
> {
> 
> 	while (true)
> 	{
> 		wait_for_completion(completion);
> 		
> 		// Do something here
> 
> 		reinit_completion(completion);
> 		enable_irq(irq);
> 	}
> }
> 
> static irqreturn_t my_irq_handler(int irq, void *dev)
> {
> 	disable_irq(irq);
> 
> 	complete(completion);
> 
> 	return IRQ_HANDLED;
> }
> 
> Something like the above is what I have. Is it a correct way to 
> do things or complete idiotic brainfart. Workqueues can sleep so
> I thought of the above code, but, was not sure.
> 
> And I am not using _interruptible or _interruptible_timeout because
> I absolutely want it to wait for the IRQ. Now as such though this 
> works I get stack traces with hung task complaining and I have
> to set /proc/sys/kernel/hung_task_timeout_secs to 0. And were the IRQ
> not generated I do get NMI watchdog hang.
> 
> I will accept I have only little knowledge of these things.
> 
> Regards,
> Victor.
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


_______________________________________________
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