dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] dmaengine: idxd: support reporting of halt interrupt
@ 2021-08-24 13:24 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-08-24 13:24 UTC (permalink / raw)
  To: dave.jiang; +Cc: dmaengine

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-24 13:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 13:24 [bug report] dmaengine: idxd: support reporting of halt interrupt Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).