aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorMartin Peschke <mp3@de.ibm.com>2008-03-27 09:22:01 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:19:04 -0400
commit348447e85749120ad600a5c8e23b6bb7058b931d (patch)
treec7d524906bf256c113d32783e8bfaecad1d1657c /drivers/s390
parentd79a83dbffe2e49e73f2903c350937faf2e0c2f1 (diff)
[SCSI] zfcp: Add trace records for recovery thread and its queues
This patch writes trace records which provide information about the operation of the zfcp error recovery thread and the queues it works on. 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>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c51
-rw-r--r--drivers/s390/scsi/zfcp_def.h12
-rw-r--r--drivers/s390/scsi/zfcp_erp.c9
-rw-r--r--drivers/s390/scsi/zfcp_ext.h3
4 files changed, 75 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index e7712eb13eea..5a4b1e9a8b50 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -521,9 +521,19 @@ static struct debug_view zfcp_hba_dbf_view = {
521}; 521};
522 522
523static const char *zfcp_rec_dbf_tags[] = { 523static const char *zfcp_rec_dbf_tags[] = {
524 [ZFCP_REC_DBF_ID_THREAD] = "thread",
524}; 525};
525 526
526static const char *zfcp_rec_dbf_ids[] = { 527static const char *zfcp_rec_dbf_ids[] = {
528 [1] = "new",
529 [2] = "ready",
530 [3] = "kill",
531 [4] = "down sleep",
532 [5] = "down wakeup",
533 [6] = "down sleep ecd",
534 [7] = "down wakeup ecd",
535 [8] = "down sleep epd",
536 [9] = "down wakeup epd",
527}; 537};
528 538
529static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, 539static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view,
@@ -536,6 +546,12 @@ static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view,
536 zfcp_dbf_outs(&p, "hint", zfcp_rec_dbf_ids[r->id2]); 546 zfcp_dbf_outs(&p, "hint", zfcp_rec_dbf_ids[r->id2]);
537 zfcp_dbf_out(&p, "id", "%d", r->id2); 547 zfcp_dbf_out(&p, "id", "%d", r->id2);
538 switch (r->id) { 548 switch (r->id) {
549 case ZFCP_REC_DBF_ID_THREAD:
550 zfcp_dbf_out(&p, "sema", "%d", r->u.thread.sema);
551 zfcp_dbf_out(&p, "total", "%d", r->u.thread.total);
552 zfcp_dbf_out(&p, "ready", "%d", r->u.thread.ready);
553 zfcp_dbf_out(&p, "running", "%d", r->u.thread.running);
554 break;
539 } 555 }
540 sprintf(p, "\n"); 556 sprintf(p, "\n");
541 return (p - buf) + 1; 557 return (p - buf) + 1;
@@ -550,6 +566,41 @@ static struct debug_view zfcp_rec_dbf_view = {
550 NULL 566 NULL
551}; 567};
552 568
569/**
570 * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation
571 * @id2: identifier for event
572 * @adapter: adapter
573 * @lock: non-zero value indicates that erp_lock has not yet been acquired
574 */
575void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock)
576{
577 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
578 unsigned long flags = 0;
579 struct list_head *entry;
580 unsigned ready = 0, running = 0, total;
581
582 if (lock)
583 read_lock_irqsave(&adapter->erp_lock, flags);
584 list_for_each(entry, &adapter->erp_ready_head)
585 ready++;
586 list_for_each(entry, &adapter->erp_running_head)
587 running++;
588 total = adapter->erp_total_count;
589 if (lock)
590 read_unlock_irqrestore(&adapter->erp_lock, flags);
591
592 spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
593 memset(r, 0, sizeof(*r));
594 r->id = ZFCP_REC_DBF_ID_THREAD;
595 r->id2 = id2;
596 r->u.thread.sema = atomic_read(&adapter->erp_ready_sem.count);
597 r->u.thread.total = total;
598 r->u.thread.ready = ready;
599 r->u.thread.running = running;
600 debug_event(adapter->rec_dbf, 5, r, sizeof(*r));
601 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
602}
603
553static void 604static void
554_zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req, 605_zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req,
555 u32 s_id, u32 d_id, void *buffer, int buflen) 606 u32 s_id, u32 d_id, void *buffer, int buflen)
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index f29bee528489..332c83eba6c7 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -279,13 +279,25 @@ struct zfcp_erp_dbf_record {
279 u8 dummy[16]; 279 u8 dummy[16];
280} __attribute__ ((packed)); 280} __attribute__ ((packed));
281 281
282struct zfcp_rec_dbf_record_thread {
283 u32 sema;
284 u32 total;
285 u32 ready;
286 u32 running;
287} __attribute__ ((packed));
288
282struct zfcp_rec_dbf_record { 289struct zfcp_rec_dbf_record {
283 u8 id; 290 u8 id;
284 u8 id2; 291 u8 id2;
285 union { 292 union {
293 struct zfcp_rec_dbf_record_thread thread;
286 } u; 294 } u;
287} __attribute__ ((packed)); 295} __attribute__ ((packed));
288 296
297enum {
298 ZFCP_REC_DBF_ID_THREAD,
299};
300
289struct zfcp_hba_dbf_record_response { 301struct zfcp_hba_dbf_record_response {
290 u32 fsf_command; 302 u32 fsf_command;
291 u64 fsf_reqid; 303 u64 fsf_reqid;
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 2dc8110ebf74..f9383f068169 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -788,6 +788,7 @@ zfcp_erp_action_ready(struct zfcp_erp_action *erp_action)
788 788
789 zfcp_erp_action_to_ready(erp_action); 789 zfcp_erp_action_to_ready(erp_action);
790 up(&adapter->erp_ready_sem); 790 up(&adapter->erp_ready_sem);
791 zfcp_rec_dbf_event_thread(2, adapter, 0);
791} 792}
792 793
793/* 794/*
@@ -1027,6 +1028,7 @@ zfcp_erp_thread_kill(struct zfcp_adapter *adapter)
1027 1028
1028 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, &adapter->status); 1029 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, &adapter->status);
1029 up(&adapter->erp_ready_sem); 1030 up(&adapter->erp_ready_sem);
1031 zfcp_rec_dbf_event_thread(2, adapter, 1);
1030 1032
1031 wait_event(adapter->erp_thread_wqh, 1033 wait_event(adapter->erp_thread_wqh,
1032 !atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, 1034 !atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP,
@@ -1084,7 +1086,9 @@ zfcp_erp_thread(void *data)
1084 * no action in 'ready' queue to be processed and 1086 * no action in 'ready' queue to be processed and
1085 * thread is not to be killed 1087 * thread is not to be killed
1086 */ 1088 */
1089 zfcp_rec_dbf_event_thread(4, adapter, 1);
1087 down_interruptible(&adapter->erp_ready_sem); 1090 down_interruptible(&adapter->erp_ready_sem);
1091 zfcp_rec_dbf_event_thread(5, adapter, 1);
1088 debug_text_event(adapter->erp_dbf, 5, "a_th_woken"); 1092 debug_text_event(adapter->erp_dbf, 5, "a_th_woken");
1089 } 1093 }
1090 1094
@@ -2150,7 +2154,9 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
2150 * _must_ be the one belonging to the 'exchange config 2154 * _must_ be the one belonging to the 'exchange config
2151 * data' request. 2155 * data' request.
2152 */ 2156 */
2157 zfcp_rec_dbf_event_thread(6, adapter, 1);
2153 down(&adapter->erp_ready_sem); 2158 down(&adapter->erp_ready_sem);
2159 zfcp_rec_dbf_event_thread(7, adapter, 1);
2154 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { 2160 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) {
2155 ZFCP_LOG_INFO("error: exchange of configuration data " 2161 ZFCP_LOG_INFO("error: exchange of configuration data "
2156 "for adapter %s timed out\n", 2162 "for adapter %s timed out\n",
@@ -2207,7 +2213,9 @@ zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action)
2207 debug_text_event(adapter->erp_dbf, 6, "a_xport_ok"); 2213 debug_text_event(adapter->erp_dbf, 6, "a_xport_ok");
2208 2214
2209 ret = ZFCP_ERP_SUCCEEDED; 2215 ret = ZFCP_ERP_SUCCEEDED;
2216 zfcp_rec_dbf_event_thread(8, adapter, 1);
2210 down(&adapter->erp_ready_sem); 2217 down(&adapter->erp_ready_sem);
2218 zfcp_rec_dbf_event_thread(9, adapter, 1);
2211 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { 2219 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) {
2212 ZFCP_LOG_INFO("error: exchange port data timed out (adapter " 2220 ZFCP_LOG_INFO("error: exchange port data timed out (adapter "
2213 "%s)\n", zfcp_get_busid_by_adapter(adapter)); 2221 "%s)\n", zfcp_get_busid_by_adapter(adapter));
@@ -3091,6 +3099,7 @@ zfcp_erp_action_enqueue(int action,
3091 /* finally put it into 'ready' queue and kick erp thread */ 3099 /* finally put it into 'ready' queue and kick erp thread */
3092 list_add_tail(&erp_action->list, &adapter->erp_ready_head); 3100 list_add_tail(&erp_action->list, &adapter->erp_ready_head);
3093 up(&adapter->erp_ready_sem); 3101 up(&adapter->erp_ready_sem);
3102 zfcp_rec_dbf_event_thread(1, adapter, 0);
3094 retval = 0; 3103 retval = 0;
3095 out: 3104 out:
3096 return retval; 3105 return retval;
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 06b1079b7f3d..f64951ba98c7 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -164,6 +164,9 @@ extern void zfcp_erp_port_access_changed(struct zfcp_port *);
164extern void zfcp_erp_unit_access_changed(struct zfcp_unit *); 164extern void zfcp_erp_unit_access_changed(struct zfcp_unit *);
165 165
166/******************************** AUX ****************************************/ 166/******************************** AUX ****************************************/
167extern void zfcp_rec_dbf_event_thread(u8 id, struct zfcp_adapter *adapter,
168 int lock);
169
167extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *); 170extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *);
168extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *, 171extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *,
169 struct fsf_status_read_buffer *); 172 struct fsf_status_read_buffer *);