Skip to contentSkip to conversation

megaraid_sas: silence a warning

PATCH Superseded Tomas Henzl 3 participants 5 messages Jan 31, 2020 – Feb 3, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 megaraid_sas: silence a warning

Add a flag to dma mem allocation to silence a warning.

---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +3 -2
index 0f5399b3e..1fa2d1449 100644
@@ -606,7 +606,8 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 
 	fusion->io_request_frames =
 			dma_pool_alloc(fusion->io_request_frames_pool,
-				GFP_KERNEL, &fusion->io_request_frames_phys);
+				GFP_KERNEL | __GFP_NOWARN,
+				&fusion->io_request_frames_phys);
 	if (!fusion->io_request_frames) {
 		if (instance->max_fw_cmds >= (MEGASAS_REDUCE_QD_COUNT * 2)) {
 			instance->max_fw_cmds -= MEGASAS_REDUCE_QD_COUNT;
@@ -644,7 +645,7 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 
 		fusion->io_request_frames =
 			dma_pool_alloc(fusion->io_request_frames_pool,
-				       GFP_KERNEL,
+				       GFP_KERNEL | __GFP_NOWARN,
 				       &fusion->io_request_frames_phys);
 
 		if (!fusion->io_request_frames) {
Signature · 1 line
2.21.1
#1 lore raw
Quoted 23 lines · Tomas Henzl

Add a flag to dma mem allocation to silence a warning.

---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +2 -1
index 0f5399b3e..1fa2d1449 100644
@@ -606,7 +606,8 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 
 	fusion->io_request_frames =
 			dma_pool_alloc(fusion->io_request_frames_pool,
-				GFP_KERNEL, &fusion->io_request_frames_phys);
+				GFP_KERNEL | __GFP_NOWARN,
+				&fusion->io_request_frames_phys);
 	if (!fusion->io_request_frames) {
 		if (instance->max_fw_cmds >= (MEGASAS_REDUCE_QD_COUNT * 2)) {
 			instance->max_fw_cmds -= MEGASAS_REDUCE_QD_COUNT;

drivers/scsi/megaraid/megaraid_sas_fusion.c megasas_alloc_request_fusion(struct megasas_instance *instance) · line 651

Quoted 8 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +1 -1
@@ -644,7 +645,7 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 open-isns-updates.diff.bz2
 		fusion->io_request_frames =
 			dma_pool_alloc(fusion->io_request_frames_pool,
-				       GFP_KERNEL,
+				       GFP_KERNEL | __GFP_NOWARN,
 				       &fusion->io_request_frames_phys);
 
 		if (!fusion->io_request_frames) {

I'm fairly sure this is a good fix, but I'd appreciate more information in the comment, such as what warning was silenced, and why it's okay to silence it rather than "fix" it. I know from experience that, when choosing which commits to backport, more information is better than less.

Signature · 1 line
Lee Duncan
maintainer
#2 lore raw
Quoted 31 lines · Lee Duncan
Quoted 29 lines · Tomas Henzl

Add a flag to dma mem allocation to silence a warning.

---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +3 -2
index 0f5399b3e..1fa2d1449 100644
@@ -606,7 +606,8 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 
      fusion->io_request_frames =
                      dma_pool_alloc(fusion->io_request_frames_pool,
-                             GFP_KERNEL, &fusion->io_request_frames_phys);
+                             GFP_KERNEL | __GFP_NOWARN,
+                             &fusion->io_request_frames_phys);
      if (!fusion->io_request_frames) {
              if (instance->max_fw_cmds >= (MEGASAS_REDUCE_QD_COUNT * 2)) {
                      instance->max_fw_cmds -= MEGASAS_REDUCE_QD_COUNT;
@@ -644,7 +645,7 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 open-isns-updates.diff.bz2
              fusion->io_request_frames =
                      dma_pool_alloc(fusion->io_request_frames_pool,
-                                    GFP_KERNEL,
+                                    GFP_KERNEL | __GFP_NOWARN,
                                     &fusion->io_request_frames_phys);
 
Quoted 7 lines

drivers/scsi/megaraid/megaraid_sas_fusion.c megasas_alloc_request_fusion(struct megasas_instance *instance) · line 651

Quoted 2 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +0 -0
              if (!fusion->io_request_frames) {

I'm fairly sure this is a good fix, but I'd appreciate more information in the comment, such as what warning was silenced, and why it's okay to silence it rather than "fix" it. I know from experience that, when choosing which commits to backport, more information is better than less.

This code allocates DMA memory for driver's IO frames which may exceed MAX_ORDER pages for few
megaraid_sas controllers(controllers with High Queue Depth). So there is logic to keep on reducing controller
Queue Depth until DMA memory required for IO frames fits within MAX_ORDER. So or impacted megaraid_sas controllers,
there would be multiple DMA allocation failure until driver settles down to Controller Queue Depth which has memory requirement within MAX_ORDER. These failed DMA allocation requests causes stack traces in system logs which is not harmful and this patch would silence those warnings/stack traces.

With CMA (Contiguous Memory Allocator) enabled, it's possible to allocate DMA memory exceeding MAX_ORDER.
And that is the reason of keeping this retry logic with less controller Queue Depth instead of calculating controller Queue depth at first hand which has memory requirement less than MAX_ORDER.

Thanks,
Sumit

Quoted 3 lines

--
Lee Duncan

#3 lore raw
Quoted 51 lines · Sumit Saxena
Quoted 31 lines · Lee Duncan
Quoted 29 lines · Tomas Henzl

Add a flag to dma mem allocation to silence a warning.

---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +3 -2
index 0f5399b3e..1fa2d1449 100644
@@ -606,7 +606,8 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 
      fusion->io_request_frames =
                      dma_pool_alloc(fusion->io_request_frames_pool,
-                             GFP_KERNEL, &fusion->io_request_frames_phys);
+                             GFP_KERNEL | __GFP_NOWARN,
+                             &fusion->io_request_frames_phys);
      if (!fusion->io_request_frames) {
              if (instance->max_fw_cmds >= (MEGASAS_REDUCE_QD_COUNT * 2)) {
                      instance->max_fw_cmds -= MEGASAS_REDUCE_QD_COUNT;
@@ -644,7 +645,7 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 open-isns-updates.diff.bz2
              fusion->io_request_frames =
                      dma_pool_alloc(fusion->io_request_frames_pool,
-                                    GFP_KERNEL,
+                                    GFP_KERNEL | __GFP_NOWARN,
                                     &fusion->io_request_frames_phys);
 
Quoted 7 lines

drivers/scsi/megaraid/megaraid_sas_fusion.c megasas_alloc_request_fusion(struct megasas_instance *instance) · line 651

Quoted 2 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +0 -0
              if (!fusion->io_request_frames) {

I'm fairly sure this is a good fix, but I'd appreciate more information in the comment, such as what warning was silenced, and why it's okay to silence it rather than "fix" it. I know from experience that, when choosing which commits to backport, more information is better than less.

This code allocates DMA memory for driver's IO frames which may exceed MAX_ORDER pages for few
megaraid_sas controllers(controllers with High Queue Depth). So there is logic to keep on reducing controller
Queue Depth until DMA memory required for IO frames fits within MAX_ORDER. So or impacted megaraid_sas controllers,
there would be multiple DMA allocation failure until driver settles down to Controller Queue Depth which has memory requirement within MAX_ORDER. These failed DMA allocation requests causes stack traces in system logs which is not harmful and this patch would silence those warnings/stack traces.

Quoted 5 lines

With CMA (Contiguous Memory Allocator) enabled, it's possible to allocate DMA memory exceeding MAX_ORDER.
And that is the reason of keeping this retry logic with less controller Queue Depth instead of calculating controller Queue depth at first hand which has memory requirement less than MAX_ORDER.

Thank you Sumit for writing it down.
An over-sized allocation failure is sanitized in a proper way. The warning may hide other allocation warnings in other parts of kernel as it is printed only once.

I could have written more vecasue I've underestimated it and I'm sorry for that.

Tomas

Quoted 6 lines

Thanks,
Sumit

Quoted 3 lines

--
Lee Duncan

#4 lore raw
Quoted 63 lines · Tomas Henzl
Quoted 51 lines · Sumit Saxena
Quoted 31 lines · Lee Duncan
Quoted 29 lines · Tomas Henzl

Add a flag to dma mem allocation to silence a warning.

---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +3 -2
index 0f5399b3e..1fa2d1449 100644
@@ -606,7 +606,8 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 
      fusion->io_request_frames =
                      dma_pool_alloc(fusion->io_request_frames_pool,
-                             GFP_KERNEL, &fusion->io_request_frames_phys);
+                             GFP_KERNEL | __GFP_NOWARN,
+                             &fusion->io_request_frames_phys);
      if (!fusion->io_request_frames) {
              if (instance->max_fw_cmds >= (MEGASAS_REDUCE_QD_COUNT * 2)) {
                      instance->max_fw_cmds -= MEGASAS_REDUCE_QD_COUNT;
@@ -644,7 +645,7 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
 open-isns-updates.diff.bz2
              fusion->io_request_frames =
                      dma_pool_alloc(fusion->io_request_frames_pool,
-                                    GFP_KERNEL,
+                                    GFP_KERNEL | __GFP_NOWARN,
                                     &fusion->io_request_frames_phys);
 
Quoted 7 lines

drivers/scsi/megaraid/megaraid_sas_fusion.c megasas_alloc_request_fusion(struct megasas_instance *instance) · line 651

Quoted 2 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +0 -0
              if (!fusion->io_request_frames) {

I'm fairly sure this is a good fix, but I'd appreciate more information in the comment, such as what warning was silenced, and why it's okay to silence it rather than "fix" it. I know from experience that, when choosing which commits to backport, more information is better than less.

This code allocates DMA memory for driver's IO frames which may exceed MAX_ORDER pages for few
megaraid_sas controllers(controllers with High Queue Depth). So there is logic to keep on reducing controller
Queue Depth until DMA memory required for IO frames fits within MAX_ORDER. So or impacted megaraid_sas controllers,
there would be multiple DMA allocation failure until driver settles down to Controller Queue Depth which has memory requirement within MAX_ORDER. These failed DMA allocation requests causes stack traces in system logs which is not harmful and this patch would silence those warnings/stack traces.

Quoted 5 lines

With CMA (Contiguous Memory Allocator) enabled, it's possible to allocate DMA memory exceeding MAX_ORDER.
And that is the reason of keeping this retry logic with less controller Queue Depth instead of calculating controller Queue depth at first hand which has memory requirement less than MAX_ORDER.

Thank you Sumit for writing it down.
An over-sized allocation failure is sanitized in a proper way. The warning may hide other allocation warnings in other parts of kernel as it is printed only once.

Quoted 4 lines

I could have written more vecasue I've underestimated it and I'm sorry for that.

Tomas

No problem! Thank you for adding this. Can you resubmit with this info?

If you're not familiar with submitting a 2nd version (V2), please look at the mailing list archives (or email me directly for advice).

I'd be glad to add my reviewed tag once the patch is updated.

Quoted 9 lines
Quoted 8 lines

Thanks,
Sumit

Quoted 3 lines

--
Lee Duncan