public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] genirq: Add support for priority-drop/deactivate interrupt controllers
Date: Thu, 30 Oct 2014 16:59:02 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1410301627570.5308@nanos> (raw)
In-Reply-To: <54524804.4080501@arm.com>

On Thu, 30 Oct 2014, Marc Zyngier wrote:
> So I actually implemented this, and did hit another snag: per cpu interrupts.
> They don't use the startup/shutdown methods, and reproducing the above logic
> on a per-cpu basis is not very pretty.

Hmm. Have not looked at the percpu stuff yet.
 
>  /**
> + *	handle_spliteoi_irq - irq handler for 2-phase-eoi controllers
> + *	@irq:	the interrupt number
> + *	@desc:	the interrupt description structure for this irq
> + *
> + *	This relies on mask being a very cheap operation, and on
> + *	unmask performing both unmask+EOI. This avoids additional
> + *	operations for threaded interrupts (typically ARM's GICv2/v3).
> + */
> +void
> +handle_spliteoi_irq(unsigned int irq, struct irq_desc *desc)
> +{
> +	raw_spin_lock(&desc->lock);
> +
> +	if (!irq_may_run(desc))
> +		goto out;
> +
> +	desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
> +	kstat_incr_irqs_this_cpu(irq, desc);
> +
> +	/* Mark the IRQ as in progress */
> +	mask_irq(desc);
> +
> +	/*
> +	 * If it's disabled or no action available
> +	 * then just get out of here:
> +	 */
> +	if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
> +		desc->istate |= IRQS_PENDING;
> +		goto out_unmask;

If this handler is used with the lazy disable approach then this goto
causes an irq storm if the interrupt stays active (LEVEL).

So this relies on irq_disable() actually disabling the interrupt at
the hardware level. That really wants a big fat comment if we take
this approach.

Now there is another issue. Assume the following:

CPU 0	     	     	    	CPU 1
handle_spliteoi_irq()
  mask_irq();
     handle_event();
        wake_thread();
  return;

run_thread()
   call_handler();
				disable_irq()
				    irq_disable()
   finalize_oneshot()
     if (disabled)
     	return;

So that particular interrupt gets never acknowledged with a write to
DIR. 

What happens if you enable it again at the hardware level via
enable_irq()? Is it still in dropped priority mode and waits for the
write to DIR forever? That's what I tried to avoid with my approach.

Thanks,

	tglx

  reply	other threads:[~2014-10-30 15:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-25 11:06 [PATCH 0/3] genirq: Add support for "split-EOI" irqchips Marc Zyngier
2014-10-25 11:06 ` [PATCH 1/3] genirq: Add support for priority-drop/deactivate interrupt controllers Marc Zyngier
2014-10-25 20:27   ` Thomas Gleixner
2014-10-25 20:40     ` Thomas Gleixner
2014-10-27 15:42     ` Marc Zyngier
2014-10-28 15:32       ` Thomas Gleixner
2014-10-28 19:41         ` Marc Zyngier
2014-10-28 20:14           ` Thomas Gleixner
2014-10-29 10:11             ` Marc Zyngier
2014-10-29 10:26               ` Thomas Gleixner
2014-10-30 14:15                 ` Marc Zyngier
2014-10-30 15:59                   ` Thomas Gleixner [this message]
2014-10-25 11:06 ` [PATCH 2/3] irqchip: GIC: Convert to EOImode == 1 Marc Zyngier
2014-10-25 11:06 ` [PATCH 3/3] irqchip: GICv3: " Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.11.1410301627570.5308@nanos \
    --to=tglx@linutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox