From: Brian King <brking@linux.vnet.ibm.com>
To: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
james.bottomley@hansenpartnership.com
Cc: stable@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-scsi@vger.kernel.org, martin.petersen@oracle.com
Subject: Re: [PATCH] ibmvscsi: use GFP_ATOMIC with dma_alloc_coherent in map_sg_data
Date: Thu, 10 Jan 2019 08:56:45 -0600 [thread overview]
Message-ID: <e508178b-4dab-802b-2e36-5a7ebfa226ef@linux.vnet.ibm.com> (raw)
In-Reply-To: <1547089136-20264-1-git-send-email-tyreld@linux.vnet.ibm.com>
On 01/09/2019 08:58 PM, Tyrel Datwyler wrote:
> While mapping DMA for scatter list when a scsi command is queued the
> existing call to dma_alloc_coherent() in our map_sg_data() function
> passes zero for the gfp_flags parameter. We are most definitly in atomic
> context at this point as queue_command() is called in softirq context
> and further we have a spinlock holding the scsi host lock.
>
> Fix this by passing GFP_ATOMIC to dma_alloc_coherent() to prevent any
> sort of sleeping in atomic context deadlock.
>
> Fixes: 4dddbc26c389 ("[SCSI] ibmvscsi: handle large scatter/gather lists")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
> ---
> drivers/scsi/ibmvscsi/ibmvscsi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
> index 1135e74..cb8535e 100644
> --- a/drivers/scsi/ibmvscsi/ibmvscsi.c
> +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
> @@ -731,7 +731,7 @@ static int map_sg_data(struct scsi_cmnd *cmd,
> evt_struct->ext_list = (struct srp_direct_buf *)
> dma_alloc_coherent(dev,
> SG_ALL * sizeof(struct srp_direct_buf),
> - &evt_struct->ext_list_token, 0);
> + &evt_struct->ext_list_token, GFP_ATOMIC);
> if (!evt_struct->ext_list) {
> if (!firmware_has_feature(FW_FEATURE_CMO))
> sdev_printk(KERN_ERR, cmd->device,
>
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
--
Brian King
Power Linux I/O
IBM Linux Technology Center
next prev parent reply other threads:[~2019-01-10 14:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 2:58 [PATCH] ibmvscsi: use GFP_ATOMIC with dma_alloc_coherent in map_sg_data Tyrel Datwyler
2019-01-10 14:56 ` Brian King [this message]
2019-01-10 15:07 ` Christoph Hellwig
2019-01-10 20:11 ` Tyrel Datwyler
2019-01-11 18:24 ` Christoph Hellwig
2019-01-10 23:15 ` Tyrel Datwyler
2019-01-11 18:27 ` 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=e508178b-4dab-802b-2e36-5a7ebfa226ef@linux.vnet.ibm.com \
--to=brking@linux.vnet.ibm.com \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.petersen@oracle.com \
--cc=stable@vger.kernel.org \
--cc=tyreld@linux.vnet.ibm.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).