Linux-Next discussions
 help / color / mirror / Atom feed
* linux-next: User Mode Linux broken
@ 2010-10-21 11:15 Richard Weinberger
  2010-10-21 16:09 ` Thomas Gleixner
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Weinberger @ 2010-10-21 11:15 UTC (permalink / raw)
  To: tglx; +Cc: peterz, hpa, mingo, linux-kernel@vger.kernel.org, linux-next

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()?

Thanks,
//richard

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

* Re: linux-next: User Mode Linux broken
  2010-10-21 11:15 linux-next: User Mode Linux broken Richard Weinberger
@ 2010-10-21 16:09 ` Thomas Gleixner
  2010-10-21 19:22   ` Richard Weinberger
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2010-10-21 16:09 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: peterz, hpa, mingo, linux-kernel@vger.kernel.org, linux-next

On Thu, 21 Oct 2010, Richard Weinberger wrote:

> 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

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

* Re: linux-next: User Mode Linux broken
  2010-10-21 16:09 ` Thomas Gleixner
@ 2010-10-21 19:22   ` Richard Weinberger
  2010-10-21 19:45     ` Thomas Gleixner
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Weinberger @ 2010-10-21 19:22 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: peterz, hpa, mingo, linux-kernel@vger.kernel.org, linux-next

Am Donnerstag 21 Oktober 2010, 18:09:22 schrieb Thomas Gleixner:
> On Thu, 21 Oct 2010, Richard Weinberger wrote:
> > 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
> 

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

Thanks,
//richard

diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
index 891115a..1fb4012 100644
--- a/kernel/irq/resend.c
+++ b/kernel/irq/resend.c
@@ -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

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

* Re: linux-next: User Mode Linux broken
  2010-10-21 19:22   ` Richard Weinberger
@ 2010-10-21 19:45     ` Thomas Gleixner
  2010-10-21 20:27       ` Richard Weinberger
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2010-10-21 19:45 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: peterz, hpa, mingo, linux-kernel@vger.kernel.org, linux-next

On Thu, 21 Oct 2010, Richard Weinberger wrote:
> Am Donnerstag 21 Oktober 2010, 18:09:22 schrieb Thomas Gleixner:
> > On Thu, 21 Oct 2010, Richard Weinberger wrote:
> > > 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
> > 
> 
> This patch solves the issue for me.
> What do you think?
> 
> Thanks,
> //richard
> 
> diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
> index 891115a..1fb4012 100644
> --- a/kernel/irq/resend.c
> +++ b/kernel/irq/resend.c
> @@ -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

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

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

* Re: linux-next: User Mode Linux broken
  2010-10-21 19:45     ` Thomas Gleixner
@ 2010-10-21 20:27       ` Richard Weinberger
  2010-10-22  7:03         ` Thomas Gleixner
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Weinberger @ 2010-10-21 20:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: peterz, hpa, mingo, linux-kernel@vger.kernel.org, linux-next

Am Donnerstag 21 Oktober 2010, 21:45:35 schrieb Thomas Gleixner:
> On Thu, 21 Oct 2010, Richard Weinberger wrote:
> > Am Donnerstag 21 Oktober 2010, 18:09:22 schrieb Thomas Gleixner:
> > > On Thu, 21 Oct 2010, Richard Weinberger wrote:
> > > > 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
> > 
> > This patch solves the issue for me.
> > What do you think?
> > 
> > Thanks,
> > //richard
> > 
> > diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
> > index 891115a..1fb4012 100644
> > --- a/kernel/irq/resend.c
> > +++ b/kernel/irq/resend.c
> > @@ -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
> 
> 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

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

* Re: linux-next: User Mode Linux broken
  2010-10-21 20:27       ` Richard Weinberger
@ 2010-10-22  7:03         ` Thomas Gleixner
  2010-10-22 10:50           ` Richard Weinberger
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2010-10-22  7:03 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: peterz, hpa, mingo, linux-kernel@vger.kernel.org, linux-next

On Thu, 21 Oct 2010, Richard Weinberger wrote:
> Am Donnerstag 21 Oktober 2010, 21:45:35 schrieb Thomas Gleixner:
> > 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. ;-)

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

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

* Re: linux-next: User Mode Linux broken
  2010-10-22  7:03         ` Thomas Gleixner
@ 2010-10-22 10:50           ` Richard Weinberger
  2010-10-22 11:12             ` Thomas Gleixner
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Weinberger @ 2010-10-22 10:50 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: peterz, hpa, mingo, linux-kernel, linux-next

On Fri, 22 Oct 2010 09:03:44 +0200 (CEST), Thomas Gleixner
<tglx@linutronix.de> wrote:
> On Thu, 21 Oct 2010, Richard Weinberger wrote:
>> Am Donnerstag 21 Oktober 2010, 21:45:35 schrieb Thomas Gleixner:
>> > 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. ;-)
> 
> 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

> Thanks,
> 
> 	tglx

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

* Re: linux-next: User Mode Linux broken
  2010-10-22 10:50           ` Richard Weinberger
@ 2010-10-22 11:12             ` Thomas Gleixner
  2010-10-22 13:27               ` Thomas Gleixner
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2010-10-22 11:12 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: peterz, hpa, mingo, linux-kernel, linux-next

On Fri, 22 Oct 2010, Richard Weinberger wrote:

> On Fri, 22 Oct 2010 09:03:44 +0200 (CEST), Thomas Gleixner
> <tglx@linutronix.de> wrote:
> > On Thu, 21 Oct 2010, Richard Weinberger wrote:
> >> Am Donnerstag 21 Oktober 2010, 21:45:35 schrieb Thomas Gleixner:
> >> > 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. ;-)
> > 
> > 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
---
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index a746e30..6abc1af 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -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;

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

* Re: linux-next: User Mode Linux broken
  2010-10-22 11:12             ` Thomas Gleixner
@ 2010-10-22 13:27               ` Thomas Gleixner
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Gleixner @ 2010-10-22 13:27 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: peterz, hpa, mingo, linux-kernel, linux-next

On Fri, 22 Oct 2010, Thomas Gleixner wrote:
> 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
---
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index a746e30..97e204b 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -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);
 	}
 }
 

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

end of thread, other threads:[~2010-10-22 13:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-21 11:15 linux-next: User Mode Linux broken Richard Weinberger
2010-10-21 16:09 ` Thomas Gleixner
2010-10-21 19:22   ` Richard Weinberger
2010-10-21 19:45     ` Thomas Gleixner
2010-10-21 20:27       ` Richard Weinberger
2010-10-22  7:03         ` Thomas Gleixner
2010-10-22 10:50           ` Richard Weinberger
2010-10-22 11:12             ` Thomas Gleixner
2010-10-22 13:27               ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox