Skip to content

Commit f4ba528

Browse files
Chandrakanth Patilroot
authored andcommitted
scsi: mpi3mr: Event processing debug improvement
JIRA: https://issues.redhat.com/browse/RHEL-80698 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> (cherry picked from commit 04f79c1) Signed-off-by: Chandrakanth Patil <chanpati@redhat.com>
1 parent 06c4d37 commit f4ba528

File tree

1 file changed

+50
-17
lines changed

1 file changed

+50
-17
lines changed

drivers/scsi/mpi3mr/mpi3mr_os.c

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,10 @@ static int mpi3mr_report_tgtdev_to_host(struct mpi3mr_ioc *mrioc,
985985
goto out;
986986
}
987987
}
988+
dprint_event_bh(mrioc,
989+
"exposed target device with handle(0x%04x), perst_id(%d)\n",
990+
tgtdev->dev_handle, perst_id);
991+
goto out;
988992
} else
989993
mpi3mr_report_tgtdev_to_sas_transport(mrioc, tgtdev);
990994
out:
@@ -1344,9 +1348,9 @@ static void mpi3mr_devstatuschg_evt_bh(struct mpi3mr_ioc *mrioc,
13441348
(struct mpi3_event_data_device_status_change *)fwevt->event_data;
13451349

13461350
dev_handle = le16_to_cpu(evtdata->dev_handle);
1347-
ioc_info(mrioc,
1348-
"%s :device status change: handle(0x%04x): reason code(0x%x)\n",
1349-
__func__, dev_handle, evtdata->reason_code);
1351+
dprint_event_bh(mrioc,
1352+
"processing device status change event bottom half for handle(0x%04x), rc(0x%02x)\n",
1353+
dev_handle, evtdata->reason_code);
13501354
switch (evtdata->reason_code) {
13511355
case MPI3_EVENT_DEV_STAT_RC_HIDDEN:
13521356
delete = 1;
@@ -1365,8 +1369,13 @@ static void mpi3mr_devstatuschg_evt_bh(struct mpi3mr_ioc *mrioc,
13651369
}
13661370

13671371
tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle);
1368-
if (!tgtdev)
1372+
if (!tgtdev) {
1373+
dprint_event_bh(mrioc,
1374+
"processing device status change event bottom half,\n"
1375+
"cannot identify target device for handle(0x%04x), rc(0x%02x)\n",
1376+
dev_handle, evtdata->reason_code);
13691377
goto out;
1378+
}
13701379
if (uhide) {
13711380
tgtdev->is_hidden = 0;
13721381
if (!tgtdev->host_exposed)
@@ -1406,12 +1415,17 @@ static void mpi3mr_devinfochg_evt_bh(struct mpi3mr_ioc *mrioc,
14061415

14071416
perst_id = le16_to_cpu(dev_pg0->persistent_id);
14081417
dev_handle = le16_to_cpu(dev_pg0->dev_handle);
1409-
ioc_info(mrioc,
1410-
"%s :Device info change: handle(0x%04x): persist_id(0x%x)\n",
1411-
__func__, dev_handle, perst_id);
1418+
dprint_event_bh(mrioc,
1419+
"processing device info change event bottom half for handle(0x%04x), perst_id(%d)\n",
1420+
dev_handle, perst_id);
14121421
tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle);
1413-
if (!tgtdev)
1422+
if (!tgtdev) {
1423+
dprint_event_bh(mrioc,
1424+
"cannot identify target device for device info\n"
1425+
"change event handle(0x%04x), perst_id(%d)\n",
1426+
dev_handle, perst_id);
14141427
goto out;
1428+
}
14151429
mpi3mr_update_tgtdev(mrioc, tgtdev, dev_pg0, false);
14161430
if (!tgtdev->is_hidden && !tgtdev->host_exposed)
14171431
mpi3mr_report_tgtdev_to_host(mrioc, perst_id);
@@ -2012,8 +2026,11 @@ static void mpi3mr_fwevt_bh(struct mpi3mr_ioc *mrioc,
20122026
mpi3mr_fwevt_del_from_list(mrioc, fwevt);
20132027
mrioc->current_event = fwevt;
20142028

2015-
if (mrioc->stop_drv_processing)
2029+
if (mrioc->stop_drv_processing) {
2030+
dprint_event_bh(mrioc, "ignoring event(0x%02x) in the bottom half handler\n"
2031+
"due to stop_drv_processing\n", fwevt->event_id);
20162032
goto out;
2033+
}
20172034

20182035
if (mrioc->unrecoverable) {
20192036
dprint_event_bh(mrioc,
@@ -2025,6 +2042,9 @@ static void mpi3mr_fwevt_bh(struct mpi3mr_ioc *mrioc,
20252042
if (!fwevt->process_evt)
20262043
goto evt_ack;
20272044

2045+
dprint_event_bh(mrioc, "processing event(0x%02x) in the bottom half handler\n",
2046+
fwevt->event_id);
2047+
20282048
switch (fwevt->event_id) {
20292049
case MPI3_EVENT_DEVICE_ADDED:
20302050
{
@@ -2763,6 +2783,9 @@ static void mpi3mr_devstatuschg_evt_th(struct mpi3mr_ioc *mrioc,
27632783
goto out;
27642784

27652785
dev_handle = le16_to_cpu(evtdata->dev_handle);
2786+
dprint_event_th(mrioc,
2787+
"device status change event top half with rc(0x%02x) for handle(0x%04x)\n",
2788+
evtdata->reason_code, dev_handle);
27662789

27672790
switch (evtdata->reason_code) {
27682791
case MPI3_EVENT_DEV_STAT_RC_INT_DEVICE_RESET_STRT:
@@ -2786,8 +2809,12 @@ static void mpi3mr_devstatuschg_evt_th(struct mpi3mr_ioc *mrioc,
27862809
}
27872810

27882811
tgtdev = mpi3mr_get_tgtdev_by_handle(mrioc, dev_handle);
2789-
if (!tgtdev)
2812+
if (!tgtdev) {
2813+
dprint_event_th(mrioc,
2814+
"processing device status change event could not identify device for handle(0x%04x)\n",
2815+
dev_handle);
27902816
goto out;
2817+
}
27912818
if (hide)
27922819
tgtdev->is_hidden = hide;
27932820
if (tgtdev->starget && tgtdev->starget->hostdata) {
@@ -2863,13 +2890,13 @@ static void mpi3mr_energypackchg_evt_th(struct mpi3mr_ioc *mrioc,
28632890
u16 shutdown_timeout = le16_to_cpu(evtdata->shutdown_timeout);
28642891

28652892
if (shutdown_timeout <= 0) {
2866-
ioc_warn(mrioc,
2893+
dprint_event_th(mrioc,
28672894
"%s :Invalid Shutdown Timeout received = %d\n",
28682895
__func__, shutdown_timeout);
28692896
return;
28702897
}
28712898

2872-
ioc_info(mrioc,
2899+
dprint_event_th(mrioc,
28732900
"%s :Previous Shutdown Timeout Value = %d New Shutdown Timeout Value = %d\n",
28742901
__func__, mrioc->facts.shutdown_timeout, shutdown_timeout);
28752902
mrioc->facts.shutdown_timeout = shutdown_timeout;
@@ -2974,9 +3001,11 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc,
29743001
struct mpi3_device_page0 *dev_pg0 =
29753002
(struct mpi3_device_page0 *)event_reply->event_data;
29763003
if (mpi3mr_create_tgtdev(mrioc, dev_pg0))
2977-
ioc_err(mrioc,
2978-
"%s :Failed to add device in the device add event\n",
2979-
__func__);
3004+
dprint_event_th(mrioc,
3005+
"failed to process device added event for handle(0x%04x),\n"
3006+
"perst_id(%d) in the event top half handler\n",
3007+
le16_to_cpu(dev_pg0->dev_handle),
3008+
le16_to_cpu(dev_pg0->persistent_id));
29803009
else
29813010
process_evt_bh = 1;
29823011
break;
@@ -3039,11 +3068,15 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc,
30393068
break;
30403069
}
30413070
if (process_evt_bh || ack_req) {
3071+
dprint_event_th(mrioc,
3072+
"scheduling bottom half handler for event(0x%02x),ack_required=%d\n",
3073+
evt_type, ack_req);
30423074
sz = event_reply->event_data_length * 4;
30433075
fwevt = mpi3mr_alloc_fwevt(sz);
30443076
if (!fwevt) {
3045-
ioc_info(mrioc, "%s :failure at %s:%d/%s()!\n",
3046-
__func__, __FILE__, __LINE__, __func__);
3077+
dprint_event_th(mrioc,
3078+
"failed to schedule bottom half handler for\n"
3079+
"event(0x%02x), ack_required=%d\n", evt_type, ack_req);
30473080
return;
30483081
}
30493082

0 commit comments

Comments
 (0)