File 555ee510-x86-irq-limit-the-maximum-number-of-domain-PIRQs.patch of Package xen.950
# Commit 75d28c917094b0e264874e92e8980b00a372b99f
# Date 2015-05-22 10:13:04 +0200
# Author Andrew Cooper <andrew.cooper3@citrix.com>
# Committer Jan Beulich <jbeulich@suse.com>
x86/irq: limit the maximum number of domain PIRQs
c/s 7e73a6e "have architectures specify the number of PIRQs a hardware domain
gets" increased the default number of pirqs for dom0, as 256 was found to be
too low in some cases.
However, it didn't account for the upper bound presented by the domains EOI
bitmap, registered with the PHYSDEVOP_pirq_eoi_gmfn_v* hypercall.
On a server with 240 cpus, Xen was observed to be attempting to clear the EOI
bit for dom0's pirq 0xb40f, which hit a pagefault.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2613,6 +2613,10 @@ unsigned int arch_dom0_irqs(void)
dom0_max_vcpus());
n = min(nr_irqs_gsi + n * NR_DYNAMIC_VECTORS, nr_irqs);
+
+ /* Bounded by the domain pirq eoi bitmap gfn. */
+ n = min_t(unsigned int, n, PAGE_SIZE * BITS_PER_BYTE);
+
printk("Dom0 has maximum %u PIRQs\n", n);
return n;
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1070,13 +1070,19 @@ bool_t cpu_has_pending_apic_eoi(void)
static inline void set_pirq_eoi(struct domain *d, unsigned int irq)
{
if ( is_pv_domain(d) && d->arch.pv_domain.pirq_eoi_map )
+ {
+ ASSERT(irq < PAGE_SIZE * BITS_PER_BYTE);
set_bit(irq, d->arch.pv_domain.pirq_eoi_map);
+ }
}
static inline void clear_pirq_eoi(struct domain *d, unsigned int irq)
{
if ( is_pv_domain(d) && d->arch.pv_domain.pirq_eoi_map )
+ {
+ ASSERT(irq < PAGE_SIZE * BITS_PER_BYTE);
clear_bit(irq, d->arch.pv_domain.pirq_eoi_map);
+ }
}
static void set_eoi_ready(void *data);