blob: 71ae7972b81abd91fe5b0b20db2a98dc2cbd3209 [file] [log] [blame]
Joel Stanleyd7fd58d2019-10-23 12:30:37 +11001From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: James Smart <jsmart2021@gmail.com>
3Date: Wed, 14 Aug 2019 16:56:31 -0700
4Subject: [PATCH 7/8] scsi: lpfc: Limit xri count for kdump environment
5
6scsi-mq operation inherently performs pre-allocation of resources for
7blk-mq request queues. Even though the kdump environment reduces the
8configuration to a single CPU, thus 1 hardware queue, which helps
9significantly, the resources are still rather large due to the per request
10allocations. blk-mq pre-allocations can be over 4KB per request. With
11adapter can_queue values in the 4k or 8k range, this can easily be 32MBs
12before any other driver memory is factored in. Driver SGL DMA buffer
13allocation can be up to 8KB per request as well adding an additional
1464MB. Totals are well over 100MB for a single shost. Given kdump memory
15auto-sizing utilities don't accommodate this amount of memory well, it's
16very possible for kdump to fail due to lack of memory.
17
18Fix by having the driver recognize that it is booting within a kdump
19context and reduce the number of requests it will support to a more
20reasonable value.
21
22Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
23Signed-off-by: James Smart <jsmart2021@gmail.com>
24Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
25(cherry picked from commit 31f06d2e73726160645f8d9976a0b3f42e136da7)
26Signed-off-by: Joel Stanley <joel@jms.id.au>
27---
28 drivers/scsi/lpfc/lpfc_init.c | 5 +++++
29 1 file changed, 5 insertions(+)
30
31diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
32index 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 =