Skip to contentSkip to conversation

ibmvscsi: use GFP_KERNEL with dma_alloc_coherent in initialize_event_pool

PATCH Applied Tyrel Datwyler 5 participants 7 messages Jan 10, 2019 – Oct 21, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ibmvscsi: use GFP_KERNEL with dma_alloc_coherent in initialize_event_pool

During driver probe we allocate a dma region for our event pool. Currently, zero is passed for the gfp_flags parameter. Driver probe callbacks run in process context and we hold no locks so we can sleep here if necessary.

Fix by passing GFP_KERNEL explicitly to dma_alloc_coherent().

---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ibmvscsi/ibmvscsi.c +1 -1
index cb8535e..10d5e77 100644
@@ -465,7 +465,7 @@ static int initialize_event_pool(struct event_pool *pool,
 	pool->iu_storage =
 	    dma_alloc_coherent(hostdata->dev,
 			       pool->size * sizeof(*pool->iu_storage),
-			       &pool->iu_token, 0);
+			       &pool->iu_token, GFP_KERNEL);
 	if (!pool->iu_storage) {
 		kfree(pool->events);
 		return -ENOMEM;
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Tyrel Datwyler

During driver probe we allocate a dma region for our event pool. Currently, zero is passed for the gfp_flags parameter. Driver probe callbacks run in process context and we hold no locks so we can sleep here if necessary.

Fix by passing GFP_KERNEL explicitly to dma_alloc_coherent().

---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ibmvscsi/ibmvscsi.c +0 -0
index cb8535e..10d5e77 100644

drivers/scsi/ibmvscsi/ibmvscsi.c static int initialize_event_pool(struct event_pool *pool, · line 471

Quoted 8 lines
drivers/scsi/ibmvscsi/ibmvscsi.c +1 -1
@@ -465,7 +465,7 @@ static int initialize_event_pool(struct event_pool *pool,
 	pool->iu_storage =
 	    dma_alloc_coherent(hostdata->dev,
 			       pool->size * sizeof(*pool->iu_storage),
-			       &pool->iu_token, 0);
+			       &pool->iu_token, GFP_KERNEL);
 	if (!pool->iu_storage) {
 		kfree(pool->events);
 		return -ENOMEM;
Signature · 3 lines
Brian King
Power Linux I/O
IBM Linux Technology Center
maintainer
#2 lore raw
In reply to Tyrel Datwyler

Just stumbled upon this trivial little patch that looks to have gotten lost in the shuffle. Seems it even got a reviewed-by from Brian [1].

So, uh I guess after almost 3 years...ping?

-Tyrel

[1]
https://yhbt.net/lore/all/[email protected]/

Quoted 26 lines · Tyrel Datwyler

During driver probe we allocate a dma region for our event pool. Currently, zero is passed for the gfp_flags parameter. Driver probe callbacks run in process context and we hold no locks so we can sleep here if necessary.

Fix by passing GFP_KERNEL explicitly to dma_alloc_coherent().

---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ibmvscsi/ibmvscsi.c +1 -1
index cb8535e..10d5e77 100644
@@ -465,7 +465,7 @@ static int initialize_event_pool(struct event_pool *pool,
 	pool->iu_storage =
 	    dma_alloc_coherent(hostdata->dev,
 			       pool->size * sizeof(*pool->iu_storage),
-			       &pool->iu_token, 0);
+			       &pool->iu_token, GFP_KERNEL);
 	if (!pool->iu_storage) {
 		kfree(pool->events);
 		return -ENOMEM;
#3 lore raw
Quoted 4 lines · Tyrel Datwyler

Just stumbled upon this trivial little patch that looks to have gotten lost in the shuffle. Seems it even got a reviewed-by from Brian [1].

So, uh I guess after almost 3 years...ping?

It's marked "Changes Requested" here:

https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/

If it isn't picked up in a few days you should probably do a resend so that it reappears in patchwork.

cheers

maintainer
#4 lore raw
Quoted 9 lines · Michael Ellerman
Quoted 4 lines · Tyrel Datwyler

Just stumbled upon this trivial little patch that looks to have gotten lost in the shuffle. Seems it even got a reviewed-by from Brian [1].

So, uh I guess after almost 3 years...ping?

It's marked "Changes Requested" here:

https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/

Interesting

Quoted 4 lines

If it isn't picked up in a few days you should probably do a resend so that it reappears in patchwork.

Fair enough

-Tyrel

Quoted 3 lines

cheers

#6 lore raw
In reply to Tyrel Datwyler
Quoted 8 lines · Tyrel Datwyler

During driver probe we allocate a dma region for our event pool. Currently, zero is passed for the gfp_flags parameter. Driver probe callbacks run in process context and we hold no locks so we can sleep here if necessary.

Fix by passing GFP_KERNEL explicitly to dma_alloc_coherent().

[...]

Applied to 5.16/scsi-queue, thanks!

[1/1] ibmvscsi: use GFP_KERNEL with dma_alloc_coherent in initialize_event_pool

      https://git.kernel.org/mkp/scsi/c/3319a8ba82b9
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering