WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [tip:irq/core] x86: xen: Sanitise sparse_irq handling

To: "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "mingo@xxxxxxxxxx" <mingo@xxxxxxxxxx>, "hpa@xxxxxxxxx" <hpa@xxxxxxxxx>, Jeremy Fitzhardinge <Jeremy.Fitzhardinge@xxxxxxxxxx>, "tglx@xxxxxxxxxxxxx" <tglx@xxxxxxxxxxxxx>, "mingo@xxxxxxx" <mingo@xxxxxxx>
Subject: [Xen-devel] Re: [tip:irq/core] x86: xen: Sanitise sparse_irq handling
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Fri, 15 Oct 2010 17:15:06 -0700
Cc: "Xen-devel@xxxxxxxxxxxxxxxxxxx" <Xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxx>, "linux-tip-commits@xxxxxxxxxxxxxxx" <linux-tip-commits@xxxxxxxxxxxxxxx>
Delivery-date: Fri, 15 Oct 2010 17:16:16 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <tip-77dff1c755c3218691e95e7e38ee14323b35dbdb@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <tip-77dff1c755c3218691e95e7e38ee14323b35dbdb@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.4
 On 10/12/2010 01:29 PM, tip-bot for Thomas Gleixner wrote:
> Commit-ID:  77dff1c755c3218691e95e7e38ee14323b35dbdb
> Gitweb:     http://git.kernel.org/tip/77dff1c755c3218691e95e7e38ee14323b35dbdb
> Author:     Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> AuthorDate: Wed, 29 Sep 2010 17:37:10 +0200
> Committer:  Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> CommitDate: Tue, 12 Oct 2010 16:53:44 +0200
>
> x86: xen: Sanitise sparse_irq handling
>
> There seems to be more cleanups possible, but that's left to the xen
> experts :)

This causes the kernel to fail to boot under Xen.  The WARN_ON(res !=
irq) triggers and nobody is very happy about the results.

It looks like the patch below might be sufficient, but then the system
fails due to block IO errors (not sure if that's related).

    J

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 7d24b0d..a11fabb 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -338,31 +338,7 @@ static void unmask_evtchn(int port)
 
 static int find_unbound_irq(void)
 {
-       struct irq_data *data;
-       int irq, res;
-
-       for (irq = 0; irq < nr_irqs; irq++) {
-               data = irq_get_irq_data(irq);
-               /* only 0->15 have init'd desc; handle irq > 16 */
-               if (!data)
-                       break;
-               if (data->chip == &no_irq_chip)
-                       break;
-               if (data->chip != &xen_dynamic_chip)
-                       continue;
-               if (irq_info[irq].type == IRQT_UNBOUND)
-                       return irq;
-       }
-
-       if (irq == nr_irqs)
-               panic("No available IRQ to bind to: increase nr_irqs!\n");
-
-       res = irq_alloc_desc_at(irq, 0);
-
-       if (WARN_ON(res != irq))
-               return -1;
-
-       return irq;
+       return irq_alloc_descs(-1, 0, 1, 0);
 }
 
 int bind_evtchn_to_irq(unsigned int evtchn)




> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Reviewed-by: Ingo Molnar <mingo@xxxxxxx>
> Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
> ---
>  drivers/xen/events.c |   23 +++++++++++------------
>  1 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
> index 13365ba..7d24b0d 100644
> --- a/drivers/xen/events.c
> +++ b/drivers/xen/events.c
> @@ -338,30 +338,29 @@ static void unmask_evtchn(int port)
>  
>  static int find_unbound_irq(void)
>  {
> -     int irq;
> -     struct irq_desc *desc;
> +     struct irq_data *data;
> +     int irq, res;
>  
>       for (irq = 0; irq < nr_irqs; irq++) {
> -             desc = irq_to_desc(irq);
> +             data = irq_get_irq_data(irq);
>               /* only 0->15 have init'd desc; handle irq > 16 */
> -             if (desc == NULL)
> +             if (!data)
>                       break;
> -             if (desc->chip == &no_irq_chip)
> +             if (data->chip == &no_irq_chip)
>                       break;
> -             if (desc->chip != &xen_dynamic_chip)
> +             if (data->chip != &xen_dynamic_chip)
>                       continue;
>               if (irq_info[irq].type == IRQT_UNBOUND)
> -                     break;
> +                     return irq;
>       }
>  
>       if (irq == nr_irqs)
>               panic("No available IRQ to bind to: increase nr_irqs!\n");
>  
> -     desc = irq_to_desc_alloc_node(irq, 0);
> -     if (WARN_ON(desc == NULL))
> -             return -1;
> +     res = irq_alloc_desc_at(irq, 0);
>  
> -     dynamic_irq_init_keep_chip_data(irq);
> +     if (WARN_ON(res != irq))
> +             return -1;
>  
>       return irq;
>  }
> @@ -495,7 +494,7 @@ static void unbind_from_irq(unsigned int irq)
>       if (irq_info[irq].type != IRQT_UNBOUND) {
>               irq_info[irq] = mk_unbound_info();
>  
> -             dynamic_irq_cleanup(irq);
> +             irq_free_desc(irq);
>       }
>  
>       spin_unlock(&irq_mapping_update_lock);


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel