linux/drivers/scsi/mpi3mr
Shin'ichiro Kawasaki 8c6b808c8c scsi: mpi3mr: Avoid MAX_PAGE_ORDER WARNING for buffer allocations
Commit fc44449411 ("scsi: mpi3mr: HDB allocation and posting for hardware
and firmware buffers") added mpi3mr_alloc_diag_bufs() which calls
dma_alloc_coherent() to allocate the trace buffer and the firmware
buffer. mpi3mr_alloc_diag_bufs() decides the buffer sizes from the driver
configuration. In my environment, the sizes are 8MB. With the sizes,
dma_alloc_coherent() fails and report this WARNING:

    WARNING: CPU: 4 PID: 438 at mm/page_alloc.c:4676 __alloc_pages_noprof+0x52f/0x640

The WARNING indicates that the order of the allocation size is larger than
MAX_PAGE_ORDER. After this failure, mpi3mr_alloc_diag_bufs() reduces the
buffer sizes and retries dma_alloc_coherent(). In the end, the buffer
allocations succeed with 4MB size in my environment, which corresponds to
MAX_PAGE_ORDER=10. Though the allocations succeed, the WARNING message is
misleading and should be avoided.

To avoid the WARNING, check the orders of the buffer allocation sizes
before calling dma_alloc_coherent(). If the orders are larger than
MAX_PAGE_ORDER, fall back to the retry path.

Fixes: fc44449411 ("scsi: mpi3mr: HDB allocation and posting for hardware and firmware buffers")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240810042701.661841-3-shinichiro.kawasaki@wdc.com
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-12 20:51:37 -04:00
..
mpi scsi: mpi3mr: HDB allocation and posting for hardware and firmware buffers 2024-06-26 23:30:09 -04:00
Kconfig scsi: mpi3mr: Select CONFIG_SCSI_SAS_ATTRS 2022-10-22 03:14:51 +00:00
Makefile scsi: mpi3mr: Refer CONFIG_SCSI_MPI3MR in Makefile 2022-12-14 03:01:38 +00:00
mpi3mr_app.c scsi: mpi3mr: Avoid MAX_PAGE_ORDER WARNING for buffer allocations 2024-08-12 20:51:37 -04:00
mpi3mr_debug.h scsi: mpi3mr: Update copyright year 2023-03-16 23:54:29 -04:00
mpi3mr_fw.c scsi: mpi3mr: Prevent PCI writes from driver during PCI error recovery 2024-07-04 23:37:07 -04:00
mpi3mr_os.c scsi: mpi3mr: Add missing spin_lock_init() for mrioc->trigger_lock 2024-08-12 18:22:04 -04:00
mpi3mr_transport.c Merge branch '6.10/scsi-fixes' into 6.11/scsi-staging 2024-07-10 22:23:30 -04:00
mpi3mr.h scsi: mpi3mr: Driver version update 2024-07-04 23:37:07 -04:00