public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: dave.jiang@intel.com
Cc: dmaengine@vger.kernel.org
Subject: [bug report] dmaengine: idxd: support reporting of halt interrupt
Date: Tue, 24 Aug 2021 16:24:07 +0300	[thread overview]
Message-ID: <20210824132407.GA6072@kili> (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

                 reply	other threads:[~2021-08-24 13:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210824132407.GA6072@kili \
    --to=dan.carpenter@oracle.com \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox