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] Make dom0_vcpus_pin a platform independan

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Make dom0_vcpus_pin a platform independant option.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Sep 2006 17:20:12 +0000
Delivery-date: Mon, 25 Sep 2006 10:20:58 -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 Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
# Node ID b7b653e36d20811831f26bb951ea66dca5854b17
# Parent  f052ccc0cc26b53aa633e641ea84a6d1cb2014de
Make dom0_vcpus_pin a platform independant option.
By default, it's off. When enabled on the command line, it
causes dom0's VCPUs to be pinned to their respective physical
CPUs at creation time. Once pinned, they can never be moved.
ALso cleanup VCPU initialization of scheduler parameters.
Signed-off-by: Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
---
 docs/src/user.tex            |    2 +
 xen/arch/ia64/xen/domain.c   |    6 -----
 xen/arch/ia64/xen/xensetup.c |    8 -------
 xen/common/domain.c          |    6 -----
 xen/common/schedule.c        |   45 ++++++++++++++++++++++++++++++++++---------
 xen/include/xen/sched.h      |    2 -
 6 files changed, 41 insertions(+), 28 deletions(-)

diff -r f052ccc0cc26 -r b7b653e36d20 docs/src/user.tex
--- a/docs/src/user.tex Mon Sep 25 14:11:22 2006 +0100
+++ b/docs/src/user.tex Mon Sep 25 16:31:02 2006 +0100
@@ -3208,6 +3208,8 @@ editing \path{grub.conf}.
   respectively; if no suffix is specified, the parameter defaults to
   kilobytes. In previous versions of Xen, suffixes were not supported
   and the value is always interpreted as kilobytes.
+\item [ dom0\_vcpus\_pin ] Pins domain 0 VCPUs on their respective
+  physical CPUS (default=false).
 \item [ tbuf\_size=xxx ] Set the size of the per-cpu trace buffers, in
   pages (default 0).  
 \item [ sched=xxx ] Select the CPU scheduler Xen should use.  The
diff -r f052ccc0cc26 -r b7b653e36d20 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Mon Sep 25 14:11:22 2006 +0100
+++ b/xen/arch/ia64/xen/domain.c        Mon Sep 25 16:31:02 2006 +0100
@@ -54,7 +54,6 @@ static unsigned int dom0_max_vcpus = 1;
 static unsigned int dom0_max_vcpus = 1;
 integer_param("dom0_max_vcpus", dom0_max_vcpus); 
 
-extern int opt_dom0_vcpus_pin;
 extern unsigned long running_on_sim;
 
 extern char dom0_command_line[];
@@ -1021,12 +1020,9 @@ int construct_dom0(struct domain *d,
            dom0_max_vcpus = MAX_VIRT_CPUS;
        
        printf ("Dom0 max_vcpus=%d\n", dom0_max_vcpus);
-       for ( i = 1; i < dom0_max_vcpus; i++ ) {
+       for ( i = 1; i < dom0_max_vcpus; i++ )
            if (alloc_vcpu(d, i, i) == NULL)
                printf ("Cannot allocate dom0 vcpu %d\n", i);
-           else if (opt_dom0_vcpus_pin)
-               d->vcpu[i]->cpu_affinity = cpumask_of_cpu(i);
-       }
 
        /* Copy the OS image. */
        loaddomainelfimage(d,image_start);
diff -r f052ccc0cc26 -r b7b653e36d20 xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c      Mon Sep 25 14:11:22 2006 +0100
+++ b/xen/arch/ia64/xen/xensetup.c      Mon Sep 25 16:31:02 2006 +0100
@@ -48,10 +48,6 @@ extern void init_IRQ(void);
 extern void init_IRQ(void);
 extern void trap_init(void);
 
-/* opt_dom0_vcpus_pin: If true, dom0 VCPUs are pinned. */
-unsigned int opt_dom0_vcpus_pin = 0;
-boolean_param("dom0_vcpus_pin", opt_dom0_vcpus_pin);
-
 /* opt_nosmp: If true, secondary processors are ignored. */
 static int opt_nosmp = 0;
 boolean_param("nosmp", opt_nosmp);
@@ -520,10 +516,6 @@ printk("num_online_cpus=%d, max_cpus=%d\
                        0) != 0)
         panic("Could not set up DOM0 guest OS\n");
 
-    /* PIN domain0 VCPU 0 on CPU 0. */
-    if (opt_dom0_vcpus_pin)
-        dom0->vcpu[0]->cpu_affinity = cpumask_of_cpu(0);
-
     if (!running_on_sim)  // slow on ski and pages are pre-initialized to zero
        scrub_heap_pages();
 
diff -r f052ccc0cc26 -r b7b653e36d20 xen/common/domain.c
--- a/xen/common/domain.c       Mon Sep 25 14:11:22 2006 +0100
+++ b/xen/common/domain.c       Mon Sep 25 16:31:02 2006 +0100
@@ -82,20 +82,16 @@ struct vcpu *alloc_vcpu(
 
     v->domain = d;
     v->vcpu_id = vcpu_id;
-    v->processor = cpu_id;
     v->vcpu_info = &d->shared_info->vcpu_info[vcpu_id];
     spin_lock_init(&v->pause_lock);
 
-    v->cpu_affinity = is_idle_domain(d) ?
-        cpumask_of_cpu(cpu_id) : CPU_MASK_ALL;
-
     v->runstate.state = is_idle_vcpu(v) ? RUNSTATE_running : RUNSTATE_offline;
     v->runstate.state_entry_time = NOW();
 
     if ( (vcpu_id != 0) && !is_idle_domain(d) )
         set_bit(_VCPUF_down, &v->vcpu_flags);
 
-    if ( sched_init_vcpu(v) < 0 )
+    if ( sched_init_vcpu(v, cpu_id) < 0 )
     {
         free_vcpu_struct(v);
         return NULL;
diff -r f052ccc0cc26 -r b7b653e36d20 xen/common/schedule.c
--- a/xen/common/schedule.c     Mon Sep 25 14:11:22 2006 +0100
+++ b/xen/common/schedule.c     Mon Sep 25 16:31:02 2006 +0100
@@ -37,6 +37,11 @@ static char opt_sched[10] = "credit";
 static char opt_sched[10] = "credit";
 string_param("sched", opt_sched);
 
+/* opt_dom0_vcpus_pin: If true, dom0 VCPUs are pinned. */
+static unsigned int opt_dom0_vcpus_pin;
+boolean_param("dom0_vcpus_pin", opt_dom0_vcpus_pin);
+
+
 #define TIME_SLOP      (s32)MICROSECS(50)     /* allow time to slip a bit */
 
 /* Various timer handlers. */
@@ -97,18 +102,37 @@ void vcpu_runstate_get(struct vcpu *v, s
     }
 }
 
-int sched_init_vcpu(struct vcpu *v) 
-{
+int sched_init_vcpu(struct vcpu *v, unsigned int processor) 
+{
+    const struct domain * const d = v->domain;
+
+    /* Initialize processor and affinity settings. */
+    v->processor = processor;
+
+    if ( is_idle_domain(d) || (d->domain_id == 0 && opt_dom0_vcpus_pin) )
+    {
+        /*
+         * The idler and potentially dom0 VCPUs are pinned onto their
+         * respective physical CPUs.
+         */
+        v->cpu_affinity = cpumask_of_cpu(processor);
+
+        /* The idle VCPUs takes over their CPUs on creation... */
+        if ( is_idle_domain(d) )
+        {
+            per_cpu(schedule_data, v->processor).curr = v;
+            per_cpu(schedule_data, v->processor).idle = v;
+            set_bit(_VCPUF_running, &v->vcpu_flags);
+        }
+    }
+    else
+    {
+        v->cpu_affinity = CPU_MASK_ALL;
+    }
+
     /* Initialise the per-domain timers. */
     init_timer(&v->timer, vcpu_timer_fn, v, v->processor);
     init_timer(&v->poll_timer, poll_timer_fn, v, v->processor);
-
-    if ( is_idle_vcpu(v) )
-    {
-        per_cpu(schedule_data, v->processor).curr = v;
-        per_cpu(schedule_data, v->processor).idle = v;
-        set_bit(_VCPUF_running, &v->vcpu_flags);
-    }
 
     TRACE_2D(TRC_SCHED_DOM_ADD, v->domain->domain_id, v->vcpu_id);
 
@@ -211,6 +235,9 @@ int vcpu_set_affinity(struct vcpu *v, cp
 {
     cpumask_t online_affinity;
     unsigned long flags;
+
+    if ( v->domain->domain_id == 0 && opt_dom0_vcpus_pin )
+        return -EINVAL;
 
     cpus_and(online_affinity, *affinity, cpu_online_map);
     if ( cpus_empty(online_affinity) )
diff -r f052ccc0cc26 -r b7b653e36d20 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Mon Sep 25 14:11:22 2006 +0100
+++ b/xen/include/xen/sched.h   Mon Sep 25 16:31:02 2006 +0100
@@ -280,7 +280,7 @@ void new_thread(struct vcpu *d,
 #define set_current_state(_s) do { current->state = (_s); } while (0)
 void scheduler_init(void);
 void schedulers_start(void);
-int  sched_init_vcpu(struct vcpu *);
+int  sched_init_vcpu(struct vcpu *v, unsigned int processor);
 void sched_destroy_domain(struct domain *);
 long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *);
 int  sched_id(void);

_______________________________________________
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] Make dom0_vcpus_pin a platform independant option., Xen patchbot-unstable <=