Commit 698ec016 authored by Martin Peschke's avatar Martin Peschke Committed by James Bottomley

[SCSI] zfcp: Add traces for state changes.

This patch writes a trace record which provides information about state
changes for adapters, ports and units, e.g. target failure, targets becoming
online, targets being temporarily blocked due to pending recovery, targets
which have been recovered successfully etc.
Signed-off-by: default avatarMartin Peschke <mp3@de.ibm.com>
Signed-off-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 348447e8
...@@ -170,8 +170,8 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device) ...@@ -170,8 +170,8 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device)
BUG_ON(!zfcp_reqlist_isempty(adapter)); BUG_ON(!zfcp_reqlist_isempty(adapter));
adapter->req_no = 0; adapter->req_no = 0;
zfcp_erp_modify_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING, zfcp_erp_modify_adapter_status(adapter, 10, 0,
ZFCP_SET); ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_wait(adapter); zfcp_erp_wait(adapter);
goto out; goto out;
...@@ -236,7 +236,7 @@ zfcp_ccw_notify(struct ccw_device *ccw_device, int event) ...@@ -236,7 +236,7 @@ zfcp_ccw_notify(struct ccw_device *ccw_device, int event)
ZFCP_LOG_NORMAL("adapter %s: operational again\n", ZFCP_LOG_NORMAL("adapter %s: operational again\n",
zfcp_get_busid_by_adapter(adapter)); zfcp_get_busid_by_adapter(adapter));
debug_text_event(adapter->erp_dbf,1,"dev_oper"); debug_text_event(adapter->erp_dbf,1,"dev_oper");
zfcp_erp_modify_adapter_status(adapter, zfcp_erp_modify_adapter_status(adapter, 11, 0,
ZFCP_STATUS_COMMON_RUNNING, ZFCP_STATUS_COMMON_RUNNING,
ZFCP_SET); ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, zfcp_erp_adapter_reopen(adapter,
......
...@@ -522,6 +522,7 @@ static struct debug_view zfcp_hba_dbf_view = { ...@@ -522,6 +522,7 @@ static struct debug_view zfcp_hba_dbf_view = {
static const char *zfcp_rec_dbf_tags[] = { static const char *zfcp_rec_dbf_tags[] = {
[ZFCP_REC_DBF_ID_THREAD] = "thread", [ZFCP_REC_DBF_ID_THREAD] = "thread",
[ZFCP_REC_DBF_ID_TARGET] = "target",
}; };
static const char *zfcp_rec_dbf_ids[] = { static const char *zfcp_rec_dbf_ids[] = {
...@@ -534,6 +535,58 @@ static const char *zfcp_rec_dbf_ids[] = { ...@@ -534,6 +535,58 @@ static const char *zfcp_rec_dbf_ids[] = {
[7] = "down wakeup ecd", [7] = "down wakeup ecd",
[8] = "down sleep epd", [8] = "down sleep epd",
[9] = "down wakeup epd", [9] = "down wakeup epd",
[10] = "online",
[11] = "operational",
[12] = "scsi slave destroy",
[13] = "propagate failed adapter",
[14] = "propagate failed port",
[15] = "block adapter",
[16] = "unblock adapter",
[17] = "block port",
[18] = "unblock port",
[19] = "block unit",
[20] = "unblock unit",
[21] = "unit recovery failed",
[22] = "port recovery failed",
[23] = "adapter recovery failed",
[24] = "qdio queues down",
[25] = "p2p failed",
[26] = "nameserver lookup failed",
[27] = "nameserver port failed",
[28] = "link up",
[29] = "link down",
[30] = "link up status read",
[31] = "open port failed",
[32] = "open port failed",
[33] = "close port",
[34] = "open unit failed",
[35] = "exclusive open unit failed",
[36] = "shared open unit failed",
[37] = "link down",
[38] = "link down status read no link",
[39] = "link down status read fdisc login",
[40] = "link down status read firmware update",
[41] = "link down status read unknown reason",
[42] = "link down ecd incomplete",
[43] = "link down epd incomplete",
[44] = "sysfs adapter recovery",
[45] = "sysfs port recovery",
[46] = "sysfs unit recovery",
[47] = "port boxed abort",
[48] = "unit boxed abort",
[49] = "port boxed ct",
[50] = "port boxed close physical",
[51] = "port boxed open unit",
[52] = "port boxed close unit",
[53] = "port boxed fcp",
[54] = "unit boxed fcp",
[55] = "port access denied ct",
[56] = "port access denied els",
[57] = "port access denied open port",
[58] = "port access denied close physical",
[59] = "unit access denied open unit",
[60] = "shared unit access denied open unit",
[61] = "unit access denied fcp",
}; };
static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view,
...@@ -552,6 +605,14 @@ static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, ...@@ -552,6 +605,14 @@ static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view,
zfcp_dbf_out(&p, "ready", "%d", r->u.thread.ready); zfcp_dbf_out(&p, "ready", "%d", r->u.thread.ready);
zfcp_dbf_out(&p, "running", "%d", r->u.thread.running); zfcp_dbf_out(&p, "running", "%d", r->u.thread.running);
break; break;
case ZFCP_REC_DBF_ID_TARGET:
zfcp_dbf_out(&p, "reference", "0x%016Lx", r->u.target.ref);
zfcp_dbf_out(&p, "status", "0x%08x", r->u.target.status);
zfcp_dbf_out(&p, "erp_count", "%d", r->u.target.erp_count);
zfcp_dbf_out(&p, "d_id", "0x%06x", r->u.target.d_id);
zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.target.wwpn);
zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.target.fcp_lun);
break;
} }
sprintf(p, "\n"); sprintf(p, "\n");
return (p - buf) + 1; return (p - buf) + 1;
...@@ -601,6 +662,71 @@ void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock) ...@@ -601,6 +662,71 @@ void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock)
spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
} }
static void zfcp_rec_dbf_event_target(u8 id2, u64 ref,
struct zfcp_adapter *adapter,
atomic_t *status, atomic_t *erp_count,
u64 wwpn, u32 d_id, u64 fcp_lun)
{
struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
unsigned long flags;
spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
memset(r, 0, sizeof(*r));
r->id = ZFCP_REC_DBF_ID_TARGET;
r->id2 = id2;
r->u.target.ref = ref;
r->u.target.status = atomic_read(status);
r->u.target.wwpn = wwpn;
r->u.target.d_id = d_id;
r->u.target.fcp_lun = fcp_lun;
r->u.target.erp_count = atomic_read(erp_count);
debug_event(adapter->rec_dbf, 3, r, sizeof(*r));
spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
}
/**
* zfcp_rec_dbf_event_adapter - trace event for adapter state change
* @id: identifier for trigger of state change
* @ref: additional reference (e.g. request)
* @adapter: adapter
*/
void zfcp_rec_dbf_event_adapter(u8 id, u64 ref, struct zfcp_adapter *adapter)
{
zfcp_rec_dbf_event_target(id, ref, adapter, &adapter->status,
&adapter->erp_counter, 0, 0, 0);
}
/**
* zfcp_rec_dbf_event_port - trace event for port state change
* @id: identifier for trigger of state change
* @ref: additional reference (e.g. request)
* @port: port
*/
void zfcp_rec_dbf_event_port(u8 id, u64 ref, struct zfcp_port *port)
{
struct zfcp_adapter *adapter = port->adapter;
zfcp_rec_dbf_event_target(id, ref, adapter, &port->status,
&port->erp_counter, port->wwpn, port->d_id,
0);
}
/**
* zfcp_rec_dbf_event_unit - trace event for unit state change
* @id: identifier for trigger of state change
* @ref: additional reference (e.g. request)
* @unit: unit
*/
void zfcp_rec_dbf_event_unit(u8 id, u64 ref, struct zfcp_unit *unit)
{
struct zfcp_port *port = unit->port;
struct zfcp_adapter *adapter = port->adapter;
zfcp_rec_dbf_event_target(id, ref, adapter, &unit->status,
&unit->erp_counter, port->wwpn, port->d_id,
unit->fcp_lun);
}
static void static void
_zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req, _zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req,
u32 s_id, u32 d_id, void *buffer, int buflen) u32 s_id, u32 d_id, void *buffer, int buflen)
......
...@@ -286,16 +286,27 @@ struct zfcp_rec_dbf_record_thread { ...@@ -286,16 +286,27 @@ struct zfcp_rec_dbf_record_thread {
u32 running; u32 running;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct zfcp_rec_dbf_record_target {
u64 ref;
u32 status;
u32 d_id;
u64 wwpn;
u64 fcp_lun;
u32 erp_count;
} __attribute__ ((packed));
struct zfcp_rec_dbf_record { struct zfcp_rec_dbf_record {
u8 id; u8 id;
u8 id2; u8 id2;
union { union {
struct zfcp_rec_dbf_record_thread thread; struct zfcp_rec_dbf_record_thread thread;
struct zfcp_rec_dbf_record_target target;
} u; } u;
} __attribute__ ((packed)); } __attribute__ ((packed));
enum { enum {
ZFCP_REC_DBF_ID_THREAD, ZFCP_REC_DBF_ID_THREAD,
ZFCP_REC_DBF_ID_TARGET,
}; };
struct zfcp_hba_dbf_record_response { struct zfcp_hba_dbf_record_response {
......
This diff is collapsed.
...@@ -131,22 +131,23 @@ extern int zfcp_scsi_command_sync(struct zfcp_unit *, struct scsi_cmnd *, int); ...@@ -131,22 +131,23 @@ extern int zfcp_scsi_command_sync(struct zfcp_unit *, struct scsi_cmnd *, int);
extern struct fc_function_template zfcp_transport_functions; extern struct fc_function_template zfcp_transport_functions;
/******************************** ERP ****************************************/ /******************************** ERP ****************************************/
extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u32, int); extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u8, u64, u32,
int);
extern int zfcp_erp_adapter_reopen(struct zfcp_adapter *, int); extern int zfcp_erp_adapter_reopen(struct zfcp_adapter *, int);
extern int zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int); extern int zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int);
extern void zfcp_erp_adapter_failed(struct zfcp_adapter *); extern void zfcp_erp_adapter_failed(struct zfcp_adapter *, u8, u64);
extern void zfcp_erp_modify_port_status(struct zfcp_port *, u32, int); extern void zfcp_erp_modify_port_status(struct zfcp_port *, u8, u64, u32, int);
extern int zfcp_erp_port_reopen(struct zfcp_port *, int); extern int zfcp_erp_port_reopen(struct zfcp_port *, int);
extern int zfcp_erp_port_shutdown(struct zfcp_port *, int); extern int zfcp_erp_port_shutdown(struct zfcp_port *, int);
extern int zfcp_erp_port_forced_reopen(struct zfcp_port *, int); extern int zfcp_erp_port_forced_reopen(struct zfcp_port *, int);
extern void zfcp_erp_port_failed(struct zfcp_port *); extern void zfcp_erp_port_failed(struct zfcp_port *, u8, u64);
extern int zfcp_erp_port_reopen_all(struct zfcp_adapter *, int); extern int zfcp_erp_port_reopen_all(struct zfcp_adapter *, int);
extern void zfcp_erp_modify_unit_status(struct zfcp_unit *, u32, int); extern void zfcp_erp_modify_unit_status(struct zfcp_unit *, u8, u64, u32, int);
extern int zfcp_erp_unit_reopen(struct zfcp_unit *, int); extern int zfcp_erp_unit_reopen(struct zfcp_unit *, int);
extern int zfcp_erp_unit_shutdown(struct zfcp_unit *, int); extern int zfcp_erp_unit_shutdown(struct zfcp_unit *, int);
extern void zfcp_erp_unit_failed(struct zfcp_unit *); extern void zfcp_erp_unit_failed(struct zfcp_unit *, u8, u64);
extern int zfcp_erp_thread_setup(struct zfcp_adapter *); extern int zfcp_erp_thread_setup(struct zfcp_adapter *);
extern int zfcp_erp_thread_kill(struct zfcp_adapter *); extern int zfcp_erp_thread_kill(struct zfcp_adapter *);
...@@ -155,10 +156,10 @@ extern void zfcp_erp_async_handler(struct zfcp_erp_action *, unsigned long); ...@@ -155,10 +156,10 @@ extern void zfcp_erp_async_handler(struct zfcp_erp_action *, unsigned long);
extern int zfcp_test_link(struct zfcp_port *); extern int zfcp_test_link(struct zfcp_port *);
extern void zfcp_erp_port_boxed(struct zfcp_port *); extern void zfcp_erp_port_boxed(struct zfcp_port *, u8 id, u64 ref);
extern void zfcp_erp_unit_boxed(struct zfcp_unit *); extern void zfcp_erp_unit_boxed(struct zfcp_unit *, u8 id, u64 ref);
extern void zfcp_erp_port_access_denied(struct zfcp_port *); extern void zfcp_erp_port_access_denied(struct zfcp_port *, u8 id, u64 ref);
extern void zfcp_erp_unit_access_denied(struct zfcp_unit *); extern void zfcp_erp_unit_access_denied(struct zfcp_unit *, u8 id, u64 ref);
extern void zfcp_erp_adapter_access_changed(struct zfcp_adapter *); extern void zfcp_erp_adapter_access_changed(struct zfcp_adapter *);
extern void zfcp_erp_port_access_changed(struct zfcp_port *); extern void zfcp_erp_port_access_changed(struct zfcp_port *);
extern void zfcp_erp_unit_access_changed(struct zfcp_unit *); extern void zfcp_erp_unit_access_changed(struct zfcp_unit *);
...@@ -166,6 +167,9 @@ extern void zfcp_erp_unit_access_changed(struct zfcp_unit *); ...@@ -166,6 +167,9 @@ extern void zfcp_erp_unit_access_changed(struct zfcp_unit *);
/******************************** AUX ****************************************/ /******************************** AUX ****************************************/
extern void zfcp_rec_dbf_event_thread(u8 id, struct zfcp_adapter *adapter, extern void zfcp_rec_dbf_event_thread(u8 id, struct zfcp_adapter *adapter,
int lock); int lock);
extern void zfcp_rec_dbf_event_adapter(u8 id, u64 ref, struct zfcp_adapter *);
extern void zfcp_rec_dbf_event_port(u8 id, u64 ref, struct zfcp_port *port);
extern void zfcp_rec_dbf_event_unit(u8 id, u64 ref, struct zfcp_unit *unit);
extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *); extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *);
extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *, extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *,
......
This diff is collapsed.
...@@ -185,7 +185,7 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt) ...@@ -185,7 +185,7 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status); atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status);
sdpnt->hostdata = NULL; sdpnt->hostdata = NULL;
unit->device = NULL; unit->device = NULL;
zfcp_erp_unit_failed(unit); zfcp_erp_unit_failed(unit, 12, 0);
zfcp_unit_put(unit); zfcp_unit_put(unit);
} else } else
ZFCP_LOG_NORMAL("bug: no unit associated with SCSI device at " ZFCP_LOG_NORMAL("bug: no unit associated with SCSI device at "
......
...@@ -191,8 +191,8 @@ zfcp_sysfs_adapter_failed_store(struct device *dev, struct device_attribute *att ...@@ -191,8 +191,8 @@ zfcp_sysfs_adapter_failed_store(struct device *dev, struct device_attribute *att
goto out; goto out;
} }
zfcp_erp_modify_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING, zfcp_erp_modify_adapter_status(adapter, 44, 0,
ZFCP_SET); ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_wait(adapter); zfcp_erp_wait(adapter);
out: out:
......
...@@ -193,7 +193,8 @@ zfcp_sysfs_port_failed_store(struct device *dev, struct device_attribute *attr, ...@@ -193,7 +193,8 @@ zfcp_sysfs_port_failed_store(struct device *dev, struct device_attribute *attr,
goto out; goto out;
} }
zfcp_erp_modify_port_status(port, ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); zfcp_erp_modify_port_status(port, 45, 0,
ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED); zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_wait(port->adapter); zfcp_erp_wait(port->adapter);
out: out:
......
...@@ -94,7 +94,8 @@ zfcp_sysfs_unit_failed_store(struct device *dev, struct device_attribute *attr, ...@@ -94,7 +94,8 @@ zfcp_sysfs_unit_failed_store(struct device *dev, struct device_attribute *attr,
goto out; goto out;
} }
zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); zfcp_erp_modify_unit_status(unit, 46, 0,
ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_wait(unit->port->adapter); zfcp_erp_wait(unit->port->adapter);
out: out:
......
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