Print this page
9695 Slow crash dumps, significantly slower than live core
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
   1 /*
   2  * mr_sas_tbolt.c: source for mr_sas driver for New Generation.
   3  * i.e. Thunderbolt and Invader
   4  *
   5  * Solaris MegaRAID device driver for SAS2.0 controllers
   6  * Copyright (c) 2008-2012, LSI Logic Corporation.
   7  * All rights reserved.
   8  *
   9  * Version:
  10  * Author:
  11  *              Swaminathan K S
  12  *              Arun Chandrashekhar
  13  *              Manju R
  14  *              Rasheed
  15  *              Shakeel Bukhari
  16  */
  17 
  18 /*
  19  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  20  * Copyright 2015, 2017 Citrus IT Limited. All rights reserved.
  21  * Copyright 2015 Garrett D'Amore <garrett@damore.org>
  22  */
  23 
  24 
  25 #include <sys/types.h>
  26 #include <sys/file.h>
  27 #include <sys/atomic.h>
  28 #include <sys/scsi/scsi.h>
  29 #include <sys/byteorder.h>
  30 #include <sys/sdt.h>
  31 #include "ld_pd_map.h"
  32 #include "mr_sas.h"
  33 #include "fusion.h"
  34 
  35 /*
  36  * FMA header files
  37  */
  38 #include <sys/ddifm.h>
  39 #include <sys/fm/protocol.h>
  40 #include <sys/fm/util.h>
  41 #include <sys/fm/io/ddi.h>
  42 
  43 
  44 /* Pre-TB command size and TB command size. */
  45 #define MR_COMMAND_SIZE (64*20) /* 1280 bytes */
  46 MR_LD_RAID *MR_LdRaidGet(U32 ld, MR_FW_RAID_MAP_ALL *map);
  47 U16 MR_TargetIdToLdGet(U32 ldTgtId, MR_FW_RAID_MAP_ALL *map);
  48 U16 MR_GetLDTgtId(U32 ld, MR_FW_RAID_MAP_ALL *map);
  49 U16 get_updated_dev_handle(PLD_LOAD_BALANCE_INFO, struct IO_REQUEST_INFO *);
  50 extern ddi_dma_attr_t mrsas_generic_dma_attr;
  51 extern uint32_t mrsas_tbolt_max_cap_maxxfer;
  52 extern struct ddi_device_acc_attr endian_attr;
  53 extern int      debug_level_g;
  54 extern unsigned int     enable_fp;
  55 volatile int dump_io_wait_time = 90;
  56 extern volatile int  debug_timeout_g;
  57 extern int      mrsas_issue_pending_cmds(struct mrsas_instance *);
  58 extern int mrsas_complete_pending_cmds(struct mrsas_instance *instance);
  59 extern void     push_pending_mfi_pkt(struct mrsas_instance *,
  60                         struct mrsas_cmd *);
  61 extern U8 MR_BuildRaidContext(struct mrsas_instance *, struct IO_REQUEST_INFO *,
  62             MPI2_SCSI_IO_VENDOR_UNIQUE *, MR_FW_RAID_MAP_ALL *);
  63 
  64 /* Local static prototypes. */
  65 static struct mrsas_cmd *mrsas_tbolt_build_cmd(struct mrsas_instance *,
  66     struct scsi_address *, struct scsi_pkt *, uchar_t *);
  67 static void mrsas_tbolt_set_pd_lba(U8 *, size_t, uint8_t *, U64, U32);
  68 static int mrsas_tbolt_check_map_info(struct mrsas_instance *);
  69 static int mrsas_tbolt_sync_map_info(struct mrsas_instance *);
  70 static int mrsas_tbolt_prepare_pkt(struct scsa_cmd *);
  71 static int mrsas_tbolt_ioc_init(struct mrsas_instance *, dma_obj_t *);
  72 static void mrsas_tbolt_get_pd_info(struct mrsas_instance *,
  73     struct mrsas_tbolt_pd_info *, int);
  74 
  75 static int mrsas_debug_tbolt_fw_faults_after_ocr = 0;


1091 fail_ioc_init:
1092 
1093         (void) mrsas_free_dma_obj(instance, instance->drv_ver_dma_obj);
1094 
1095         return (DDI_FAILURE);
1096 }
1097 
1098 int
1099 wait_for_outstanding_poll_io(struct mrsas_instance *instance)
1100 {
1101         int i;
1102         uint32_t wait_time = dump_io_wait_time;
1103         for (i = 0; i < wait_time; i++) {
1104                 /*
1105                  * Check For Outstanding poll Commands
1106                  * except ldsync command and aen command
1107                  */
1108                 if (instance->fw_outstanding <= 2) {
1109                         break;
1110                 }
1111                 drv_usecwait(10*MILLISEC);
1112                 /* complete commands from reply queue */
1113                 (void) mr_sas_tbolt_process_outstanding_cmd(instance);
1114         }
1115         if (instance->fw_outstanding > 2) {
1116                 return (1);
1117         }
1118         return (0);
1119 }
1120 /*
1121  * scsi_pkt handling
1122  *
1123  * Visible to the external world via the transport structure.
1124  */
1125 
1126 int
1127 mrsas_tbolt_tran_start(struct scsi_address *ap, struct scsi_pkt *pkt)
1128 {
1129         struct mrsas_instance   *instance = ADDR2MR(ap);
1130         struct scsa_cmd         *acmd = PKT2CMD(pkt);
1131         struct mrsas_cmd        *cmd = NULL;


   1 /*
   2  * mr_sas_tbolt.c: source for mr_sas driver for New Generation.
   3  * i.e. Thunderbolt and Invader
   4  *
   5  * Solaris MegaRAID device driver for SAS2.0 controllers
   6  * Copyright (c) 2008-2012, LSI Logic Corporation.
   7  * All rights reserved.
   8  *
   9  * Version:
  10  * Author:
  11  *              Swaminathan K S
  12  *              Arun Chandrashekhar
  13  *              Manju R
  14  *              Rasheed
  15  *              Shakeel Bukhari
  16  */
  17 
  18 /*
  19  * Copyright 2018 Nexenta Systems, Inc.
  20  * Copyright 2015, 2017 Citrus IT Limited. All rights reserved.
  21  * Copyright 2015 Garrett D'Amore <garrett@damore.org>
  22  */
  23 
  24 
  25 #include <sys/types.h>
  26 #include <sys/file.h>
  27 #include <sys/atomic.h>
  28 #include <sys/scsi/scsi.h>
  29 #include <sys/byteorder.h>
  30 #include <sys/sdt.h>
  31 #include "ld_pd_map.h"
  32 #include "mr_sas.h"
  33 #include "fusion.h"
  34 
  35 /*
  36  * FMA header files
  37  */
  38 #include <sys/ddifm.h>
  39 #include <sys/fm/protocol.h>
  40 #include <sys/fm/util.h>
  41 #include <sys/fm/io/ddi.h>
  42 
  43 
  44 /* Pre-TB command size and TB command size. */
  45 #define MR_COMMAND_SIZE (64*20) /* 1280 bytes */
  46 MR_LD_RAID *MR_LdRaidGet(U32 ld, MR_FW_RAID_MAP_ALL *map);
  47 U16 MR_TargetIdToLdGet(U32 ldTgtId, MR_FW_RAID_MAP_ALL *map);
  48 U16 MR_GetLDTgtId(U32 ld, MR_FW_RAID_MAP_ALL *map);
  49 U16 get_updated_dev_handle(PLD_LOAD_BALANCE_INFO, struct IO_REQUEST_INFO *);
  50 extern ddi_dma_attr_t mrsas_generic_dma_attr;
  51 extern uint32_t mrsas_tbolt_max_cap_maxxfer;
  52 extern struct ddi_device_acc_attr endian_attr;
  53 extern int      debug_level_g;
  54 extern unsigned int     enable_fp;
  55 volatile int dump_io_wait_time = 900;
  56 extern volatile int  debug_timeout_g;
  57 extern int      mrsas_issue_pending_cmds(struct mrsas_instance *);
  58 extern int mrsas_complete_pending_cmds(struct mrsas_instance *instance);
  59 extern void     push_pending_mfi_pkt(struct mrsas_instance *,
  60                         struct mrsas_cmd *);
  61 extern U8 MR_BuildRaidContext(struct mrsas_instance *, struct IO_REQUEST_INFO *,
  62             MPI2_SCSI_IO_VENDOR_UNIQUE *, MR_FW_RAID_MAP_ALL *);
  63 
  64 /* Local static prototypes. */
  65 static struct mrsas_cmd *mrsas_tbolt_build_cmd(struct mrsas_instance *,
  66     struct scsi_address *, struct scsi_pkt *, uchar_t *);
  67 static void mrsas_tbolt_set_pd_lba(U8 *, size_t, uint8_t *, U64, U32);
  68 static int mrsas_tbolt_check_map_info(struct mrsas_instance *);
  69 static int mrsas_tbolt_sync_map_info(struct mrsas_instance *);
  70 static int mrsas_tbolt_prepare_pkt(struct scsa_cmd *);
  71 static int mrsas_tbolt_ioc_init(struct mrsas_instance *, dma_obj_t *);
  72 static void mrsas_tbolt_get_pd_info(struct mrsas_instance *,
  73     struct mrsas_tbolt_pd_info *, int);
  74 
  75 static int mrsas_debug_tbolt_fw_faults_after_ocr = 0;


1091 fail_ioc_init:
1092 
1093         (void) mrsas_free_dma_obj(instance, instance->drv_ver_dma_obj);
1094 
1095         return (DDI_FAILURE);
1096 }
1097 
1098 int
1099 wait_for_outstanding_poll_io(struct mrsas_instance *instance)
1100 {
1101         int i;
1102         uint32_t wait_time = dump_io_wait_time;
1103         for (i = 0; i < wait_time; i++) {
1104                 /*
1105                  * Check For Outstanding poll Commands
1106                  * except ldsync command and aen command
1107                  */
1108                 if (instance->fw_outstanding <= 2) {
1109                         break;
1110                 }
1111                 drv_usecwait(MILLISEC);
1112                 /* complete commands from reply queue */
1113                 (void) mr_sas_tbolt_process_outstanding_cmd(instance);
1114         }
1115         if (instance->fw_outstanding > 2) {
1116                 return (1);
1117         }
1118         return (0);
1119 }
1120 /*
1121  * scsi_pkt handling
1122  *
1123  * Visible to the external world via the transport structure.
1124  */
1125 
1126 int
1127 mrsas_tbolt_tran_start(struct scsi_address *ap, struct scsi_pkt *pkt)
1128 {
1129         struct mrsas_instance   *instance = ADDR2MR(ap);
1130         struct scsa_cmd         *acmd = PKT2CMD(pkt);
1131         struct mrsas_cmd        *cmd = NULL;