All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen: do not unmask disabled IRQ on eoi.
@ 2010-10-15 10:52 Ian Campbell
  2010-10-15 16:12 ` Stefano Stabellini
  0 siblings, 1 reply; 23+ messages in thread
From: Ian Campbell @ 2010-10-15 10:52 UTC (permalink / raw)
  To: jeremy; +Cc: xen-devel, Ian Campbell

This prevents a guest from being able to trigger an interrupt storm in
dom0 rendering it inoperable. In particular this effects event
channels delivered to userspace by the /dev/xen/evtchn driver which
uses disable_irq in its interupt handler to prevent further interrupts
firing until the interrupt has been handled by the userspace
application and it has requested an unmask. Without this patch the
event channel is re-enabled immediately after the interrupt handler
completes.

The issue was introduced by 0672fb44a111 "xen/events: change to using
fasteoi".

In the specific instance I saw a domU would spin sending console event
channel notifications to dom0 because its console ring was full (this
behaviour has since been tempered by f3483182666a "xen/hvc: only
notify if we actually sent something") but xenconsoled would be unable
to run due to the storm and hence the ring would never be drained.

I'm not convinced this is the right way to go about this -- there does
not seem to be much precedent and I would have expected some sort of
generic handling but I cannot see any.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 drivers/xen/events.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 1496ba5..a9b0637 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -1215,6 +1215,17 @@ int resend_irq_on_evtchn(unsigned int irq)
 	return 1;
 }
 
+static void eoi_dynirq(unsigned int irq)
+{
+	struct irq_desc *desc = irq_to_desc(irq);
+	int evtchn = evtchn_from_irq(irq);
+
+	move_masked_irq(irq);
+
+	if (VALID_EVTCHN(evtchn) & !(desc->status & IRQ_DISABLED))
+		unmask_evtchn(evtchn);
+}
+
 static void ack_dynirq(unsigned int irq)
 {
 	int evtchn = evtchn_from_irq(irq);
@@ -1408,7 +1419,7 @@ static struct irq_chip xen_dynamic_chip __read_mostly = {
 	.mask		= mask_irq,
 	.unmask		= unmask_irq,
 
-	.eoi		= ack_dynirq,
+	.eoi		= eoi_dynirq,
 	.set_affinity	= set_affinity_irq,
 	.retrigger	= retrigger_irq,
 };
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2010-10-29 14:32 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-15 10:52 [PATCH] xen: do not unmask disabled IRQ on eoi Ian Campbell
2010-10-15 16:12 ` Stefano Stabellini
2010-10-15 16:32   ` Ian Campbell
2010-10-15 16:39     ` Ian Campbell
2010-10-15 17:03       ` Stefano Stabellini
2010-10-15 17:33         ` Jeremy Fitzhardinge
2010-10-18  8:09         ` Jan Beulich
2010-10-18 14:58           ` Stefano Stabellini
2010-10-18 15:16             ` Jan Beulich
2010-10-18 18:14               ` Stefano Stabellini
2010-10-18 20:04                 ` Stefano Stabellini
2010-10-19  7:13                   ` Jan Beulich
2010-10-19  6:36                 ` Jan Beulich
2010-10-21 13:36                   ` Stefano Stabellini
2010-10-22  7:41                     ` Jan Beulich
2010-10-22  8:07                       ` Ian Campbell
2010-10-22  8:29                         ` Jan Beulich
2010-10-22  8:34                           ` Ian Campbell
2010-10-22 13:57                             ` Stefano Stabellini
2010-10-22 14:48                               ` Jan Beulich
2010-10-22 16:24                                 ` Stefano Stabellini
2010-10-29 14:32                                   ` Stefano Stabellini
2010-10-22 12:04                       ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.