linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>
Cc: x86@kernel.org, Robert Hodaszi <Robert.Hodaszi@digi.com>
Subject: Re: [patch V2 3/6] genirq: Add optional hardware synchronization for shutdown
Date: Mon, 1 Jul 2019 09:48:09 +0100	[thread overview]
Message-ID: <f516fe3a-39de-698b-eb15-c52d88c8f0c6@arm.com> (raw)
In-Reply-To: <20190628111440.279463375@linutronix.de>

On 28/06/2019 12:11, Thomas Gleixner wrote:
> free_irq() ensures that no hardware interrupt handler is executing on a
> different CPU before actually releasing resources and deactivating the
> interrupt completely in a domain hierarchy.
> 
> But that does not catch the case where the interrupt is on flight at the
> hardware level but not yet serviced by the target CPU. That creates an
> interesing race condition:
> 
>    CPU 0                  CPU 1               IRQ CHIP
> 
>                                               interrupt is raised
>                                               sent to CPU1
> 			  Unable to handle
> 			  immediately
> 			  (interrupts off,
> 			   deep idle delay)
>    mask()
>    ...
>    free()
>      shutdown()
>      synchronize_irq()
>      release_resources()
>                           do_IRQ()
>                             -> resources are not available
> 
> That might be harmless and just trigger a spurious interrupt warning, but
> some interrupt chips might get into a wedged state.
> 
> Utilize the existing irq_get_irqchip_state() callback for the
> synchronization in free_irq().
> 
> synchronize_hardirq() is not using this mechanism as it might actually
> deadlock unter certain conditions, e.g. when called with interrupts
> disabled and the target CPU is the one on which the synchronization is
> invoked. synchronize_irq() uses it because that function cannot be called
> from non preemtible contexts as it might sleep.
> 
> No functional change intended and according to Marc the existing GIC
> implementations where the driver supports the callback should be able
> to cope with that core change. Famous last words.

I still stand by what I've said! I gave it a go on a small sample of my
 home zoo, and nothing caught fire (although it is not exactly easy to
trigger a situation where the additional synchronization would be useful).

> 
> Fixes: 464d12309e1b ("x86/vector: Switch IOAPIC to global reservation mode")
> Reported-by: Robert Hodaszi <Robert.Hodaszi@digi.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

FWIW:

Reviewed-and-tested-by: Marc Zyngier <marc.zyngier@arm.com>

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2019-07-01  8:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 11:11 [patch V2 0/6] x86/irq: Cure various interrupt issues Thomas Gleixner
2019-06-28 11:11 ` [patch V2 1/6] genirq: Delay deactivation in free_irq() Thomas Gleixner
2019-07-03  8:16   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2019-06-28 11:11 ` [patch V2 2/6] genirq: Fix misleading synchronize_irq() documentation Thomas Gleixner
2019-07-01 14:53   ` Peter Zijlstra
2019-07-01 18:01     ` Thomas Gleixner
2019-07-01 18:23       ` Peter Zijlstra
2019-07-03  8:16   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2019-06-28 11:11 ` [patch V2 3/6] genirq: Add optional hardware synchronization for shutdown Thomas Gleixner
2019-07-01  8:48   ` Marc Zyngier [this message]
2019-07-01 14:56   ` Peter Zijlstra
2019-07-01 18:02     ` Thomas Gleixner
2019-07-03  8:17   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2019-06-28 11:11 ` [patch V2 4/6] x86/ioapic: Implement irq_get_irqchip_state() callback Thomas Gleixner
2019-07-03  8:18   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2019-06-28 11:11 ` [patch V2 5/6] x86/irq: Handle spurious interrupt after shutdown gracefully Thomas Gleixner
2019-07-03  8:18   ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2019-06-28 11:11 ` [patch V2 6/6] x86/irq: Seperate unused system vectors from spurious entry again Thomas Gleixner
2019-07-03  8:19   ` [tip:x86/apic] " tip-bot for Thomas Gleixner

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=f516fe3a-39de-698b-eb15-c52d88c8f0c6@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=Robert.Hodaszi@digi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).