Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f238f43 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: dwc3: gadget: Keep track of IRQ timing statistics"

parents da67ca60 117192b5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -911,6 +911,10 @@ struct dwc3 {
	unsigned                bh_completion_time[MAX_INTR_STATS];
	unsigned                bh_handled_evt_cnt[MAX_INTR_STATS];
	unsigned                bh_dbg_index;
	ktime_t			irq_start_time[MAX_INTR_STATS];
	unsigned                irq_completion_time[MAX_INTR_STATS];
	unsigned                irq_event_count[MAX_INTR_STATS];
	unsigned                irq_dbg_index;
};

/* -------------------------------------------------------------------------- */
+10 −1
Original line number Diff line number Diff line
@@ -1175,7 +1175,16 @@ static int dwc3_gadget_int_events_show(struct seq_file *s, void *unused)
	seq_printf(s, "unknown_event:%u\n", dbg_gadget_events->unknown_event);

	seq_printf(s, "\n\t== Last %d interrupts stats ==\t\n", MAX_INTR_STATS);
	seq_puts(s, "events count:\t");
	seq_puts(s, "@ time (us):\t");
	for (i = 0; i < MAX_INTR_STATS; i++)
		seq_printf(s, "%lld\t", ktime_to_us(dwc->irq_start_time[i]));
	seq_puts(s, "\nhard irq time (us):\t");
	for (i = 0; i < MAX_INTR_STATS; i++)
		seq_printf(s, "%d\t", dwc->irq_completion_time[i]);
	seq_puts(s, "\nevents count:\t");
	for (i = 0; i < MAX_INTR_STATS; i++)
		seq_printf(s, "%d\t", dwc->irq_event_count[i]);
	seq_puts(s, "\nbh handled count:\t");
	for (i = 0; i < MAX_INTR_STATS; i++)
		seq_printf(s, "%d\t", dwc->bh_handled_evt_cnt[i]);
	seq_puts(s, "\ntasklet time:\t");
+11 −0
Original line number Diff line number Diff line
@@ -3476,7 +3476,10 @@ static irqreturn_t dwc3_interrupt(int irq, void *_dwc)
	struct dwc3			*dwc = _dwc;
	int				i;
	irqreturn_t			ret = IRQ_NONE;
	unsigned			temp_cnt = 0;
	ktime_t				start_time;

	start_time = ktime_get();
	spin_lock(&dwc->lock);

	if (dwc->err_evt_seen) {
@@ -3491,10 +3494,18 @@ static irqreturn_t dwc3_interrupt(int irq, void *_dwc)
		status = dwc3_process_event_buf(dwc, i);
		if (status == IRQ_WAKE_THREAD)
			ret = status;

		temp_cnt += dwc->ev_buffs[i]->count;
	}

	spin_unlock(&dwc->lock);

	dwc->irq_start_time[dwc->irq_dbg_index] = start_time;
	dwc->irq_completion_time[dwc->irq_dbg_index] =
		ktime_us_delta(ktime_get(), start_time);
	dwc->irq_event_count[dwc->irq_dbg_index] = temp_cnt / 4;
	dwc->irq_dbg_index = (dwc->irq_dbg_index + 1) % MAX_INTR_STATS;

	if (ret == IRQ_WAKE_THREAD) {
		disable_irq_nosync(irq);
		tasklet_schedule(&dwc->bh);