All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch 2 of 2]: PV-domain SMP performance Linux-part
@ 2008-12-17 12:22 Juergen Gross
  2008-12-17 15:06 ` Jan Beulich
  0 siblings, 1 reply; 37+ messages in thread
From: Juergen Gross @ 2008-12-17 12:22 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]


-- 
Juergen Gross                             Principal Developer
IP SW OS6                      Telephone: +49 (0) 89 636 47950
Fujitsu Siemens Computers         e-mail: juergen.gross@fujitsu-siemens.com
Otto-Hahn-Ring 6                Internet: www.fujitsu-siemens.com
D-81739 Muenchen         Company details: www.fujitsu-siemens.com/imprint.html

[-- Attachment #2: vcpu_desched-linux.patch --]
[-- Type: text/x-patch, Size: 3944 bytes --]

Mark vcpu as no_desched when interrupts are disabled.

Signed-off-by: juergen.gross@fujitsu-siemens.com

# HG changeset patch
# User juergen.gross@fujitsu-siemens.com
# Date 1229515973 -3600
# Node ID b5bbaec70b34d990e64e730caf712bb236490f95
# Parent  ff9683032b76f533509191bb9532df10cbb9830b
added support of vcpu preempt disable

diff -r ff9683032b76 -r b5bbaec70b34 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	Wed Dec 17 13:12:53 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 b5bbaec70b34 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	Wed Dec 17 13:12:53 2008 +0100
@@ -33,8 +33,12 @@ do {									\
 	vcpu_info_t *_vcpu;						\
 	barrier();							\
 	_vcpu = current_vcpu_info();		\
-	if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {			\
+	if ( !(x) ) {							\
+		_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); \
 		if ( unlikely(_vcpu->evtchn_upcall_pending) )		\
 			force_evtchn_callback();			\
 	}								\
@@ -69,7 +73,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 +85,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, _vcpu))?:0);	\
 	if ( unlikely(_vcpu->evtchn_upcall_pending) )			\
 		force_evtchn_callback();				\
 } while (0)
diff -r ff9683032b76 -r b5bbaec70b34 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	Wed Dec 17 13:12:53 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;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2009-01-20 20:12 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-17 12:22 [Patch 2 of 2]: PV-domain SMP performance Linux-part Juergen Gross
2008-12-17 15:06 ` Jan Beulich
2008-12-18  7:18   ` Juergen Gross
2008-12-18  7:41     ` Jan Beulich
2008-12-19  8:12       ` Juergen Gross
2008-12-19  9:10         ` Keir Fraser
2008-12-19  9:25           ` Juergen Gross
2008-12-19  9:56             ` Keir Fraser
2009-01-16  7:16               ` Juergen Gross
2009-01-16  7:38                 ` Venefax
2009-01-16  7:48                   ` Juergen Gross
2009-01-16  7:57                     ` Venefax
2009-01-16  8:19                       ` Juergen Gross
2009-01-16 10:16                     ` James Harper
2009-01-16 10:31                       ` Juergen Gross
2009-01-16 10:41                       ` Keir Fraser
2009-01-16 11:01                         ` James Harper
2009-01-16 11:14                           ` Keir Fraser
2009-01-16 11:18                           ` Jan Beulich
2009-01-16 14:40                           ` Steve Prochniak
2009-01-16 17:43                       ` Jeremy Fitzhardinge
2009-01-16  8:17                 ` Keir Fraser
2009-01-16  9:36                   ` Juergen Gross
2009-01-16  9:53                     ` Keir Fraser
2009-01-16 17:41                       ` Jeremy Fitzhardinge
2009-01-19 17:15                         ` George Dunlap
2009-01-20 20:12                           ` Jeremy Fitzhardinge
2008-12-19  9:33           ` Jan Beulich
2008-12-19  9:56             ` Keir Fraser
2008-12-19 15:15               ` George Dunlap
2009-01-12 12:55                 ` Juergen Gross
2009-01-19 17:32                   ` George Dunlap
2009-01-20  7:56                     ` Juergen Gross
2008-12-19 10:06             ` Juergen Gross
2008-12-19 10:36               ` Jan Beulich
2008-12-19 10:42                 ` Juergen Gross
2008-12-19 10:48                 ` Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.