aboutsummaryrefslogtreecommitdiffstats
path: root/xen
Commit message (Collapse)AuthorAgeFilesLines
* Get rid of non-static 'inline' modifiers (gcc 4.2.1 complains)Tim Deegan2012-01-261-2/+2
| | | | | | | They seem to have been introduced by accident in 23311:f4585056b9ae when some 'static inline' functions were moved out of a header Signed-off-by: Tim Deegan <tim@xen.org>
* Bring OpenBSD stdarg handling in line with FreeBSD caseTim Deegan2012-01-261-3/+1
| | | | | | | Having an absolute path in a #include confuses distcc's pump mode so get rid ofit by using the same runes for both BSDs. Signed-off-by: Tim Deegan <tim@xen.org>
* x86/mm: Avoid spurious deadlock panic triggerAndres Lagar-Cavilla2012-01-261-1/+2
| | | | | | | | | | In the mm layer, if we take lock A, then lock B, and the recursively lock A, the deadlock detector panics. This is not a deadlock risk because we already 'own' the outer lock (A), so we will not contend for that resource. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: clean use of p2m unlocked queriesAndres Lagar-Cavilla2012-01-265-12/+44
| | | | | | | | | | Limit such queries only to p2m_query types. This is more compatible with the name and intended semantics: perform only a lookup, and explicitly in an unlocked way. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Properly account for paged out pagesAndres Lagar-Cavilla2012-01-261-1/+2
| | | | | | | | | If we hit the page after nominate but before paging it out, don't decrement the domain count of paged out pages. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Remove stale variable from debugtrace printk in p2m auditAndres Lagar-Cavilla2012-01-261-2/+2
| | | | | | Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Output domain count of paged pages in consoleAndres Lagar-Cavilla2012-01-261-2/+4
| | | | | | | Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Olaf Hering <olaf@aepfle.de> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Allow foreign read-only mappings of shared pagesAndres Lagar-Cavilla2012-01-261-1/+7
| | | | | | | | | Because shared pages are owned by dom_cow, the ownership test while foreign mapping fails. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Fix p2m teardown lockingAndres Lagar-Cavilla2012-01-261-2/+2
| | | | | | | | | Holding the p2m lock during a p2m teardown, while unsharing entries pointing to shared frames, causes a locking inversion and deadlock panic. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Fix paging_loadAndres Lagar-Cavilla2012-01-261-10/+8
| | | | | | | | | | | | | | | | When restoring a p2m entry in the paging_load path, we were not updating the m2p entry correctly. Also take advantage of this to act on an old suggestion: once done with the load, promote the p2m entry to the final guest accessible type. This simplifies logic. Tested to work with xenpaging. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Olaf Hering <olaf@aepfle.de> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Sharing overhaul style improvementsAndres Lagar-Cavilla2012-01-262-33/+33
| | | | | | | | | | | | | | The name 'shared_info' for the list of shared pages backed by a share frame collided with the identifier also used for a domain's shared info page. To avoid grep/cscope/etc aliasing, rename the shared memory token to 'sharing. This patch only addresses style, and performs no functional changes. To ease reviwing, the patch was left as a stand-alone last-slot addition to the queue to avoid propagating changes throughout the whole series. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: use RCU in mem sharing audit list, eliminate global lock completelyAndres Lagar-Cavilla2012-01-263-68/+44
| | | | | | Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* Add the ability to poll stats about shared memory via the consoleAndres Lagar-Cavilla2012-01-264-2/+27
| | | | | | | Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Signed-off-by: Adin Scannell <adin@scannell.ca> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: New domctl: add a shared page to the physmapAndres Lagar-Cavilla2012-01-262-1/+105
| | | | | | | | | | This domctl is useful to, for example, populate parts of a domain's physmap with shared frames, directly. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Signed-off-by: Adin Scannell <adin@scannell.ca> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Check how many mfns are shared, in addition to how many are savedAndres Lagar-Cavilla2012-01-266-6/+40
| | | | | | | | | | | | | This patch also moves the existing sharing-related memory op to the correct location, and adds logic to the audit() method that uses the new information. This patch only provides the Xen implementation of the domctls. Signed-off-by: Andres Lagar-Cavilla <andres@scannell.ca> Signed-off-by: Adin Scannell <adin@scannell.ca> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Enforce lock ordering for sharing page locksAndres Lagar-Cavilla2012-01-263-2/+35
| | | | | | | | | | | Use the ordering constructs in mm-locks.h to enforce an order for the p2m and page locks in the sharing code. Applies to either the global sharing lock (in audit mode) or the per page locks. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Signed-off-by: Adin Scanneell <adin@scannell.ca> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Add per-page locking for memory sharing, when audits are disabledAndres Lagar-Cavilla2012-01-264-98/+275
| | | | | | | | | | | | | | | | | With the removal of the hash table, all that is needed now is locking of individual shared pages, as new (gfn,domain) pairs are removed or added from the list of mappings. We recycle PGT_locked and use it to lock individual pages. We ensure deadlock is averted by locking pages in increasing order. The global lock remains for the benefit of the auditing code, and is thus enabled only as a compile-time option. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Signed-off-by: Adin Scannell <adin@scannell.ca> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Update mem sharing interface to (re)allow sharing of grantsAndres Lagar-Cavilla2012-01-262-9/+61
| | | | | | | | | | | | | | | | | Previously, the mem sharing code would return an opaque handle to index shared pages (and nominees) in its global hash table. By removing the hash table, the new interfaces requires a gfn and a version. However, when sharing grants, the caller provides a grant ref and a version. Update interface to handle this case. The use case for grant sharing is when sharing from within a backend (e.g. memshr + blktap2), in which case the backend is only exposed to grant references. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Signed-off-by: Adin Scannell <adin@scannell.ca> Committed-by: Tim Deegan <tim@xen.org> Acked-by: Tim Deegan <tim@xen.org>
* x86/mm: Eliminate hash table in sharing code as index of shared mfnsAndres Lagar-Cavilla2012-01-264-275/+291
| | | | | | | | | | | | Eliminate the sharing hastable mechanism by storing a list head directly in the page info for the case when the page is shared. This does not add any extra space to the page_info and serves to remove significant complexity from sharing. Signed-off-by: Adin Scannell <adin@scannell.ca> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* xenoprof: Make the escape code consistent across 32 and 64-bit xenGeorge Dunlap2012-01-261-1/+1
| | | | | | | | | | | | | | | At the moment, the xenoprof escape code is defined as "~0UL". Unfortunately, this expands to 0xffffffff on 32-bit systems and 0xffffffffffffffff on 64-bit systems; with the result that while 32-on-32 and 64-in-64 work fine, 32-on-64 (also known as "compat mode") is broken. This patch makes the definition consistent across architectures. In so doing, it will break old-32-bit-on-new-Xen, and vice versa; but this was seen as an acceptable thing to do. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* xenoprof: Use uint64_t explicitly for internal callsGeorge Dunlap2012-01-263-7/+5
| | | | | | | | | | | | | A recent changeset to make XENOPROF_ESCAPE_CODE consistent across 32- and 64-bit builds caused a build failure, because values were passed through functions as "unsigned long". Replace these with uint64_t explicitly. Also remove redundant function prototype from perfmon.c, now that it's in a header file. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* SVM: Plumb NPT error-code bits into nested-fault access_X arguments.Tim Deegan2012-01-244-9/+8
| | | | Signed-off-by: Tim Deegan <tim@xen.org>
* reflect cpupool in numa node affinityJuergen Gross2012-01-243-8/+27
| | | | | | | | | In order to prefer node local memory for a domain the numa node locality info must be built according to the cpus belonging to the cpupool of the domain. Signed-off-by: juergen.gross@ts.fujitsu.com Committed-by: Keir Fraser <keir@xen.org>
* switch to dynamically allocated cpumask in domain_update_node_affinity()Juergen Gross2012-01-241-4/+9
| | | | | | | cpumasks should rather be allocated dynamically. Signed-off-by: juergen.gross@ts.fujitsu.com Committed-by: Keir Fraser <keir@xen.org>
* introduce and use common macros for selecting cpupool based cpumasksJuergen Gross2012-01-246-16/+13
| | | | | | | | 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>
* Add a GNTTABOP to swap the content of two grant references under lockWei Liu2012-01-245-2/+115
| | | | | | | | provided that they are not currently active. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* Revert 24538:5bb22a6871f6 "xenoprof: Make the escape code consistent across ↵Keir Fraser2012-01-231-1/+1
| | | | | | | | 32 and 64-bit xen" Breaks 32-bit build. Signed-off-by: Keir Fraser <keir@xen.org>
* decompressors: fix string typo 'bufer'Paul Bolle2012-01-232-3/+3
| | | | | | Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Jan Beulich <jbeulich@suse.com> Committed-by: Jan Beulich <jbeulich@suse.com>
* unlzo: fix input buffer freeSascha Hauer2012-01-231-1/+1
| | | | | | | | | unlzo modifies the pointer to in_buf, so we have to free the original buffer, not the modified pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jan Beulich <jbeulich@suse.com> Committed-by: Jan Beulich <jbeulich@suse.com>
* libelf-loader: introduce elf_load_imageStefano Stabellini2012-01-233-5/+34
| | | | | | | | | | | | | | Implement a new function, called elf_load_image, to perform the actually copy of the elf image and clearing the padding. The function is implemented as memcpy and memset when the library is built as part of the tools, but it is implemented as raw_copy_to_guest and raw_clear_guest when built as part of Xen, so that it can be safely called with an HVM style dom0. 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>
* Introduce clear_user and clear_guestStefano Stabellini2012-01-2312-0/+527
| | | | | | | | | | | | Introduce clear_user for x86 and ia64, shamelessly taken from Linux. The x86 version is the 32 bit clear_user implementation. Introduce clear_guest for x86 and ia64. The x86 implementation is based on clear_user and a new clear_user_hvm function. The ia64 implementation is actually in xencomm and it is based on xencomm_copy_to_guest. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Jan Beulich <JBeulich@suse.com> Committed-by: Keir Fraser <keir@xen.org>
* xen: implement an signed 64 bit division helper functionStefano Stabellini2012-01-231-0/+19
| | | | | | | | | Implement a C function to perform 64 bit signed division and return both quotient and remainder. Useful as an helper function to implement __aeabi_ldivmod. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* A collection of fixes to Xen common filesStefano Stabellini2012-01-237-10/+16
| | | | | | | | | | | | | | | | - call free_xenoprof_pages only ifdef CONFIG_XENOPROF; - define PRI_stime as PRId64 in an header file; - respect boundaries in is_kernel_*; - implement is_kernel_rodata; - guest_physmap_add_page should be ((void)0). - fix guest_physmap_add_page; - introduce CONFIG_XENOPROF; - define _srodata and _erodata as const char*. 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>
* Include some header files that are not automatically included on all archsStefano Stabellini2012-01-2313-2/+17
| | | | | | | 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>
* Move cpufreq option parsing to cpufreq.cStefano Stabellini2012-01-233-33/+35
| | | | | | | | 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> Acked-by: Jan Beulich <jbeulich@suse.com> Committed-by: Keir Fraser <keir@xen.org>
* xenoprof: Make the escape code consistent across 32 and 64-bit xenGeorge Dunlap2012-01-231-1/+1
| | | | | | | | | | | | | | | | At the moment, the xenoprof escape code is defined as "~0UL". Unfortunately, this expands to 0xffffffff on 32-bit systems and 0xffffffffffffffff on 64-bit systems; with the result that while 32-on-32 and 64-in-64 work fine, 32-on-64 (also known as "compat mode") is broken. This patch makes the definition consistent across architectures. In so doing, it will break old-32-bit-on-new-Xen, and vice versa; but this was seen as an acceptable thing to do. Signed-off-by: Marcus Granado <marcus.granado@eu.citrix.com> Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* xenoprof: Handle 32-bit guest stacks properly in a 64-bit hypervisorGeorge Dunlap2012-01-231-7/+41
| | | | | | | | | | | | | The dump_guest_backtrace() function attempted to walk the stack based on the assumption that the guest and hypervisor pointer sizes were the same; thus any 32-bit guest running under 64-bit hypervisor would have unreliable results. In 64-bit mode, read the 32-bit stack frame properly. Signed-off-by: Marcus Granado <marcus.granado@eu.citrix.com> Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* xenoprof: Adjust indentationGeorge Dunlap2012-01-231-44/+44
| | | | | | | | | Bring indentation into Xen hypervisor standard coding style. No functional changes. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* x86/vMSI: miscellaneous fixesJan Beulich2012-01-234-34/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | This addresses a number of problems in msixtbl_{read,write}(): - address alignment was not checked, allowing for memory corruption in the hypervisor (write case) or returning of hypervisor private data to the guest (read case) - the interrupt mask bit was permitted to be written by the guest (while Xen's interrupt flow control routines need to control it) - MAX_MSIX_TABLE_{ENTRIES,PAGES} were pointlessly defined to plain numbers (making it unobvious why they have these values, and making the latter non-portable) - MAX_MSIX_TABLE_PAGES was also off by one (failing to account for a non-zero table offset); this was also affecting host MSI-X code - struct msixtbl_entry's table_flags[] was one element larger than necessary due to improper open-coding of BITS_TO_LONGS() - msixtbl_read() unconditionally accessed the physical table, even though the data was only needed in a quarter of all cases - various calculations were done unnecessarily for both of the rather distinct code paths in msixtbl_read() Additionally it is unclear on what basis MAX_MSIX_ACC_ENTRIES was chosen to be 3. Signed-off-by: Jan Beulich <jbeulich@suse.com> Committed-by: Keir Fraser <keir@xen.org>
* x86/hvm: No need to arch_set_info_guest() before restoring per-vcpu HVM state.Keir Fraser2012-01-225-49/+25
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* x86/hvm: Fix earlier hvm_load_cpu_ctxt() breakage.Keir Fraser2012-01-201-1/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* vpmu: separate architecture specific PMU initialisationDietmar Hahn2012-01-204-39/+60
| | | | | | | | | This patch moves the architecture specific initialisation of the PMU into the archicture specific directory. Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com> Signed-off-by: Keir Fraser <keir@xen.org> Committed-by: Keir Fraser <keir@xen.org>
* x86/hvm: Remove unnecessary packed attribute from hvm_hw_cpu_xsave struct.Keir Fraser2012-01-201-1/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* iommu: Move IOMMU faults handling into softirq for AMD-Vi.Dario Faggioli2012-01-201-3/+41
| | | | | | | | | | | | Dealing with interrupts from AMD-Vi IOMMU(s) is deferred to a softirq-tasklet, raised by the actual IRQ handler. To avoid more interrupts being generated (because of further faults), they must be masked in the IOMMU within the low level IRQ handler and enabled back in the tasklet body. Notice that this may cause the log to overflow, but none of the existing entry will be overwritten. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* x86/hvm: Allow wake up of offline vcpu via nmi-ipiJuergen Gross2012-01-201-0/+9
| | | | | | | | | | On a real machine a cpu disabled via hlt with interrupts disabled can be reactivated via a nmi ipi. Enable the hypervisor to do this for hvm, too. Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Signed-off-by: Keir Fraser <keir@xen.org> Committed-by: Keir Fraser <keir@xen.org>
* xen: Simplify callers of boot_vcpu(). In VCPUOP_up, checkKeir Fraser2012-01-203-22/+17
| | | | | | is_initialised under the per-domain lock. Signed-off-by: Keir Fraser <keir@xen.org>
* x86/mm: refine epte_present testTim Deegan2012-01-191-1/+5
| | | | | | | | | | | | | | | | | | The current test for a present ept entry checks for a permission bit to be set. While this is valid in contexts in which we want to know whether an entry will fault, it is not correct when it comes to testing whether an entry is valid. Specifically, in the ept_change_entry_type_page function which is used to set entries to the log dirty type. In combination with a p2m access type like n or n2rwx, log dirty will not be set for ept entries for which it should. Reported-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Signed-off-by: Tim Deegan <tim@xen.org> Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Committed-by: Tim Deegan <tim@xen.org>
* Correct p2m unlocking during grant table mapAndres Lagar-Cavilla2012-01-191-2/+6
| | | | | | | | We were not putting gfn's consistently. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Don't ASSERT() for a valid mfn on paged p2m entries in guest_physmap_adAndres Lagar-Cavilla2012-01-191-2/+2
| | | | | | | Signed-off-by: Adin Scannell <adin@scannell.ca> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
* x86/mm: Improve ring management for memory events. Do not lose guest eventsAndres Lagar-Cavilla2012-01-197-121/+340
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is an amalgamation of the work done by Olaf Hering <olaf@aepfle.de> and our work. It combines logic changes to simplify the memory event API, as well as leveraging wait queues to deal with extreme conditions in which too many events are generated by a guest vcpu. In order to generate a new event, a slot in the ring is claimed. If a guest vcpu is generating the event and there is no space, it is put on a wait queue. If a foreign vcpu is generating the event and there is no space, the vcpu is expected to retry its operation. If an error happens later, the function returns the claimed slot via a cancel operation. Thus, the API has only four calls: claim slot, cancel claimed slot, put request in the ring, consume the response. With all these mechanisms, no guest events are lost. Our testing includes 1. ballooning down 512 MiBs; 2. using mem access n2rwx, in which every page access in a four-vCPU guest results in an event, with no vCPU pausing, and the four vCPUs touching all RAM. No guest events were lost in either case, and qemu-dm had no mapping problems. Signed-off-by: Adin Scannell <adin@scannell.ca> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>