From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 14/14] ARM: gic: add gic_ppi_map_on_cpu()
Date: Fri, 8 Jul 2011 20:57:08 +0100 [thread overview]
Message-ID: <20110708195708.GR4812@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1309855755-6261-15-git-send-email-marc.zyngier@arm.com>
On Tue, Jul 05, 2011 at 09:49:15AM +0100, Marc Zyngier wrote:
> It is sometimes usefull to compute the mapping of a PPI on a CPU
> that is not the one handling the interrupt (in the probe function
> of a driver, for example).
This is unsafe. Firstly, smp_processor_id() in preemptible contexts
is not valid as you can be migrated to another CPU at any moment.
Secondly, if you have a driver probe function, and you want to
register a PPI interrupt for a different CPU, while you can call the
request function, the resulting ->unmask will be called on the
calling CPU (assuming preempt is disabled and we don't schedule).
You might get lucky and it may be called on your intended CPU...
That means the mask registers you access are on the local CPU, not
the target CPU, so you end up with the wrong interrupt enabled.
As request_threaded_irq() contains a kzalloc() which can schedule,
I can't see how you can safely request a particular per-CPU interrupt
and guarantee that you'll enable it on the appropriate core.
Finally, note that using request_irq() from the secondary_startup()
thread is probably a very bad idea - should it require to schedule,
there is nothing for the secondary CPU to switch to - we're the
secondary CPUs idle thread.
I think you'll need to use setup_irq() to register the PPI interrupts,
especially for the TWD. However, that then gives you a problem when
you come to tear it down on CPU hot unplug, as free_irq() can't be
used - it'll try to kfree() the static irqaction structure.
So I think more thought is required on this entire patch set.
I have thought (before this patch set appeared) about making the PPI
stuff entirely GIC specific, having an array of 16 function pointers
in the GIC code to allow things like TWD to hook into. No preemption
or sleep problems, no genirq overhead to their handling, etc. Then
again, I think we do need irq_enter()..irq_exit().
next prev parent reply other threads:[~2011-07-08 19:57 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-05 8:49 [PATCH v8 00/14] Consolidating GIC per-cpu interrupts Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 01/14] ARM: gic: add per-cpu interrupt mapping Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 02/14] ARM: smp: add interrupt handler for local timers Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 03/14] ARM: smp_twd: add support for remapped PPI interrupts Marc Zyngier
2011-07-08 19:27 ` Russell King - ARM Linux
2011-07-10 15:13 ` Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 04/14] ARM: omap4: use remapped PPI interrupts for local timer Marc Zyngier
2011-07-07 14:32 ` Tony Lindgren
2011-07-05 8:49 ` [PATCH v8 05/14] ARM: versatile: " Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 06/14] ARM: shmobile: " Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 07/14] ARM: ux500: " Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 08/14] ARM: tegra: " Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 09/14] ARM: msm: " Marc Zyngier
2011-07-05 18:06 ` David Brown
2011-07-05 8:49 ` [PATCH v8 10/14] ARM: exynos4: " Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 11/14] ARM: gic: remove previous local timer interrupt handling Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 12/14] ARM: gic: add compute_irqnr macro for exynos4 Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 13/14] ARM: SMP: automatically select ARM_GIC_PPI_MAP Marc Zyngier
2011-07-05 8:49 ` [PATCH v8 14/14] ARM: gic: add gic_ppi_map_on_cpu() Marc Zyngier
2011-07-08 19:57 ` Russell King - ARM Linux [this message]
2011-07-10 15:10 ` Marc Zyngier
2011-07-10 15:37 ` Russell King - ARM Linux
2011-07-10 18:30 ` Russell King - ARM Linux
2011-07-11 9:52 ` Marc Zyngier
2011-07-11 10:17 ` Russell King - ARM Linux
2011-07-11 11:14 ` Marc Zyngier
2011-07-11 11:38 ` Russell King - ARM Linux
2011-07-11 12:36 ` Marc Zyngier
2011-07-06 5:46 ` [PATCH v8 00/14] Consolidating GIC per-cpu interrupts Shawn Guo
2011-07-06 9:53 ` Marc Zyngier
2011-07-06 11:02 ` Marc Zyngier
2011-07-06 11:11 ` Russell King - ARM Linux
2011-07-06 11:18 ` Marc Zyngier
2011-07-06 12:26 ` Arnd Bergmann
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=20110708195708.GR4812@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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;
as well as URLs for NNTP newsgroup(s).