aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/schedule.c
Commit message (Collapse)AuthorAgeFilesLines
...
* scheduler: Introduce pcpu_schedule_lockKeir Fraser2010-12-241-5/+6
| | | | | | | | | | | Many places in Xen, particularly schedule.c, grab the per-cpu spinlock directly, rather than through vcpu_schedule_lock(). Since the lock pointer may change between the time it's read and the time the lock is successfully acquired, we need to check after acquiring the lock to make sure that the pcpu's lock hasn't changed, due to cpu initialization or cpupool activity. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* Move IDLE_DOMAIN_ID defn to public header, and change DOMID_INVALID to fix ↵Keir Fraser2010-12-091-1/+1
| | | | | | clash. Signed-off-by: Keir Fraser <keir@xen.org>
* ARINC 653 schedulerKeir Fraser2010-12-011-0/+2
| | | | | | From: Josh Holtrop <Josh.Holtrop@dornerworks.com> Signed-off-by: Keir Fraser <keir@xen.org> Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
* cpupool: Simplify locking, use refcounts for cpupool liveness.Keir Fraser2010-11-261-7/+2
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* Define Linux-style <preempt.h> interface.Keir Fraser2010-11-181-0/+1
| | | | | | Use it to disable sleeping in spinlock and rcu-read regions. Signed-off-by: Keir Fraser <keir@xen.org>
* Wait queues, allowing conditional sleep in hypervisor context.Keir Fraser2010-11-171-0/+5
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* Add locking-depth debugging, introduce in_atomic() boolean.Keir Fraser2010-11-161-1/+1
| | | | | | | This will be useful for debugging use of sleep-in-hypervisor primitives. Signed-off-by: Keir Fraser <keir@xen.org>
* Make multicall state per-vcpu rather than per-cpuKeir Fraser2010-11-161-1/+0
| | | | | | | This is a prerequisite for allowing guest descheduling within a hypercall. Signed-off-by: Keir Fraser <keir@xen.org>
* cpupools: Make interface more consistentKeir Fraser2010-10-241-2/+8
| | | | | | | | | | | | | | | | | | | | The current cpupools code interface is a bit inconsistent. This patch addresses this by making the interaction for each vcpu in a pool look like this: alloc_vdata() -- allocates and sets up vcpu data insert_vcpu() -- the vcpu is ready to run in this pool remove_vcpu() -- take the vcpu out of the pool free_vdata() -- delete allocated vcpu data (Previously, remove_vcpu and free_vdata were combined into a "destroy vcpu", and insert_vcpu was only called for idle vcpus.) This also addresses a bug in credit2 which was caused by a misunderstanding of the cpupools interface. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
* Eliminate unnecessary casts from __trace_var() invocationsKeir Fraser2010-09-201-3/+2
| | | | | | This is possible now that its last parameter's type is 'const void *'. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* cpupool: correct removing cpu from cpupoolKeir Fraser2010-08-091-1/+1
| | | | | | | | Corrects an error introduced with cs 21422. Without the patch my machine crashed when removing a cpu from a cpupool other than Pool-0. Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
* scheduler: Add a per-scheduler yield callbackKeir Fraser2010-08-091-0/+6
| | | | Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* Always call domain_update_node_affinity() with IRQs enabled.Keir Fraser2010-08-061-1/+2
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* numa: Small tweaks to domain_update_node_affinity() and its callers.Keir Fraser2010-08-041-2/+9
| | | | | From: Andrew Jones <drjones@redhat.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* numa: Attempt more efficient NUMA allocation in hypervisor by default.Keir Fraser2010-08-041-0/+3
| | | | | | | | | 1. Try to allocate from nodes containing CPUs which a guest can be scheduled on. 2. Remember which node we allocated from last, and round-robin allocations among above-mentioned nodes. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xen: use s_time_t for periodic timer deadlines.Keir Fraser2010-07-081-1/+1
| | | | | | | | | Otherwise vcpu_periodic_timer_work() can think the next timer is in the future (and re-issue it unchanged) while timer_softirq_action() thinks it's in the past (and fires it immediately), leading to livelock. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* Fix sched_adjust_global() and clean up surrounding code.Keir Fraser2010-06-171-35/+32
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: IRQ affinity should track vCPU affinityKeir Fraser2010-06-171-0/+7
| | | | | | | | | | | | | | With IRQs getting bound to the CPU the binding vCPU currently runs on there can result quite a bit of extra cross CPU traffic as soon as that vCPU moves to a different pCPU. Likewise, when a domain re-binds an event channel associated with a pIRQ, that IRQ's affinity should also be adjusted. The open issue is how to break ties for interrupts shared by multiple domains - currently, the last request (at any point in time) is being honored. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Watchdog timers for domainsKeir Fraser2010-06-041-0/+85
| | | | | | | | Each domain is allowed to set, reset and disable its timers; when any timer runs out the domain is killed. Patch from Christian Limpach <Christian.Limpach@citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* Allow domains to set a shutdown code without actually shutting downKeir Fraser2010-06-041-0/+21
| | | | | | | | Useful for Windows guests, since the PV drivers are notified that the domain is about to crash just before the crash dump gets written. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* timers: Track inactive timers and migrate them on cpu offline.Keir Fraser2010-06-021-21/+2
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* cpupool: Clean up unused prorotype and duplicate trace call.Keir Fraser2010-05-261-4/+0
| | | | Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
* Fix CPU hotplug after percpu data handling changes.Keir Fraser2010-05-191-45/+67
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* cpupool: Fix CPU hotplug after recent changes.Keir Fraser2010-05-171-22/+33
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Remove many uses of cpu_possible_map and iterators over NR_CPUS.Keir Fraser2010-05-141-8/+33
| | | | | | | The significant remaining culprits for x86 are credit2, hpet, and percpu-area subsystems. To be dealt with in a separate patch. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* tasklet: Improve scheduler interaction.Keir Fraser2010-05-111-1/+20
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* scheduler: Add a global parameter adjustment to the switchable scheduler ↵Keir Fraser2010-05-041-0/+15
| | | | | | | | | | | | interface ...along with a new sysctl to call it directly. This is in order to support DornerWorks' new ARINC653 scheduler. Based on code from Josh Holtrop and Kathy Hadley at DornerWorks, Ltd Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
* credit2/cpupools: Fix crashKeir Fraser2010-05-041-1/+2
| | | | Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
* cpupools [1/6]: hypervisor changesKeir Fraser2010-04-211-46/+254
| | | | Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
* Cleanups to cpu_disable_scheduler().Keir Fraser2010-04-191-4/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* credit2: Add credit2 scheduler to hypervisorKeir Fraser2010-04-141-0/+2
| | | | | | | | | This is the core credit2 patch. It adds the new credit2 scheduler to the hypervisor, as the non-default scheduler. It should be emphasized that this is still in the development phase, and is probably still unstable. It is known to be suboptimal for multi-socket systems. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* credit2: Flexible cpu-to-schedule-spinlock mappingsKeir Fraser2010-04-141-8/+10
| | | | | | | | Credit2 shares a runqueue between several cpus. Rather than have double locking and dealing with the cpu-to-runqueue races, allow the scheduler to redefine the sched_lock-to-cpu mapping. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* credit2: Add context_saved scheduler callbackKeir Fraser2010-04-141-0/+2
| | | | | | | | | | Because credit2 shares a runqueue between several cpus, it needs to know when a scheduled-out process has finally been context-switched away so that it can be added to the runqueue again. (Otherwise it may be grabbed by another processor before the context has been properly saved.) Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* Architecture-independent, and tasklet-based, continue_hypercall_on_cpu().Keir Fraser2010-04-141-42/+4
| | | | | Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xentrace: fix lost records resumeKeir Fraser2010-04-121-4/+10
| | | | | | | | | | | | Reorder the SCHED_SWITCH trace before the runstate change trace to fix a problem with the lost records "resume" code. Namely: The "lost records" trace includes the currently running process. But during SCHED_SWITCH, it reads the wrong value, confusing xenalyze. Making sure there are no trace records between runstate change trace and the actual context switch fixes it. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* cpuidle: Small fix to urgent_count update logic.Keir Fraser2010-02-241-2/+4
| | | | | From: Ke Yu <ke.yu@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* cpuidle: do not enter deep C state if there is urgent VCPUKeir Fraser2010-02-161-3/+44
| | | | | | | | | | | | | when VCPU is polling on event channel, it usually has urgent task running, e.g. spin_lock, in this case, it is better for cpuidle driver not to enter deep C state. This patch fix the issue that SLES 11 SP1 domain0 hangs in the box of large number of CPUs (>= 64 CPUs). Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Tian Kevin <kevin.tian@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* If the 'sched' parameter is unrecognized, choose the first schedulerKeir Fraser2010-02-151-0/+3
| | | | Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* Remove hardcoded instances of TIMER_SLOP.Keir Fraser2010-02-101-4/+1
| | | | | | | They aren't needed at all, since slop now only delays a timer firing, rather than allowing it to happen early. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Miscellaneous data placement adjustmentsKeir Fraser2009-10-281-4/+4
| | | | | | | Make various data items const or __read_mostly where possible/reasonable. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* properly __initdata-annotate command line option string buffersKeir Fraser2009-08-311-1/+1
| | | | Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Rename for_each_cpu() to for_each_possible_cpu()Keir Fraser2009-07-151-1/+1
| | | | | | ... to be more precise in naming, and also to match Linux. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Move logic for avoiding limited idle quantum into credit scheduler.Keir Fraser2009-04-021-5/+3
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Only set scheduler quantum timer for non-idle VCPUsKeir Fraser2009-04-011-2/+3
| | | | | | | | This removes the last idle periodic timer in xen, and enhances the idle average C state residency from two-digits ms to three-digit ms. Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Tian Kevin <kevin.tian@intel.com>
* cpuidle: suspend/resume scheduler tick timer during cpu idle state entry/exitKeir Fraser2009-03-311-0/+10
| | | | | | | | | | | | cpuidle can collaborate with scheduler to reduce unnecessary timer interrupt. For example, credit scheduler accounting timer doesn't need to be active at idle time, so it can be stopped at cpuidle entry and resumed at cpuidle exit. This patch implements this function by adding two ops in scheduler: tick_suspend/tick_resume, and implement them for credit scheduler Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Tian Kevin <kevin.tian@intel.com>
* xenpm: Add a small scheduler knob "sched_smt_power_savings"Keir Fraser2009-03-201-0/+9
| | | | | | | | | Current scheduler only care performance, thus always picks pCPU from the most idle package. This knob provides another option to pick pCPU from least idle package, for user who want performance power balance. Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Tian Kevin <kevin.tian@intel.com>
* Improve vcpu_migration_delay handling.Keir Fraser2009-03-111-0/+1
| | | | Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
* xentrace: trace when we continue with the same taskKeir Fraser2009-03-091-0/+15
| | | | | | | | | Trace when the scheduler decides to continue running the same process. This lets us see that this is happening for one; it also lets us see domains in a trace which are actively running on pcpu but never scheduled out. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* Cpufreq: remove redundant fragmentsKeir Fraser2009-01-051-1/+1
| | | | Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* Fix a typo caused by 18898.Keir Fraser2008-12-111-2/+2
| | | | | | new state is updated too early. Signed-off-by: Kevin Tian <kevin.tian@intel.com>