Commit ae0904f6 authored by Swen Schillig's avatar Swen Schillig Committed by James Bottomley

[SCSI] zfcp: Redesign of the debug tracing for recovery actions.

The tracing environment of the zfcp LLD has become very bulky and hard
to maintain. Small changes involve a large modification process which
is error-prone and not effective.  This patch is the first of a set to
redesign the zfcp tracing to a more straight-forward and easy to
extend scheme.  It removes all interpretation and visualization parts
and focuses on bare logging of the information.

This patch deals with all trace records of the zfcp error recovery.
Signed-off-by: default avatarSwen schillig <swen@vnet.ibm.com>
Signed-off-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 6b57b159
This diff is collapsed.
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "zfcp_fsf.h" #include "zfcp_fsf.h"
#include "zfcp_def.h" #include "zfcp_def.h"
#define ZFCP_DBF_TAG_LEN 7
#define ZFCP_DBF_TAG_SIZE 4 #define ZFCP_DBF_TAG_SIZE 4
#define ZFCP_DBF_ID_SIZE 7 #define ZFCP_DBF_ID_SIZE 7
...@@ -40,57 +41,72 @@ struct zfcp_dbf_dump { ...@@ -40,57 +41,72 @@ struct zfcp_dbf_dump {
u8 data[]; /* dump data */ u8 data[]; /* dump data */
} __attribute__ ((packed)); } __attribute__ ((packed));
struct zfcp_dbf_rec_record_thread { /**
u32 total; * struct zfcp_dbf_rec_trigger - trace record for triggered recovery action
* @ready: number of ready recovery actions
* @running: number of running recovery actions
* @want: wanted recovery action
* @need: needed recovery action
*/
struct zfcp_dbf_rec_trigger {
u32 ready; u32 ready;
u32 running; u32 running;
};
struct zfcp_dbf_rec_record_target {
u64 ref;
u32 status;
u32 d_id;
u64 wwpn;
u64 fcp_lun;
u32 erp_count;
};
struct zfcp_dbf_rec_record_trigger {
u8 want; u8 want;
u8 need; u8 need;
u32 as; } __packed;
u32 ps;
u32 ls; /**
u64 ref; * struct zfcp_dbf_rec_running - trace record for running recovery
u64 action; * @fsf_req_id: request id for fsf requests
u64 wwpn; * @rec_status: status of the fsf request
u64 fcp_lun; * @rec_step: current step of the recovery action
}; * rec_count: recovery counter
*/
struct zfcp_dbf_rec_running {
u64 fsf_req_id;
u32 rec_status;
u16 rec_step;
u8 rec_action;
u8 rec_count;
} __packed;
struct zfcp_dbf_rec_record_action { /**
u32 status; * enum zfcp_dbf_rec_id - recovery trace record id
u32 step; * @ZFCP_DBF_REC_TRIG: triggered recovery identifier
u64 action; * @ZFCP_DBF_REC_RUN: running recovery identifier
u64 fsf_req; */
enum zfcp_dbf_rec_id {
ZFCP_DBF_REC_TRIG = 1,
ZFCP_DBF_REC_RUN = 2,
}; };
struct zfcp_dbf_rec_record { /**
* struct zfcp_dbf_rec - trace record for error recovery actions
* @id: unique number of recovery record type
* @tag: identifier string specifying the location of initiation
* @lun: logical unit number
* @wwpn: word wide port number
* @d_id: destination ID
* @adapter_status: current status of the adapter
* @port_status: current status of the port
* @lun_status: current status of the lun
* @u.trig: structure zfcp_dbf_rec_trigger
* @u.run: structure zfcp_dbf_rec_running
*/
struct zfcp_dbf_rec {
u8 id; u8 id;
char id2[7]; char tag[ZFCP_DBF_TAG_LEN];
u64 lun;
u64 wwpn;
u32 d_id;
u32 adapter_status;
u32 port_status;
u32 lun_status;
union { union {
struct zfcp_dbf_rec_record_action action; struct zfcp_dbf_rec_trigger trig;
struct zfcp_dbf_rec_record_thread thread; struct zfcp_dbf_rec_running run;
struct zfcp_dbf_rec_record_target target;
struct zfcp_dbf_rec_record_trigger trigger;
} u; } u;
}; } __packed;
enum {
ZFCP_REC_DBF_ID_ACTION,
ZFCP_REC_DBF_ID_THREAD,
ZFCP_REC_DBF_ID_TARGET,
ZFCP_REC_DBF_ID_TRIGGER,
};
struct zfcp_dbf_hba_record_response { struct zfcp_dbf_hba_record_response {
u32 fsf_command; u32 fsf_command;
...@@ -232,7 +248,7 @@ struct zfcp_dbf { ...@@ -232,7 +248,7 @@ struct zfcp_dbf {
spinlock_t hba_lock; spinlock_t hba_lock;
spinlock_t san_lock; spinlock_t san_lock;
spinlock_t scsi_lock; spinlock_t scsi_lock;
struct zfcp_dbf_rec_record rec_buf; struct zfcp_dbf_rec rec_buf;
struct zfcp_dbf_hba_record hba_buf; struct zfcp_dbf_hba_record hba_buf;
struct zfcp_dbf_san_record san_buf; struct zfcp_dbf_san_record san_buf;
struct zfcp_dbf_scsi_record scsi_buf; struct zfcp_dbf_scsi_record scsi_buf;
......
...@@ -76,9 +76,9 @@ static void zfcp_erp_action_ready(struct zfcp_erp_action *act) ...@@ -76,9 +76,9 @@ static void zfcp_erp_action_ready(struct zfcp_erp_action *act)
struct zfcp_adapter *adapter = act->adapter; struct zfcp_adapter *adapter = act->adapter;
list_move(&act->list, &act->adapter->erp_ready_head); list_move(&act->list, &act->adapter->erp_ready_head);
zfcp_dbf_rec_action("erardy1", act); zfcp_dbf_rec_run("erardy1", act);
wake_up(&adapter->erp_ready_wq); wake_up(&adapter->erp_ready_wq);
zfcp_dbf_rec_thread("erardy2", adapter->dbf); zfcp_dbf_rec_run("erardy2", act);
} }
static void zfcp_erp_action_dismiss(struct zfcp_erp_action *act) static void zfcp_erp_action_dismiss(struct zfcp_erp_action *act)
...@@ -239,7 +239,7 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter, ...@@ -239,7 +239,7 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
char *id, void *ref, u32 act_status) char *id, void *ref, u32 act_status)
{ {
int retval = 1, need; int retval = 1, need;
struct zfcp_erp_action *act = NULL; struct zfcp_erp_action *act;
if (!adapter->erp_thread) if (!adapter->erp_thread)
return -EIO; return -EIO;
...@@ -255,10 +255,9 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter, ...@@ -255,10 +255,9 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
++adapter->erp_total_count; ++adapter->erp_total_count;
list_add_tail(&act->list, &adapter->erp_ready_head); list_add_tail(&act->list, &adapter->erp_ready_head);
wake_up(&adapter->erp_ready_wq); wake_up(&adapter->erp_ready_wq);
zfcp_dbf_rec_thread("eracte1", adapter->dbf);
retval = 0; retval = 0;
out: out:
zfcp_dbf_rec_trigger(id, ref, want, need, act, adapter, port, sdev); zfcp_dbf_rec_trig(id, adapter, port, sdev, want, need);
return retval; return retval;
} }
...@@ -490,14 +489,14 @@ static int status_change_set(unsigned long mask, atomic_t *status) ...@@ -490,14 +489,14 @@ static int status_change_set(unsigned long mask, atomic_t *status)
static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter) static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter)
{ {
if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status)) if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status))
zfcp_dbf_rec_adapter("eraubl1", NULL, adapter->dbf); zfcp_dbf_rec_run("eraubl1", &adapter->erp_action);
atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status); atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status);
} }
static void zfcp_erp_port_unblock(struct zfcp_port *port) static void zfcp_erp_port_unblock(struct zfcp_port *port)
{ {
if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status)) if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status))
zfcp_dbf_rec_port("erpubl1", NULL, port); zfcp_dbf_rec_run("erpubl1", &port->erp_action);
atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status); atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status);
} }
...@@ -506,14 +505,14 @@ static void zfcp_erp_lun_unblock(struct scsi_device *sdev) ...@@ -506,14 +505,14 @@ static void zfcp_erp_lun_unblock(struct scsi_device *sdev)
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status)) if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status))
zfcp_dbf_rec_lun("erlubl1", NULL, sdev); zfcp_dbf_rec_run("erlubl1", &sdev_to_zfcp(sdev)->erp_action);
atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status); atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status);
} }
static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action) static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action)
{ {
list_move(&erp_action->list, &erp_action->adapter->erp_running_head); list_move(&erp_action->list, &erp_action->adapter->erp_running_head);
zfcp_dbf_rec_action("erator1", erp_action); zfcp_dbf_rec_run("erator1", erp_action);
} }
static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act) static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act)
...@@ -530,11 +529,11 @@ static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act) ...@@ -530,11 +529,11 @@ static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act)
if (act->status & (ZFCP_STATUS_ERP_DISMISSED | if (act->status & (ZFCP_STATUS_ERP_DISMISSED |
ZFCP_STATUS_ERP_TIMEDOUT)) { ZFCP_STATUS_ERP_TIMEDOUT)) {
req->status |= ZFCP_STATUS_FSFREQ_DISMISSED; req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
zfcp_dbf_rec_action("erscf_1", act); zfcp_dbf_rec_run("erscf_1", act);
req->erp_action = NULL; req->erp_action = NULL;
} }
if (act->status & ZFCP_STATUS_ERP_TIMEDOUT) if (act->status & ZFCP_STATUS_ERP_TIMEDOUT)
zfcp_dbf_rec_action("erscf_2", act); zfcp_dbf_rec_run("erscf_2", act);
if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED)
act->fsf_req_id = 0; act->fsf_req_id = 0;
} else } else
...@@ -693,10 +692,8 @@ static int zfcp_erp_adapter_strat_fsf_xconf(struct zfcp_erp_action *erp_action) ...@@ -693,10 +692,8 @@ static int zfcp_erp_adapter_strat_fsf_xconf(struct zfcp_erp_action *erp_action)
return ZFCP_ERP_FAILED; return ZFCP_ERP_FAILED;
} }
zfcp_dbf_rec_thread_lock("erasfx1", adapter->dbf);
wait_event(adapter->erp_ready_wq, wait_event(adapter->erp_ready_wq,
!list_empty(&adapter->erp_ready_head)); !list_empty(&adapter->erp_ready_head));
zfcp_dbf_rec_thread_lock("erasfx2", adapter->dbf);
if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
break; break;
...@@ -735,10 +732,10 @@ static int zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *act) ...@@ -735,10 +732,10 @@ static int zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *act)
if (ret) if (ret)
return ZFCP_ERP_FAILED; return ZFCP_ERP_FAILED;
zfcp_dbf_rec_thread_lock("erasox1", adapter->dbf); zfcp_dbf_rec_run("erasox1", act);
wait_event(adapter->erp_ready_wq, wait_event(adapter->erp_ready_wq,
!list_empty(&adapter->erp_ready_head)); !list_empty(&adapter->erp_ready_head));
zfcp_dbf_rec_thread_lock("erasox2", adapter->dbf); zfcp_dbf_rec_run("erasox2", act);
if (act->status & ZFCP_STATUS_ERP_TIMEDOUT) if (act->status & ZFCP_STATUS_ERP_TIMEDOUT)
return ZFCP_ERP_FAILED; return ZFCP_ERP_FAILED;
...@@ -1206,7 +1203,7 @@ static void zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action) ...@@ -1206,7 +1203,7 @@ static void zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action)
} }
list_del(&erp_action->list); list_del(&erp_action->list);
zfcp_dbf_rec_action("eractd1", erp_action); zfcp_dbf_rec_run("eractd1", erp_action);
switch (erp_action->action) { switch (erp_action->action) {
case ZFCP_ERP_ACTION_REOPEN_LUN: case ZFCP_ERP_ACTION_REOPEN_LUN:
...@@ -1357,11 +1354,9 @@ static int zfcp_erp_thread(void *data) ...@@ -1357,11 +1354,9 @@ static int zfcp_erp_thread(void *data)
unsigned long flags; unsigned long flags;
for (;;) { for (;;) {
zfcp_dbf_rec_thread_lock("erthrd1", adapter->dbf);
wait_event_interruptible(adapter->erp_ready_wq, wait_event_interruptible(adapter->erp_ready_wq,
!list_empty(&adapter->erp_ready_head) || !list_empty(&adapter->erp_ready_head) ||
kthread_should_stop()); kthread_should_stop());
zfcp_dbf_rec_thread_lock("erthrd2", adapter->dbf);
if (kthread_should_stop()) if (kthread_should_stop())
break; break;
......
...@@ -46,15 +46,9 @@ extern void zfcp_cfdc_adapter_access_changed(struct zfcp_adapter *); ...@@ -46,15 +46,9 @@ extern void zfcp_cfdc_adapter_access_changed(struct zfcp_adapter *);
/* zfcp_dbf.c */ /* zfcp_dbf.c */
extern int zfcp_dbf_adapter_register(struct zfcp_adapter *); extern int zfcp_dbf_adapter_register(struct zfcp_adapter *);
extern void zfcp_dbf_adapter_unregister(struct zfcp_dbf *); extern void zfcp_dbf_adapter_unregister(struct zfcp_dbf *);
extern void zfcp_dbf_rec_thread(char *, struct zfcp_dbf *); extern void zfcp_dbf_rec_trig(char *, struct zfcp_adapter *,
extern void zfcp_dbf_rec_thread_lock(char *, struct zfcp_dbf *); struct zfcp_port *, struct scsi_device *, u8, u8);
extern void zfcp_dbf_rec_adapter(char *, void *, struct zfcp_dbf *); extern void zfcp_dbf_rec_run(char *, struct zfcp_erp_action *);
extern void zfcp_dbf_rec_port(char *, void *, struct zfcp_port *);
extern void zfcp_dbf_rec_lun(char *, void *, struct scsi_device *);
extern void zfcp_dbf_rec_trigger(char *, void *, u8, u8, void *,
struct zfcp_adapter *, struct zfcp_port *,
struct scsi_device *);
extern void zfcp_dbf_rec_action(char *, struct zfcp_erp_action *);
extern void _zfcp_dbf_hba_fsf_response(const char *, int, struct zfcp_fsf_req *, extern void _zfcp_dbf_hba_fsf_response(const char *, int, struct zfcp_fsf_req *,
struct zfcp_dbf *); struct zfcp_dbf *);
extern void _zfcp_dbf_hba_fsf_unsol(const char *, int level, struct zfcp_dbf *, extern void _zfcp_dbf_hba_fsf_unsol(const char *, int level, struct zfcp_dbf *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment