فهرست منبع

qcacmn: Enhance latest HIF CE event history

Latest CE event history is helpful to analyze CE reaping
issues when dump is not available. Enhance latest HIF CE
event history to capture last two events, so that during
error situations more data is available to detect CE
reaping issues.

Change-Id: I503ec5c84ff02b967e1ce93954725ffd9866e93c
CRs-Fixed: 3590596
Karthik Kantamneni 1 سال پیش
والد
کامیت
8aa322295a
3فایلهای تغییر یافته به همراه40 افزوده شده و 24 حذف شده
  1. 35 17
      hif/src/ce/ce_service.c
  2. 3 6
      hif/src/ce/ce_service_srng.c
  3. 2 1
      hif/src/hif_main.h

+ 35 - 17
hif/src/ce/ce_service.c

@@ -173,7 +173,7 @@ void hif_display_latest_desc_hist(struct hif_opaque_softc *hif_ctx)
 	struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
 	struct ce_desc_hist *ce_hist;
 	struct latest_evt_history *evt;
-	int i;
+	int i, j;
 
 	if (!scn)
 		return;
@@ -184,12 +184,14 @@ void hif_display_latest_desc_hist(struct hif_opaque_softc *hif_ctx)
 		if (!ce_hist->enable[i + HIF_CE_MAX_LATEST_HIST])
 			continue;
 
-		evt = &ce_hist->latest_evt[i];
-		hif_info_high("CE_id:%d cpu_id:%d irq_entry:0x%llx tasklet_entry:0x%llx tasklet_resched:0x%llx tasklet_exit:0x%llx ce_work:0x%llx hp:%x tp:%x",
-			      (i + HIF_CE_MAX_LATEST_HIST), evt->cpu_id,
-			      evt->irq_entry_ts, evt->bh_entry_ts,
-			      evt->bh_resched_ts, evt->bh_exit_ts,
-			      evt->bh_work_ts, evt->ring_hp, evt->ring_tp);
+		for (j = 0; j < HIF_CE_MAX_LATEST_EVTS; j++) {
+			evt = &ce_hist->latest_evts[i][j];
+			hif_info_high("CE_id:%d event_idx:%d cpu_id:%d irq_entry:0x%llx tasklet_entry:0x%llx tasklet_resched:0x%llx tasklet_exit:0x%llx ce_work:0x%llx hp:%x tp:%x",
+				      (i + HIF_CE_MAX_LATEST_HIST), j, evt->cpu_id,
+				      evt->irq_entry_ts, evt->bh_entry_ts,
+				      evt->bh_resched_ts, evt->bh_exit_ts,
+				      evt->bh_work_ts, evt->ring_hp, evt->ring_tp);
+		}
 	}
 }
 
@@ -198,32 +200,48 @@ void hif_record_latest_evt(struct ce_desc_hist *ce_hist,
 			   int ce_id, uint64_t time,
 			   uint32_t hp, uint32_t tp)
 {
-	struct latest_evt_history *latest_evt;
+	struct latest_evt_history *latest_evts;
+	int idx = 0;
 
 	if (ce_id != 2 && ce_id != 3)
 		return;
 
-	latest_evt = &ce_hist->latest_evt[ce_id - HIF_CE_MAX_LATEST_HIST];
+	latest_evts = &ce_hist->latest_evts[ce_id - HIF_CE_MAX_LATEST_HIST][idx];
 
 	switch (type) {
 	case HIF_IRQ_EVENT:
-		latest_evt->irq_entry_ts = time;
-		latest_evt->cpu_id = qdf_get_cpu();
+		if (latest_evts[idx].irq_entry_ts >
+		    latest_evts[idx + 1].irq_entry_ts)
+			idx = 1;
+		latest_evts[idx].irq_entry_ts = time;
+		latest_evts[idx].cpu_id = qdf_get_cpu();
 		break;
 	case HIF_CE_TASKLET_ENTRY:
-		latest_evt->bh_entry_ts = time;
+		if (latest_evts[idx].bh_entry_ts >
+		    latest_evts[idx + 1].bh_entry_ts)
+			idx = 1;
+		latest_evts[idx].bh_entry_ts = time;
 		break;
 	case HIF_CE_TASKLET_RESCHEDULE:
-		latest_evt->bh_resched_ts = time;
+		if (latest_evts[idx].bh_resched_ts >
+		    latest_evts[idx + 1].bh_resched_ts)
+			idx = 1;
+		latest_evts[idx].bh_resched_ts = time;
 		break;
 	case HIF_CE_TASKLET_EXIT:
-		latest_evt->bh_exit_ts = time;
+		if (latest_evts[idx].bh_exit_ts >
+		    latest_evts[idx + 1].bh_exit_ts)
+			idx = 1;
+		latest_evts[idx].bh_exit_ts = time;
 		break;
 	case HIF_TX_DESC_COMPLETION:
 	case HIF_CE_DEST_STATUS_RING_REAP:
-		latest_evt->bh_work_ts = time;
-		latest_evt->ring_hp = hp;
-		latest_evt->ring_tp = tp;
+		if (latest_evts[idx].bh_work_ts >
+		    latest_evts[idx + 1].bh_work_ts)
+			idx = 1;
+		latest_evts[idx].bh_work_ts = time;
+		latest_evts[idx].ring_hp = hp;
+		latest_evts[idx].ring_tp = tp;
 		break;
 	default:
 		break;

+ 3 - 6
hif/src/ce/ce_service_srng.c

@@ -446,16 +446,13 @@ ce_completed_recv_next_nolock_srng(struct CE_state *CE_state,
 	int nbytes;
 	struct ce_srng_dest_status_desc dest_status_info;
 
-	if (hal_srng_access_start(scn->hal_soc, status_ring->srng_ctx)) {
-		status = QDF_STATUS_E_FAILURE;
-		goto done;
-	}
+	if (hal_srng_access_start(scn->hal_soc, status_ring->srng_ctx))
+		return QDF_STATUS_E_FAILURE;
 
 	dest_status = hal_srng_dst_peek(scn->hal_soc, status_ring->srng_ctx);
 	if (!dest_status) {
-		status = QDF_STATUS_E_FAILURE;
 		hal_srng_access_end_reap(scn->hal_soc, status_ring->srng_ctx);
-		goto done;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	/*

+ 2 - 1
hif/src/hif_main.h

@@ -226,6 +226,7 @@ struct hif_latency_detect {
 #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
 
 #define HIF_CE_MAX_LATEST_HIST 2
+#define HIF_CE_MAX_LATEST_EVTS 2
 
 struct latest_evt_history {
 	uint64_t irq_entry_ts;
@@ -247,7 +248,7 @@ struct ce_desc_hist {
 	uint32_t hist_index;
 	uint32_t hist_id;
 	void *hist_ev[CE_COUNT_MAX];
-	struct latest_evt_history latest_evt[HIF_CE_MAX_LATEST_HIST];
+	struct latest_evt_history latest_evts[HIF_CE_MAX_LATEST_HIST][HIF_CE_MAX_LATEST_EVTS];
 };
 
 void hif_record_latest_evt(struct ce_desc_hist *ce_hist,