Joel Stanley | d7fd58d | 2019-10-23 12:30:37 +1100 | [diff] [blame] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | From: James Smart <jsmart2021@gmail.com> |
| 3 | Date: Wed, 14 Aug 2019 16:56:31 -0700 |
| 4 | Subject: [PATCH 7/8] scsi: lpfc: Limit xri count for kdump environment |
| 5 | |
| 6 | scsi-mq operation inherently performs pre-allocation of resources for |
| 7 | blk-mq request queues. Even though the kdump environment reduces the |
| 8 | configuration to a single CPU, thus 1 hardware queue, which helps |
| 9 | significantly, the resources are still rather large due to the per request |
| 10 | allocations. blk-mq pre-allocations can be over 4KB per request. With |
| 11 | adapter can_queue values in the 4k or 8k range, this can easily be 32MBs |
| 12 | before any other driver memory is factored in. Driver SGL DMA buffer |
| 13 | allocation can be up to 8KB per request as well adding an additional |
| 14 | 64MB. Totals are well over 100MB for a single shost. Given kdump memory |
| 15 | auto-sizing utilities don't accommodate this amount of memory well, it's |
| 16 | very possible for kdump to fail due to lack of memory. |
| 17 | |
| 18 | Fix by having the driver recognize that it is booting within a kdump |
| 19 | context and reduce the number of requests it will support to a more |
| 20 | reasonable value. |
| 21 | |
| 22 | Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> |
| 23 | Signed-off-by: James Smart <jsmart2021@gmail.com> |
| 24 | Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> |
| 25 | (cherry picked from commit 31f06d2e73726160645f8d9976a0b3f42e136da7) |
| 26 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
| 27 | --- |
| 28 | drivers/scsi/lpfc/lpfc_init.c | 5 +++++ |
| 29 | 1 file changed, 5 insertions(+) |
| 30 | |
| 31 | diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c |
| 32 | index a5b515fdda2e..7edbba7debc2 100644 |
| 33 | --- a/drivers/scsi/lpfc/lpfc_init.c |
| 34 | +++ b/drivers/scsi/lpfc/lpfc_init.c |
| 35 | @@ -39,6 +39,7 @@ |
| 36 | #include <linux/msi.h> |
| 37 | #include <linux/irq.h> |
| 38 | #include <linux/bitops.h> |
| 39 | +#include <linux/crash_dump.h> |
| 40 | |
| 41 | #include <scsi/scsi.h> |
| 42 | #include <scsi/scsi_device.h> |
| 43 | @@ -8309,6 +8310,10 @@ lpfc_sli4_read_config(struct lpfc_hba *phba) |
| 44 | bf_get(lpfc_mbx_rd_conf_extnts_inuse, rd_config); |
| 45 | phba->sli4_hba.max_cfg_param.max_xri = |
| 46 | bf_get(lpfc_mbx_rd_conf_xri_count, rd_config); |
| 47 | + /* Reduce resource usage in kdump environment */ |
| 48 | + if (is_kdump_kernel() && |
| 49 | + phba->sli4_hba.max_cfg_param.max_xri > 512) |
| 50 | + phba->sli4_hba.max_cfg_param.max_xri = 512; |
| 51 | phba->sli4_hba.max_cfg_param.xri_base = |
| 52 | bf_get(lpfc_mbx_rd_conf_xri_base, rd_config); |
| 53 | phba->sli4_hba.max_cfg_param.max_vpi = |