Ejemplo n.º 1
0
int xnintr_query_next(int irq, xnintr_iterator_t *iterator, char *name_buf)
{
	xnintr_t *intr;
	xnticks_t last_switch;
	int cpu_no = iterator->cpu + 1;
	int err = 0;
	spl_t s;

	if (cpu_no == xnarch_num_online_cpus())
		cpu_no = 0;
	iterator->cpu = cpu_no;

	xnlock_get_irqsave(&intrlock, s);

	if (iterator->list_rev != xnintr_list_rev) {
		err = -EAGAIN;
		goto unlock_and_exit;
	}

	if (!iterator->prev) {
		if (irq == XNARCH_TIMER_IRQ)
			intr = &nkclock;
		else
			intr = xnintr_shirq_first(irq);
	} else
		intr = xnintr_shirq_next(iterator->prev);

	if (!intr) {
		cpu_no = -1;
		iterator->prev = NULL;
		err = -ENODEV;
		goto unlock_and_exit;
	}

	snprintf(name_buf, XNOBJECT_NAME_LEN, "IRQ%d: %s", irq, intr->name);

	iterator->hits = xnstat_counter_get(&intr->stat[cpu_no].hits);

	last_switch = xnpod_sched_slot(cpu_no)->last_account_switch;

	iterator->exectime_period = intr->stat[cpu_no].account.total;
	iterator->account_period =
		last_switch - intr->stat[cpu_no].account.start;
	intr->stat[cpu_no].sum.total += iterator->exectime_period;
	iterator->exectime_total = intr->stat[cpu_no].sum.total;

	intr->stat[cpu_no].account.total = 0;
	intr->stat[cpu_no].account.start = last_switch;

	/* Proceed to next entry in shared IRQ chain when all CPUs
	 * have been visited for this one. */
	if (cpu_no + 1 == xnarch_num_online_cpus())
		iterator->prev = intr;

     unlock_and_exit:
	xnlock_put_irqrestore(&intrlock, s);

	return err;
}
Ejemplo n.º 2
0
static inline int format_irq_proc(unsigned int irq,
				  struct xnvfile_regular_iterator *it)
{
	struct xnintr *intr;
	spl_t s;

	if (xnintr_is_timer_irq(irq)) {
		xnvfile_puts(it, "         [timer]");
		return 0;
	}

#ifdef CONFIG_SMP
	if (irq == RTHAL_TIMER_IPI) {
		xnvfile_puts(it, "         [timer-ipi]");
		return 0;
	}
	if (irq == RTHAL_RESCHEDULE_IPI) {
		xnvfile_puts(it, "         [reschedule]");
		return 0;
	}
	if (irq == RTHAL_CRITICAL_IPI) {
		xnvfile_puts(it, "         [sync]");
		return 0;
	}
#endif /* CONFIG_SMP */
	if (rthal_virtual_irq_p(irq)) {
		xnvfile_puts(it, "         [virtual]");
		return 0;
	}

	xnlock_get_irqsave(&intrlock, s);

	intr = xnintr_shirq_first(irq);
	if (intr) {
		xnvfile_puts(it, "        ");

		do {
			xnvfile_putc(it, ' ');
			xnvfile_puts(it, intr->name);
			intr = xnintr_shirq_next(intr);
		} while (intr);
	}

	xnlock_put_irqrestore(&intrlock, s);

	return 0;
}
Ejemplo n.º 3
0
static inline int format_irq_proc(unsigned int irq,
				  struct xnvfile_regular_iterator *it)
{
	struct xnintr *intr;

	if (irq == XNARCH_TIMER_IRQ) {
		xnvfile_puts(it, "         [timer]");
		return 0;
	}

#ifdef CONFIG_SMP
	if (irq == RTHAL_RESCHEDULE_IPI) {
		xnvfile_puts(it, "         [reschedule]");
		return 0;
	}
	if (irq == RTHAL_CRITICAL_IPI) {
		xnvfile_puts(it, "         [sync]");
		return 0;
	}
#endif /* CONFIG_SMP */
	if (rthal_virtual_irq_p(irq)) {
		xnvfile_puts(it, "         [virtual]");
		return 0;
	}

	down(&intrlock);

	intr = xnintr_shirq_first(irq);
	if (intr) {
		xnvfile_puts(it, "        ");

		do {
			xnvfile_putc(it, ' ');
			xnvfile_puts(it, intr->name);
			intr = xnintr_shirq_next(intr);
		} while (intr);
	}

	up(&intrlock);

	return 0;
}
Ejemplo n.º 4
0
static int format_irq_proc(unsigned int irq, char *str)
{
	xnintr_t *intr;
	char *p = str;
	spl_t s;

	if (rthal_virtual_irq_p(irq)) {
		p += sprintf(p, "         [virtual]");
		return p - str;
	} else if (irq == XNARCH_TIMER_IRQ) {
		p += sprintf(p, "         [timer]");
		return p - str;
#ifdef CONFIG_SMP
	} else if (irq == RTHAL_SERVICE_IPI0) {
		p += sprintf(p, "         [IPI]");
		return p - str;
	} else if (irq == RTHAL_CRITICAL_IPI) {
		p += sprintf(p, "         [critical sync]");
		return p - str;
#endif /* CONFIG_SMP */
	}

	xnlock_get_irqsave(&intrlock, s);

	intr = xnintr_shirq_first(irq);
	if (intr) {
		strcpy(p, "        "); p += 8;

		do {
			*p = ' '; p += 1;
			strcpy(p, intr->name); p += strlen(intr->name);

			intr = xnintr_shirq_next(intr);
		} while (intr);
	}

	xnlock_put_irqrestore(&intrlock, s);

	return p - str;
}