All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] ntb: Sleep in interrupt handling
@ 2017-06-01  9:17 Jia-Ju Bai
  2017-06-01 13:00   ` Allen Hubbe
  0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2017-06-01  9:17 UTC (permalink / raw)
  To: jdmason, dave.jiang, Allen.Hubbe; +Cc: linux-ntb, LKML

According to ntb_transport.c, the driver may sleep in interrupt handling.
The function call path is:
ntb_transport_rxc_db (tasklet_init indicates it handles interrupt)
   ntb_process_rxc
     ntb_async_rx
       ntb_async_rx_submit
         schedule_timeout --> may sleep

This bug is found by my static analysis tool and my code review.
I hope to fix it, but I do not have a good solution.

Thanks,
Jia-Ju Bai


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [BUG] ntb: Sleep in interrupt handling
  2017-06-01  9:17 [BUG] ntb: Sleep in interrupt handling Jia-Ju Bai
@ 2017-06-01 13:00   ` Allen Hubbe
  0 siblings, 0 replies; 3+ messages in thread
From: Allen Hubbe @ 2017-06-01 13:00 UTC (permalink / raw)
  To: 'Jia-Ju Bai', jdmason, dave.jiang; +Cc: linux-ntb, 'LKML'

From: Jia-Ju Bai 
> According to ntb_transport.c, the driver may sleep in interrupt handling.
> The function call path is:
> ntb_transport_rxc_db (tasklet_init indicates it handles interrupt)
>    ntb_process_rxc
>      ntb_async_rx
>        ntb_async_rx_submit
>          schedule_timeout --> may sleep
> 
> This bug is found by my static analysis tool and my code review.
> I hope to fix it, but I do not have a good solution.

Thanks! There is a recovery path if ntb_async_tx_submit fails.  It will do the transmission with memcpy instead of dma.  So, rather than retry in ntb_async_tx_submit, just fail to the recovery path.  Basically, replace the whole for(retries) loop with just txd = prep();  Would you like to work on the patch?

> 
> Thanks,
> Jia-Ju Bai



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [BUG] ntb: Sleep in interrupt handling
@ 2017-06-01 13:00   ` Allen Hubbe
  0 siblings, 0 replies; 3+ messages in thread
From: Allen Hubbe @ 2017-06-01 13:00 UTC (permalink / raw)
  To: 'Jia-Ju Bai', jdmason, dave.jiang; +Cc: linux-ntb, 'LKML'

From: Jia-Ju Bai 
> According to ntb_transport.c, the driver may sleep in interrupt handling.
> The function call path is:
> ntb_transport_rxc_db (tasklet_init indicates it handles interrupt)
>    ntb_process_rxc
>      ntb_async_rx
>        ntb_async_rx_submit
>          schedule_timeout --> may sleep
> 
> This bug is found by my static analysis tool and my code review.
> I hope to fix it, but I do not have a good solution.

Thanks! There is a recovery path if ntb_async_tx_submit fails.  It will do the transmission with memcpy instead of dma.  So, rather than retry in ntb_async_tx_submit, just fail to the recovery path.  Basically, replace the whole for(retries) loop with just txd = prep();  Would you like to work on the patch?

> 
> Thanks,
> Jia-Ju Bai

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-01 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-01  9:17 [BUG] ntb: Sleep in interrupt handling Jia-Ju Bai
2017-06-01 13:00 ` Allen Hubbe
2017-06-01 13:00   ` Allen Hubbe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.