Skip to contentSkip to conversation

dmaengine: idxd: support reporting of halt interrupt

bug report Dan Carpenter 1 participant 1 message Aug 24, 2021 dmaengine

lore
Share & tools
lore
#0 lore raw

Hello Dave Jiang,

The patch 5b0c68c473a1: "dmaengine: idxd: support reporting of halt interrupt" from Apr 20, 2021, leads to the following Smatch static checker warning:

	drivers/dma/idxd/device.c:431 idxd_wq_quiesce()
	warn: sleeping in atomic context

drivers/dma/idxd/device.c

    428 void idxd_wq_quiesce(struct idxd_wq *wq)
    429 {
    430 	percpu_ref_kill(&wq->wq_active);
--> 431 	wait_for_completion(&wq->wq_dead);
    432 	percpu_ref_exit(&wq->wq_active);
    433 }

The call tree is:

process_misc_interrupts() <- disables preempt
-> idxd_wqs_quiesce()
-> idxd_wq_quiesce()

drivers/dma/idxd/irq.c
124 gensts.bits = ioread32(idxd->reg_base + IDXD_GENSTATS_OFFSET);
125 if (gensts.state == IDXD_DEVICE_STATE_HALT) {
126 idxd->state = IDXD_DEV_HALTED;
127 if (gensts.reset_type == IDXD_DEVICE_RESET_SOFTWARE) {
128 /*

   129                           * If we need a software reset, we will throw the work
   130                           * on a system workqueue in order to allow interrupts
   131                           * for the device command completions.
   132                           */
   133                          INIT_WORK(&idxd->work, idxd_device_reinit);
   134                          queue_work(idxd->wq, &idxd->work);
   135                  } else {
   136                          spin_lock_bh(&idxd->dev_lock);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Maybe take this spinlock later?

   137                          idxd_wqs_quiesce(idxd);
                                ^^^^^^^^^^^^^^^^^^^^^^

Sleeps.

   138                          idxd_wqs_unmap_portal(idxd);
   139                          idxd_device_clear_state(idxd);
   140                          dev_err(&idxd->pdev->dev,
   141                                  "idxd halted, need %s.\n",
   142                                  gensts.reset_type == IDXD_DEVICE_RESET_FLR ?
   143                                  "FLR" : "system reset");

144 spin_unlock_bh(&idxd->dev_lock);
145 return -ENXIO;
146 }
147 }
148
149 return 0;

regards,
dan carpenter