public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: gaurav.srivastava@broadcom.com
Cc: linux-scsi@vger.kernel.org, James Smart <james.smart@broadcom.com>
Subject: [bug report] scsi: lpfc: vmid: Introduce VMID in I/O path
Date: Fri, 18 Feb 2022 10:46:13 +0300	[thread overview]
Message-ID: <20220218074613.GA10308@kili> (raw)

Hello Gaurav Srivastava,

The patch 33c79741deaf: "scsi: lpfc: vmid: Introduce VMID in I/O
path" from Jun 8, 2021, leads to the following Smatch static checker
warning:

	mm/percpu.c:1949 __alloc_percpu()
	warn: sleeping in atomic context

drivers/scsi/lpfc/lpfc_scsi.c
  5510                        vmp->io_rd_cnt = 0;
  5511                        vmp->io_wr_cnt = 0;
  5512                        vmp->flag = LPFC_VMID_SLOT_USED;
  5513
  5514                        vmp->delete_inactive =
  5515                                vport->vmid_inactivity_timeout ? 1 : 0;
  5516
  5517                        /* if type priority tag, get next available VMID */
  5518                        if (lpfc_vmid_is_type_priority_tag(vport))
  5519                                lpfc_vmid_assign_cs_ctl(vport, vmp);
  5520
  5521                        /* allocate the per cpu variable for holding */
  5522                        /* the last access time stamp only if VMID is enabled */
  5523                        if (!vmp->last_io_time)
  5524                                vmp->last_io_time = __alloc_percpu(sizeof(u64),
                                                          ^^^^^^^^^^^^^^
This allocation sleeps.  A non-sleeping alternative is __alloc_percpu_gfp().

  5525                                                                   __alignof__(struct
  5526                                                                   lpfc_vmid));
  5527                        if (!vmp->last_io_time) {
  5528                                hash_del(&vmp->hnode);
  5529                                vmp->flag = LPFC_VMID_SLOT_FREE;
  5530                                write_unlock(&vport->vmid_lock);
  5531                                return -EIO;
  5532                        }
  5533
  5534                        write_unlock(&vport->vmid_lock);
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We're holding a write lock.

regards,
dan carpenter

                 reply	other threads:[~2022-02-18  7:46 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=20220218074613.GA10308@kili \
    --to=dan.carpenter@oracle.com \
    --cc=gaurav.srivastava@broadcom.com \
    --cc=james.smart@broadcom.com \
    --cc=linux-scsi@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