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-ppc-devel

Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] SMP/IPI/MB combined

To: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Subject: Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] SMP/IPI/MB combined
From: Amos Waterland <apw@xxxxxxxxxx>
Date: Tue, 28 Nov 2006 01:37:47 -0500
Cc: xen-ppc-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 27 Nov 2006 22:37:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <7CA606E0-3186-4FE2-A3E7-09212F29C563@xxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E1GmyHa-0008Rc-1c@xxxxxxxxxxxxxxxxxxxxx> <7CA606E0-3186-4FE2-A3E7-09212F29C563@xxxxxxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
This will have to be reworked and broken up into individual parts for
submission, but here is what is necessary to make 'C-a C-a C-a t' work
properly.

Jimi, when you disassemble xen-syms compiled without this patch, do you
see a bogus infinite loop in read_clocks?  The compiler is not told that
read_clocks_cpumask is volatile, so it is free to turn that loop into an
infinite loop, as my gcc 4.1.1 cross-compiler does.  I am surprised that
other Xen architectures have not seen the same problem.

 arch/powerpc/smp.c    |   18 ++++++++++--------
 common/keyhandler.c   |    2 +-
 include/xen/cpumask.h |    2 +-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff -r 305751a5281e xen/arch/powerpc/smp.c
--- a/xen/arch/powerpc/smp.c    Wed Nov 22 16:29:25 2006 -0500
+++ b/xen/arch/powerpc/smp.c    Tue Nov 28 00:45:24 2006 -0500
@@ -91,31 +91,33 @@ int on_selected_cpus(
     int wait)
 {
     int t, retval = 0, nr_cpus = cpus_weight(selected);
+    int stall = timebase_freq * 10;
 
     spin_lock(&call_lock);
 
     call_data.func = func;
     call_data.info = info;
     call_data.wait = wait;
-    call_data.wait = 1;  /* Until we get RCU around call_data.  */
     atomic_set(&call_data.started, 0);
     atomic_set(&call_data.finished, 0);
     mb();
 
     send_IPI_mask(selected, CALL_FUNCTION_VECTOR);
 
-    /* We always wait for an initiation ACK from remote CPU.  */
-    for (t = 0; atomic_read(&call_data.started) != nr_cpus; t++) {
-        if (t && t % timebase_freq == 0) {
-            printk("IPI start stall: %d ACKS to %d SYNS\n", 
-                   atomic_read(&call_data.started), nr_cpus);
-        }
+    /* If told to, we wait for an initiation ACK from remote CPU.  */
+    if (wait) {
+       for (t = 0; atomic_read(&call_data.started) != nr_cpus; t++) {
+           if (t > 0 && t % stall == 0) {
+               printk("IPI start stall: %d ACKS to %d SYNS\n", 
+                      atomic_read(&call_data.started), nr_cpus);
+           }
+       }
     }
 
     /* If told to, we wait for a completion ACK from remote CPU.  */
     if (wait) {
         for (t = 0; atomic_read(&call_data.finished) != nr_cpus; t++) {
-            if (t > timebase_freq && t % timebase_freq == 0) {
+            if (t > 0 && t % stall == 0) {
                 printk("IPI finish stall: %d ACKS to %d SYNS\n", 
                        atomic_read(&call_data.finished), nr_cpus);
             }
diff -r 305751a5281e xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Wed Nov 22 16:29:25 2006 -0500
+++ b/xen/common/keyhandler.c   Tue Nov 28 00:12:14 2006 -0500
@@ -193,7 +193,7 @@ static void dump_domains(unsigned char k
     read_unlock(&domlist_lock);
 }
 
-static cpumask_t read_clocks_cpumask = CPU_MASK_NONE;
+static cpumask_t volatile read_clocks_cpumask = CPU_MASK_NONE;
 static s_time_t read_clocks_time[NR_CPUS];
 
 static void read_clocks_slave(void *unused)
diff -r 305751a5281e xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h Wed Nov 22 16:29:25 2006 -0500
+++ b/xen/include/xen/cpumask.h Tue Nov 28 00:12:42 2006 -0500
@@ -177,7 +177,7 @@ static inline int __cpus_subset(const cp
 }
 
 #define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
-static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
+static inline int __cpus_empty(const cpumask_t volatile *srcp, int nbits)
 {
        return bitmap_empty(srcp->bits, nbits);
 }

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