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-changelog

[Xen-changelog] [XENOPROFILE] Fix incorrect use of on_each_cpu() which c

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [XENOPROFILE] Fix incorrect use of on_each_cpu() which could lead
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 16 May 2006 09:36:10 +0000
Delivery-date: Tue, 16 May 2006 02:37:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 4fd6ba0e333673a275403867aebd805efc14d41d
# Parent  dc213d745642690b4bbc34af951e57f0d04c2d04
[XENOPROFILE] Fix incorrect use of on_each_cpu() which could lead
to sleep with interrupts disabled. on_each_cpu() disables interrupts.
proc_create() calls passes GFP_KERNEL to kmalloc().

The patch converts from on_each_cpu() to for_each_cpu(), and then
simplifies things.

Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c |   68 ++++++++-------------
 1 files changed, 26 insertions(+), 42 deletions(-)

diff -r dc213d745642 -r 4fd6ba0e3336 
linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
--- a/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c        Mon May 15 
16:32:09 2006 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c        Tue May 16 
09:08:06 2006 +0100
@@ -141,56 +141,40 @@ xenoprof_ovf_interrupt(int irq, void * d
 }
 
 
-static void unbind_virq_cpu(void * info)
-{
-       int cpu = smp_processor_id();
-       if (ovf_irq[cpu] >= 0) {
-               unbind_from_irqhandler(ovf_irq[cpu], NULL);
-               ovf_irq[cpu] = -1;
-       }
-}
-
-
 static void unbind_virq(void)
 {
-       on_each_cpu(unbind_virq_cpu, NULL, 0, 1);
-}
-
-
-int bind_virq_error;
-
-static void bind_virq_cpu(void * info)
-{
-       int result;
-       int cpu = smp_processor_id();
-
-       result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
-                                        cpu,
-                                        xenoprof_ovf_interrupt,
-                                        SA_INTERRUPT,
-                                        "xenoprof",
-                                        NULL);
-
-       if (result<0) {
-               bind_virq_error = result;
-               printk("xenoprof.c: binding VIRQ_XENOPROF to IRQ failed on CPU "
-                      "%d\n", cpu);
-       } else {
-               ovf_irq[cpu] = result;
+       int i;
+
+       for_each_cpu(i) {
+               if (ovf_irq[i] >= 0) {
+                       unbind_from_irqhandler(ovf_irq[i], NULL);
+                       ovf_irq[i] = -1;
+               }
        }
 }
 
 
 static int bind_virq(void)
 {
-       bind_virq_error = 0;
-       on_each_cpu(bind_virq_cpu, NULL, 0, 1);
-       if (bind_virq_error) {
-               unbind_virq();
-               return bind_virq_error;
-       } else {
-               return 0;
-       }
+       int i, result;
+
+       for_each_cpu(i) {
+               result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
+                                                i,
+                                                xenoprof_ovf_interrupt,
+                                                SA_INTERRUPT,
+                                                "xenoprof",
+                                                NULL);
+
+               if (result < 0) {
+                       unbind_virq();
+                       return result;
+               }
+
+               ovf_irq[i] = result;
+       }
+               
+       return 0;
 }
 
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [XENOPROFILE] Fix incorrect use of on_each_cpu() which could lead, Xen patchbot-unstable <=