aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/spinlock.c
Commit message (Collapse)AuthorAgeFilesLines
* use SMP barrier in common code dealing with shared memory protocolsIan Campbell2013-07-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Xen currently makes no strong distinction between the SMP barriers (smp_mb etc) and the regular barrier (mb etc). In Linux, where we inherited these names from having imported Linux code which uses them, the SMP barriers are intended to be sufficient for implementing shared-memory protocols between processors in an SMP system while the standard barriers are useful for MMIO etc. On x86 with the stronger ordering model there is not much practical difference here but ARM has weaker barriers available which are suitable for use as SMP barriers. Therefore ensure that common code uses the SMP barriers when that is all which is required. On both ARM and x86 both types of barrier are currently identical so there is no actual change. A future patch will change smp_mb to a weaker barrier on ARM. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* Include some header files that are not automatically included on all archsStefano Stabellini2012-01-231-0/+1
| | | | | | | Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* avoid hypervisor panic when printing lock profiling informationJuergen Gross2011-11-071-2/+2
| | | | | | | | When printing lock profiling information via keyhandler in the hypervisor the system will panic. This patch corrects the problem. Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Committed-by: Keir Fraser <keir@xen.org>
* Make lock profiling usable againJuergen Gross2011-11-071-13/+21
| | | | | | | | | | | | Using lock profiling (option lock_profile in xen/Rules.mk) resulted in build errors. Changes: - Include public/sysctl.h in spinlock.h when using lock profiling. - Allocate profile data in an own structure to avoid struct domain becoming larger then one page Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Acked-by: Keir Fraser <keir@xen.org>
* spinlock: Define check_barrier() for non-debug build, fixes build.Keir Fraser2011-03-291-0/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* Remove spin_barrier_irq(). It is pointless.Keir Fraser2011-03-261-10/+39
| | | | | | | | Add a barrier-appropriate consistency check to spinlock.c, and add code comments to explain why barrier operations are more relaxed than lock-acquisition operations. Signed-off-by: Keir Fraser <keir@xen.org>
* rwlock: Allow to scale to 2^31-1 readers on x86.Keir Fraser2011-03-261-6/+47
| | | | | | | | | Also rework to match the 'trylock' style of raw function used for spinlocks. Inspired by Jan Beulich's patch to do similar improved scaling. Signed-off-by: Keir Fraser <keir@xen.org>
* Define Linux-style <preempt.h> interface.Keir Fraser2010-11-181-33/+21
| | | | | | Use it to disable sleeping in spinlock and rcu-read regions. Signed-off-by: Keir Fraser <keir@xen.org>
* Add locking-depth debugging, introduce in_atomic() boolean.Keir Fraser2010-11-161-6/+40
| | | | | | | This will be useful for debugging use of sleep-in-hypervisor primitives. Signed-off-by: Keir Fraser <keir@xen.org>
* Move cpu hotplug routines into common cpu.c file.Keir Fraser2010-05-141-2/+11
| | | | | | | | | Also simplify the locking (reverting to use if spin_trylock, as returning EBUSY/EAGAIN seems unavoidable after all). In particular this should continue to ensure that stop_machine_run() does not have cpu_online_map change under its feet. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* lockprof: Fix x86_32 build and clean up coding styleKeir Fraser2009-10-151-52/+41
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Spinlock profiling (enable in build with lock_profile=y)Keir Fraser2009-10-141-0/+258
| | | | | | | Adds new tool xenlockprof to run from dom0. From: Juergen Gross <juergen.gross@ts.fujitsu.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Transcendent memory ("tmem") for Xen.Keir Fraser2009-05-261-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tmem, when called from a tmem-capable (paravirtualized) guest, makes use of otherwise unutilized ("fallow") memory to create and manage pools of pages that can be accessed from the guest either as "ephemeral" pages or as "persistent" pages. In either case, the pages are not directly addressible by the guest, only copied to and fro via the tmem interface. Ephemeral pages are a nice place for a guest to put recently evicted clean pages that it might need again; these pages can be reclaimed synchronously by Xen for other guests or other uses. Persistent pages are a nice place for a guest to put "swap" pages to avoid sending them to disk. These pages retain data as long as the guest lives, but count against the guest memory allocation. Tmem pages may optionally be compressed and, in certain cases, can be shared between guests. Tmem also handles concurrency nicely and provides limited QoS settings to combat malicious DoS attempts. Save/restore and live migration support is not yet provided. Tmem is primarily targeted for an x86 64-bit hypervisor. On a 32-bit x86 hypervisor, it has limited functionality and testing due to limitations of the xen heap. Nearly all of tmem is architecture-independent; three routines remain to be ported to ia64 and it should work on that architecture too. It is also structured to be portable to non-Xen environments. Tmem defaults off (for now) and must be enabled with a "tmem" xen boot option (and does nothing unless a tmem-capable guest is running). The "tmem_compress" boot option enables compression which takes about 10x more CPU but approximately doubles the number of pages that can be stored. Tmem can be controlled via several "xm" commands and many interesting tmem statistics can be obtained. A README and internal specification will follow, but lots of useful prose about tmem, as well as Linux patches, can be found at http://oss.oracle.com/projects/tmem . Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
* Simplify spinlock code and re-enable IRQs where possible when spinning.Keir Fraser2009-03-311-3/+18
| | | | | | Based on a patch by Juergen Gross. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Clean up use of spin_is_locked() and introduce rw_is_locked().Keir Fraser2008-12-131-0/+6
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* spinlock: Add debug-build checks for IRQ-safe spinlocks.Keir Fraser2008-10-231-0/+52
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* spinlock: Add assertions for lock_irq() variants.Keir Fraser2008-10-221-0/+3
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Define spin_barrier_irq() for IRQ-safe spinlocks, and use it for virq_lock.Keir Fraser2008-10-221-0/+8
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* spinlock: Modify recursive spinlock definitions to support up to 4095 CPUs.Keir Fraser2008-10-201-1/+8
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Clean up spinlock operations and compile as first-class functions.Keir Fraser2008-10-201-0/+147
This follows modern Linux, since apparently outlining spinlock operations does not slow down execution. The cleanups will also allow more convenient addition of diagnostic code. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>