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

Re: [Xen-devel] [Patch 2 of 2]: PV-domain SMP performance Linux-part

To: Jan Beulich <jbeulich@xxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [Patch 2 of 2]: PV-domain SMP performance Linux-part
From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 Dec 2008 09:12:25 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 19 Dec 2008 00:12:58 -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:CC:Subject:References: In-Reply-To:X-Enigmail-Version:Content-Type; b=iVpDiTMKCt+IeG6fXwp9iftec8ywjZOmJ0lBfqalkzsQ84RuogKxofs1 Q480TEDbo6b5wHYKby9Jgb1yRi9LlG0JawTQMxBTb1BEKcNRJv93VDVdk qyOUY+qZ5UBwKMx;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <494A0CD5.76E4.0078.0@xxxxxxxxxx>
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
References: <4948EF0B.6090404@xxxxxxxxxxxxxxxxxxx> <49492387.76E4.0078.0@xxxxxxxxxx> <4949F950.80509@xxxxxxxxxxxxxxxxxxx> <494A0CD5.76E4.0078.0@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018)
Jan Beulich wrote:
>>>> Juergen Gross <juergen.gross@xxxxxxxxxxxxxxxxxxx> 18.12.08 08:18 >>>
>> Jan Beulich wrote:
>>>> +          _vcpu->no_desched = 0;                                  \
>>>> +          _vcpu->evtchn_upcall_mask = 0;                          \
>>>>            barrier(); /* unmask then check (avoid races) */        \
>>>> +          if ( unlikely(_vcpu->desched_delay) )                   \
>>>> +                  (void)((HYPERVISOR_sched_op(SCHEDOP_yield, _vcpu))?:0); 
>>>> \
>>> Why not just cast the function result to void? Likewise further below...
>> I took that from include/xen/hypercall.h, which mentioned problems with just
>> casting the function result.
> 
> Ah, yes, I recall. But then why don't you use that macro? After all, 
> hypercall.h
> must have been included if you're able to call HYPERVISOR_sched_op().

This was an artefact from previous tests, sorry.
Attached patch should be clean now.

Keir, what is your main objection?
Putting this interface into the hypervisor or only the Linux part?
I still think this would be good to have in linux, but our BS2000 port would
really be much easier having this interface in the hypervisor!
So if you don't mind adding only the first patch, this would be absolutely
okay for us.


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
Mark vcpu as no_desched when interrupts are disabled.

Signed-off-by: juergen.gross@xxxxxxxxxxxxxxxxxxx

# HG changeset patch
# User juergen.gross@xxxxxxxxxxxxxxxxxxx
# Date 1229673855 -3600
# Node ID 0b6ef982e456e4adbd2a547406d475d1b554fcbe
# Parent  ff9683032b76f533509191bb9532df10cbb9830b
added support of vcpu preempt disable

diff -r ff9683032b76 -r 0b6ef982e456 arch/x86_64/kernel/xen_entry.S
--- a/arch/x86_64/kernel/xen_entry.S    Sat Dec 13 16:00:43 2008 +0000
+++ b/arch/x86_64/kernel/xen_entry.S    Fri Dec 19 09:04:15 2008 +0100
@@ -4,6 +4,7 @@
 /* Offsets into shared_info_t. */                
 #define evtchn_upcall_pending          /* 0 */
 #define evtchn_upcall_mask             1
+#define no_desched                     2
 
 #define sizeof_vcpu_shift              6
 
@@ -25,8 +26,10 @@
 #define XEN_PUT_VCPU_INFO_fixup
 #endif
 
-#define XEN_LOCKED_BLOCK_EVENTS(reg)   movb $1,evtchn_upcall_mask(reg)
-#define XEN_LOCKED_UNBLOCK_EVENTS(reg) movb $0,evtchn_upcall_mask(reg)
+#define XEN_LOCKED_BLOCK_EVENTS(reg)   movb $1,evtchn_upcall_mask(reg) ; \
+                                       movb $1,no_desched(reg)
+#define XEN_LOCKED_UNBLOCK_EVENTS(reg) movb $0,evtchn_upcall_mask(reg) ; \
+                                       movb $0,no_desched(reg)
 #define XEN_BLOCK_EVENTS(reg)  XEN_GET_VCPU_INFO(reg)                  ; \
                                XEN_LOCKED_BLOCK_EVENTS(reg)            ; \
                                XEN_PUT_VCPU_INFO(reg)
diff -r ff9683032b76 -r 0b6ef982e456 include/asm-x86_64/mach-xen/asm/irqflags.h
--- a/include/asm-x86_64/mach-xen/asm/irqflags.h        Sat Dec 13 16:00:43 
2008 +0000
+++ b/include/asm-x86_64/mach-xen/asm/irqflags.h        Fri Dec 19 09:04:15 
2008 +0100
@@ -34,7 +34,10 @@ do {                                                         
        \
        barrier();                                                      \
        _vcpu = current_vcpu_info();            \
        if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {                   \
+               _vcpu->no_desched = 0;                                  \
                barrier(); /* unmask then check (avoid races) */        \
+               if ( unlikely(_vcpu->desched_delay) )                   \
+                       VOID(HYPERVISOR_sched_op(SCHEDOP_yield, 0));    \
                if ( unlikely(_vcpu->evtchn_upcall_pending) )           \
                        force_evtchn_callback();                        \
        }                                                               \
@@ -69,7 +72,10 @@ static inline int raw_irqs_disabled_flag
 
 #define raw_local_irq_disable()                                                
\
 do {                                                                   \
-       current_vcpu_info()->evtchn_upcall_mask = 1;                            
        \
+       vcpu_info_t *_vcpu;                                             \
+       _vcpu = current_vcpu_info();            \
+       _vcpu->evtchn_upcall_mask = 1;                                  \
+       _vcpu->no_desched = 1;                                          \
        barrier();                                                      \
 } while (0)
 
@@ -78,8 +84,11 @@ do {                                                         
        \
        vcpu_info_t *_vcpu;                                             \
        barrier();                                                      \
        _vcpu = current_vcpu_info();            \
+       _vcpu->no_desched = 0;                                          \
        _vcpu->evtchn_upcall_mask = 0;                                  \
        barrier(); /* unmask then check (avoid races) */                \
+       if ( unlikely(_vcpu->desched_delay) )                           \
+               VOID(HYPERVISOR_sched_op(SCHEDOP_yield, 0));            \
        if ( unlikely(_vcpu->evtchn_upcall_pending) )                   \
                force_evtchn_callback();                                \
 } while (0)
diff -r ff9683032b76 -r 0b6ef982e456 include/xen/interface/xen.h
--- a/include/xen/interface/xen.h       Sat Dec 13 16:00:43 2008 +0000
+++ b/include/xen/interface/xen.h       Fri Dec 19 09:04:15 2008 +0100
@@ -434,9 +434,18 @@ struct vcpu_info {
      * non-zero mask therefore guarantees that the VCPU will not receive
      * an upcall activation. The mask is cleared when the VCPU requests
      * to block: this avoids wakeup-waiting races.
+     *
+     * The guest can set 'no_desched' to a non-zero value to avoid being
+     * descheduled. If the hypervisor didn't deschedule the VCPU due to
+     * 'no_desched' being set, it will itself set 'desched_delay' to inform
+     * the guest to give up control voluntaryly later. This is just a wish
+     * of the guest which the hypervisor may not obey (and it will deschedule
+     * the guest after a reasonable time anyway).
      */
     uint8_t evtchn_upcall_pending;
     uint8_t evtchn_upcall_mask;
+    uint8_t no_desched;
+    uint8_t desched_delay;
     unsigned long evtchn_pending_sel;
     struct arch_vcpu_info arch;
     struct vcpu_time_info time;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel