linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: umalhi@cisco.com
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] IB/usnic: Add Cisco VIC low-level hardware driver
Date: Wed, 4 Aug 2021 12:08:10 +0300	[thread overview]
Message-ID: <20210804090810.GA6406@kili> (raw)

[ This is an ancient bug, but the bug is clear to see, but unfortunately
  it's probably less easy to fix.  - dan ]

Hello Upinder Malhi,

The patch e3cf00d0a87f: "IB/usnic: Add Cisco VIC low-level hardware
driver" from Sep 10, 2013, leads to the following static checker
warning:

	fs/kernfs/dir.c:476 kernfs_drain()
	warn: sleeping in atomic context

drivers/infiniband/hw/usnic/usnic_ib_verbs.c
   190          if (usnic_ib_share_vf) {
   191                  /* Try to find resouces on a used vf which is in pd */
   192                  dev_list = usnic_uiom_get_dev_list(pd->umem_pd);
   193                  if (IS_ERR(dev_list))
   194                          return ERR_CAST(dev_list);
   195                  for (i = 0; dev_list[i]; i++) {
   196                          dev = dev_list[i];
   197                          vf = dev_get_drvdata(dev);
   198                          spin_lock(&vf->lock);
                                ^^^^^^^^^^^^^^^^^^^^^
We're holding a spin lock.

   199                          vnic = vf->vnic;
   200                          if (!usnic_vnic_check_room(vnic, res_spec)) {
   201                                  usnic_dbg("Found used vnic %s from %s\n",
   202                                                  dev_name(&us_ibdev->ib_dev.dev),
   203                                                  pci_name(usnic_vnic_get_pdev(
   204                                                                          vnic)));
   205                                  qp_grp = usnic_ib_qp_grp_create(us_ibdev->ufdev,
                                                 ^^^^^^^^^^^^^^^^^^^^^^
The create function calls usnic_ib_sysfs_qpn_add() which does a
kobject_init_and_add().  Unfortunately kobject allocations have many
sleeps inside them so it can't be done while holding a spinlock.

Same thing for the other usnic_ib_qp_grp_create() later on in the same
function.

   206                                                                  vf, pd,
   207                                                                  res_spec,
   208                                                                  trans_spec);
   209  
   210                                  spin_unlock(&vf->lock);
   211                                  goto qp_grp_check;
   212                          }
   213                          spin_unlock(&vf->lock);
   214  
   215                  }
   216                  usnic_uiom_free_dev_list(dev_list);
   217                  dev_list = NULL;
   218          }

regards,
dan carpenter


             reply	other threads:[~2021-08-04  9:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  9:08 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-07-05 10:23 [bug report] IB/usnic: Add Cisco VIC low-level hardware driver Dan Carpenter
2021-07-05 13:47 ` Robin Murphy
2021-07-05 15:21   ` Jason Gunthorpe
2021-07-05 15:39     ` Robin Murphy
2021-07-05 15:45     ` Dan Carpenter
2017-10-12 12:57 Dan Carpenter

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=20210804090810.GA6406@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=umalhi@cisco.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 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).