From 0abe3fb1c5056b7f2f99178b23db8aa95dd03f85 Mon Sep 17 00:00:00 2001 From: "Mike Rapoport (Microsoft)" Date: Sat, 4 Jul 2026 09:13:36 +0300 Subject: [PATCH] scsi: ipr: Use kmalloc() to allocate IPR dump buffer memory IPR dump machinery allocates memory to save adapter's crash dump using __get_free_page(). This memory can be allocated with kmalloc() as there's nothing special about it to go directly to the page allocator. kmalloc() provides a better API that does not require ugly casts and kfree() does not need to know the size of the freed object. Replace use of __get_free_page() with kmalloc(). While on it, relax GFP_ATOMIC to GFP_NOIO for allocation of dump buffers. The allocations happen in a workqueue context, but with storage adapter being in a state where it can't handle I/O. Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com Tested-by: Wen Xiong Reviewed-by: Hannes Reinecke Signed-off-by: Mike Rapoport (Microsoft) Link: https://patch.msgid.link/20260704-b4-scsi-v2-3-7d2d21a810de@kernel.org Signed-off-by: Martin K. Petersen (Oracle) --- drivers/scsi/ipr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index d207e5e81afe..19153dd24736 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -2893,7 +2893,7 @@ static int ipr_sdt_copy(struct ipr_ioa_cfg *ioa_cfg, (ioa_dump->hdr.len + bytes_copied) < max_dump_size) { if (ioa_dump->page_offset >= PAGE_SIZE || ioa_dump->page_offset == 0) { - page = (__be32 *)__get_free_page(GFP_ATOMIC); + page = kmalloc(PAGE_SIZE, GFP_NOIO); if (!page) { ipr_trace; @@ -3226,7 +3226,7 @@ static void ipr_release_dump(struct kref *kref) spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); for (i = 0; i < dump->ioa_dump.next_page_index; i++) - free_page((unsigned long) dump->ioa_dump.ioa_data[i]); + kfree(dump->ioa_dump.ioa_data[i]); vfree(dump->ioa_dump.ioa_data); kfree(dump);