aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/smp.c
Commit message (Collapse)AuthorAgeFilesLines
* xen/arm: implement smp_call_functionJulien Grall2013-05-081-83/+5
| | | | | | | | Move smp_call_function and on_selected_cpus to common code. Signed-off-by: Julien Grall <julien.grall@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: fix CMCI injectionJan Beulich2013-02-261-0/+5
| | | | | | | | | | | | | | | | This fixes the wrong use of literal vector 0xF7 with an "int" instruction (invalidated by 25113:14609be41f36) and the fact that doing the injection via a software interrupt was never valid anyway (because cmci_interrupt() acks the LAPIC, which does the wrong thing if the interrupt didn't get delivered though it). In order to do latter, the patch introduces send_IPI_self(), at once removing two opend coded uses of "genapic" in the IRQ handling code. Reported-by: Yongjie Ren <yongjie.ren@intel.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Tested-by: Yongjie Ren <yongjie.ren@intel.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: make cpu_2_logical_apicid private to x2apic codeJan Beulich2012-11-081-5/+0
| | | | | | | | ... as it in fact is only being used there. While moving it, also make it a per-CPU variable rather than a NR_CPUS-sized array. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: All vectored interrupts go through do_IRQ().Keir Fraser2012-03-301-12/+3
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* x86/hpet: replace disabling of legacy broadcastJan Beulich2012-03-271-1/+2
| | | | | | | | | | | | | ... by the call to hpet_disable() added in the immediately preceding patch. In order to retain the behavior intended by c/s 23776:0ddb4481f883, implement one of the alternative options pointed out there: remove CPUs from the online map in __stop_this_cpu() (and hence doing so in stop_this_cpu() is no longer needed). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86/hpet: disable before reboot or kexecJan Beulich2012-03-271-0/+2
| | | | | | | | | | | | | | Linux up to now is not smart enough to properly clear the HPET when it boots, which is particularly a problem when a kdump attempt from running under Xen is being made. Linux itself added code to work around this to its shutdown paths quite some time ago, so let's do something similar in Xen: Save the configuration register settings during boot, and restore them during shutdown. This should cover the majority of cases where the secondary kernel might not come up because timer interrupts don't work. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* eliminate first_cpu() etcJan Beulich2011-11-081-1/+1
| | | | | | | | This includes the conversion from for_each_cpu_mask() to for_each-cpu(). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
* eliminate cpu_clear()Jan Beulich2011-11-081-2/+2
| | | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
* eliminate cpu_test_xyz()Jan Beulich2011-11-081-1/+1
| | | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
* eliminate cpus_xyz()Jan Beulich2011-11-081-3/+3
| | | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
* eliminate direct assignments of CPU masksJan Beulich2011-10-211-11/+13
| | | | | | | | | | | | | | | | Use cpumask_copy() instead of direct variable assignments for copying CPU masks. While direct assignments are not a problem when both sides are variables actually defined as cpumask_t (except for possibly copying *much* more than would actually need to be copied), they must not happen when the original variable is of type cpumask_var_t (which may have lass space allocated to it than a full cpumask_t). Eliminate as many of such assignments as possible (in several cases it's even possible to collapse two operations [copy then clear one bit] into one [cpumask_andnot()]), and thus set the way for reducing the allocation size in alloc_cpumask_var(). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* eliminate cpumask accessors referencing NR_CPUSJan Beulich2011-10-211-3/+3
| | | | | | | ... in favor of using the new, nr_cpumask_bits-based ones. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: add irq count for IPIsKevin Tian2011-08-311-0/+3
| | | | | | | | such count is useful to assist decision make in cpuidle governor, while w/o this patch only device interrupts through do_IRQ is currently counted. Signed-off-by: Kevin Tian <kevin.tian@intel.com>
* x86: Clean up smp_call_function handling.Keir Fraser2011-05-011-9/+5
| | | | | | | We don't need so many communication fields between caller and handler. Signed-off-by: Keir Fraser <keir@xen.org>
* kexec: Clean up shutdown logic. Reinstate ACPI DMAR during kexec.Keir Fraser2010-07-291-1/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: send_IPI_mask() ignores offline CPUs in given cpumask.Keir Fraser2010-06-291-1/+2
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: Do not include apic.h/io_apic.h from asm/smp.hKeir Fraser2010-06-111-0/+10
| | | | | | ...and fix up the ensuing fall-out of implicit dependencies Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* smp_call_function/on_selected_cpus/on_each_cpu all return void.Keir Fraser2010-06-011-4/+3
| | | | | | None of them can fail, so a return code is pointless. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: Rename __sync_lazy_execstate() to __sync_local_execstate().Keir Fraser2010-04-191-1/+1
| | | | | | | This naming scheme is more rational. Also use non-x86-specific function sync_local_execstate() where possible. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* When flush tlb mask, we need consider the cpu_online_map.Keir Fraser2010-03-301-1/+2
| | | | | | | | | | | | | | | | | | | | The same is true for EPT flushes. We noticed sometime system hang on cpu online/offline stress test. The reason is because flush_tlb_mask from __get_page_type is deadloop. This should be caused by a small windows in cpu offline. The cpu_online_map is changed and the interrupt is disabled at take_cpu_down() for the to-be-offline CPU. However, the __sync_lazy_execstate() called from idle_task_exit() in the idle_loop() for the to-be-offline CPU. At that time, the stop_machine_run is finished already, and __get_page_type may be called in other CPU before the __sync_lazy_execstate(). Thanks Jan pointing out issue in my original patch. Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
* x86: Implement per-cpu vector for xen hypervisorKeir Fraser2009-08-191-1/+45
| | | | | | | | | | | | | | | Since Xen and Linux has big differece in code base, it is very hard to port Linux's patch and apply it to Xen directly, so this patch only adopts core logic of Linux, and make it work for Xen. Key changes: 1. vector allocation algorithm 2. all IRQ chips' set_affinity logic 3. IRQ migration when cpu hot remove. 4. Break assumptions which depend on global vector policy. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
* x86: Fix flush_area_mask() and on_selected_cpus() to not race updatesKeir Fraser2009-05-281-30/+28
| | | | | | of the supplied cpumask (which is now passed by reference). Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Remove unused 'retry' parameter from on_selected_cpus() etc.Keir Fraser2009-05-271-4/+2
| | | | | | | Remove the unused "retry" parameter of on_selected_cpus(), on_each_cpu(), smp_call_function(), and smp_call_function_single(). Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Pass cpumasks by reference always.Keir Fraser2009-05-271-41/+49
| | | | | | | | | | | | | Rather than passing cpumasks by value in all cases (which is problematic for large NR_CPUS configurations), pass them 'by reference' (i.e. through a pointer to a const cpumask). On x86 this changes send_IPI_mask() to always only send IPIs to remote CPUs (meaning any caller needing to handle the current CPU as well has to do so on its own). Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x2apic: Clean up send_IPI_mask_x2apic() and add a memory barrier.Keir Fraser2008-09-251-1/+0
| | | | | | | | | | | | | The barrier is required to prevent the WRMSR from executing before the processor has written synchronising data to be received by remote CPUs. At the same time remove needless wmb() from on_selected_cpus(). We now assume send_IPI_mask() is a sufficient compiler and CPU memory barrier. Original patch by Kevin Tian <kevin.tian@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: Support x2APIC mode.Keir Fraser2008-05-011-1/+4
| | | | Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
* x86: Reduce assertion aggressiveness in send_IPI_mask().Keir Fraser2008-04-231-22/+5
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: On CPU shutdown, clear pending FPU exceptions.Keir Fraser2008-03-041-4/+14
| | | | | | I've seen at least one BIOS which fails warm reboot if FPU exceptions are pending. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Remove unused smpboot.h header file.Keir Fraser2007-11-211-1/+0
| | | | Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
* x86: allow pv guests to disable TSC for applicationsKeir Fraser2007-10-291-0/+6
| | | | | | | | | | | | | | | | | Linux, under CONFIG_SECCOMP, has been capable of hiding the TSC from processes for quite a while. This patch enables this to actually work for pv kernels, by allowing them to control CR4.TSD (and, as a simple thing to do at the same time, CR4.DE). Applies cleanly only on top of the previously submitted debug register handling patch. Signed-off-by: Jan Beulich <jbeulich@novell.com> Also clean up CR4 and EFER handling, and hack-n-slash header file inclusion madness to get the tree building again. Signed-off-by: Keir Fraser <keir@xensource.com>
* x86: Tighten handling of page-type attributes and makeKeir Fraser2007-10-171-1/+1
| | | | | | map_pages_to_xen() smarter and safer. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* x86: consolidate/enhance TLB flushing interfaceKeir Fraser2007-10-161-25/+9
| | | | | | | | | | | | Folding into a single local handler and a single SMP multiplexor as well as adding capability to also flush caches through the same interfaces (a subsequent patch will make use of this). Once at changing cpuinfo_x86, this patch also removes several unused fields apparently inherited from Linux. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* x86: Use halt() macro instead of direct HLT asm.kfraser@localhost.localdomain2007-09-111-1/+3
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* x86: Cleanup system restart code, and wait 10ms for APs to offline.kfraser@localhost.localdomain2007-09-101-4/+14
| | | | | Signed-off-by: Joseph Cihula <joseph.cihula@intel.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* x86: Handle 'self-IPI' on legacy UP systems with no APIC.kfraser@localhost.localdomain2007-09-101-0/+13
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* x86: Various cleanups around CR4 handling, cpu_possible_map, and VMX ↵kfraser@localhost.localdomain2007-07-121-1/+1
| | | | | | initialisation. Signed-off-by: Keir Fraser <keir@xensource.com>
* xen: Remove legacy references to explicitly per-cpu perf counters.kfraser@localhost.localdomain2007-03-271-3/+3
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* hvm: Only do hvm_disable() on HVM-enabled systems.kfraser@localhost.localdomain2007-02-281-1/+1
| | | | | Original patch by Jan Beulich. Signed-off-by: Keir Fraser <keir@xensource.com>
* x86: flush_tlb_mask() should take into account specified VA to flushkfraser@localhost.localdomain2007-01-231-1/+4
| | | | | on local processor. Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com>
* [HVM] Disable VMX/SVM on auxiliary processors when shutting down an SMP system.kfraser@localhost.localdomain2006-09-291-0/+2
| | | | | | | | | | With Intel VT, VMXOFF needs to be executed before halting the CPU. Without this fix Xen or Linux is unable to start up the CPU after a kexec reboot. Tested using x86_32 on a Pentium D 930. Signed-Off-By: Magnus Damm <magnus@valinux.co.jp>
* [XEN] Various cleanups to bitops usage.kfraser@dhcp93.uk.xensource.com2006-06-271-1/+2
| | | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Use DEFINE_SPINLOCK consistently throughout Xen.kaf24@firebug.cl.cam.ac.uk2006-06-011-1/+1
| | | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Add more in_irq() checking. Add irq_enter()/irq_exit() wherekaf24@firebug.cl.cam.ac.uk2006-05-051-0/+6
| | | | | | they are missing in a few places. Signed-off-by: Keir Fraser <keir@xensource.com>
* Remove bogus extern declaration.kaf24@firebug.cl.cam.ac.uk2006-04-151-1/+1
| | | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Simplify the Xen genapic code. Many genapic hooks have beenkaf24@firebug.cl.cam.ac.uk2006-04-041-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | replaced with unconditional static 'sane' implementations. Functions relating to interrupt/IPI delivery have been grouped into two sets: physical delivery and logical-flat delivery. All subarchitectures use physical delivery except the basic default subarchitecture. The main behavioural changes are: 1. Summit no longer uses logical-clustered delivery mode 2. Physical mode no longer makes any pretence to set the LDR sanely. We never deliver interrupts in logical mode so this really should not matter. 3. Sanity checking of phys_cpu_present_map is enabled for all subarchitectures. Really we should have a sane set of APIC IDs in the system, as we rely on them for physical delivery mode. 4. We enable 'bigsmp' mode on any system with more than eight CPUs. The previous xAPIC check was unnecessary, since our bigsmp mode uses physical delivery, not logical-clustered. This all obviously needs testing on some big systems. Signed-off-by: Keir Fraser <keir@xensource.com>
* Clean up subarch 'mach-foo' header files. No need forkaf24@firebug.cl.cam.ac.uk2006-04-031-2/+2
| | | | | | | | subarch apicdef.h and ipi.h can be much simplified. Signed-off-by: Keir Fraser <keir@xensource.com>
* Remove send_IPI_all, send_IPI_allbutself and send_IPI_selfkaf24@firebug.cl.cam.ac.uk2006-04-031-71/+26
| | | | | | | | | | shortcutting IPI functions. They're either unused or used so frequently that we may as well simplify things and always use send_IPI_mask. Signed-off-by: Keir Fraser <keir@xensource.com>
* on_selected_cpus() must not send IPIs with empty target masks.kaf24@firebug.cl.cam.ac.uk2006-03-231-0/+17
| | | | | | | | This causes send accept errors on Pentium/P6 . Signed-off-by: Keir Fraser <keir@xensource.com>
* New SMP IPI interface function called on_selected_cpus(), currently implementedkaf24@firebug.cl.cam.ac.uk2006-03-211-15/+25
| | | | | | | | | | only for x86. The x86 implementation of smp_call_function has been simplified and is now based on on_slected_cpus(). Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.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-3/+3
| | | | | | | | | | | 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>