aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/enlighten.c
diff options
context:
space:
mode:
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>2016-08-03 13:22:27 -0400
committerDavid Vrabel <david.vrabel@citrix.com>2016-08-24 13:44:40 -0400
commit5fc509bc2bd6dddd4107eaf90680cd76cfc2ffed (patch)
tree30265b703433375b2e86f1b96997b4b4971f7be6 /arch/x86/xen/enlighten.c
parentfa8410b355251fd30341662a40ac6b22d3e38468 (diff)
xen/x86: Move irq allocation from Xen smp_op.cpu_up()
Commit ce0d3c0a6fb1 ("genirq: Revert sparse irq locking around __cpu_up() and move it to x86 for now") reverted irq locking introduced by commit a89941816726 ("hotplug: Prevent alloc/free of irq descriptors during cpu up/down") because of Xen allocating irqs in both of its cpu_up ops. We can move those allocations into CPU notifiers so that original patch can be reinstated. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'arch/x86/xen/enlighten.c')
-rw-r--r--arch/x86/xen/enlighten.c61
1 files changed, 48 insertions, 13 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 8ffb089b19a5..c7f6b1f90efa 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -140,6 +140,8 @@ RESERVE_BRK(shared_info_page_brk, PAGE_SIZE);
140__read_mostly int xen_have_vector_callback; 140__read_mostly int xen_have_vector_callback;
141EXPORT_SYMBOL_GPL(xen_have_vector_callback); 141EXPORT_SYMBOL_GPL(xen_have_vector_callback);
142 142
143static struct notifier_block xen_cpu_notifier;
144
143/* 145/*
144 * Point at some empty memory to start with. We map the real shared_info 146 * Point at some empty memory to start with. We map the real shared_info
145 * page as soon as fixmap is up and running. 147 * page as soon as fixmap is up and running.
@@ -1627,6 +1629,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
1627 xen_initial_gdt = &per_cpu(gdt_page, 0); 1629 xen_initial_gdt = &per_cpu(gdt_page, 0);
1628 1630
1629 xen_smp_init(); 1631 xen_smp_init();
1632 register_cpu_notifier(&xen_cpu_notifier);
1630 1633
1631#ifdef CONFIG_ACPI_NUMA 1634#ifdef CONFIG_ACPI_NUMA
1632 /* 1635 /*
@@ -1820,21 +1823,53 @@ static void __init init_hvm_pv_info(void)
1820 xen_domain_type = XEN_HVM_DOMAIN; 1823 xen_domain_type = XEN_HVM_DOMAIN;
1821} 1824}
1822 1825
1823static int xen_hvm_cpu_notify(struct notifier_block *self, unsigned long action, 1826static int xen_cpu_notify(struct notifier_block *self, unsigned long action,
1824 void *hcpu) 1827 void *hcpu)
1825{ 1828{
1826 int cpu = (long)hcpu; 1829 int cpu = (long)hcpu;
1830 int rc;
1831
1827 switch (action) { 1832 switch (action) {
1828 case CPU_UP_PREPARE: 1833 case CPU_UP_PREPARE:
1829 if (cpu_acpi_id(cpu) != U32_MAX) 1834 if (xen_hvm_domain()) {
1830 per_cpu(xen_vcpu_id, cpu) = cpu_acpi_id(cpu); 1835 /*
1831 else 1836 * This can happen if CPU was offlined earlier and
1832 per_cpu(xen_vcpu_id, cpu) = cpu; 1837 * offlining timed out in common_cpu_die().
1833 xen_vcpu_setup(cpu); 1838 */
1834 if (xen_have_vector_callback) { 1839 if (cpu_report_state(cpu) == CPU_DEAD_FROZEN) {
1835 if (xen_feature(XENFEAT_hvm_safe_pvclock)) 1840 xen_smp_intr_free(cpu);
1836 xen_setup_timer(cpu); 1841 xen_uninit_lock_cpu(cpu);
1842 }
1843
1844 if (cpu_acpi_id(cpu) != U32_MAX)
1845 per_cpu(xen_vcpu_id, cpu) = cpu_acpi_id(cpu);
1846 else
1847 per_cpu(xen_vcpu_id, cpu) = cpu;
1848 xen_vcpu_setup(cpu);
1837 } 1849 }
1850
1851 if (xen_pv_domain() ||
1852 (xen_have_vector_callback &&
1853 xen_feature(XENFEAT_hvm_safe_pvclock)))
1854 xen_setup_timer(cpu);
1855
1856 rc = xen_smp_intr_init(cpu);
1857 if (rc) {
1858 WARN(1, "xen_smp_intr_init() for CPU %d failed: %d\n",
1859 cpu, rc);
1860 return NOTIFY_BAD;
1861 }
1862
1863 break;
1864 case CPU_ONLINE:
1865 xen_init_lock_cpu(cpu);
1866 break;
1867 case CPU_UP_CANCELED:
1868 xen_smp_intr_free(cpu);
1869 if (xen_pv_domain() ||
1870 (xen_have_vector_callback &&
1871 xen_feature(XENFEAT_hvm_safe_pvclock)))
1872 xen_teardown_timer(cpu);
1838 break; 1873 break;
1839 default: 1874 default:
1840 break; 1875 break;
@@ -1842,8 +1877,8 @@ static int xen_hvm_cpu_notify(struct notifier_block *self, unsigned long action,
1842 return NOTIFY_OK; 1877 return NOTIFY_OK;
1843} 1878}
1844 1879
1845static struct notifier_block xen_hvm_cpu_notifier = { 1880static struct notifier_block xen_cpu_notifier = {
1846 .notifier_call = xen_hvm_cpu_notify, 1881 .notifier_call = xen_cpu_notify,
1847}; 1882};
1848 1883
1849#ifdef CONFIG_KEXEC_CORE 1884#ifdef CONFIG_KEXEC_CORE
@@ -1875,7 +1910,7 @@ static void __init xen_hvm_guest_init(void)
1875 if (xen_feature(XENFEAT_hvm_callback_vector)) 1910 if (xen_feature(XENFEAT_hvm_callback_vector))
1876 xen_have_vector_callback = 1; 1911 xen_have_vector_callback = 1;
1877 xen_hvm_smp_init(); 1912 xen_hvm_smp_init();
1878 register_cpu_notifier(&xen_hvm_cpu_notifier); 1913 register_cpu_notifier(&xen_cpu_notifier);
1879 xen_unplug_emulated_devices(); 1914 xen_unplug_emulated_devices();
1880 x86_init.irqs.intr_init = xen_init_IRQ; 1915 x86_init.irqs.intr_init = xen_init_IRQ;
1881 xen_hvm_init_time_ops(); 1916 xen_hvm_init_time_ops();