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] [xen-unstable] move register_cpu_notifier() into .init.t

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] move register_cpu_notifier() into .init.text
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sun, 03 Apr 2011 13:00:11 +0100
Delivery-date: Sun, 03 Apr 2011 05:02:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Jan Beulich <jbeulich@xxxxxxxxxx>
# Date 1301756223 -3600
# Node ID f5d33782a57b19ab33f8c980504597539edf78d9
# Parent  c80281a99feb5964427390f5cd7900db907b47ee
move register_cpu_notifier() into .init.text

With no modular drivers, all CPU notifier setup is supposed to happen
during boot. There also is a respective comment in the function.=20

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---


diff -r c80281a99feb -r f5d33782a57b xen/arch/x86/nmi.c
--- a/xen/arch/x86/nmi.c        Sat Apr 02 15:56:32 2011 +0100
+++ b/xen/arch/x86/nmi.c        Sat Apr 02 15:57:03 2011 +0100
@@ -389,13 +389,13 @@
 
 void watchdog_enable(void)
 {
-    static unsigned long heartbeat_initialised;
+    atomic_dec(&watchdog_disable_count);
+}
+
+void __init watchdog_setup(void)
+{
     unsigned int cpu;
 
-    if ( !atomic_dec_and_test(&watchdog_disable_count) ||
-         test_and_set_bit(0, &heartbeat_initialised) )
-        return;
-
     /*
      * Activate periodic heartbeats. We cannot do this earlier during 
      * setup because the timer infrastructure is not available.
@@ -403,6 +403,8 @@
     for_each_online_cpu ( cpu )
         cpu_nmi_callback(&cpu_nmi_nfb, CPU_UP_PREPARE, (void *)(long)cpu);
     register_cpu_notifier(&cpu_nmi_nfb);
+
+    watchdog_enable();
 }
 
 void nmi_watchdog_tick(struct cpu_user_regs * regs)
diff -r c80281a99feb -r f5d33782a57b xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Sat Apr 02 15:56:32 2011 +0100
+++ b/xen/arch/x86/setup.c      Sat Apr 02 15:57:03 2011 +0100
@@ -1259,7 +1259,7 @@
     do_initcalls();
 
     if ( opt_watchdog ) 
-        watchdog_enable();
+        watchdog_setup();
     
     if ( !tboot_protect_mem_regions() )
         panic("Could not protect TXT memory regions\n");
diff -r c80281a99feb -r f5d33782a57b xen/common/cpu.c
--- a/xen/common/cpu.c  Sat Apr 02 15:56:32 2011 +0100
+++ b/xen/common/cpu.c  Sat Apr 02 15:57:03 2011 +0100
@@ -2,6 +2,7 @@
 #include <xen/cpumask.h>
 #include <xen/cpu.h>
 #include <xen/event.h>
+#include <xen/init.h>
 #include <xen/sched.h>
 #include <xen/stop_machine.h>
 
@@ -53,7 +54,7 @@
 
 static NOTIFIER_HEAD(cpu_chain);
 
-void register_cpu_notifier(struct notifier_block *nb)
+void __init register_cpu_notifier(struct notifier_block *nb)
 {
     if ( !spin_trylock(&cpu_add_remove_lock) )
         BUG(); /* Should never fail as we are called only during boot. */
diff -r c80281a99feb -r f5d33782a57b xen/common/notifier.c
--- a/xen/common/notifier.c     Sat Apr 02 15:56:32 2011 +0100
+++ b/xen/common/notifier.c     Sat Apr 02 15:57:03 2011 +0100
@@ -19,7 +19,7 @@
  * Adds a notifier to a raw notifier chain.
  * All locking must be provided by the caller.
  */
-void notifier_chain_register(
+void __init notifier_chain_register(
     struct notifier_head *nh, struct notifier_block *n)
 {
     struct list_head *chain = &nh->head.chain;
@@ -44,7 +44,7 @@
  * Removes a notifier from a raw notifier chain.
  * All locking must be provided by the caller.
  */
-void notifier_chain_unregister(
+void __init notifier_chain_unregister(
     struct notifier_head *nh, struct notifier_block *n)
 {
     list_del(&n->chain);
diff -r c80281a99feb -r f5d33782a57b xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c        Sat Apr 02 15:56:32 2011 +0100
+++ b/xen/common/sched_credit2.c        Sat Apr 02 15:57:03 2011 +0100
@@ -2010,7 +2010,8 @@
     /* Hope this is safe from cpupools switching things around. :-) */
     ops = per_cpu(scheduler, cpu);
 
-    init_pcpu(ops, cpu);
+    if ( ops->alloc_pdata == csched_alloc_pdata )
+        init_pcpu(ops, cpu);
 
     return NOTIFY_DONE;
 }
@@ -2038,6 +2039,13 @@
 };
 
 static int
+csched_global_init(void)
+{
+    register_cpu_notifier(&cpu_credit2_nfb);
+    return 0;
+}
+
+static int
 csched_init(struct scheduler *ops)
 {
     int i;
@@ -2070,8 +2078,6 @@
     spin_lock_init(&prv->lock);
     INIT_LIST_HEAD(&prv->sdom);
 
-    register_cpu_notifier(&cpu_credit2_nfb);
-
     /* But un-initialize all runqueues */
     for ( i=0; i<NR_CPUS; i++)
     {
@@ -2120,6 +2126,7 @@
 
     .dump_cpu_state = csched_dump_pcpu,
     .dump_settings  = csched_dump,
+    .global_init    = csched_global_init,
     .init           = csched_init,
     .deinit         = csched_deinit,
     .alloc_vdata    = csched_alloc_vdata,
diff -r c80281a99feb -r f5d33782a57b xen/common/schedule.c
--- a/xen/common/schedule.c     Sat Apr 02 15:56:32 2011 +0100
+++ b/xen/common/schedule.c     Sat Apr 02 15:57:03 2011 +0100
@@ -66,7 +66,6 @@
     &sched_credit_def,
     &sched_credit2_def,
     &sched_arinc653_def,
-    NULL
 };
 
 static struct scheduler __read_mostly ops;
@@ -1324,17 +1323,25 @@
 
     open_softirq(SCHEDULE_SOFTIRQ, schedule);
 
-    for ( i = 0; schedulers[i] != NULL; i++ )
+    for ( i = 0; i < ARRAY_SIZE(schedulers); i++ )
     {
-        ops = *schedulers[i];
-        if ( strcmp(ops.opt_name, opt_sched) == 0 )
-            break;
+        if ( schedulers[i]->global_init && schedulers[i]->global_init() < 0 )
+            schedulers[i] = NULL;
+        else if ( !ops.name && !strcmp(schedulers[i]->opt_name, opt_sched) )
+            ops = *schedulers[i];
     }
 
-    if ( schedulers[i] == NULL )
+    if ( !ops.name )
     {
         printk("Could not find scheduler: %s\n", opt_sched);
-        ops = *schedulers[0];
+        for ( i = 0; i < ARRAY_SIZE(schedulers); i++ )
+            if ( schedulers[i] )
+            {
+                ops = *schedulers[i];
+                break;
+            }
+        BUG_ON(!ops.name);
+        printk("Using '%s' (%s)\n", ops.name, ops.opt_name);
     }
 
     if ( cpu_schedule_up(0) )
@@ -1407,8 +1414,8 @@
     int i;
     struct scheduler *sched;
 
-    for ( i = 0; schedulers[i] != NULL; i++ )
-        if ( schedulers[i]->sched_id == sched_id )
+    for ( i = 0; i < ARRAY_SIZE(schedulers); i++ )
+        if ( schedulers[i] && schedulers[i]->sched_id == sched_id )
             goto found;
     *perr = -ENOENT;
     return NULL;
diff -r c80281a99feb -r f5d33782a57b xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h      Sat Apr 02 15:56:32 2011 +0100
+++ b/xen/include/asm-x86/config.h      Sat Apr 02 15:57:03 2011 +0100
@@ -393,6 +393,7 @@
 #ifndef __ASSEMBLY__
 extern void watchdog_disable(void);
 extern void watchdog_enable(void);
+extern void watchdog_setup(void);
 #endif
 
 #endif /* __X86_CONFIG_H__ */
diff -r c80281a99feb -r f5d33782a57b xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h        Sat Apr 02 15:56:32 2011 +0100
+++ b/xen/include/xen/sched-if.h        Sat Apr 02 15:57:03 2011 +0100
@@ -141,6 +141,8 @@
     unsigned int sched_id;  /* ID for this scheduler             */
     void *sched_data;       /* global data pointer               */
 
+    int          (*global_init)    (void);
+
     int          (*init)           (struct scheduler *);
     void         (*deinit)         (const struct scheduler *);
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] move register_cpu_notifier() into .init.text, Xen patchbot-unstable <=