aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/sched-if.h
Commit message (Collapse)AuthorAgeFilesLines
* scheduler: adjust internal locking interfaceJan Beulich2013-10-141-82/+56
| | | | | | | | | | | | | | | Make the locking functions return the lock pointers, so they can be passed to the unlocking functions (which in turn can check that the lock is still actually providing the intended protection, i.e. the parameters determining which lock is the right one didn't change). Further use proper spin lock primitives rather than open coded local_irq_...() constructs, so that interrupts can be re-enabled as appropriate while spinning. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* x86/S3: Fix cpu pool scheduling after suspend/resumeBen Guthro2013-04-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This review is another S3 scheduler problem with the system_state variable introduced with the following changeset: http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=269f543ea750ed567d18f2e819e5d5ce58eda5c5 Specifically, the cpu_callback function that takes the CPU down during suspend, and back up during resume. We were seeing situations where, after S3, only CPU0 was in cpupool0. Guest performance suffered greatly, since all vcpus were only on a single pcpu. Guests under high CPU load showed the problem much more quickly than an idle guest. Removing this if condition forces the CPUs to go through the expected online/offline state, and be properly scheduled after S3. This also includes a necessary partial change proposed earlier by Tomasz Wroblewski here: http://lists.xen.org/archives/html/xen-devel/2013-01/msg02206.html It should also resolve the issues discussed in this thread: http://lists.xen.org/archives/html/xen-devel/2012-11/msg01801.html Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com> Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
* xen: allow for explicitly specifying node-affinityDario Faggioli2013-04-171-0/+2
| | | | | | | | | | | | | | | Make it possible to pass the node-affinity of a domain to the hypervisor from the upper layers, instead of always being computed automatically. Note that this also required generalizing the Flask hooks for setting and getting the affinity, so that they now deal with both vcpu and node affinity. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Acked-by: Keir Fraser <keir@xen.org>
* xen: sched_credit: define and use curr_on_cpu(cpu)Dario Faggioli2012-12-181-0/+2
| | | | | | | | | | To fetch `per_cpu(schedule_data,cpu).curr' in a more readable way. It's in sched-if.h as that is where `struct schedule_data' is declared. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: George Dunlap <george.dunlap@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* scheduler: Add a #define for the default ratelimitGeorge Dunlap2012-02-231-0/+1
| | | | | Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* introduce and use common macros for selecting cpupool based cpumasksJuergen Gross2012-01-241-0/+5
| | | | | | | | There are several instances of the same construct finding the cpumask for a cpupool. Use macros instead. Signed-off-by: juergen.gross@ts.fujitsu.com Committed-by: Keir Fraser <keir@xen.org>
* sched_credit: Use delay to control scheduling frequencyHui Lv2012-01-171-0/+5
| | | | | | | | | | | | | | | | | | | | This patch can improve Xen performance: 1. Basically, the "delay method" can achieve 11% overall performance boost for SPECvirt than original credit scheduler. 2. We have tried 1ms delay and 10ms delay, there is no big difference between these two configurations. (1ms is enough to achieve a good performance) 3. We have compared different load level response time/latency (low, high, peak), "delay method" didn't bring very much response time increase. 4. 1ms delay can reduce 30% context switch at peak performance, where produces the benefits. (int sched_ratelimit_us = 1000 is the recommended setting) Signed-off-by: Hui Lv <hui.lv@intel.com> Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* cpupools: allocate CPU masks dynamicallyJan Beulich2011-10-211-1/+1
| | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* xen: remove more declarations from C files.Tim Deegan2011-05-271-0/+6
| | | | | | | | | | This patch moves some more, mostly data, extern declarations into header files. I haven't been as strict as I was with functions; in particular there are a number of declarations of assembler labels that are only used in one place. I've also left a few compat-mode tricks, and all the magic in symbols.c Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* credit2: add a callback to migrate to a new cpuGeorge Dunlap2011-04-271-0/+2
| | | | | | | | | | | | | | In credit2, there needs to be a strong correlation between v->processor and the runqueue to which a vcpu is assigned; much of the code relies on this invariant. Allow credit2 to manage the actual migration itself. This fixes the most recent credit2 bug reported on the list (Xen BUG at sched_credit2.c:1606) in Xen 4.1, as well as the bug at sched_credit2.c:811 in -unstable (which catches the same condition earlier). Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* move register_cpu_notifier() into .init.textJan Beulich2011-04-021-0/+2
| | | | | | | 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@novell.com>
* scheduler: Introduce pcpu_schedule_lockKeir Fraser2010-12-241-0/+51
| | | | | | | | | | | 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>
* scheduler: Update vcpu_schedule_lock to check for changed lock pointer as wellKeir Fraser2010-12-241-11/+13
| | | | | | | | | | | | | | | | | | | | Credit2 has different cpus share a lock; which means that as cpus are added, and as they're moved between pools, the pointer to the scheduler lock may also change as well. Since we don't want to have to grab a lock before grabbing the per-cpu scheduler lock, we use the lock itself to protect against the pointer changing. However, since it may change between reading and locking, after we grab the lock we need to check to make sure it's still the right one. Update the vcpu_schedule_lock() definition to reflect this: both v->processor and that processor's schedule lock are liable to change; check both after grabbing the lock, and release / re-acquire if necessary. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* cpupool: Simplify locking, use refcounts for cpupool liveness.Keir Fraser2010-11-261-0/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* cpupools: Make interface more consistentKeir Fraser2010-10-241-1/+2
| | | | | | | | | | | | | | | | | | | | 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>
* scheduler: Add a per-scheduler yield callbackKeir Fraser2010-08-091-0/+1
| | | | Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* Fix sched_adjust_global() and clean up surrounding code.Keir Fraser2010-06-171-2/+0
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: IRQ affinity should track vCPU affinityKeir Fraser2010-06-171-0/+1
| | | | | | | | | | | | | | 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>
* Fix CPU hotplug after percpu data handling changes.Keir Fraser2010-05-191-3/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* cpupool: Fix CPU hotplug after recent changes.Keir Fraser2010-05-171-2/+2
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* tasklet: Improve scheduler interaction.Keir Fraser2010-05-111-1/+2
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* scheduler: const-ify references to 'struct scheduler' where possible.Keir Fraser2010-05-041-21/+23
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* cpupools [1/6]: hypervisor changesKeir Fraser2010-04-211-15/+45
| | | | Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
* credit2: Flexible cpu-to-schedule-spinlock mappingsKeir Fraser2010-04-141-4/+23
| | | | | | | | 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/+1
| | | | | | | | | | 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>
* cpuidle: do not enter deep C state if there is urgent VCPUKeir Fraser2010-02-161-0/+1
| | | | | | | | | | | | | 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>
* cpuidle: suspend/resume scheduler tick timer during cpu idle state entry/exitKeir Fraser2009-03-311-0/+3
| | | | | | | | | | | | 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>
* xen: New vcpu_op commands for setting periodic and single-shot timers.kfraser@localhost.localdomain2007-03-091-2/+0
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* [XEN] Initial support for multi-core and multi-threaded CPU scheduling.Emmanuel Ackaouy2006-11-061-0/+1
| | | | | | | In multi-core and multi-threaded systems, not all idling "CPUs" are equal: When there are idling execution vehicles, it's better to spread VCPUs across sockets and cores before co-scheduling cores and threads. Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
* [XEN] Re-jig VCPU initialisation -- VMX init requires generic VCPUkfraser@localhost.localdomain2006-11-061-1/+4
| | | | | | fields to already be allocated. This has led to a general cleanup of domain and vcpu initialisation and destruction. Signed-off-by: Keir Fraser <keir@xensource.com>
* [XEN] Fix domctl for changing VCPU affinity.kfraser@localhost.localdomain2006-09-211-2/+0
| | | | | | | | | Now works for any VCPU, including the caller's VCPU. By not synchronously pausing the affected VCPU we avoid any risk of deadlock. Signed-off-by: Keir Fraser <keir@xensource.com>
* Replace dom0_ops hypercall with three new hypercalls:kfraser@localhost.localdomain2006-08-251-3/+2
| | | | | | | | | | | | | | | | | | | | | | 1. platform_op -- used by dom0 kernel to perform actions on the hardware platform (e.g., MTRR access, microcode update, platform quirks, ...) 2. domctl -- used by management tools to control a specified domain 3. sysctl -- used by management tools for system-wide actions Benefits include more sensible factoring of actions to hypercalls. Also allows tool compatibility to be tracked separately from the dom0 kernel. The assumption is that it will be easier to replace libxenctrl, libxenguest and Xen as a matched set if the dom0 kernel does not need to be replaced too (e.g., because that would require vendor revalidation). From here on we hope to maintain dom0 kernel compatibility. This promise is not extended to tool compatibility beyond the existing guarantee that compatibility will not be broken within a three-level stable release [3.0.2, 3.0.3, etc.]. Signed-off-by: Keir Fraser <keir@xensource.com>
* [XEN] Make per-cpu schedule data explicitly PER_CPU.kaf24@firebug.cl.cam.ac.uk2006-08-081-4/+6
| | | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Domain creation/destruction cleanups.kaf24@firebug.cl.cam.ac.uk2006-06-011-4/+7
| | | | | | | | | 1. Move alloc/dealloc routines to domain.[ch] 2. Merge alloc_task/add_vcpu schedops -> init_vcpu 3. Merge free_task/remove_vcpu schedops -> destroy_domain Signed-off-by: Keir Fraser <keir@xensource.com>
* New weighted fair-share CPU scheduler w/ automatic SMP load balancingack@kneesa.uk.xensource.com2006-05-261-0/+2
| | | | | Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
* New VCPUOP_get_runstate_info hypercall. Returns information about the currentkaf24@firebug.cl.cam.ac.uk2006-02-251-6/+0
| | | | | | | | | run state of a VCPU (running, runnable, blocked, etc.) and the total time spent in each state since the VCPU was created. Signed-off-by: Keir Fraser <keir@xensource.com>
* Introduce a locking protocol for acquiring the 'schedulerkaf24@firebug.cl.cam.ac.uk2006-01-131-4/+33
| | | | | | | | | | lock' on a particular VCPU. Since this requires acquiring the approrpiate per-CPU lock, we must re-check the VCPU's current CPU binding after the lock is acquired. Signed-off-by: Keir Fraser <keir@xensource.com>
* Rename ac_timer_* interfaces -> timer_*. The ac_ iskaf24@firebug.cl.cam.ac.uk2006-01-121-1/+1
| | | | | | | | | | meaningless and unnecessary. Rename rem_timer -> stop_timer. Signed-off-by: Keir Fraser <keir@xensource.com>
* Reduce locked critical region in __enter_scheduler(),kaf24@firebug.cl.cam.ac.uk2006-01-071-1/+0
| | | | | | | | | | | | | | changing the context switch interface yet again. domain_runnable() renamed to vcpu_runnable(). Fix stupid bug resulting in bogus value for vcpu_dirty_cpumask, which caused vcpu_sync_execstate() to fail sometimes. Signed-off-by: Keir Fraser <keir@xensource.com>
* Change the context-switch interface. Get rid ofkaf24@firebug.cl.cam.ac.uk2006-01-061-2/+3
| | | | | | | | | | | | | | context_switch_finalise(). Instead provide a back-call context_switch_done() for situations where arch-specific context_switch() function does not return to the caller, or needs to do some parts of state restoration with interrupts enabled. Get rid of ugly hack in arch/ia64. Signed-off-by: Keir Fraser <keir@xensource.com>
* Clean up domain shutdown and modification of vcpukaf24@firebug.cl.cam.ac.uk2006-01-061-0/+1
| | | | | | | | processor affinity. Signed-off-by: Keir Fraser <keir@xensource.com>
* bitkeeper revision 1.1644.1.1 (429f749dKFzVUg9NXDMVu4apHJvpNQ)kaf24@firebug.cl.cam.ac.uk2005-06-021-8/+8
| | | | | | | The last annoying rename: struct exec_domain *ed -> struct vcpu *v Signed-off-by: Keir Fraser <keir@xensource.com>
* bitkeeper revision 1.1548 (4294554btfa2GpomqV57KFpxEHsjEA)kaf24@firebug.cl.cam.ac.uk2005-05-251-8/+0
| | | | | | | | | Move to Linux's cpumask_t and 'hotplug' multi-processor booting interfaces. This also brings apic.c and various other files closer to their Linux 2.6 equivalents. Simplified the scheduler interfaces a little (particularly per-cpu and idle-domain initialisation). Signed-off-by: Keir Fraser <keir@xensource.com>
* bitkeeper revision 1.1346.1.1 (42670505dNhgnJm5dQD81pCalXMZgw)iap10@freefall.cl.cam.ac.uk2005-04-211-0/+9
|\ | | | | | | | | manual merge
| * bitkeeper revision 1.1159.170.104 (4214e770zuNBDS-jq2cWXHSs1B4UOw)sd386@font.cl.cam.ac.uk2005-02-171-3/+8
| | | | | | | | | | Extended sedf scheduler (weighted extraqueues), added enhanced scheduling histogramm
* | bitkeeper revision 1.1236.1.209 (42517173PR-QieAWB-SNd4qnSxKmMQ)kaf24@firebug.cl.cam.ac.uk2005-04-041-3/+1
| | | | | | | | | | | | | | Remove broken atropos and round-robin schedulers. Clean up the scheduler plugin interface a little. Signed-off-by: Keir Fraser <keir@xensource.com>
* | bitkeeper revision 1.1236.43.1 (4242f75e6Zk-5XZxY7UL-J_Qi8D43g)kaf24@firebug.cl.cam.ac.uk2005-03-241-23/+17
| | | | | | | | | | | | Fix VIRQ_TIMER holdoff for SMP guests. Signed-off-by: Keir Fraser <keir@xensource.com>
* | bitkeeper revision 1.1159.1.451 (41a51866R21ReiS-WH2NSkl2MaBhaA)cl349@arcadians.cl.cam.ac.uk2004-11-241-1/+1
| | | | | | | | | | | | Add per exec_domain event_channel initialization. Make sched_rem_domain/rem_task act on exec_domain.
* | bitkeeper revision 1.1159.1.393 (4190a145cbZFKzGdkH5xPlOlxNNPnw)cl349@freefall.cl.cam.ac.uk2004-11-091-9/+9
|/ | | | | Split struct exec_domain out of struct domain.
* bitkeeper revision 1.1108.36.1 (4108f279nPgkLZARXvnqXNBEsFkj4Q)gm281@boulderdash.cl.cam.ac.uk2004-07-291-24/+0
| | | | | The runqueue management functions removed from sched-if.h and put into schedulers