Skip to contentSkip to conversation

linux-next: User Mode Linux broken

DISCUSSION Richard Weinberger 2 participants 9 messages Oct 21, 2010 – Oct 22, 2010

Subsystems (3)
lore
Share & tools
lore
#1 lore raw
Quoted 11 lines · Richard Weinberger

Thomas,

Your commit c5f7563 ("genirq: Provide compat handling for chip->enable()") breaks UML.
It does not start anymore.

When I apply this patch it works fine again.
http://userweb.kernel.org/~akpm/mmotm/broken-out/um-migrate-from-__do_irq-to-
generic_handle_irq.patch

Maybe your patch breaks all users of __do_IRQ()?

Not intentionally :)

The irq_chip of um has it's own dummy enable function, so the compat code uses it.

+static void compat_irq_enable(struct irq_data *data) +{
+ data->chip->enable(data->irq);
+}
+

...

+ if (chip->enable)
+ chip->irq_enable = compat_irq_enable;
+
+ /*
+ * The real defaults
+ */
+ if (!chip->irq_enable)
+ chip->irq_enable = default_enable;

So I really can't see how's that supposed to break UM

Thanks,

tglx

author maintainer
#2 lore raw

Am Donnerstag 21 Oktober 2010, 18:09:22 schrieb Thomas Gleixner:

Quoted 35 lines · Richard Weinberger
Quoted 11 lines

Thomas,

Your commit c5f7563 ("genirq: Provide compat handling for chip->enable()") breaks UML.
It does not start anymore.

When I apply this patch it works fine again.
http://userweb.kernel.org/~akpm/mmotm/broken-out/um-migrate-from-__do_irq
-to- generic_handle_irq.patch

Maybe your patch breaks all users of __do_IRQ()?

Not intentionally :)

The irq_chip of um has it's own dummy enable function, so the compat code uses it.

(quoted diff) +13 -0
+static void compat_irq_enable(struct irq_data *data)
+{
+	data->chip->enable(data->irq);
+}
+
 
...
 
+	if (chip->enable)
+		chip->irq_enable = compat_irq_enable;
+
+	/*
+	 * The real defaults
+	 */
+	if (!chip->irq_enable)
+		chip->irq_enable = default_enable;
Quoted 2 lines

So I really can't see how's that supposed to break UM

This patch solves the issue for me.
What do you think?

Thanks,
//richard

kernel/irq/resend.c +0 -0
index 891115a..1fb4012 100644
@@ -60,8 +60,11 @@ void check_irq_resend(struct irq_desc *desc, unsigned int 

irq)

        /*
         * Make sure the interrupt is enabled, before resending it:
         */
+#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
+       desc->irq_data.chip->enable(irq);
+#elif
        desc->irq_data.chip->irq_enable(&desc->irq_data);

-
+#endif
/*
* We do not resend level type interrupts. Level type
* interrupts are resent by hardware when they are still

#3 lore raw
Quoted 62 lines · Richard Weinberger

Am Donnerstag 21 Oktober 2010, 18:09:22 schrieb Thomas Gleixner:

Quoted 35 lines · Richard Weinberger
Quoted 11 lines

Thomas,

Your commit c5f7563 ("genirq: Provide compat handling for chip->enable()") breaks UML.
It does not start anymore.

When I apply this patch it works fine again.
http://userweb.kernel.org/~akpm/mmotm/broken-out/um-migrate-from-__do_irq
-to- generic_handle_irq.patch

Maybe your patch breaks all users of __do_IRQ()?

Not intentionally :)

The irq_chip of um has it's own dummy enable function, so the compat code uses it.

(quoted diff) +13 -0
+static void compat_irq_enable(struct irq_data *data)
+{
+	data->chip->enable(data->irq);
+}
+
 
...
 
+	if (chip->enable)
+		chip->irq_enable = compat_irq_enable;
+
+	/*
+	 * The real defaults
+	 */
+	if (!chip->irq_enable)
+		chip->irq_enable = default_enable;
Quoted 2 lines

So I really can't see how's that supposed to break UM

This patch solves the issue for me.
What do you think?

Thanks,
//richard

kernel/irq/resend.c +4 -1
index 891115a..1fb4012 100644
@@ -60,8 +60,11 @@ void check_irq_resend(struct irq_desc *desc, unsigned int 
 irq)
        /*
         * Make sure the interrupt is enabled, before resending it:
         */
+#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
+       desc->irq_data.chip->enable(irq);
+#elif
        desc->irq_data.chip->irq_enable(&desc->irq_data);
-
+#endif
        /*
         * We do not resend level type interrupts. Level type
Quoted 1 line

* interrupts are resent by hardware when they are still

Why shold it solve it ? irq_enable is set to compat_irq_enable which in turn calls chip->enable.

So how's that different ?

Thanks,

tglx

author maintainer
#4 lore raw

Am Donnerstag 21 Oktober 2010, 21:45:35 schrieb Thomas Gleixner:

Quoted 68 lines · Richard Weinberger
Quoted 67 lines

Am Donnerstag 21 Oktober 2010, 18:09:22 schrieb Thomas Gleixner:

Quoted 35 lines · Richard Weinberger
Quoted 11 lines

Thomas,

Your commit c5f7563 ("genirq: Provide compat handling for chip->enable()") breaks UML.
It does not start anymore.

When I apply this patch it works fine again.
http://userweb.kernel.org/~akpm/mmotm/broken-out/um-migrate-from-__do
_irq -to- generic_handle_irq.patch

Maybe your patch breaks all users of __do_IRQ()?

Not intentionally :)

The irq_chip of um has it's own dummy enable function, so the compat code uses it.

(quoted diff) +13 -0
+static void compat_irq_enable(struct irq_data *data)
+{
+	data->chip->enable(data->irq);
+}
+
 
...
 
+	if (chip->enable)
+		chip->irq_enable = compat_irq_enable;
+
+	/*
+	 * The real defaults
+	 */
+	if (!chip->irq_enable)
+		chip->irq_enable = default_enable;
Quoted 1 line

So I really can't see how's that supposed to break UM

This patch solves the issue for me.
What do you think?

Thanks,
//richard

kernel/irq/resend.c +3 -0
index 891115a..1fb4012 100644
@@ -60,8 +60,11 @@ void check_irq_resend(struct irq_desc *desc, unsigned
 int irq)
 
        /*
 
         * Make sure the interrupt is enabled, before resending it:
         */
 
+#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
+       desc->irq_data.chip->enable(irq);
+#elif
 
        desc->irq_data.chip->irq_enable(&desc->irq_data);
kernel/irq/resend.c +1 -1
-
+#endif
 
        /*
Quoted 7 lines
Quoted 2 lines

* We do not resend level type interrupts. Level type
* interrupts are resent by hardware when they are still

Why shold it solve it ? irq_enable is set to compat_irq_enable which in turn calls chip->enable.

So how's that different ?

I took a closer look on the issue.

check_irq_resend() gets called before irq_chip_set_defaults(). In the first call to check_irq_resend() desc->irq_data.chip->irq_enable is NULL. UML dies due to a NULL-pointer dereference...

I don't know why check_irq_resend() is called before irq_chip_set_defaults(). It's your code. ;-)

Thanks,
//richard

#5 lore raw
Quoted 6 lines · Richard Weinberger

Am Donnerstag 21 Oktober 2010, 21:45:35 schrieb Thomas Gleixner:

Quoted 4 lines

Why shold it solve it ? irq_enable is set to compat_irq_enable which in turn calls chip->enable.

So how's that different ?

Quoted 8 lines

I took a closer look on the issue.

check_irq_resend() gets called before irq_chip_set_defaults(). In the first call to check_irq_resend() desc->irq_data.chip->irq_enable is NULL. UML dies due to a NULL-pointer dereference...

I don't know why check_irq_resend() is called before irq_chip_set_defaults(). It's your code. ;-)

Well, but it only gets called via enable_irq(). So that means something is calling enable_irq _before_ request/setup_irq().

arch/um/kernel/irq.c:init_IRQ() does that :)

Thanks,

tglx

author maintainer
#6 lore raw
Quoted 13 lines · Thomas Gleixner
Quoted 12 lines · Richard Weinberger

Am Donnerstag 21 Oktober 2010, 21:45:35 schrieb Thomas Gleixner:

Quoted 4 lines

Why shold it solve it ? irq_enable is set to compat_irq_enable which in turn calls chip->enable.

So how's that different ?

I took a closer look on the issue.

check_irq_resend() gets called before irq_chip_set_defaults(). In the first call to check_irq_resend() desc->irq_data.chip->irq_enable is NULL. UML dies due to a NULL-pointer dereference...

Quoted 7 lines
Quoted 2 lines

I don't know why check_irq_resend() is called before irq_chip_set_defaults(). It's your code. ;-)

Well, but it only gets called via enable_irq(). So that means something is calling enable_irq _before_ request/setup_irq().

arch/um/kernel/irq.c:init_IRQ() does that :)

Sorry I'm not very familiar with the IRQ stuff.
Does that mean init_IRQ() is not allowed to call enable_irq()?

Thanks,
//richard

Quoted 3 lines

Thanks,

tglx

#7 lore raw
Quoted 18 lines · Richard Weinberger
Quoted 16 lines · Thomas Gleixner
Quoted 14 lines · Richard Weinberger

Am Donnerstag 21 Oktober 2010, 21:45:35 schrieb Thomas Gleixner:

Quoted 4 lines

Why shold it solve it ? irq_enable is set to compat_irq_enable which in turn calls chip->enable.

So how's that different ?

I took a closer look on the issue.

check_irq_resend() gets called before irq_chip_set_defaults(). In the first call to check_irq_resend() desc->irq_data.chip->irq_enable is NULL. UML dies due to a NULL-pointer dereference...

I don't know why check_irq_resend() is called before irq_chip_set_defaults(). It's your code. ;-)

Quoted 7 lines
Quoted 4 lines

Well, but it only gets called via enable_irq(). So that means something is calling enable_irq _before_ request/setup_irq().

arch/um/kernel/irq.c:init_IRQ() does that :)

Sorry I'm not very familiar with the IRQ stuff.
Does that mean init_IRQ() is not allowed to call enable_irq()?

Well, nothing is supposed to call enable_irq() before an interrupt is installed with request_irq() or setup_irq().

Patch below should fix your problem.

Thanks,

tglx
---

arch/um/kernel/irq.c +0 -1
index a746e30..6abc1af 100644
@@ -395,7 +395,6 @@ void __init init_IRQ(void)
 	irq_desc[TIMER_IRQ].action = NULL;
 	irq_desc[TIMER_IRQ].depth = 1;
 	irq_desc[TIMER_IRQ].chip = &SIGVTALRM_irq_type;
-	enable_irq(TIMER_IRQ);
 	for (i = 1; i < NR_IRQS; i++) {
 		irq_desc[i].status = IRQ_DISABLED;
 		irq_desc[i].action = NULL;
#8 lore raw
Quoted 5 lines · Thomas Gleixner

On Fri, 22 Oct 2010, Richard Weinberger wrote:
Well, nothing is supposed to call enable_irq() before an interrupt is installed with request_irq() or setup_irq().

Patch below should fix your problem.

Yuck. Missed the second instance. Updated patch below.

Thanks,

tglx
---

arch/um/kernel/irq.c +0 -2
index a746e30..97e204b 100644
@@ -395,13 +395,11 @@ void __init init_IRQ(void)
 	irq_desc[TIMER_IRQ].action = NULL;
 	irq_desc[TIMER_IRQ].depth = 1;
 	irq_desc[TIMER_IRQ].chip = &SIGVTALRM_irq_type;
-	enable_irq(TIMER_IRQ);
 	for (i = 1; i < NR_IRQS; i++) {
 		irq_desc[i].status = IRQ_DISABLED;
 		irq_desc[i].action = NULL;
 		irq_desc[i].depth = 1;
 		irq_desc[i].chip = &normal_irq_type;
-		enable_irq(i);
 	}
 }