Skip to content

Commit

Permalink
[SCSI] zfcp: Add traces for state changes.
Browse files Browse the repository at this point in the history
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: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
Martin Peschke authored and James Bottomley committed Apr 7, 2008
1 parent 348447e commit 698ec01
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 114 deletions.
6 changes: 3 additions & 3 deletions drivers/s390/scsi/zfcp_ccw.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device)
BUG_ON(!zfcp_reqlist_isempty(adapter));
adapter->req_no = 0;

zfcp_erp_modify_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING,
ZFCP_SET);
zfcp_erp_modify_adapter_status(adapter, 10, 0,
ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_wait(adapter);
goto out;
Expand Down Expand Up @@ -236,7 +236,7 @@ zfcp_ccw_notify(struct ccw_device *ccw_device, int event)
ZFCP_LOG_NORMAL("adapter %s: operational again\n",
zfcp_get_busid_by_adapter(adapter));
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_SET);
zfcp_erp_adapter_reopen(adapter,
Expand Down
126 changes: 126 additions & 0 deletions drivers/s390/scsi/zfcp_dbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ static struct debug_view zfcp_hba_dbf_view = {

static const char *zfcp_rec_dbf_tags[] = {
[ZFCP_REC_DBF_ID_THREAD] = "thread",
[ZFCP_REC_DBF_ID_TARGET] = "target",
};

static const char *zfcp_rec_dbf_ids[] = {
Expand All @@ -534,6 +535,58 @@ static const char *zfcp_rec_dbf_ids[] = {
[7] = "down wakeup ecd",
[8] = "down sleep 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,
Expand All @@ -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, "running", "%d", r->u.thread.running);
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");
return (p - buf) + 1;
Expand Down Expand Up @@ -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);
}

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
_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)
Expand Down
11 changes: 11 additions & 0 deletions drivers/s390/scsi/zfcp_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,27 @@ struct zfcp_rec_dbf_record_thread {
u32 running;
} __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 {
u8 id;
u8 id2;
union {
struct zfcp_rec_dbf_record_thread thread;
struct zfcp_rec_dbf_record_target target;
} u;
} __attribute__ ((packed));

enum {
ZFCP_REC_DBF_ID_THREAD,
ZFCP_REC_DBF_ID_TARGET,
};

struct zfcp_hba_dbf_record_response {
Expand Down
Loading

0 comments on commit 698ec01

Please sign in to comment.