From: Yang Yingliang <yangyingliang@huawei.com>
To: Christoph Hellwig <hch@lst.de>
Cc: <linux-kernel@vger.kernel.org>, <target-devel@vger.kernel.org>,
<linux-scsi@vger.kernel.org>, <james.smart@broadcom.com>,
<martin.petersen@oracle.com>
Subject: Re: [PATCH -next] scsi: efct: Use GFP_ATOMIC under spin lock
Date: Thu, 23 Dec 2021 11:56:08 +0800 [thread overview]
Message-ID: <44ff658e-4a00-ee5b-1f84-fa89f9b9291f@huawei.com> (raw)
In-Reply-To: <20211221142859.GA30187@lst.de>
On 2021/12/21 22:28, Christoph Hellwig wrote:
> On Tue, Dec 21, 2021 at 07:37:06PM +0800, Yang Yingliang wrote:
>> A spin lock is taken here so we should use GFP_ATOMIC.
>>
>> Fixes: efac162a4e4d ("scsi: efct: Don't pass GFP_DMA to dma_alloc_coherent()")
> No, it does not fix that commit. The driver did sleeping allocations
> even before the commit.
>
> But wher is "here"? Can we look into not holding that lock over an
> allocation if it is preferable? If not we should at least pass down
> the gfp_flags so that only the caller(s) that can't sleep pass GFP_ATOMIC.
According the comment of els_ios_lock, it's used to protect els ios
list, I think we
can move down the spin lock like this:
--- a/drivers/scsi/elx/libefc/efc_els.c
+++ b/drivers/scsi/elx/libefc/efc_els.c
@@ -46,8 +46,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32
reqlen, u32 rsplen)
efc = node->efc;
- spin_lock_irqsave(&node->els_ios_lock, flags);
-
if (!node->els_io_enabled) {
efc_log_err(efc, "els io alloc disabled\n");
spin_unlock_irqrestore(&node->els_ios_lock, flags);
@@ -88,6 +86,8 @@ efc_els_io_alloc_size(struct efc_node *node, u32
reqlen, u32 rsplen)
els = NULL;
}
+ spin_lock_irqsave(&node->els_ios_lock, flags);
+
if (els) {
/* initialize fields */
els->els_retries_remaining = EFC_FC_ELS_DEFAULT_RETRIES;
next prev parent reply other threads:[~2021-12-23 3:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-21 11:37 Yang Yingliang
2021-12-21 14:28 ` Christoph Hellwig
2021-12-23 3:56 ` Yang Yingliang [this message]
2022-01-10 8:54 ` Christoph Hellwig
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=44ff658e-4a00-ee5b-1f84-fa89f9b9291f@huawei.com \
--to=yangyingliang@huawei.com \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=target-devel@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
all inboxes | Powered by JetHome®