aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/lib.h
Commit message (Collapse)AuthorAgeFilesLines
* xen: Add macro ROUNDUPJulien Grall2013-10-081-0/+2
| | | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Keir Fraser <keir@xen.org> CC: Jan Beulich <jbeulich@suse.com>
* console: buffer and show origin of guest PV writesDaniel De Graaf2013-09-101-0/+2
| | | | | | | | | | | | | Guests other than domain 0 using the console output have previously been controlled by the VERBOSE #define, but with no designation of which guest's output was on the console. This patch converts the HVM output buffering to be used by all domains except the hardware domain (dom0): stripping non-printable characters, line buffering the output, and prefixing it with the domain ID. This is especially useful for debugging stub domains during early boot. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Keir Fraser <keir@xen.org>
* gcov: Call constructors during initializationFrediano Ziglio2013-02-211-0/+2
| | | | | | This allow modules to set initializer functions. This is used by Gcc instrumentation code for profiling arcs and test coverage.
* xen: Define debug_build() based on NDEBUG. Use it in a few printk's.Keir Fraser2013-01-301-0/+2
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* IOMMU: add phantom function supportJan Beulich2013-01-071-0/+3
| | | | | | | | | | | | | Apart from generating device context entries for the base function, all phantom functions also need context entries to be generated for them. In order to distinguish different use cases, a variant of pci_get_pdev() is being introduced that, even when passed a phantom function number, would return the underlying actual device. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: "Zhang, Xiantao" <xiantao.zhang@intel.com>
* use C11's _Static_assert() for BUILD_BUG_ON etc when availableJan Beulich2012-07-271-2/+8
| | | | | | | | | | | | This produces a more meaningful compiler diagnostic in case it happens to trigger. As a minor piece of cleanup, at once also use BUILD_BUG_ON_ZERO() to actually define BUILD_BUG_ON() in the legacy case, slightly reducing redundancy. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* Allow cmdline_parse() to be used with const stringsDavid Vrabel2012-03-221-1/+1
| | | | | | Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xen: Remove unused vsscanf/sscanf functionsDaniel De Graaf2012-02-061-4/+0
| | | | | Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Keir Fraser <keir@xen.org>
* force inclusion of xen/config.h through compiler optionJan Beulich2012-01-131-1/+0
| | | | | | | | | | | | | As we expect all source files to include the header as the first thing anyway, stop doing this by repeating the inclusion in each and every source file (and in many headers), but rather enforce this uniformly through the compiler command line. As a first cleanup step, remove the explicit inclusion from all common headers. Further cleanup can be done incrementally. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* Adjust non-debug ASSERT() definition to avoid unused-variable warnings.Keir Fraser2011-08-221-1/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* Update radix-tree.[ch] from upstream Linux to gain RCU awareness.Keir Fraser2011-05-091-1/+2
| | | | | | | | | | | | | | | | | | | We still leave behind features we don't need such as tagged nodes. Other changes: - Allow callers to define their own node alloc routines. - Only allocate per-node rcu_head when using the default RCU-safe alloc routines. - Keep our own radix_tree_destroy(). In future it may also be worth getting rid of the complex and pointless special-casing of radix-tree height==0, in which a single data item can be stored directly in radix_tree_root. It introduces a whole lot of special cases and complicates RCU handling. If we get rid of it we can reclaim the 'indirect pointer' tag in bit 0 of every slot entry. Signed-off-by: Keir Fraser <keir@xen.org>
* xen: stringify assertion condition for printing sooner.Keir Fraser2011-01-181-2/+2
| | | | | | | | | | | | | So that: (XEN) Assertion '!(((*({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"(&per_cpu____preempt_count)); (typeof(&per_cpu____preempt_count)) (__ptr + (get_cpu_info()->per_cpu_offset)); }))) || ((irq_stat[(((get_cpu_info()->processor_id)1... becomes: (XEN) Assertion '"!in_atomic()"' failed at softirq.c:61 Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* consolidate custom parameter parsing routines looking for boolean valuesKeir Fraser2010-11-191-0/+1
| | | | | | | Have a single function for this, rather than doing the same in half a dozen places. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Define Linux-style <preempt.h> interface.Keir Fraser2010-11-181-2/+0
| | | | | | 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-0/+2
| | | | | | | This will be useful for debugging use of sleep-in-hypervisor primitives. Signed-off-by: Keir Fraser <keir@xen.org>
* Define ABS() library function. Use it.Keir Fraser2010-05-111-0/+5
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Reduce 'd' debug key's global impactKeir Fraser2010-05-061-0/+3
| | | | | | | | | | | | | | | | | | | | On large systems, dumping state may cause time management to get stalled for so long a period that it wouldn't recover. Therefore alter the state dumping logic to alternatively block each CPU as it prints rather than one CPU for a very long time (using the alternative key handling toggle introduced with an earlier patch). Further, instead of using on_selected_cpus(), which is unsafe when the dumping happens from a hardware interrupt, introduce and use a dedicated IPI sending function (which each architecture can implement to its liking) Finally, don't print useless data (e.g. the hypervisor context of the interrupt that is used for triggering the printing, but isn't part of the context that's actually interesting). Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Move muldiv64 out and make it as a public function.Keir Fraser2009-06-241-0/+2
| | | | | | | | muldiv64 is used to caculate u64*u32/u32, and we will use it for TSC scaling. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Transcendent memory ("tmem") for Xen.Keir Fraser2009-05-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Introduce __must_be_arrayKeir Fraser2009-05-201-0/+6
| | | | | | | Cloning the similar construct from Linux, allowing to detect improper uses of ARRAY_SIZE() at build time. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Use unlikely() in BUG_ON()/WARN_ON()Keir Fraser2009-03-311-2/+2
| | | | | | | | | | | | | -fno-reorder-blocks was added in c/s 1712, when x86-64 just started to become enabled. The reason it got added is entirely unclear to me, and it prevents the intended effect of unlikely() constructs (in particular the ones added here) of moving out of line code which is expected to never get executed, as well as using forward branches (which are statically predicted taken by various processors' branch prediction units) preferably to reach infrequently executed code. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* x86 mcheck: Provide MCA "injection" hypervisor services.Keir Fraser2009-03-171-0/+1
| | | | Signed-off-by: Gavin Maltby <gavin.maltby@sun.com>
* Fix BUILD_BUG_ON()Keir Fraser2008-12-111-1/+1
| | | | | | | | | | As was noticed on the Linux side, using an array here isn't appropriate if the condition is not a compile time constant - gcc allows such arrays, and hence the intended effect of producing a compiler error is not achieved in that case. Bit field widths do not know similar language extensions, and hence always produce a compiler error. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Xen Security Modules: FLASKkfraser@localhost.localdomain2007-08-311-0/+4
| | | | Signed-off-by: George Coker <gscoker@alpha.ncsc.mil>
* Add WARN() and generic WARN_ON().kfraser@localhost.localdomain2007-03-271-1/+3
| | | | | | Based on a patch by Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* x86: Better BUG() and ASSERT() logging.kfraser@localhost.localdomain2007-02-211-10/+12
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* xen/x86: Better BUG back traces.kfraser@localhost.localdomain2007-02-201-2/+3
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Remove sprintf() from Xen. Use snprintf() and friends.Keir Fraser2007-01-301-2/+1
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Remove unused implementation of vsprintf().kfraser@localhost.localdomain2007-01-291-2/+1
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Improve consistency of type-attribute usage (volatile/const).kfraser@localhost.localdomain2006-12-211-5/+5
| | | | | From: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* [XEN] Add 'loglvl' and 'guest_loglvl' boot parameters.kaf24@localhost.localdomain2006-11-021-4/+0
| | | | | | | | | | | | | | | | | <lvl> := none|error|warning|info|debug|all loglvl=<lvl_print_always>[/<lvl_print_ratelimit>] <lvl_print_always>: log level which is always printed <lvl_print_rlimit>: log level which is rate-limit printed 'loglvl' applies to non-guest-related messages. 'guest_loglvl' applies to guest-related messages. Defaults: loglvl=warning ; guest_loglvl=none/warning Also clean up hvm_print_line(). Signed-off-by: Keir Fraser <keir@xensource.com>
* [XEN] Extend dom0_mem syntax to support min/max clamps.kfraser@localhost.localdomain2006-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | dom0_mem=[min:<min_amt>,][max:<max_amt>,][<amt>] <min_amt>: The minimum amount of memory which should be allocated for dom0. <max_amt>: The maximum amount of memory which should be allocated for dom0. <amt>: The precise amount of memory to allocate for dom0. Notes: 1. <amt> is clamped from below by <min_amt> and from above by available memory and <max_amt> 2. <min_amt> is clamped from above by available memory and <max_amt> 3. <min_amt> is ignored if it is greater than <max_amt> 4. If <amt> is not specified, it is calculated as follows: "All of memory is allocated to domain 0, minus 1/16th which is reserved for uses such as DMA buffers (the reservation is clamped to 128MB)." Each value can be specified as positive or negative: If +ve: The specified amount is an absolute value. If -ve: The specified amount is subtracted from total available memory. Signed-off-by: Keir Fraser <keir@xensource.com>
* [XEN] Implement log levels. It adds the thresholds and code to printkkaf24@localhost.localdomain2006-10-271-0/+4
| | | | | to implement the thresholds. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
* [XEN] Implement rate-limited logging.kaf24@localhost.localdomain2006-10-271-0/+2
| | | | | | | | Taken from Andi Kleen's rate limit in the Linux kernel. This keeps large amounts of prints in the HV down. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
* [XEN] Remove definition of printf. All users are switched to printk.kfraser@localhost.localdomain2006-10-231-2/+1
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* [OpenBSD] Various changes to get Xen building on OpenBSD.kfraser@localhost.localdomain2006-10-181-1/+1
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* [XEN] Remove shadow2 dependencies from common code.kfraser@localhost.localdomain2006-08-181-2/+2
| | | | | | | Disable debugtrace functionality even in debug builds: it's currently only used by shadow2 maintainers. Signed-off-by: Keir Fraser <keir@xensource.com>
* Replace shadow pagetable code with shadow2.tdeegan@york.uk.xensource.com2006-08-161-2/+2
|
* [XEN] BUG() places console in sync mode.kfraser@dhcp93.uk.xensource.com2006-06-281-7/+11
| | | | | | | Also move the BUG code out of line. Original patch from Jimi Xenidis. Signed-off-by: Keir Fraser <keir@xensource.com>
* [XEN] Add a warning banner when 'sync_console' is used. Make itkaf24@firebug.cl.cam.ac.uk2006-06-201-0/+1
| | | | | | very obvious and mildly annoying. Signed-off-by: Keir Fraser <keir@xensource.com>
* Add BUILD_BUG_ON() and a handful of users.kaf24@firebug.cl.cam.ac.uk2006-04-271-0/+3
| | | | | Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Add format printf attribute to panic() prototype and fix the error kaf24@firebug.cl.cam.ac.uk2006-03-261-1/+2
| | | | | | | | | this catches. Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* Upgrade arch/x86/cpu/* files to their equivalents inkaf24@firebug.cl.cam.ac.uk2006-02-141-0/+8
| | | | | | | | | | | linux-2.6.16-rc2/arch/i386/kernel/cpu/*. Also include kernel taint tracking and include that information, and Xen release info, in our crash dumps. Signed-off-by: Keir Fraser <keir@xensource.com>
* Add cpumask_scnprintf() and cpulist_scnprintf(). This alsokaf24@firebug.cl.cam.ac.uk2006-01-071-2/+8
| | | | | | | | | | adds the bitmap_scnprintf functions and scnprintf itself. Add dirty cpu and cpu affinity info to 'q'-key debug output. Signed-off-by: Keir Fraser <keir@xensource.com>
* bitkeeper revision 1.1649 (429f6bb65KQm70mnFwO33ykh9n1qag)cl349@firebug.cl.cam.ac.uk2005-06-021-1/+1
| | | | | | | | | | | | | sched.h: g/c unneeded include. Many files: Rename xen/slab.h to xen/xmalloc.h and fix resulting fallout. xmalloc.h: Rename: xen/include/xen/slab.h -> xen/include/xen/xmalloc.h sched.h, multicall.c, dom_mem_ops.c, asm-offsets.c: cleanup incorrect includes. Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
* bitkeeper revision 1.1619.1.2 (429ce59cTt9KxcOT0JuoCYbuDDPRFw)cl349@firebug.cl.cam.ac.uk2005-05-311-0/+1
| | | | | | | Many files: Don't include xen/slab.h and xen/domain.h at the _END_ of xen/sched.h. Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
* bitkeeper revision 1.1466.2.1 (428d01177uVxPlsgcWtGU3xUZaKeJw)kaf24@firebug.cl.cam.ac.uk2005-05-191-1/+1
| | | | | | | Rename memparse() to parse_size_and_unit(). A more general-purpose name, and avoids unecessary clash with Linux function name. Signed-off-by: Keir Fraser <keir@xensource.com>
* bitkeeper revision 1.1389.17.1 (42823056RNtq4AlseRHL98DJV2uJgA)kaf24@firebug.cl.cam.ac.uk2005-05-111-3/+10
| | | | | | | | | | | | | | | | | Change the Xen command-line parameter syntax. 'noacpi' and 'ignorebiostables' are gone. 'dom0_mem' can optionally take a k/m/g suffix to specify units (default units are still kilobytes). Also added: 1. 'mem=xxx' to specify maximum physical RAM address (supports k/m/g suffix) 2. acpi=xxx/acpi_skip_timer_override/noapic: These all have same semantics as in Linux. They are *automatically* propagated to the domain0 command line, as dom0 shares resposibility for platform initialisation. Signed-off-by: Keir Fraser <keir@xensource.com>
* bitkeeper revision 1.1389.5.40 (428084e6OcTkByL6plgj4UPN6alYkA)kaf24@firebug.cl.cam.ac.uk2005-05-101-0/+1
| | | | | | Fix the 64-bit build. Signed-off-by: Keir Fraser <keir@xensource.com>
* bitkeeper revision 1.1385.1.7 (427f6405sUeICnIzUJ_HaXbYnLds4A)mafetter@fleming.research2005-05-091-1/+1
| | | | | | | | | Enabling light-weight shadows (especially shadow_mode_dirty). Light-weight shadows leave all the page ref counts based on the guest p.t. pages, while heavy-weight shadows do all their ref counts based on the shadow's p.t. pages. shadow_mode_refcounts(dom) == 1 implies heavy-weight shadows.