]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: mpi3mr: Event processing debug improvement
authorRanjan Kumar <ranjan.kumar@broadcom.com>
Wed, 23 Apr 2025 09:21:39 +0000 (14:51 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 29 Apr 2025 01:54:03 +0000 (21:54 -0400)
Improve event process debugging. Implement more verbose event logging
throughout the driver.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20250423092139.110206-1-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpi3mr/mpi3mr_os.c

index 261d7550d5a6b475b48dd56de845d82a2cb48fad..ce444efd859e34dd56ec303fd717cac67ee69f73 100644 (file)
@@ -985,6 +985,10 @@ static int mpi3mr_report_tgtdev_to_host(struct mpi3mr_ioc *mrioc,
                                goto out;
                        }
                }
+               dprint_event_bh(mrioc,
+                   "exposed target device with handle(0x%04x), perst_id(%d)\n",
+                   tgtdev->dev_handle, perst_id);
+               goto out;
        } else
                mpi3mr_report_tgtdev_to_sas_transport(mrioc, tgtdev);
 out:
@@ -1344,9 +1348,9 @@ static void mpi3mr_devstatuschg_evt_bh(struct mpi3mr_ioc *mrioc,
            (struct mpi3_event_data_device_status_change *)fwevt->event_data;
 
        dev_handle = le16_to_cpu(evtdata->dev_handle);
-       ioc_info(mrioc,
-           "%s :device status change: handle(0x%04x): reason code(0x%x)\n",
-           __func__, dev_handle, evtdata->reason_code);
+       dprint_event_bh(mrioc,
+           "processing device status change event bottom half for handle(0x%04x), rc(0x%02x)\n",
+           dev_handle, evtdata->reason_code);
        switch (evtdata->reason_code) {
        case MPI3_EVENT_DEV_STAT_RC_HIDDEN:
                delete = 1;
@@ -1365,8 +1369,13 @@ static void mpi3mr_devstatuschg_evt_bh(struct mpi3mr_ioc *mrioc,
        }
 
        tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle);
-       if (!tgtdev)
+       if (!tgtdev) {
+               dprint_event_bh(mrioc,
+                   "processing device status change event bottom half,\n"
+                   "cannot identify target device for handle(0x%04x), rc(0x%02x)\n",
+                   dev_handle, evtdata->reason_code);
                goto out;
+       }
        if (uhide) {
                tgtdev->is_hidden = 0;
                if (!tgtdev->host_exposed)
@@ -1406,12 +1415,17 @@ static void mpi3mr_devinfochg_evt_bh(struct mpi3mr_ioc *mrioc,
 
        perst_id = le16_to_cpu(dev_pg0->persistent_id);
        dev_handle = le16_to_cpu(dev_pg0->dev_handle);
-       ioc_info(mrioc,
-           "%s :Device info change: handle(0x%04x): persist_id(0x%x)\n",
-           __func__, dev_handle, perst_id);
+       dprint_event_bh(mrioc,
+           "processing device info change event bottom half for handle(0x%04x), perst_id(%d)\n",
+           dev_handle, perst_id);
        tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle);
-       if (!tgtdev)
+       if (!tgtdev) {
+               dprint_event_bh(mrioc,
+                   "cannot identify target device for  device info\n"
+                   "change event handle(0x%04x), perst_id(%d)\n",
+                   dev_handle, perst_id);
                goto out;
+       }
        mpi3mr_update_tgtdev(mrioc, tgtdev, dev_pg0, false);
        if (!tgtdev->is_hidden && !tgtdev->host_exposed)
                mpi3mr_report_tgtdev_to_host(mrioc, perst_id);
@@ -2012,8 +2026,11 @@ static void mpi3mr_fwevt_bh(struct mpi3mr_ioc *mrioc,
        mpi3mr_fwevt_del_from_list(mrioc, fwevt);
        mrioc->current_event = fwevt;
 
-       if (mrioc->stop_drv_processing)
+       if (mrioc->stop_drv_processing) {
+               dprint_event_bh(mrioc, "ignoring event(0x%02x) in the bottom half handler\n"
+                               "due to stop_drv_processing\n", fwevt->event_id);
                goto out;
+       }
 
        if (mrioc->unrecoverable) {
                dprint_event_bh(mrioc,
@@ -2025,6 +2042,9 @@ static void mpi3mr_fwevt_bh(struct mpi3mr_ioc *mrioc,
        if (!fwevt->process_evt)
                goto evt_ack;
 
+       dprint_event_bh(mrioc, "processing event(0x%02x) in the bottom half handler\n",
+           fwevt->event_id);
+
        switch (fwevt->event_id) {
        case MPI3_EVENT_DEVICE_ADDED:
        {
@@ -2763,6 +2783,9 @@ static void mpi3mr_devstatuschg_evt_th(struct mpi3mr_ioc *mrioc,
                goto out;
 
        dev_handle = le16_to_cpu(evtdata->dev_handle);
+       dprint_event_th(mrioc,
+           "device status change event top half with rc(0x%02x) for handle(0x%04x)\n",
+           evtdata->reason_code, dev_handle);
 
        switch (evtdata->reason_code) {
        case MPI3_EVENT_DEV_STAT_RC_INT_DEVICE_RESET_STRT:
@@ -2786,8 +2809,12 @@ static void mpi3mr_devstatuschg_evt_th(struct mpi3mr_ioc *mrioc,
        }
 
        tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle);
-       if (!tgtdev)
+       if (!tgtdev) {
+               dprint_event_th(mrioc,
+                   "processing device status change event could not identify device for handle(0x%04x)\n",
+                   dev_handle);
                goto out;
+       }
        if (hide)
                tgtdev->is_hidden = hide;
        if (tgtdev->starget && tgtdev->starget->hostdata) {
@@ -2863,13 +2890,13 @@ static void mpi3mr_energypackchg_evt_th(struct mpi3mr_ioc *mrioc,
        u16 shutdown_timeout = le16_to_cpu(evtdata->shutdown_timeout);
 
        if (shutdown_timeout <= 0) {
-               ioc_warn(mrioc,
+               dprint_event_th(mrioc,
                    "%s :Invalid Shutdown Timeout received = %d\n",
                    __func__, shutdown_timeout);
                return;
        }
 
-       ioc_info(mrioc,
+       dprint_event_th(mrioc,
            "%s :Previous Shutdown Timeout Value = %d New Shutdown Timeout Value = %d\n",
            __func__, mrioc->facts.shutdown_timeout, shutdown_timeout);
        mrioc->facts.shutdown_timeout = shutdown_timeout;
@@ -2974,9 +3001,11 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc,
                struct mpi3_device_page0 *dev_pg0 =
                    (struct mpi3_device_page0 *)event_reply->event_data;
                if (mpi3mr_create_tgtdev(mrioc, dev_pg0))
-                       ioc_err(mrioc,
-                           "%s :Failed to add device in the device add event\n",
-                           __func__);
+                       dprint_event_th(mrioc,
+                               "failed to process device added event for handle(0x%04x),\n"
+                               "perst_id(%d) in the event top half handler\n",
+                               le16_to_cpu(dev_pg0->dev_handle),
+                               le16_to_cpu(dev_pg0->persistent_id));
                else
                        process_evt_bh = 1;
                break;
@@ -3039,11 +3068,15 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc,
                break;
        }
        if (process_evt_bh || ack_req) {
+               dprint_event_th(mrioc,
+                       "scheduling bottom half handler for event(0x%02x),ack_required=%d\n",
+                       evt_type, ack_req);
                sz = event_reply->event_data_length * 4;
                fwevt = mpi3mr_alloc_fwevt(sz);
                if (!fwevt) {
-                       ioc_info(mrioc, "%s :failure at %s:%d/%s()!\n",
-                           __func__, __FILE__, __LINE__, __func__);
+                       dprint_event_th(mrioc,
+                               "failed to schedule bottom half handler for\n"
+                               "event(0x%02x), ack_required=%d\n", evt_type, ack_req);
                        return;
                }