mpi3mr: Few Enhancements and minor fix
Subsystems (2)
cover mpi3mr: Few Enhancements and minor fix
Few Enhancements and minor fix of mpi3mr driver.
Ranjan Kumar (4):
mpi3mr: Improve Shutdown times when firmware has faulted
mpi3mr: Support PCIe Error Recovery callback handlers
mpi3mr: Reset stop_bsgs flag post controller reset failure
mpi3mr: Update driver version to 8.6.1.0.0
drivers/scsi/mpi3mr/mpi3mr.h | 36 ++- drivers/scsi/mpi3mr/mpi3mr_app.c | 64 +++-- drivers/scsi/mpi3mr/mpi3mr_fw.c | 67 +++-- drivers/scsi/mpi3mr/mpi3mr_os.c | 330 +++++++++++++++++++++---- drivers/scsi/mpi3mr/mpi3mr_transport.c | 39 ++- 5 files changed, 440 insertions(+), 96 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/4 mpi3mr: Improve Shutdown times when firmware has faulted
The driver monitors the controller state periodically while waiting for the shutdown notification MPI request to complete. If the firmware is faulty, the driver resets the controller and re-issues the shutdown notification. The driver will make three attempts to complete the shutdown process and will not retry the notification request if the controller reset is unsuccessful.
--- drivers/scsi/mpi3mr/mpi3mr.h | 1 + drivers/scsi/mpi3mr/mpi3mr_fw.c | 36 +++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +1 -0
@@ -158,6 +158,7 @@ extern atomic64_t event_counter;/* Controller Reset related definitions */ #define MPI3MR_HOSTDIAG_UNLOCK_RETRY_COUNT 5#define MPI3MR_MAX_RESET_RETRY_COUNT 3 +#define MPI3MR_MAX_SHUTDOWN_RETRY_COUNT 2/* ResponseCode definitions */ #define MPI3MR_RI_MASK_RESPCODE (0x000000FF)
drivers/scsi/mpi3mr/mpi3mr_fw.c +28 -8
@@ -4555,9 +4555,10 @@ void mpi3mr_free_mem(struct mpi3mr_ioc *mrioc)*/ static void mpi3mr_issue_ioc_shutdown (struct mpi3mr_ioc *mrioc) { -u32 ioc_config, ioc_status; -u8 retval =1 ; +u32 ioc_config, ioc_status, shutdown_action; +u8 retval =1 , retry =0 ;u32 timeout =MPI3MR_DEFAULT_SHUTDOWN_TIME *10 ; +u32 timeout_remaining =0 ;ioc_info (mrioc,"Issuing shutdown Notification\n" );if (mrioc->unrecoverable) {
@@ -4572,15 +4573,16 @@ static void mpi3mr_issue_ioc_shutdown(struct mpi3mr_ioc *mrioc)return ; } + shutdown_action =MPI3_SYSIF_IOC_CONFIG_SHUTDOWN_NORMAL | +MPI3_SYSIF_IOC_CONFIG_DEVICE_SHUTDOWN_SEND_REQ ; ioc_config =readl (&mrioc->sysif_regs->ioc_configuration); - ioc_config |=MPI3_SYSIF_IOC_CONFIG_SHUTDOWN_NORMAL ; - ioc_config |=MPI3_SYSIF_IOC_CONFIG_DEVICE_SHUTDOWN_SEND_REQ ; + ioc_config |= shutdown_action;writel (ioc_config, &mrioc->sysif_regs->ioc_configuration);if (mrioc->facts.shutdown_timeout) timeout = mrioc->facts.shutdown_timeout *10 ; - + timeout_remaining = timeout; do { ioc_status = readl(&mrioc->sysif_regs->ioc_status); if ((ioc_status & MPI3_SYSIF_IOC_STATUS_SHUTDOWN_MASK)
@@ -4588,8 +4590,26 @@ static void mpi3mr_issue_ioc_shutdown(struct mpi3mr_ioc *mrioc) retval =0 ;break ; } +if (mrioc->unrecoverable) +break ; +if (ioc_status &MPI3_SYSIF_IOC_STATUS_FAULT ) { +mpi3mr_print_fault_info (mrioc); +if (retry >=MPI3MR_MAX_SHUTDOWN_RETRY_COUNT ) +break ; +if (mpi3mr_issue_reset (mrioc, +MPI3_SYSIF_HOST_DIAG_RESET_ACTION_SOFT_RESET , +MPI3MR_RESET_FROM_CTLR_CLEANUP )) +break ; + ioc_config = +readl (&mrioc->sysif_regs->ioc_configuration); + ioc_config |= shutdown_action; +writel (ioc_config, + &mrioc->sysif_regs->ioc_configuration); + timeout_remaining = timeout; + retry++; + }msleep (100 ); - }while (--timeout); + }while (--timeout_remaining); ioc_status =readl (&mrioc->sysif_regs->ioc_status); ioc_config =readl (&mrioc->sysif_regs->ioc_configuration);
@@ -4598,11 +4618,11 @@ static void mpi3mr_issue_ioc_shutdown(struct mpi3mr_ioc *mrioc)if ((ioc_status &MPI3_SYSIF_IOC_STATUS_SHUTDOWN_MASK ) ==MPI3_SYSIF_IOC_STATUS_SHUTDOWN_IN_PROGRESS )ioc_warn (mrioc, -"shutdown still in progress after timeout\n" ); +"shutdown still in progress\n" ); }ioc_info (mrioc, -"Base IOC Sts/Config after %s shutdown is (0x%x)/(0x%x)\n" , +"ioc_status/ioc_config after %s shutdown is (0x%x)/(0x%x)\n" , (!retval) ?"successful" :"failed" , ioc_status, ioc_config); }
Signature · 1 line
2.31.1
PATCH 2/4 mpi3mr: Support PCIe Error Recovery callback handlers
In reply to Ranjan KumarThe driver has been upgraded to include support for the PCIe error recovery callback handler which is crucial for the recovery of the controllers. This feature is necessary for addressing the errors reported by the PCIe AER (Advanced Error Reporting) mechanism.
--- drivers/scsi/mpi3mr/mpi3mr.h | 31 +++ drivers/scsi/mpi3mr/mpi3mr_app.c | 64 +++-- drivers/scsi/mpi3mr/mpi3mr_fw.c | 30 ++- drivers/scsi/mpi3mr/mpi3mr_os.c | 330 +++++++++++++++++++++---- drivers/scsi/mpi3mr/mpi3mr_transport.c | 39 ++- 5 files changed, 408 insertions(+), 86 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +31 -0
@@ -23,6 +23,7 @@#include <linux/miscdevice.h> #include <linux/module.h> #include <linux/pci.h> +#include <linux/aer.h> #include <linux/poll.h> #include <linux/sched.h> #include <linux/slab.h>
@@ -481,6 +482,7 @@ struct mpi3mr_throttle_group_info {/* HBA port flags */ #define MPI3MR_HBA_PORT_FLAG_DIRTY 0x01 +#define MPI3MR_HBA_PORT_FLAG_NEW 0x02/* IOCTL data transfer sge*/ #define MPI3MR_NUM_IOCTL_SGE 256
@@ -900,6 +902,29 @@ struct scmd_priv {u8 mpi3mr_scsiio_req[MPI3MR_ADMIN_REQ_FRAME_SZ ]; }; +/** +* struct mpi3mr_pdevinfo - PCI device information +* +* @dev_id: PCI device ID of the adapter +* @dev_hw_rev: PCI revision of the adapter +* @subsys_dev_id: PCI subsystem device ID of the adapter +* @subsys_ven_id: PCI subsystem vendor ID of the adapter +* @dev: PCI device +* @func: PCI function +* @bus: PCI bus +* @seg_id: PCI segment ID +*/ +struct mpi3mr_pdevinfo { +u16 id; +u16 ssid; +u16 ssvid; +u16 segment; +u8 dev:5 ; +u8 func:3 ; +u8 bus; +u8 revision; +}; +/** * struct mpi3mr_ioc - Adapter anchor structure stored in shost * private data
@@ -1056,6 +1081,9 @@ struct scmd_priv {* @ioctl_chain_sge: DMA buffer descriptor for IOCTL chain * @ioctl_resp_sge: DMA buffer descriptor for Mgmt cmd response * @ioctl_sges_allocated: Flag for IOCTL SGEs allocated or not +* @pcie_err_recovery: PCIe error recovery in progress +* @block_on_pcie_err: Block IO during PCI error recovery +* @pdevinfo: PCI device information */ struct mpi3mr_ioc {struct list_head list;
@@ -1247,6 +1275,9 @@ struct mpi3mr_ioc {struct dma_memory_desc ioctl_chain_sge;struct dma_memory_desc ioctl_resp_sge;bool ioctl_sges_allocated; +bool pcie_err_recovery; +bool block_on_pcie_err; +struct mpi3mr_pdevinfo pdevinfo; };/**
drivers/scsi/mpi3mr/mpi3mr_app.c +37 -27
99 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_fw.c +22 -8
@@ -595,7 +595,7 @@ int mpi3mr_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) mrioc = (struct mpi3mr_ioc *)shost->hostdata;if ((mrioc->reset_in_progress || mrioc->prepare_for_reset || - mrioc->unrecoverable)) + mrioc->unrecoverable || mrioc->pcie_err_recovery))return 0 ; num_entries = mpi3mr_process_op_reply_q(mrioc,
@@ -1037,14 +1037,16 @@ enum mpi3mr_iocstate mpi3mr_get_iocstate(struct mpi3mr_ioc *mrioc)u32 ioc_status, ioc_config;u8 ready, enabled; - ioc_status =readl (&mrioc->sysif_regs->ioc_status); - ioc_config =readl (&mrioc->sysif_regs->ioc_configuration); -if (mrioc->unrecoverable)return MRIOC_STATE_UNRECOVERABLE ; + + ioc_status =readl (&mrioc->sysif_regs->ioc_status); +if (ioc_status &MPI3_SYSIF_IOC_STATUS_FAULT )return MRIOC_STATE_FAULT ; + ioc_config =readl (&mrioc->sysif_regs->ioc_configuration); + ready = (ioc_status &MPI3_SYSIF_IOC_STATUS_READY ); enabled = (ioc_config &MPI3_SYSIF_IOC_CONFIG_ENABLE_IOC );
@@ -1667,6 +1669,12 @@ int mpi3mr_admin_request_post(struct mpi3mr_ioc *mrioc, void *admin_req, retval = -EAGAIN ; goto out; } +if (mrioc->pcie_err_recovery) { +ioc_err (mrioc,"admin request queue submission failed due to pcie error recovery in progress\n" ); + retval = -EAGAIN ; + goto out; + } + areq_entry = (u8 *)mrioc->admin_req_base + (areq_pi *MPI3MR_ADMIN_REQ_FRAME_SZ );memset (areq_entry,0 ,MPI3MR_ADMIN_REQ_FRAME_SZ );
@@ -2337,6 +2345,11 @@ int mpi3mr_op_request_post(struct mpi3mr_ioc *mrioc, retval = -EAGAIN ; goto out; } +if (mrioc->pcie_err_recovery) { +ioc_err (mrioc,"operational request queue submission failed due to pcie error recovery in progress\n" ); + retval = -EAGAIN ; + goto out; + } segment_base_addr = segments[pi / op_req_q->segment_qd].segment; req_entry = (u8 *)segment_base_addr +
@@ -2585,7 +2598,7 @@ static void mpi3mr_watchdog_work(struct work_struct *work)u32 fault, host_diagnostic, ioc_status;u32 reset_reason =MPI3MR_RESET_FROM_FAULT_WATCH ; -if (mrioc->reset_in_progress) +if (mrioc->reset_in_progress || mrioc->pcie_err_recovery)return ;if (!mrioc->unrecoverable && !pci_device_is_present (mrioc->pdev)) {
@@ -4111,7 +4124,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume) goto out_failed_noretry; } -if (is_resume) { +if (is_resume || mrioc->block_on_pcie_err) {dprint_reset (mrioc,"setting up single ISR\n" ); retval =mpi3mr_setup_isr (mrioc,1 );if (retval) {
@@ -4151,7 +4164,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume) goto out_failed; } -if (is_resume) { +if (is_resume || mrioc->block_on_pcie_err) {dprint_reset (mrioc,"setting up multiple ISR\n" ); retval =mpi3mr_setup_isr (mrioc,0 );if (retval) {
@@ -4645,7 +4658,8 @@ void mpi3mr_cleanup_ioc(struct mpi3mr_ioc *mrioc) ioc_state =mpi3mr_get_iocstate (mrioc); -if ((!mrioc->unrecoverable) && (!mrioc->reset_in_progress) && +if (!mrioc->unrecoverable && !mrioc->reset_in_progress && + !mrioc->pcie_err_recovery && (ioc_state ==MRIOC_STATE_READY )) {if (mpi3mr_issue_and_process_mur (mrioc,MPI3MR_RESET_FROM_CTLR_CLEANUP ))
drivers/scsi/mpi3mr/mpi3mr_os.c +283 -47
460 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_transport.c +35 -4
@@ -149,6 +149,11 @@ static int mpi3mr_report_manufacture(struct mpi3mr_ioc *mrioc,return -EFAULT ; } +if (mrioc->pcie_err_recovery) { +ioc_err (mrioc,"%s: pcie error recovery in progress!\n" , __func__); +return -EFAULT ; + } + data_out_sz =sizeof (struct rep_manu_request ); data_in_sz =sizeof (struct rep_manu_reply ); data_out = dma_alloc_coherent(&mrioc->pdev->dev,
@@ -792,6 +797,12 @@ static int mpi3mr_set_identify(struct mpi3mr_ioc *mrioc, u16 handle,return -EFAULT ; } +if (mrioc->pcie_err_recovery) { +ioc_err (mrioc,"%s: pcie error recovery in progress!\n" , + __func__); +return -EFAULT ; + } +if ((mpi3mr_cfg_get_dev_pg0 (mrioc, &ioc_status, &device_pg0,sizeof (device_pg0),MPI3_DEVICE_PGAD_FORM_HANDLE , handle))) {ioc_err (mrioc,"%s: device page0 read failed\n" , __func__);
@@ -1009,6 +1020,9 @@ mpi3mr_alloc_hba_port(struct mpi3mr_ioc *mrioc, u16 port_id) hba_port->port_id = port_id;ioc_info (mrioc,"hba_port entry: %p, port: %d is added to hba_port list\n" , hba_port, hba_port->port_id); +if (mrioc->reset_in_progress || + mrioc->pcie_err_recovery) + hba_port->flags =MPI3MR_HBA_PORT_FLAG_NEW ;list_add_tail (&hba_port->list, &mrioc->hba_port_table_list);return hba_port; }
@@ -1057,7 +1071,7 @@ void mpi3mr_update_links(struct mpi3mr_ioc *mrioc,struct mpi3mr_sas_node *mr_sas_node;struct mpi3mr_sas_phy *mr_sas_phy; -if (mrioc->reset_in_progress) +if (mrioc->reset_in_progress || mrioc->pcie_err_recovery)return ;spin_lock_irqsave (&mrioc->sas_node_lock, flags);
@@ -1965,7 +1979,7 @@ int mpi3mr_expander_add(struct mpi3mr_ioc *mrioc, u16 handle)if (!handle)return -1 ; -if (mrioc->reset_in_progress) +if (mrioc->reset_in_progress || mrioc->pcie_err_recovery)return -1 ; if ((mpi3mr_cfg_get_sas_exp_pg0(mrioc, &ioc_status, &expander_pg0,
@@ -2171,7 +2185,7 @@ void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc,/* remove sibling ports attached to this expander */ list_for_each_entry_safe (mr_sas_port, next, &sas_expander->sas_port_list, port_list) { -if (mrioc->reset_in_progress) +if (mrioc->reset_in_progress || mrioc->pcie_err_recovery)return ;if (mr_sas_port->remote_identify.device_type ==SAS_END_DEVICE )
@@ -2221,7 +2235,7 @@ void mpi3mr_expander_remove(struct mpi3mr_ioc *mrioc, u64 sas_address,struct mpi3mr_sas_node *sas_expander;unsigned long flags; -if (mrioc->reset_in_progress) +if (mrioc->reset_in_progress || mrioc->pcie_err_recovery)return ;if (!hba_port)
@@ -2532,6 +2546,11 @@ static int mpi3mr_get_expander_phy_error_log(struct mpi3mr_ioc *mrioc,return -EFAULT ; } +if (mrioc->pcie_err_recovery) { +ioc_err (mrioc,"%s: pcie error recovery in progress!\n" , __func__); +return -EFAULT ; + } + data_out_sz =sizeof (struct phy_error_log_request ); data_in_sz =sizeof (struct phy_error_log_reply ); sz = data_out_sz + data_in_sz;
@@ -2791,6 +2810,12 @@ mpi3mr_expander_phy_control(struct mpi3mr_ioc *mrioc,return -EFAULT ; } +if (mrioc->pcie_err_recovery) { +ioc_err (mrioc,"%s: pcie error recovery in progress!\n" , + __func__); +return -EFAULT ; + } + data_out_sz =sizeof (struct phy_control_request ); data_in_sz =sizeof (struct phy_control_reply ); sz = data_out_sz + data_in_sz;
@@ -3214,6 +3239,12 @@ mpi3mr_transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, goto out; } +if (mrioc->pcie_err_recovery) { +ioc_err (mrioc,"%s: pcie error recovery in progress!\n" , __func__); + rc = -EFAULT ; + goto out; + } + rc =mpi3mr_map_smp_buffer (&mrioc->pdev->dev, &job->request_payload, &dma_addr_out, &dma_len_out, &addr_out);if (rc)
Signature · 1 line
2.31.1
Re: [PATCH v1 2/4] mpi3mr: Support PCIe Error Recovery callback handlers
Quoted 15 lines · Ranjan Kumar
The driver has been upgraded to include support for the PCIe error recovery callback handler which is crucial for the recovery of the controllers. This feature is necessary for addressing the errors reported by the PCIe AER (Advanced Error Reporting) mechanism.
Signed-off-by Sathya Prakash <[email protected]>Signed-off-by Ranjan Kumar <[email protected]>...
drivers/scsi/mpi3mr/mpi3mr_os.c +5
-0+static int +mpi3mr_get_shost_and_mrioc (struct pci_dev *pdev, +struct Scsi_Host **shost,struct mpi3mr_ioc **mrioc) +{ + *shost =pci_get_drvdata (pdev);
drivers/scsi/mpi3mr/mpi3mr_os.c mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 5283
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +10
-0+if (*shost ==NULL ) { +dev_err (&pdev->dev,"pdev's driver data is null\n" ); +return -1 ; + } + + *mrioc =shost_priv (*shost); +if (*mrioc ==NULL ) { +dev_err (&pdev->dev,"shost's private data is null\n" ); + *shost =NULL ; +return -1 ;
I'm a little bit skeptical about these checks for NULL, although I do see that the existing code has similar "if (!shost)" checks.
Usually these checks will only find memory corruption or logic errors, and silently bailing out, as the previous "if (!shost)" checks do, just masks a serious problem. Logging errors, as you do here, is a little better, but I think it's better to just take the exception when we dereference the NULL pointer later because that's impossible to ignore and usually gives more clues about what went wrong.
drivers/scsi/mpi3mr/mpi3mr_os.c mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 5286
Quoted 3 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-0+} +return 0 ; +}
The addition and use of mpi3mr_get_shost_and_mrioc() looks like it could be a separate patch. If so, it might be nice to split this into several smaller, simpler patches.
drivers/scsi/mpi3mr/mpi3mr_os.c static void mpi3mr_shutdown(struct pci_dev *pdev) · line 5416
Quoted 12 lines
static int
__maybe_unused
mpi3mr_suspend(struct device *dev)
{drivers/scsi/mpi3mr/mpi3mr_os.c +3
-3struct pci_dev *pdev =to_pci_dev (dev); -struct Scsi_Host *shost =pci_get_drvdata (pdev); +struct Scsi_Host *shost;struct mpi3mr_ioc *mrioc; -if (!shost) -return 0 ; +if (mpi3mr_get_shost_and_mrioc (pdev, &shost, &mrioc)) +return -1 ;
Is -1 really the best return value here? It seems like usually a negative errno is returned.
Bjorn
Sathya Prakash Veerichetty
maintainerRe: [PATCH v1 2/4] mpi3mr: Support PCIe Error Recovery callback handlers
Quoted 31 lines · Bjorn Helgaas
Quoted 15 lines · Ranjan Kumar
The driver has been upgraded to include support for the PCIe error recovery callback handler which is crucial for the recovery of the controllers. This feature is necessary for addressing the errors reported by the PCIe AER (Advanced Error Reporting) mechanism.
Signed-off-by Sathya Prakash <[email protected]>Signed-off-by Ranjan Kumar <[email protected]>...
drivers/scsi/mpi3mr/mpi3mr_os.c +5
-0+static int +mpi3mr_get_shost_and_mrioc (struct pci_dev *pdev, +struct Scsi_Host **shost,struct mpi3mr_ioc **mrioc) +{ + *shost =pci_get_drvdata (pdev);drivers/scsi/mpi3mr/mpi3mr_os.c mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 5283
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +10
-0+if (*shost ==NULL ) { +dev_err (&pdev->dev,"pdev's driver data is null\n" ); +return -1 ; + } + + *mrioc =shost_priv (*shost); +if (*mrioc ==NULL ) { +dev_err (&pdev->dev,"shost's private data is null\n" ); + *shost =NULL ; +return -1 ;I'm a little bit skeptical about these checks for NULL, although I do see that the existing code has similar "if (!shost)" checks.
Quoted 7 lines
Usually these checks will only find memory corruption or logic errors, and silently bailing out, as the previous "if (!shost)" checks do, just masks a serious problem. Logging errors, as you do here, is a little better, but I think it's better to just take the exception when we dereference the NULL pointer later because that's impossible to ignore and usually gives more clues about what went wrong.
Agree, however, I wouldn't want to crash the system from this driver. Will add WARN notices and move this into a separate patch later. For now, will check this inside the PM functions as we do currently for other cases.
Quoted 7 lines
drivers/scsi/mpi3mr/mpi3mr_os.c mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 5286
Quoted 3 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-0+} +return 0 ; +}The addition and use of
mpi3mr_get_shost_and_mrioc()looks like it could be a separate patch. If so, it might be nice to split this into several smaller, simpler patches
Will detach this from this patch and will submit another separate patch.
Quoted 9 lines
Quoted 9 lines
static int
__maybe_unused
mpi3mr_suspend(struct device *dev){ struct pci_dev *pdev = to_pci_dev(dev);drivers/scsi/mpi3mr/mpi3mr_os.c +1
-1-struct Scsi_Host *shost =pci_get_drvdata (pdev); +struct Scsi_Host *shost;struct mpi3mr_ioc *mrioc;
Quoted 7 lines
drivers/scsi/mpi3mr/mpi3mr_os.c static void mpi3mr_shutdown(struct pci_dev *pdev) · line 5416
Quoted 4 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +2
-2-if (!shost) -return 0 ; +if (mpi3mr_get_shost_and_mrioc (pdev, &shost, &mrioc)) +return -1 ;Is -1 really the best return value here? It seems like usually a negative errno is returned.
The __suspend_report_result just prints the return value, so i thought -1 is fine as we already print a error message. Do you recommend to use another negative (non -1) number for differentiation between generic error and this?
Quoted 3 lines
Bjorn
Re: [PATCH v1 2/4] mpi3mr: Support PCIe Error Recovery callback handlers
Quoted 17 lines · Sathya Prakash Veerichetty
Quoted 1 line · Bjorn Helgaas
On Wed, Dec 06, 2023 at 08:55:11PM +0530, Ranjan Kumar wrote:
...
Quoted 13 lines
Quoted 12 lines
static int
__maybe_unused
mpi3mr_suspend(struct device *dev){ struct pci_dev *pdev = to_pci_dev(dev);drivers/scsi/mpi3mr/mpi3mr_os.c +3
-3-struct Scsi_Host *shost =pci_get_drvdata (pdev); +struct Scsi_Host *shost;struct mpi3mr_ioc *mrioc; -if (!shost) -return 0 ; +if (mpi3mr_get_shost_and_mrioc (pdev, &shost, &mrioc)) +return -1 ;
Quoted 7 lines
Quoted 2 lines
Is -1 really the best return value here? It seems like usually a negative errno is returned.
The
__suspend_report_resultjust prints the return value, so i thought -1 is fine as we already print a error message. Do you recommend to use another negative (non -1) number for differentiation between generic error and this?
In addition to being printed by __suspend_report_result() (if the return value is non-zero), the return value is returned up the chain by legacy_suspend(), pci_pm_suspend(), etc.
I would probably make mpi3mr_get_shost_and_mrioc() return an errno like -ENODEV and then have mpi3mr_suspend() capture that and return it.
These function pointers go in struct dev_pm_ops, and these functions are documented as returning "error codes", which I interpret as errno values:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/pm.h?id=v6.6#n258
Bjorn
kernel test robot
build botRe: [PATCH v1 2/4] mpi3mr: Support PCIe Error Recovery callback handlers
In reply to Ranjan Kumarkernel test robot noticed the following build warnings:
Hi Ranjan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on next-20231207]
[cannot apply to jejb-scsi/for-next linus/master v6.7-rc4] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ranjan-Kumar/mpi3mr-Improve-Shutdown-times-when-firmware-has-faulted/20231207-004256 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next patch link: https://lore.kernel.org/r/20231206152513.71253-3-ranjan.kumar%40broadcom.com patch subject: [PATCH v1 2/4] mpi3mr: Support PCIe Error Recovery callback handlers config: arc-randconfig-001-20231207 (https://download.01.org/0day-ci/archive/20231207/[email protected]/config) compiler: arc-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231207/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/scsi/mpi3mr/mpi3mr_os.c:5272: warning: Function parameter or member 'mrioc' not described in 'mpi3mr_get_shost_and_mrioc' >> drivers/scsi/mpi3mr/mpi3mr_os.c:5272: warning: Excess function parameter 'ioc' description in 'mpi3mr_get_shost_and_mrioc'
vim +5272 drivers/scsi/mpi3mr/mpi3mr_os.c
5258
5259 /**
5260 * mpi3mr_get_shost_and_mrioc - get shost and ioc reference if
5261 * they are valid
5262 * @pdev: PCI device struct
5263 * @shost: address to store scsi host reference
5264 * @ioc: address store HBA adapter reference
5265 *
5266 * Return: 0 if *shost and *ioc are not NULL otherwise -1.
5267 */
5268
5269 static int
5270 mpi3mr_get_shost_and_mrioc(struct pci_dev *pdev,
5271 struct Scsi_Host **shost, struct mpi3mr_ioc **mrioc)
> 5272 { 5273 *shost = pci_get_drvdata(pdev);
5274 if (*shost == NULL) {
5275 dev_err(&pdev->dev, "pdev's driver data is null\n");
5276 return -1;
5277 }
5278
5279 *mrioc = shost_priv(*shost);
5280 if (*mrioc == NULL) {
5281 dev_err(&pdev->dev, "shost's private data is null\n");
5282 *shost = NULL;
5283 return -1;
5284 }
5285 return 0;
5286 }
5287
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 3/4 mpi3mr: Reset stop_bsgs flag post controller reset failure
In reply to Ranjan Kumarstop_bsgs flag blocks the ioctls during controller reset. currently, it remains set after a controller failure, so resetting it.
--- drivers/scsi/mpi3mr/mpi3mr_fw.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/mpi3mr/mpi3mr_fw.c +1 -0
@@ -5138,6 +5138,7 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc, mrioc->device_refresh_on =0 ; mrioc->unrecoverable =1 ; mrioc->reset_in_progress =0 ; + mrioc->stop_bsgs =0 ; retval =-1 ;mpi3mr_flush_cmds_for_unrecovered_controller (mrioc); }
Signature · 1 line
2.31.1
PATCH 4/4 mpi3mr: Update driver version to 8.6.1.0.0
In reply to Ranjan KumarUpdate driver version to 8.6.1.0.0
--- drivers/scsi/mpi3mr/mpi3mr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +2 -2
@@ -56,8 +56,8 @@ extern struct list_head mrioc_list;extern int prot_mask;extern atomic64_t event_counter; -#define MPI3MR_DRIVER_VERSION "8.5.1.0.0" -#define MPI3MR_DRIVER_RELDATE "5-December-2023" +#define MPI3MR_DRIVER_VERSION "8.6.1.0.0" +#define MPI3MR_DRIVER_RELDATE "6-December-2023"#define MPI3MR_DRIVER_NAME "mpi3mr"#define MPI3MR_DRIVER_LICENSE "GPL"
Signature · 1 line
2.31.1