Subject: Re: Xen 1.2 - problems solved!
To: None <tls@rek.tjls.com>
From: Michael Kukat <michael@unixiron.org>
List: port-xen
Date: 12/14/2004 11:48:43
Hello,

> On Mon, Dec 13, 2004 at 01:12:19PM +0100, Michael Kukat wrote:
>> +       movl    $0,%ebx

> This change makes an *enormous* difference in performance on one of the
> TNF servers.  I will commit it and request a pullup for 2.1.

As promised, i like to clean up this a bit. See the included patch (again
based on 2.0 release sources) for a further improvement. I used the symbols
now in locore.S and added domain termination handling on shutdown. Currently,
DomU just exits after shutdown (also on reboot, as i don't see a way to do a
real reboot of DomU), and on shutdown of Dom0, Xen reboots the machine. Is
there any hook known to do some way of halt instead of reboot here? At least,
with this patch, no domain loops eating up the CPU on shutdown.

Further loop issues known to me:

- prompt for root-FS if cannot be found (but this is likely a user error, if
this happens :)
- DDB prompt (without read/write console, ddb doesn't make much sense)

Maybe there are more, but this patch should fix the most common issues.

I didn't found any useful documentation for the schedops, but i think we don't
really need SCHEDOP_stop somewhere, as the examples also use SCHEDOP_exit to
terminate a domain.

More cleanup from me might take a while now, so i don't bother the list with
new patches the next days :)

diff -Naru sys.orig/arch/xen/i386/locore.S sys/arch/xen/i386/locore.S
--- sys.orig/arch/xen/i386/locore.S	2004-09-23 04:41:01.000000000 +0200
+++ sys/arch/xen/i386/locore.S	2004-12-14 10:04:06.000000000 +0100
@@ -237,7 +237,8 @@
 #endif

 #include <machine/xen.h>
-#define __HYPERVISOR_yield		   8
+#define __HYPERVISOR_sched_op		   8
+#define __SCHEDOP_yield			   0

 	.space 512
 tmpstk:
@@ -1609,7 +1610,8 @@
 	addl	$4,%esp
 	jmp	idle_start
 4:
-	movl	$__HYPERVISOR_yield,%eax
+	movl	$__HYPERVISOR_sched_op,%eax
+	movl	$__SCHEDOP_yield,%ebx
 	TRAP_INSTR
 NENTRY(mpidle)
 idle_start:
diff -Naru sys.orig/arch/xen/i386/machdep.c sys/arch/xen/i386/machdep.c
--- sys.orig/arch/xen/i386/machdep.c	2004-05-22 17:58:02.000000000 +0200
+++ sys/arch/xen/i386/machdep.c	2004-12-14 10:35:08.000000000 +0100
@@ -824,34 +824,9 @@
 	x86_broadcast_ipi(X86_IPI_HALT);
 #endif

-	if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
-#if NACPI > 0
-		if (acpi_softc != NULL) {
-			delay(500000);
-			acpi_enter_sleep_state(acpi_softc, ACPI_STATE_S5);
-			printf("WARNING: ACPI powerdown failed!\n");
-		}
-#endif
-#if NAPM > 0 && !defined(APM_NO_POWEROFF)
-		/* turn off, if we can.  But try to turn disk off and
-		 * wait a bit first--some disk drives are slow to clean up
-		 * and users have reported disk corruption.
-		 */
-		delay(500000);
-		apm_set_powstate(APM_DEV_DISK(0xff), APM_SYS_OFF);
-		delay(500000);
-		apm_set_powstate(APM_DEV_ALLDEVS, APM_SYS_OFF);
-		printf("WARNING: APM powerdown failed!\n");
-		/*
-		 * RB_POWERDOWN implies RB_HALT... fall into it...
-		 */
-#endif
-	}
-
 	if (howto & RB_HALT) {
 		printf("\n");
 		printf("The operating system has halted.\n");
-		printf("Please press any key to reboot.\n\n");

 #ifdef BEEP_ONHALT
 		{
@@ -865,21 +840,9 @@
 			}
 		}
 #endif
-
-		cnpollc(1);	/* for proper keyboard command handling */
-		if (cngetc() == 0) {
-			/* no console attached, so just hlt */
-			for(;;) {
-				__asm __volatile("hlt");
-			}
-		}
-		cnpollc(0);
 	}

-	printf("rebooting...\n");
-	if (cpureset_delay > 0)
-		delay(cpureset_delay * 1000);
-	cpu_reset();
+	HYPERVISOR_exit();
 	for(;;) ;
 	/*NOTREACHED*/
 }

...Michael

-- 
http://www.unixiron.org/    Home Powered by: (Net|Open|Free)BSD IRIX NonStop-UX
Solaris AIX HP-UX Tru64 MUNIX Ultrix VMS SINIX Dolphin_Unix OpenStep MacOS A/UX