From: John Garry <john.garry@huawei.com>
To: Vaishali Thakkar <vaishali.thakkar@oracle.com>,
<jejb@linux.vnet.ibm.com>
Cc: <linux-kernel@vger.kernel.org>, <martin.petersen@oracle.com>,
<linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] [SCSI] wd719x: Avoid calling request_firmware under spinlock
Date: Thu, 15 Sep 2016 15:14:25 +0100 [thread overview]
Message-ID: <5c68b70f-e20e-08e4-66f9-2090806b0078@huawei.com> (raw)
In-Reply-To: <b71b38ff-f0d0-83c6-6066-195180b08ea0@huawei.com>
On 15/09/2016 15:08, John Garry wrote:
> On 15/09/2016 14:48, Vaishali Thakkar wrote:
>> It is preferrable to use request_firmware where sleeping is
>> allowed. Using it under spinlock can cause blocking. Here,
>> the function wd719x_chip_init calls request_firmware while
>> holding a spinlock. So, let's access it outside the spinlock.
>>
>> Coccinelle is used to detect the issue.
>>
>> Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
>> ---
>> Please note that the patch is compile-tested only. And this change
>> may require driver testing.
>> ---
>> drivers/scsi/wd719x.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
>> index e3da1a2..b8e57f3 100644
>> --- a/drivers/scsi/wd719x.c
>> +++ b/drivers/scsi/wd719x.c
>> @@ -518,13 +518,14 @@ static int wd719x_host_reset(struct scsi_cmnd *cmd)
>> int result;
>>
>> dev_info(&wd->pdev->dev, "host reset requested\n");
>> - spin_lock_irqsave(wd->sh->host_lock, flags);
>> +
>
> In the version of code I have flags is only used for this spinlock, so
> can flags be removed?
I see we're just relocating the spinlock, so ignore me
>
>> /* Try to reinit the RISC */
>> if (wd719x_chip_init(wd) == 0)
>> result = SUCCESS;
>> else
>> result = FAILED;
>>
>> + spin_lock_irqsave(wd->sh->host_lock, flags);
>> /* flush all SCBs */
>> list_for_each_entry_safe(scb, tmp, &wd->active_scbs, list) {
>> struct scsi_cmnd *tmp_cmd = scb->cmd;
>>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> .
>
prev parent reply other threads:[~2016-09-15 14:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 13:48 Vaishali Thakkar
2016-09-15 14:08 ` John Garry
2016-09-15 14:14 ` John Garry [this message]
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=5c68b70f-e20e-08e4-66f9-2090806b0078@huawei.com \
--to=john.garry@huawei.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=vaishali.thakkar@oracle.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
all inboxes | Powered by JetHome®