Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19XDWi-0000sN-Tz for qemu-devel@nongnu.org; Tue, 01 Jul 2003 01:18:00 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19XDWR-0000ja-3k for qemu-devel@nongnu.org; Tue, 01 Jul 2003 01:17:44 -0400 Received: from dp.samba.org ([66.70.73.150] helo=lists.samba.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19XDW6-0000cd-I4 for qemu-devel@nongnu.org; Tue, 01 Jul 2003 01:17:22 -0400 From: Rusty Russell Date: Tue, 01 Jul 2003 15:16:22 +1000 Sender: rusty@bach.samba.org Message-Id: <20030701051719.B97982C113@lists.samba.org> Subject: [Qemu-devel] Problem booting 2.5 kernel with HZ != 1000 Reply-To: qemu-devel@nongnu.org List-Id: List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , To: qemu-devel@nongnu.org Hi Fabrice, Setting HZ to any value other than 1000 causes vl to hang for me (no response to C-x a). The RT timer is still going off inside vl, but it doesn't seem to be getting through as a timer interrupt. BTW, vl compiled with gcc 3.3 gives a Floating Exception, so I compiled it with 2.95 and it works. Tried 0.4.1 and CVS. Here's the output, kernel patch I'm using below. rusty@bach:~/devel/cvs/qemu$ ./vl -initrd ~/devel/qemu/vl-test/initrd-2.4.20.img ~/devel/kernel/working-2.5.73-bk7-qemu-page-offset/arch/i386/boot/bzImage Connected to host network interface: tun0 /etc/vl-ifup: could not launch network script for 'tun0' Uncompressing Linux... Ok, booting the kernel. Linux version 2.5.73-bk7 (rusty@bach) (gcc version 3.2.3 (Debian)) #13 Tue Jul 1 15:03:18 EST 2003 Video mode to be used for restore is 0 BIOS-provided physical RAM map: BIOS-88: 0000000000000000 - 000000000009f000 (usable) BIOS-88: 0000000000100000 - 0000000002000000 (usable) 32MB LOWMEM available. On node 0 totalpages: 8192 DMA zone: 4096 pages, LIFO batch:1 Normal zone: 4096 pages, LIFO batch:1 HighMem zone: 0 pages, LIFO batch:1 Building zonelist for node : 0 Kernel command line: Initializing CPU#0 PID hash table entries: 256 (order 8: 2048 bytes) Detected 697.116 MHz processor. [ hang ] -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. Name: QEMU CONFIG Patch Author: Rusty Russell Status: Trivial D: Convenient patch based on Fabrice Bellard's documentation on how to D: boot an x86 kernel under qemu 0.4. Adjusts PAGE_OFFSET and HZ value. diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.73-bk7/arch/i386/Kconfig working-2.5.73-bk7-qemu-page-offset/arch/i386/Kconfig --- linux-2.5.73-bk7/arch/i386/Kconfig 2003-06-30 11:46:42.000000000 +1000 +++ working-2.5.73-bk7-qemu-page-offset/arch/i386/Kconfig 2003-06-30 15:54:49.000000000 +1000 @@ -307,6 +307,14 @@ config X86_GENERIC when it has moderate overhead. This is intended for generic distributions kernels. +config QEMU + bool "Kernel to run under QEMU" + depends on EXPERIMENTAL + help + Select this if you want to boot the kernel inside qemu, the + x86 emulator. See http://fabrice.bellard.free.fr/qemu/. + Say N. + # # Define implied options from the CPU selection here # diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.73-bk7/arch/i386/vmlinux.lds.S working-2.5.73-bk7-qemu-page-offset/arch/i386/vmlinux.lds.S --- linux-2.5.73-bk7/arch/i386/vmlinux.lds.S 2003-06-15 11:29:47.000000000 +1000 +++ working-2.5.73-bk7-qemu-page-offset/arch/i386/vmlinux.lds.S 2003-06-30 15:54:49.000000000 +1000 @@ -3,14 +3,15 @@ */ #include - +#include + OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) ENTRY(startup_32) jiffies = jiffies_64; SECTIONS { - . = 0xC0000000 + 0x100000; + . = __PAGE_OFFSET + 0x100000; /* read-only */ _text = .; /* Text and read-only data */ .text : { diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.73-bk7/include/asm-i386/page.h working-2.5.73-bk7-qemu-page-offset/include/asm-i386/page.h --- linux-2.5.73-bk7/include/asm-i386/page.h 2003-04-08 11:14:55.000000000 +1000 +++ working-2.5.73-bk7-qemu-page-offset/include/asm-i386/page.h 2003-06-30 15:54:49.000000000 +1000 @@ -10,10 +10,10 @@ #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) #ifdef __KERNEL__ -#ifndef __ASSEMBLY__ - #include +#ifndef __ASSEMBLY__ + #ifdef CONFIG_X86_USE_3DNOW #include @@ -115,12 +115,19 @@ static __inline__ int get_order(unsigned #endif /* __ASSEMBLY__ */ #ifdef __ASSEMBLY__ +#ifdef CONFIG_QEMU +#define __PAGE_OFFSET (0x90000000) +#else #define __PAGE_OFFSET (0xC0000000) +#endif /* QEMU */ +#else +#ifdef CONFIG_QEMU +#define __PAGE_OFFSET (0x90000000UL) #else #define __PAGE_OFFSET (0xC0000000UL) +#endif /* QEMU */ #endif - #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) #define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.73-bk7/include/asm-i386/param.h working-2.5.73-bk7-qemu-page-offset/include/asm-i386/param.h --- linux-2.5.73-bk7/include/asm-i386/param.h 2003-01-02 12:07:44.000000000 +1100 +++ working-2.5.73-bk7-qemu-page-offset/include/asm-i386/param.h 2003-07-01 14:59:57.000000000 +1000 @@ -2,7 +2,11 @@ #define _ASMi386_PARAM_H #ifdef __KERNEL__ -# define HZ 1000 /* Internal kernel timer frequency */ +# ifdef CONFIG_QEMU +# define HZ 100 +# else +# define HZ 1000 /* Internal kernel timer frequency */ +# endif # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ #endif