linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: Fix failing fw tracer allocation on s390
@ 2020-04-09  7:46 Niklas Schnelle
  2020-04-09 22:10 ` Saeed Mahameed
  0 siblings, 1 reply; 2+ messages in thread
From: Niklas Schnelle @ 2020-04-09  7:46 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: netdev, linux-kernel, Leon Romanovsky, Eran Ben Elisha,
	Moshe Shemesh, Niklas Schnelle

On s390 FORCE_MAX_ZONEORDER is 9 instead of 11, thus a larger kzalloc()
allocation as done for the firmware tracer will always fail.

Looking at mlx5_fw_tracer_save_trace(), it is actually the driver itself
that copies the debug data into the trace array and there is no need for
the allocation to be contiguous in physical memory. We can therefor use
kvzalloc() instead of kzalloc() and get rid of the large contiguous
allcoation.

Fixes: f53aaa31cce7 ("net/mlx5: FW tracer, implement tracer logic")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
index c9c9b479bda5..5ce6ebbc7f10 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
@@ -935,7 +935,7 @@ struct mlx5_fw_tracer *mlx5_fw_tracer_create(struct mlx5_core_dev *dev)
 		return NULL;
 	}
 
-	tracer = kzalloc(sizeof(*tracer), GFP_KERNEL);
+	tracer = kvzalloc(sizeof(*tracer), GFP_KERNEL);
 	if (!tracer)
 		return ERR_PTR(-ENOMEM);
 
@@ -982,7 +982,7 @@ struct mlx5_fw_tracer *mlx5_fw_tracer_create(struct mlx5_core_dev *dev)
 	tracer->dev = NULL;
 	destroy_workqueue(tracer->work_queue);
 free_tracer:
-	kfree(tracer);
+	kvfree(tracer);
 	return ERR_PTR(err);
 }
 
@@ -1061,7 +1061,7 @@ void mlx5_fw_tracer_destroy(struct mlx5_fw_tracer *tracer)
 	mlx5_fw_tracer_destroy_log_buf(tracer);
 	flush_workqueue(tracer->work_queue);
 	destroy_workqueue(tracer->work_queue);
-	kfree(tracer);
+	kvfree(tracer);
 }
 
 static int fw_tracer_event(struct notifier_block *nb, unsigned long action, void *data)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/mlx5: Fix failing fw tracer allocation on s390
  2020-04-09  7:46 [PATCH] net/mlx5: Fix failing fw tracer allocation on s390 Niklas Schnelle
@ 2020-04-09 22:10 ` Saeed Mahameed
  0 siblings, 0 replies; 2+ messages in thread
From: Saeed Mahameed @ 2020-04-09 22:10 UTC (permalink / raw)
  To: schnelle; +Cc: Eran Ben Elisha, netdev, linux-kernel, leon, Moshe Shemesh

On Thu, 2020-04-09 at 09:46 +0200, Niklas Schnelle wrote:
> On s390 FORCE_MAX_ZONEORDER is 9 instead of 11, thus a larger
> kzalloc()
> allocation as done for the firmware tracer will always fail.
> 
> Looking at mlx5_fw_tracer_save_trace(), it is actually the driver
> itself
> that copies the debug data into the trace array and there is no need
> for
> the allocation to be contiguous in physical memory. We can therefor
> use
> kvzalloc() instead of kzalloc() and get rid of the large contiguous
> allcoation.
> 
> Fixes: f53aaa31cce7 ("net/mlx5: FW tracer, implement tracer logic")
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

Applied to net-mlx5, will be submitted to net in my next pull request.

Thanks,
Saeed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-09 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09  7:46 [PATCH] net/mlx5: Fix failing fw tracer allocation on s390 Niklas Schnelle
2020-04-09 22:10 ` Saeed Mahameed

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).