All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: suravee.suthikulpanit@amd.com
Cc: iommu@lists.linux-foundation.org
Subject: [bug report] iommu/amd: Improve amd_iommu_v2_exit()
Date: Wed, 9 Mar 2022 15:52:39 +0300	[thread overview]
Message-ID: <20220309125239.GA11530@kili> (raw)

Hello Suravee Suthikulpanit,

The patch d46c04558fdd: "iommu/amd: Improve amd_iommu_v2_exit()" from
Mar 1, 2022, leads to the following Smatch static checker warning:

	drivers/iommu/amd/iommu_v2.c:133 free_device_state()
	warn: sleeping in atomic context

drivers/iommu/amd/iommu_v2.c
   955        static void __exit amd_iommu_v2_exit(void)
   956        {
   957                struct device_state *dev_state, *next;
   958                unsigned long flags;
   959
   960                if (!amd_iommu_v2_supported())
   961                        return;
   962
   963                amd_iommu_unregister_ppr_notifier(&ppr_nb);
   964
   965                flush_workqueue(iommu_wq);
   966
   967                /*
   968                 * The loop below might call flush_workqueue(), so call
   969                 * destroy_workqueue() after it
   970                 */
   971                spin_lock_irqsave(&state_lock, flags);

Holding a spin lock.

   972
   973                list_for_each_entry_safe(dev_state, next, &state_list, list) {
   974                        WARN_ON_ONCE(1);
   975
   976                        put_device_state(dev_state);
   977                        list_del(&dev_state->list);
   978                        free_device_state(dev_state);

Calling a sleeping function (wait_event()).

   979                }
   980
   981                spin_unlock_irqrestore(&state_lock, flags);
   982
   983                destroy_workqueue(iommu_wq);
   984        }

regards,
dan carpenter
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

                 reply	other threads:[~2022-03-09 12:53 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=20220309125239.GA11530@kili \
    --to=dan.carpenter@oracle.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=suravee.suthikulpanit@amd.com \
    /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 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.