WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Patch: implementing least priority interrupt routing

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Patch: implementing least priority interrupt routing
From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 Nov 2008 10:59:30 +0100
Delivery-date: Tue, 18 Nov 2008 01:59:56 -0800
Domainkey-signature: s=s768; d=fujitsu-siemens.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Received:Message-ID:Date:From:Organization: User-Agent:MIME-Version:To:Subject:X-Enigmail-Version: Content-Type; b=0DqLq6Et66BkDRSUzQzftYTNhIBAHlaO5BWDQVDZzNJ4V/QPrSKyng8j vs14x9S0a5p40jXBpnvuGbzWeAAwp3YHDN5uFHJvuegBsGBZgHIPnm+jB RkxFJCkfl/AvUxP;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Fujitsu Siemens Computers
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018)
Hi,

the attached patch implements interrupt routing to least priority processor
for HVM domains.
Instead of round robin the vcpu with the lowest processor priority is selected
for the interrupt. If multiple vcpus share the same low priority interrupts
are distributed between those round robin.
Tested with BS2000 domain (3 vcpus, idle processors are now preferred
interrupt target).

Juergen

-- 
Juergen Gross                             Principal Developer
IP SW OS6                      Telephone: +49 (0) 89 636 47950
Fujitsu Siemens Computers         e-mail: juergen.gross@xxxxxxxxxxxxxxxxxxx
Otto-Hahn-Ring 6                Internet: www.fujitsu-siemens.com
D-81739 Muenchen         Company details: www.fujitsu-siemens.com/imprint.html
Implementing interrupt routing to least priority processor.
Instead of round robin the vcpu with the lowest processor
priority is selected for the interrupt. If multiple vcpus
share the same low priority interrupts are distributed between
those round robin.

Signed-off-by: juergen.gross@xxxxxxxxxxxxxxxxxxx

# HG changeset patch
# User juergen.gross@xxxxxxxxxxxxxxxxxxx
# Date 1227001650 -3600
# Node ID 370b052ca213bb03f234c102d72d774df6a5aa19
# Parent  7640fba355fac233773d183077d7d01c8fd591f3
implementing least priority interrupt routing

diff -r 7640fba355fa -r 370b052ca213 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Tue Oct 28 09:47:35 2008 +0100
+++ b/xen/arch/x86/hvm/vlapic.c Tue Nov 18 10:47:30 2008 +0100
@@ -380,25 +380,35 @@
 struct vlapic *apic_round_robin(
     struct domain *d, uint8_t vector, uint32_t bitmap)
 {
-    int next, old;
-    struct vlapic *target = NULL;
+    int old;
+    uint32_t ppr, ppr_min;
+    struct vlapic *target;
+    struct vlapic *target_min = NULL;
+    struct vcpu *v;
 
-    old = next = d->arch.hvm_domain.irq.round_robin_prev_vcpu;
+    old = d->arch.hvm_domain.irq.round_robin_prev_vcpu;
+    ppr_min = 256;
+    v = d->vcpu[old];
 
     do {
-        if ( ++next == MAX_VIRT_CPUS ) 
-            next = 0;
-        if ( (d->vcpu[next] == NULL) || !test_bit(next, &bitmap) )
+        v = v->next_in_list;
+       if ( v == NULL )
+           v = d->vcpu[0];
+        if ( !test_bit(v->vcpu_id, &bitmap) )
             continue;
-        target = vcpu_vlapic(d->vcpu[next]);
-        if ( vlapic_enabled(target) )
-            break;
-        target = NULL;
-    } while ( next != old );
+        target = vcpu_vlapic(v);
+        if ( !vlapic_enabled(target) )
+            continue;
+        ppr = vlapic_get_ppr(target);
+       if ( ppr < ppr_min )
+       {
+           target_min = target;
+           ppr_min = ppr;
+           d->arch.hvm_domain.irq.round_robin_prev_vcpu = v->vcpu_id;
+       }
+    } while ( v->vcpu_id != old );
 
-    d->arch.hvm_domain.irq.round_robin_prev_vcpu = next;
-
-    return target;
+    return target_min;
 }
 
 void vlapic_EOI_set(struct vlapic *vlapic)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>