[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.5] x86/irq: limit the maximum number of domain PIRQs



commit 5eac1be2570d9d56a4a1fe9b4c0c24d5d120c904
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu May 28 12:29:49 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu May 28 12:29:49 2015 +0200

    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@xxxxxxxxxx>
    master commit: 75d28c917094b0e264874e92e8980b00a372b99f
    master date: 2015-05-22 10:13:04 +0200
---
 xen/arch/x86/io_apic.c |    4 ++++
 xen/arch/x86/irq.c     |    6 ++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 01f816b..4a053a6 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2614,6 +2614,10 @@ unsigned int arch_hwdom_irqs(domid_t domid)
     if ( !domid )
         n = min(n, 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("Dom%d has maximum %u PIRQs\n", domid, n);
 
     return n;
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 3cf6777..e7ebeff 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1073,13 +1073,19 @@ bool_t cpu_has_pending_apic_eoi(void)
 static inline void set_pirq_eoi(struct domain *d, unsigned int irq)
 {
     if ( d->arch.pirq_eoi_map )
+    {
+        ASSERT(irq < PAGE_SIZE * BITS_PER_BYTE);
         set_bit(irq, d->arch.pirq_eoi_map);
+    }
 }
 
 static inline void clear_pirq_eoi(struct domain *d, unsigned int irq)
 {
     if ( d->arch.pirq_eoi_map )
+    {
+        ASSERT(irq < PAGE_SIZE * BITS_PER_BYTE);
         clear_bit(irq, d->arch.pirq_eoi_map);
+    }
 }
 
 static void set_eoi_ready(void *data);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.5

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.