From bd3a9adac366110f9b3d1353243b0652881e691c Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Thu, 26 Aug 2004 19:06:18 +0000 Subject: [PATCH 01/28] bitkeeper revision 1.1159.52.1 (412e34aa5HAbxIOroKVPIBaWpr-yDQ) Update to Linux 2.6.8.1 --- .rootkeys | 249 +++++++++--------- linux-2.4.27-xen-sparse/include/asm-xen/irq.h | 3 + linux-2.4.27-xen-sparse/include/linux/mm.h | 5 +- linux-2.4.27-xen-sparse/mkbuildtree | 8 +- .../arch/xen/Kconfig | 0 .../arch/xen/Kconfig.drivers | 0 .../arch/xen/Makefile | 3 +- .../arch/xen/boot/Makefile | 0 .../arch/xen/configs/xen0_defconfig | 0 .../arch/xen/configs/xenU_defconfig | 0 .../arch/xen/i386/Kconfig | 0 .../arch/xen/i386/Makefile | 3 +- .../arch/xen/i386/kernel/Makefile | 1 - .../arch/xen/i386/kernel/cpu/Makefile | 0 .../arch/xen/i386/kernel/cpu/common.c | 8 +- .../arch/xen/i386/kernel/entry.S | 0 .../arch/xen/i386/kernel/head.S | 0 .../arch/xen/i386/kernel/i386_ksyms.c | 12 +- .../arch/xen/i386/kernel/ioport.c | 0 .../arch/xen/i386/kernel/irq.c | 13 +- .../arch/xen/i386/kernel/ldt.c | 2 +- .../arch/xen/i386/kernel/pci-dma.c | 3 +- .../arch/xen/i386/kernel/process.c | 2 +- .../arch/xen/i386/kernel/setup.c | 249 ++++++++++++++++-- .../arch/xen/i386/kernel/signal.c | 26 +- .../arch/xen/i386/kernel/sysenter.c | 2 +- .../arch/xen/i386/kernel/time.c | 2 +- .../arch/xen/i386/kernel/timers/Makefile | 0 .../arch/xen/i386/kernel/timers/timer_tsc.c | 4 +- .../arch/xen/i386/kernel/traps.c | 29 +- .../arch/xen/i386/kernel/vmlinux.lds.S | 0 .../arch/xen/i386/kernel/vsyscall.S | 0 .../arch/xen/i386/kernel/vsyscall.lds | 0 .../arch/xen/i386/mm/Makefile | 0 .../arch/xen/i386/mm/fault.c | 50 +++- .../arch/xen/i386/mm/highmem.c | 0 .../arch/xen/i386/mm/hypervisor.c | 0 .../arch/xen/i386/mm/init.c | 110 +++++++- .../arch/xen/i386/mm/ioremap.c | 1 - .../arch/xen/i386/mm/pgtable.c | 2 +- .../arch/xen/i386/pci/Makefile | 0 .../arch/xen/i386/pci/direct.c | 0 .../arch/xen/i386/pci/irq.c | 2 - .../arch/xen/kernel/Makefile | 0 .../arch/xen/kernel/ctrl_if.c | 0 .../arch/xen/kernel/empty.c | 0 .../arch/xen/kernel/evtchn.c | 2 +- .../arch/xen/kernel/fixup.c | 0 .../arch/xen/kernel/process.c | 2 +- .../arch/xen/kernel/reboot.c | 0 .../arch/xen/kernel/xen_proc.c | 0 .../drivers/Makefile | 2 +- .../drivers/char/mem.c | 1 - .../drivers/char/tty_io.c | 113 ++++---- .../drivers/xen/Makefile | 0 .../drivers/xen/blkback/Makefile | 0 .../drivers/xen/blkback/blkback.c | 0 .../drivers/xen/blkback/common.h | 0 .../drivers/xen/blkback/control.c | 0 .../drivers/xen/blkback/interface.c | 0 .../drivers/xen/blkback/vbd.c | 0 .../drivers/xen/blkfront/Kconfig | 0 .../drivers/xen/blkfront/Makefile | 0 .../drivers/xen/blkfront/blkfront.c | 0 .../drivers/xen/blkfront/block.h | 0 .../drivers/xen/blkfront/vbd.c | 0 .../drivers/xen/console/Makefile | 0 .../drivers/xen/console/console.c | 5 +- .../drivers/xen/evtchn/Makefile | 0 .../drivers/xen/evtchn/evtchn.c | 0 .../drivers/xen/netback/Makefile | 0 .../drivers/xen/netback/common.h | 0 .../drivers/xen/netback/control.c | 0 .../drivers/xen/netback/interface.c | 0 .../drivers/xen/netback/netback.c | 3 +- .../drivers/xen/netfront/Kconfig | 0 .../drivers/xen/netfront/Makefile | 0 .../drivers/xen/netfront/netfront.c | 0 .../drivers/xen/privcmd/Makefile | 0 .../drivers/xen/privcmd/privcmd.c | 0 .../include/asm-xen/asm-i386/desc.h | 4 +- .../include/asm-xen/asm-i386/dma-mapping.h | 3 + .../include/asm-xen/asm-i386/e820.h | 0 .../include/asm-xen/asm-i386/fixmap.h | 0 .../include/asm-xen/asm-i386/highmem.h | 0 .../include/asm-xen/asm-i386/io.h | 0 .../asm-xen/asm-i386/mach-xen/do_timer.h | 0 .../asm-xen/asm-i386/mach-xen/io_ports.h | 0 .../asm-xen/asm-i386/mach-xen/irq_vectors.h | 0 .../asm-xen/asm-i386/mach-xen/mach_mpspec.h | 5 - .../asm-xen/asm-i386/mach-xen/mach_reboot.h | 0 .../asm-i386/mach-xen/mach_resources.h | 0 .../asm-xen/asm-i386/mach-xen/mach_time.h | 0 .../asm-xen/asm-i386/mach-xen/mach_timer.h | 0 .../asm-xen/asm-i386/mach-xen/mach_traps.h | 0 .../asm-xen/asm-i386/mach-xen/pci-functions.h | 0 .../asm-i386/mach-xen/setup_arch_post.h | 4 +- .../asm-i386/mach-xen/setup_arch_pre.h | 2 +- .../include/asm-xen/asm-i386/mmu_context.h | 0 .../include/asm-xen/asm-i386/msr.h | 9 + .../include/asm-xen/asm-i386/page.h | 12 +- .../include/asm-xen/asm-i386/param.h | 1 + .../include/asm-xen/asm-i386/pci.h | 0 .../include/asm-xen/asm-i386/pgalloc.h | 0 .../asm-xen/asm-i386/pgtable-2level-defs.h | 21 ++ .../include/asm-xen/asm-i386/pgtable-2level.h | 33 ++- .../include/asm-xen/asm-i386/pgtable.h | 132 +++++++--- .../include/asm-xen/asm-i386/processor.h | 12 +- .../include/asm-xen/asm-i386/segment.h | 0 .../include/asm-xen/asm-i386/setup.h | 3 +- .../include/asm-xen/asm-i386/synch_bitops.h | 0 .../include/asm-xen/asm-i386/system.h | 7 - .../include/asm-xen/asm-i386/timer.h | 0 .../include/asm-xen/asm-i386/tlbflush.h | 0 .../include/asm-xen/asm-i386/vga.h | 0 .../include/asm-xen/asm-i386/xor.h | 0 .../include/asm-xen/ctrl_if.h | 0 .../include/asm-xen/evtchn.h | 0 .../include/asm-xen/hypervisor.h | 0 .../include/asm-xen/multicall.h | 0 .../include/asm-xen/proc_cmd.h | 0 .../include/asm-xen/queues.h | 0 .../include/asm-xen/suspend.h | 0 .../include/asm-xen/xen_proc.h | 0 .../include/linux/bio.h | 23 +- .../include/linux/page-flags.h | 17 +- .../include/linux/skbuff.h | 115 +++++++- .../mkbuildtree | 0 .../mm/page_alloc.c | 202 ++++++++------ 129 files changed, 1048 insertions(+), 474 deletions(-) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/Kconfig (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/Kconfig.drivers (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/Makefile (93%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/boot/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/configs/xen0_defconfig (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/configs/xenU_defconfig (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/Kconfig (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/Makefile (98%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/Makefile (98%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/cpu/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/cpu/common.c (98%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/entry.S (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/head.S (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/i386_ksyms.c (94%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/ioport.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/irq.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/ldt.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/pci-dma.c (97%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/process.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/setup.c (85%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/signal.c (96%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/sysenter.c (96%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/time.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/timers/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/timers/timer_tsc.c (98%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/traps.c (97%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/vmlinux.lds.S (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/vsyscall.S (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/kernel/vsyscall.lds (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/mm/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/mm/fault.c (88%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/mm/highmem.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/mm/hypervisor.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/mm/init.c (88%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/mm/ioremap.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/mm/pgtable.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/pci/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/pci/direct.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/i386/pci/irq.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/kernel/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/kernel/ctrl_if.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/kernel/empty.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/kernel/evtchn.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/kernel/fixup.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/kernel/process.c (89%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/kernel/reboot.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/kernel/xen_proc.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/Makefile (98%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/char/mem.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/char/tty_io.c (97%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkback/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkback/blkback.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkback/common.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkback/control.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkback/interface.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkback/vbd.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkfront/Kconfig (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkfront/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkfront/blkfront.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkfront/block.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/blkfront/vbd.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/console/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/console/console.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/evtchn/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/evtchn/evtchn.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/netback/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/netback/common.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/netback/control.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/netback/interface.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/netback/netback.c (99%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/netfront/Kconfig (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/netfront/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/netfront/netfront.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/privcmd/Makefile (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/drivers/xen/privcmd/privcmd.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/desc.h (96%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/dma-mapping.h (98%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/e820.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/fixmap.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/highmem.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/io.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/do_timer.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/io_ports.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/irq_vectors.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/mach_mpspec.h (60%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/mach_reboot.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/mach_resources.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/mach_time.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/mach_timer.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/mach_traps.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/pci-functions.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h (89%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h (62%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/mmu_context.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/msr.h (97%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/page.h (94%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/param.h (93%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/pci.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/pgalloc.h (100%) create mode 100644 linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level-defs.h rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/pgtable-2level.h (93%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/pgtable.h (82%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/processor.h (98%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/segment.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/setup.h (94%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/synch_bitops.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/system.h (98%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/timer.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/tlbflush.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/vga.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/asm-i386/xor.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/ctrl_if.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/evtchn.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/hypervisor.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/multicall.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/proc_cmd.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/queues.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/suspend.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/xen_proc.h (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/linux/bio.h (92%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/linux/page-flags.h (97%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/linux/skbuff.h (90%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/mkbuildtree (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/mm/page_alloc.c (92%) diff --git a/.rootkeys b/.rootkeys index 78f0158385..4ca6b9d437 100644 --- a/.rootkeys +++ b/.rootkeys @@ -125,130 +125,131 @@ 409ba2e7akOFqQUg6Qyg2s28xcXiMg linux-2.4.27-xen-sparse/mm/page_alloc.c 3e5a4e683HKVU-sxtagrDasRB8eBVw linux-2.4.27-xen-sparse/mm/swapfile.c 41180721bNns9Na7w1nJ0ZVt8bhUNA linux-2.4.27-xen-sparse/mm/vmalloc.c -40f562372u3A7_kfbYYixPHJJxYUxA linux-2.6.7-xen-sparse/arch/xen/Kconfig -40f56237utH41NPukqHksuNf29IC9A linux-2.6.7-xen-sparse/arch/xen/Kconfig.drivers -40f56237penAAlWVBVDpeQZNFIg8CA linux-2.6.7-xen-sparse/arch/xen/Makefile -40f56237JTc60m1FRlUxkUaGSQKrNw linux-2.6.7-xen-sparse/arch/xen/boot/Makefile -40f56237hRxbacU_3PdoAl6DjZ3Jnw linux-2.6.7-xen-sparse/arch/xen/configs/xen0_defconfig -40f56237wubfjJKlfIzZlI3ZM2VgGA linux-2.6.7-xen-sparse/arch/xen/configs/xenU_defconfig -40f56237Mta0yHNaMS_qtM2rge0qYA linux-2.6.7-xen-sparse/arch/xen/i386/Kconfig -40f56238u2CJdXNpjsZgHBxeVyY-2g linux-2.6.7-xen-sparse/arch/xen/i386/Makefile -40f56238eczveJ86k_4hNxCLRQIF-g linux-2.6.7-xen-sparse/arch/xen/i386/kernel/Makefile -40f56238rXVTJQKbBuXXLH52qEArcg linux-2.6.7-xen-sparse/arch/xen/i386/kernel/cpu/Makefile -40f562385s4lr6Zg92gExe7UQ4A76Q linux-2.6.7-xen-sparse/arch/xen/i386/kernel/cpu/common.c -40f56238XDtHSijkAFlbv1PT8Bhw_Q linux-2.6.7-xen-sparse/arch/xen/i386/kernel/entry.S -40f56238bnvciAuyzAiMkdzGErYt1A linux-2.6.7-xen-sparse/arch/xen/i386/kernel/head.S -40f58a0d31M2EkuPbG94ns_nOi0PVA linux-2.6.7-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c -40faa751_zbZlAmLyQgCXdYekVFdWA linux-2.6.7-xen-sparse/arch/xen/i386/kernel/ioport.c -40f562382aC3_Gt4RG-4ZsfvDRUg3Q linux-2.6.7-xen-sparse/arch/xen/i386/kernel/irq.c -40f56238ue3YRsK52HG7iccNzP1AwQ linux-2.6.7-xen-sparse/arch/xen/i386/kernel/ldt.c -4107adf1cNtsuOxOB4T6paAoY2R2PA linux-2.6.7-xen-sparse/arch/xen/i386/kernel/pci-dma.c -40f56238a8iOVDEoostsbun_sy2i4g linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c -40f56238YQIJoYG2ehDGEcdTgLmGbg linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c -40f56238nWMQg7CKbyTy0KJNvCzbtg linux-2.6.7-xen-sparse/arch/xen/i386/kernel/signal.c -40f56238UL9uv78ODDzMwLL9yryeFw linux-2.6.7-xen-sparse/arch/xen/i386/kernel/sysenter.c -40f56238qVGkpO_ycnQA8k03kQzAgA linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c -40f56238NzTgeO63RGoxHrW5NQeO3Q linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/Makefile -40f56238BMqG5PuSHufpjbvp_helBw linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c -40f562389xNa78YBZciUibQjyRU_Lg linux-2.6.7-xen-sparse/arch/xen/i386/kernel/traps.c -40f56238qASEI_IOhCKWNuwFKNZrKQ linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vmlinux.lds.S -40f56238JypKAUG01ZojFwH7qnZ5uA linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vsyscall.S -40f56238wi6AdNQjm0RT57bSkwb6hg linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vsyscall.lds -40f56238a3w6-byOzexIlMgni76Lcg linux-2.6.7-xen-sparse/arch/xen/i386/mm/Makefile -40f56238ILx8xlbywNbzTdv5Zr4xXQ linux-2.6.7-xen-sparse/arch/xen/i386/mm/fault.c -4118cc35CbY8rfGVspF5O-7EkXBEAA linux-2.6.7-xen-sparse/arch/xen/i386/mm/highmem.c -40f562383SKvDStdtrvzr5fyCbW4rw linux-2.6.7-xen-sparse/arch/xen/i386/mm/hypervisor.c -40f56239xcNylAxuGsQHwi1AyMLV8w linux-2.6.7-xen-sparse/arch/xen/i386/mm/init.c -41062ab7CjxC1UBaFhOMWWdhHkIUyg linux-2.6.7-xen-sparse/arch/xen/i386/mm/ioremap.c -40f5623906UYHv1rsVUeRc0tFT0dWw linux-2.6.7-xen-sparse/arch/xen/i386/mm/pgtable.c -4107adf12ndy94MidCaivDibJ3pPAg linux-2.6.7-xen-sparse/arch/xen/i386/pci/Makefile -4107adf1WcCgkhsdLTRGX52cOG1vJg linux-2.6.7-xen-sparse/arch/xen/i386/pci/direct.c -4107adf1s5u6249DNPUViX1YNagbUQ linux-2.6.7-xen-sparse/arch/xen/i386/pci/irq.c -40f56239zOksGg_H4XD4ye6iZNtoZA linux-2.6.7-xen-sparse/arch/xen/kernel/Makefile -40f56239bvOjuuuViZ0XMlNiREFC0A linux-2.6.7-xen-sparse/arch/xen/kernel/ctrl_if.c -40f56239pYRq5yshPTkv3ujXKc8K6g linux-2.6.7-xen-sparse/arch/xen/kernel/empty.c -40f56238xFQe9T7M_U_FItM-bZIpLw linux-2.6.7-xen-sparse/arch/xen/kernel/evtchn.c -4110f478aeQWllIN7J4kouAHiAqrPw linux-2.6.7-xen-sparse/arch/xen/kernel/fixup.c -40f56239sFcjHiIRmnObRIDF-zaeKQ linux-2.6.7-xen-sparse/arch/xen/kernel/process.c -40f562392LBhwmOxVPsYdkYXMxI_ZQ linux-2.6.7-xen-sparse/arch/xen/kernel/reboot.c -3f68905c5eiA-lBMQSvXLMWS1ikDEA linux-2.6.7-xen-sparse/arch/xen/kernel/xen_proc.c -41261688yS8eAyy-7kzG4KBs0xbYCA linux-2.6.7-xen-sparse/drivers/Makefile -4108f5c1WfTIrs0HZFeV39sttekCTw linux-2.6.7-xen-sparse/drivers/char/mem.c -4111308bZAIzwf_Kzu6x1TZYZ3E0_Q linux-2.6.7-xen-sparse/drivers/char/tty_io.c -40f56239Dp_vMTgz8TEbvo1hjHGc3w linux-2.6.7-xen-sparse/drivers/xen/Makefile -410d0893otFGghmv4dUXDUBBdY5aIA linux-2.6.7-xen-sparse/drivers/xen/blkback/Makefile -4087cf0d1XgMkooTZAiJS6NrcpLQNQ linux-2.6.7-xen-sparse/drivers/xen/blkback/blkback.c -4087cf0dZadZ8r6CEt4fNN350Yle3A linux-2.6.7-xen-sparse/drivers/xen/blkback/common.h -4087cf0dxlh29iw0w-9rxOCEGCjPcw linux-2.6.7-xen-sparse/drivers/xen/blkback/control.c -4087cf0dbuoH20fMjNZjcgrRK-1msQ linux-2.6.7-xen-sparse/drivers/xen/blkback/interface.c -4087cf0dk97tacDzxfByWV7JifUYqA linux-2.6.7-xen-sparse/drivers/xen/blkback/vbd.c -40f56239Sfle6wGv5FS0wjS_HI150A linux-2.6.7-xen-sparse/drivers/xen/blkfront/Kconfig -40f562395atl9x4suKGhPkjqLOXESg linux-2.6.7-xen-sparse/drivers/xen/blkfront/Makefile -40f56239-JNIaTzlviVJohVdoYOUpw linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c -40f56239y9naBTXe40Pi2J_z3p-d1g linux-2.6.7-xen-sparse/drivers/xen/blkfront/block.h -40f56239BVfPsXBiWQitXgDRtOsiqg linux-2.6.7-xen-sparse/drivers/xen/blkfront/vbd.c -40f56239fsLjvtD8YBRAWphps4FDjg linux-2.6.7-xen-sparse/drivers/xen/console/Makefile -3e5a4e651TH-SXHoufurnWjgl5bfOA linux-2.6.7-xen-sparse/drivers/xen/console/console.c -40f56239KYxO0YabhPzCTeUuln-lnA linux-2.6.7-xen-sparse/drivers/xen/evtchn/Makefile -40f56239DoibTX6R-ZYd3QTXAB8_TA linux-2.6.7-xen-sparse/drivers/xen/evtchn/evtchn.c -410a9817HEVJvred5Oy_uKH3HFJC5Q linux-2.6.7-xen-sparse/drivers/xen/netback/Makefile -4097ba831lpGeLlPg-bfV8XarVVuoQ linux-2.6.7-xen-sparse/drivers/xen/netback/common.h -4097ba83wvv8yi5P5xugCUBAdb6O-A linux-2.6.7-xen-sparse/drivers/xen/netback/control.c -4097ba83byY5bTSugJGZ1exTxIcMKw linux-2.6.7-xen-sparse/drivers/xen/netback/interface.c -4087cf0dGmSbFhFZyIZBJzvqxY-qBw linux-2.6.7-xen-sparse/drivers/xen/netback/netback.c -40f56239lrg_Ob0BJ8WBFS1zeg2CYw linux-2.6.7-xen-sparse/drivers/xen/netfront/Kconfig -40f56239Wd4k_ycG_mFsSO1r5xKdtQ linux-2.6.7-xen-sparse/drivers/xen/netfront/Makefile -405853f6nbeazrNyEWNHBuoSg2PiPA linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c -4108f5c1ppFXVpQzCOAZ6xXYubsjKA linux-2.6.7-xen-sparse/drivers/xen/privcmd/Makefile -3e5a4e65IUfzzMu2kZFlGEB8-rpTaA linux-2.6.7-xen-sparse/drivers/xen/privcmd/privcmd.c -40f56239YAjS52QG2FIAQpHDZAdGHg linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/desc.h -4107adf1E5O4ztGHNGMzCCNhcvqNow linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h -40f5623anSzpuEHgiNmQ56fIRfCoaQ linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/e820.h -40f5623akIoBsQ3KxSB2kufkbgONXQ linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/fixmap.h -4118b6a418gnL6AZsTdglC92YGqYTg linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/highmem.h -40f5623aJVXQwpJMOLE99XgvGsfQ8Q linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/io.h -40f5623am9BzluYFuV6EQfTd-so3dA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/do_timer.h -40f5623adZQ1IZGPxbDXONjyZGYuTA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/io_ports.h -40f5623aKXkBBxgpLx2NcvkncQ1Yyw linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h -40f5623aMQZoYuf4ml9v69N3gu8ing linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_mpspec.h -40f5623a8LroVMnZ5YRzJJmIc-zHlw linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_reboot.h -40f5623an3wOvFKmpIvqSxQfWzklVQ linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_resources.h -40f5623ayR1vnzfF__htza35a8Ft-g linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_time.h -40f5623a4YdRdVzYWJzOOoqe8mnrXA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_timer.h -40f5623aDLxmbOtUHvkWztKjAO4EjA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_traps.h -41062ab7HMSSuaUv3_Z4agLpjSO88A linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/pci-functions.h -40f5623aDMCsWOFO0jktZ4e8sjwvEg linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h -40f5623arsFXkGdPvIqvFi3yFXGR0Q linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h -4120f807GCO0uqsLqdZj9csxR1Wthw linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h -40f5623aFTyFTR-vdiA-KaGxk5JOKQ linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/msr.h -40f5623adgjZq9nAgCt0IXdWl7udSA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/page.h -40f5623a54NuG-7qHihGYmw4wWQnMA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/param.h -41137cc1kkvg0cg7uxddcEfjL7L67w linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pci.h -40f5623atCokYc2uCysSJ8jFO8TEsw linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgalloc.h -40f5623aEToIXouJgO-ao5d5pcEt1w linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h -40f5623aCCXRPlGpNthVXstGz9ZV3A linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable.h -40f5623aPCkQQfPtJSooGdhcatrvnQ linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h -40f5623bzLvxr7WoJIxVf2OH4rCBJg linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/segment.h -40f5623bG_LzgG6-qwk292nTc5Wabw linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/setup.h -40f5623bgzm_9vwxpzJswlAxg298Gg linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h -40f5623bVdKP7Dt7qm8twu3NcnGNbA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/system.h -40f5623bSgGrvrGRpD71K-lIYqaGgg linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/timer.h -40f5623bc8LKPRO09wY5dGDnY_YCpw linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/tlbflush.h -41062ab7uFxnCq-KtPeAm-aV8CicgA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/vga.h -40f5623bxUbeGjkRrjDguCy_Gm8RLw linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/xor.h -40f5623bYNP7tHE2zX6YQxp9Zq2utQ linux-2.6.7-xen-sparse/include/asm-xen/ctrl_if.h -40f5623b3Eqs8pAc5WpPX8_jTzV2qw linux-2.6.7-xen-sparse/include/asm-xen/evtchn.h -40f5623aGPlsm0u1LTO-NVZ6AGzNRQ linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h -40f5623cndVUFlkxpf7Lfx7xu8madQ linux-2.6.7-xen-sparse/include/asm-xen/multicall.h -3f108af1ylCIm82H052FVTfXACBHrw linux-2.6.7-xen-sparse/include/asm-xen/proc_cmd.h -4122466356eIBnC9ot44WSVVIFyhQA linux-2.6.7-xen-sparse/include/asm-xen/queues.h -3fa8e3f0kBLeE4To2vpdi3cpJbIkbQ linux-2.6.7-xen-sparse/include/asm-xen/suspend.h -3f689063BoW-HWV3auUJ-OqXfcGArw linux-2.6.7-xen-sparse/include/asm-xen/xen_proc.h -4124d8c4aocX7A-jIbuGraWN84pxGQ linux-2.6.7-xen-sparse/include/linux/bio.h -4124f66fp5QwbDHEfoUIa7pqO5Xhag linux-2.6.7-xen-sparse/include/linux/page-flags.h -4124f66f4NaKNa0xPiGGykn9QaZk3w linux-2.6.7-xen-sparse/include/linux/skbuff.h -40f56a0ddHCSs3501MY4hRf22tctOw linux-2.6.7-xen-sparse/mkbuildtree -410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.7-xen-sparse/mm/page_alloc.c +40f562372u3A7_kfbYYixPHJJxYUxA linux-2.6.8.1-xen-sparse/arch/xen/Kconfig +40f56237utH41NPukqHksuNf29IC9A linux-2.6.8.1-xen-sparse/arch/xen/Kconfig.drivers +40f56237penAAlWVBVDpeQZNFIg8CA linux-2.6.8.1-xen-sparse/arch/xen/Makefile +40f56237JTc60m1FRlUxkUaGSQKrNw linux-2.6.8.1-xen-sparse/arch/xen/boot/Makefile +40f56237hRxbacU_3PdoAl6DjZ3Jnw linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig +40f56237wubfjJKlfIzZlI3ZM2VgGA linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig +40f56237Mta0yHNaMS_qtM2rge0qYA linux-2.6.8.1-xen-sparse/arch/xen/i386/Kconfig +40f56238u2CJdXNpjsZgHBxeVyY-2g linux-2.6.8.1-xen-sparse/arch/xen/i386/Makefile +40f56238eczveJ86k_4hNxCLRQIF-g linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/Makefile +40f56238rXVTJQKbBuXXLH52qEArcg linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/Makefile +40f562385s4lr6Zg92gExe7UQ4A76Q linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/common.c +40f56238XDtHSijkAFlbv1PT8Bhw_Q linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/entry.S +40f56238bnvciAuyzAiMkdzGErYt1A linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/head.S +40f58a0d31M2EkuPbG94ns_nOi0PVA linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c +40faa751_zbZlAmLyQgCXdYekVFdWA linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ioport.c +40f562382aC3_Gt4RG-4ZsfvDRUg3Q linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/irq.c +40f56238ue3YRsK52HG7iccNzP1AwQ linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ldt.c +4107adf1cNtsuOxOB4T6paAoY2R2PA linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/pci-dma.c +40f56238a8iOVDEoostsbun_sy2i4g linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/process.c +40f56238YQIJoYG2ehDGEcdTgLmGbg linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/setup.c +40f56238nWMQg7CKbyTy0KJNvCzbtg linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/signal.c +40f56238UL9uv78ODDzMwLL9yryeFw linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/sysenter.c +40f56238qVGkpO_ycnQA8k03kQzAgA linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c +40f56238NzTgeO63RGoxHrW5NQeO3Q linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/Makefile +40f56238BMqG5PuSHufpjbvp_helBw linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c +40f562389xNa78YBZciUibQjyRU_Lg linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/traps.c +40f56238qASEI_IOhCKWNuwFKNZrKQ linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/vmlinux.lds.S +40f56238JypKAUG01ZojFwH7qnZ5uA linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/vsyscall.S +40f56238wi6AdNQjm0RT57bSkwb6hg linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/vsyscall.lds +40f56238a3w6-byOzexIlMgni76Lcg linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/Makefile +40f56238ILx8xlbywNbzTdv5Zr4xXQ linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/fault.c +4118cc35CbY8rfGVspF5O-7EkXBEAA linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/highmem.c +40f562383SKvDStdtrvzr5fyCbW4rw linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/hypervisor.c +40f56239xcNylAxuGsQHwi1AyMLV8w linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/init.c +41062ab7CjxC1UBaFhOMWWdhHkIUyg linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c +40f5623906UYHv1rsVUeRc0tFT0dWw linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c +4107adf12ndy94MidCaivDibJ3pPAg linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/Makefile +4107adf1WcCgkhsdLTRGX52cOG1vJg linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/direct.c +4107adf1s5u6249DNPUViX1YNagbUQ linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/irq.c +40f56239zOksGg_H4XD4ye6iZNtoZA linux-2.6.8.1-xen-sparse/arch/xen/kernel/Makefile +40f56239bvOjuuuViZ0XMlNiREFC0A linux-2.6.8.1-xen-sparse/arch/xen/kernel/ctrl_if.c +40f56239pYRq5yshPTkv3ujXKc8K6g linux-2.6.8.1-xen-sparse/arch/xen/kernel/empty.c +40f56238xFQe9T7M_U_FItM-bZIpLw linux-2.6.8.1-xen-sparse/arch/xen/kernel/evtchn.c +4110f478aeQWllIN7J4kouAHiAqrPw linux-2.6.8.1-xen-sparse/arch/xen/kernel/fixup.c +40f56239sFcjHiIRmnObRIDF-zaeKQ linux-2.6.8.1-xen-sparse/arch/xen/kernel/process.c +40f562392LBhwmOxVPsYdkYXMxI_ZQ linux-2.6.8.1-xen-sparse/arch/xen/kernel/reboot.c +3f68905c5eiA-lBMQSvXLMWS1ikDEA linux-2.6.8.1-xen-sparse/arch/xen/kernel/xen_proc.c +41261688yS8eAyy-7kzG4KBs0xbYCA linux-2.6.8.1-xen-sparse/drivers/Makefile +4108f5c1WfTIrs0HZFeV39sttekCTw linux-2.6.8.1-xen-sparse/drivers/char/mem.c +4111308bZAIzwf_Kzu6x1TZYZ3E0_Q linux-2.6.8.1-xen-sparse/drivers/char/tty_io.c +40f56239Dp_vMTgz8TEbvo1hjHGc3w linux-2.6.8.1-xen-sparse/drivers/xen/Makefile +410d0893otFGghmv4dUXDUBBdY5aIA linux-2.6.8.1-xen-sparse/drivers/xen/blkback/Makefile +4087cf0d1XgMkooTZAiJS6NrcpLQNQ linux-2.6.8.1-xen-sparse/drivers/xen/blkback/blkback.c +4087cf0dZadZ8r6CEt4fNN350Yle3A linux-2.6.8.1-xen-sparse/drivers/xen/blkback/common.h +4087cf0dxlh29iw0w-9rxOCEGCjPcw linux-2.6.8.1-xen-sparse/drivers/xen/blkback/control.c +4087cf0dbuoH20fMjNZjcgrRK-1msQ linux-2.6.8.1-xen-sparse/drivers/xen/blkback/interface.c +4087cf0dk97tacDzxfByWV7JifUYqA linux-2.6.8.1-xen-sparse/drivers/xen/blkback/vbd.c +40f56239Sfle6wGv5FS0wjS_HI150A linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/Kconfig +40f562395atl9x4suKGhPkjqLOXESg linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/Makefile +40f56239-JNIaTzlviVJohVdoYOUpw linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c +40f56239y9naBTXe40Pi2J_z3p-d1g linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/block.h +40f56239BVfPsXBiWQitXgDRtOsiqg linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/vbd.c +40f56239fsLjvtD8YBRAWphps4FDjg linux-2.6.8.1-xen-sparse/drivers/xen/console/Makefile +3e5a4e651TH-SXHoufurnWjgl5bfOA linux-2.6.8.1-xen-sparse/drivers/xen/console/console.c +40f56239KYxO0YabhPzCTeUuln-lnA linux-2.6.8.1-xen-sparse/drivers/xen/evtchn/Makefile +40f56239DoibTX6R-ZYd3QTXAB8_TA linux-2.6.8.1-xen-sparse/drivers/xen/evtchn/evtchn.c +410a9817HEVJvred5Oy_uKH3HFJC5Q linux-2.6.8.1-xen-sparse/drivers/xen/netback/Makefile +4097ba831lpGeLlPg-bfV8XarVVuoQ linux-2.6.8.1-xen-sparse/drivers/xen/netback/common.h +4097ba83wvv8yi5P5xugCUBAdb6O-A linux-2.6.8.1-xen-sparse/drivers/xen/netback/control.c +4097ba83byY5bTSugJGZ1exTxIcMKw linux-2.6.8.1-xen-sparse/drivers/xen/netback/interface.c +4087cf0dGmSbFhFZyIZBJzvqxY-qBw linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c +40f56239lrg_Ob0BJ8WBFS1zeg2CYw linux-2.6.8.1-xen-sparse/drivers/xen/netfront/Kconfig +40f56239Wd4k_ycG_mFsSO1r5xKdtQ linux-2.6.8.1-xen-sparse/drivers/xen/netfront/Makefile +405853f6nbeazrNyEWNHBuoSg2PiPA linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c +4108f5c1ppFXVpQzCOAZ6xXYubsjKA linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/Makefile +3e5a4e65IUfzzMu2kZFlGEB8-rpTaA linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/privcmd.c +40f56239YAjS52QG2FIAQpHDZAdGHg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/desc.h +4107adf1E5O4ztGHNGMzCCNhcvqNow linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h +40f5623anSzpuEHgiNmQ56fIRfCoaQ linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/e820.h +40f5623akIoBsQ3KxSB2kufkbgONXQ linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/fixmap.h +4118b6a418gnL6AZsTdglC92YGqYTg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/highmem.h +40f5623aJVXQwpJMOLE99XgvGsfQ8Q linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/io.h +40f5623am9BzluYFuV6EQfTd-so3dA linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/do_timer.h +40f5623adZQ1IZGPxbDXONjyZGYuTA linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/io_ports.h +40f5623aKXkBBxgpLx2NcvkncQ1Yyw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h +40f5623aMQZoYuf4ml9v69N3gu8ing linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_mpspec.h +40f5623a8LroVMnZ5YRzJJmIc-zHlw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_reboot.h +40f5623an3wOvFKmpIvqSxQfWzklVQ linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_resources.h +40f5623ayR1vnzfF__htza35a8Ft-g linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_time.h +40f5623a4YdRdVzYWJzOOoqe8mnrXA linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_timer.h +40f5623aDLxmbOtUHvkWztKjAO4EjA linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_traps.h +41062ab7HMSSuaUv3_Z4agLpjSO88A linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/pci-functions.h +40f5623aDMCsWOFO0jktZ4e8sjwvEg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h +40f5623arsFXkGdPvIqvFi3yFXGR0Q linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h +4120f807GCO0uqsLqdZj9csxR1Wthw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mmu_context.h +40f5623aFTyFTR-vdiA-KaGxk5JOKQ linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/msr.h +40f5623adgjZq9nAgCt0IXdWl7udSA linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/page.h +40f5623a54NuG-7qHihGYmw4wWQnMA linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/param.h +41137cc1kkvg0cg7uxddcEfjL7L67w linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pci.h +40f5623atCokYc2uCysSJ8jFO8TEsw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h +412e01beTwiaC8sYY4XJP8PxLST5CA linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level-defs.h +40f5623aEToIXouJgO-ao5d5pcEt1w linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h +40f5623aCCXRPlGpNthVXstGz9ZV3A linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h +40f5623aPCkQQfPtJSooGdhcatrvnQ linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/processor.h +40f5623bzLvxr7WoJIxVf2OH4rCBJg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/segment.h +40f5623bG_LzgG6-qwk292nTc5Wabw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/setup.h +40f5623bgzm_9vwxpzJswlAxg298Gg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h +40f5623bVdKP7Dt7qm8twu3NcnGNbA linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/system.h +40f5623bSgGrvrGRpD71K-lIYqaGgg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/timer.h +40f5623bc8LKPRO09wY5dGDnY_YCpw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/tlbflush.h +41062ab7uFxnCq-KtPeAm-aV8CicgA linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/vga.h +40f5623bxUbeGjkRrjDguCy_Gm8RLw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/xor.h +40f5623bYNP7tHE2zX6YQxp9Zq2utQ linux-2.6.8.1-xen-sparse/include/asm-xen/ctrl_if.h +40f5623b3Eqs8pAc5WpPX8_jTzV2qw linux-2.6.8.1-xen-sparse/include/asm-xen/evtchn.h +40f5623aGPlsm0u1LTO-NVZ6AGzNRQ linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h +40f5623cndVUFlkxpf7Lfx7xu8madQ linux-2.6.8.1-xen-sparse/include/asm-xen/multicall.h +3f108af1ylCIm82H052FVTfXACBHrw linux-2.6.8.1-xen-sparse/include/asm-xen/proc_cmd.h +4122466356eIBnC9ot44WSVVIFyhQA linux-2.6.8.1-xen-sparse/include/asm-xen/queues.h +3fa8e3f0kBLeE4To2vpdi3cpJbIkbQ linux-2.6.8.1-xen-sparse/include/asm-xen/suspend.h +3f689063BoW-HWV3auUJ-OqXfcGArw linux-2.6.8.1-xen-sparse/include/asm-xen/xen_proc.h +4124d8c4aocX7A-jIbuGraWN84pxGQ linux-2.6.8.1-xen-sparse/include/linux/bio.h +4124f66fp5QwbDHEfoUIa7pqO5Xhag linux-2.6.8.1-xen-sparse/include/linux/page-flags.h +4124f66f4NaKNa0xPiGGykn9QaZk3w linux-2.6.8.1-xen-sparse/include/linux/skbuff.h +40f56a0ddHCSs3501MY4hRf22tctOw linux-2.6.8.1-xen-sparse/mkbuildtree +410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.8.1-xen-sparse/mm/page_alloc.c 40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Make.defs 3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile 4124b307nRyK3dhn1hAsvrY76NuV3g tools/check/Makefile diff --git a/linux-2.4.27-xen-sparse/include/asm-xen/irq.h b/linux-2.4.27-xen-sparse/include/asm-xen/irq.h index 668195e9ca..45e12cbde1 100644 --- a/linux-2.4.27-xen-sparse/include/asm-xen/irq.h +++ b/linux-2.4.27-xen-sparse/include/asm-xen/irq.h @@ -56,4 +56,7 @@ extern void enable_irq(unsigned int); extern void irq_suspend(void); extern void irq_resume(void); + +#define CPU_MASK_NONE 0 + #endif /* _ASM_IRQ_H */ diff --git a/linux-2.4.27-xen-sparse/include/linux/mm.h b/linux-2.4.27-xen-sparse/include/linux/mm.h index b24c6d6163..523bcffd53 100644 --- a/linux-2.4.27-xen-sparse/include/linux/mm.h +++ b/linux-2.4.27-xen-sparse/include/linux/mm.h @@ -332,7 +332,10 @@ typedef struct page { /* A foreign page uses a custom destructor rather than the buddy allocator. */ #ifdef CONFIG_FOREIGN_PAGES #define PageForeign(page) test_bit(PG_foreign, &(page)->flags) -#define SetPageForeign(page) set_bit(PG_foreign, &(page)->flags) +#define SetPageForeign(page, dtor) do { \ + set_bit(PG_foreign, &(page)->flags); \ + (page)->mapping = (void *)dtor; \ +} while (0) #define ClearPageForeign(page) clear_bit(PG_foreign, &(page)->flags) #define PageForeignDestructor(page) \ ( (void (*) (struct page *)) (page)->mapping ) diff --git a/linux-2.4.27-xen-sparse/mkbuildtree b/linux-2.4.27-xen-sparse/mkbuildtree index ca407be27d..3dec55c7bd 100755 --- a/linux-2.4.27-xen-sparse/mkbuildtree +++ b/linux-2.4.27-xen-sparse/mkbuildtree @@ -78,7 +78,7 @@ relative_lndir () # Get absolute path to the destination directory pushd . >/dev/null -cd ${1} +cd ${1} || { echo "cannot cd to ${1}"; exit 1; } AD=$PWD popd >/dev/null @@ -93,7 +93,7 @@ RS=$DESTPATH for i in `find . -type f -o -type l` ; do rm -f ${AD}/${i#./} ; done # We now work from the destination directory -cd ${AD} +cd ${AD} || { echo "cannot cd to ${AD}"; exit 1; } # Remove old symlinks for i in `find . -type l`; do rm -f $i; done @@ -102,7 +102,9 @@ for i in `find . -type l`; do rm -f $i; done relative_lndir ${RS} rm -f mkbuildtree -LINUX_26=${RS}/../linux-2.6.7-xen-sparse +set ${RS}/../linux-2.6.*-xen-sparse +[ "$1" == "${RS}/../linux-2.6.*-xen-parse" ] && { echo "no Linux 2.6 sparse tree at ${RS}/../linux-2.6.*-xen-sparse"; exit 1; } +LINUX_26="$1" # Create links to the shared definitions of the hypervisor interface diff --git a/linux-2.6.7-xen-sparse/arch/xen/Kconfig b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/Kconfig rename to linux-2.6.8.1-xen-sparse/arch/xen/Kconfig diff --git a/linux-2.6.7-xen-sparse/arch/xen/Kconfig.drivers b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig.drivers similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/Kconfig.drivers rename to linux-2.6.8.1-xen-sparse/arch/xen/Kconfig.drivers diff --git a/linux-2.6.7-xen-sparse/arch/xen/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/Makefile similarity index 93% rename from linux-2.6.7-xen-sparse/arch/xen/Makefile rename to linux-2.6.8.1-xen-sparse/arch/xen/Makefile index e3772803d3..e6d2270de2 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/Makefile +++ b/linux-2.6.8.1-xen-sparse/arch/xen/Makefile @@ -12,7 +12,8 @@ # Copyright (C) 2004 by Christian Limpach # -override EXTRAVERSION:=$(subst linux-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL),,$(shell basename $(TOPDIR)))$(EXTRAVERSION) +EXTRAEXTRAVERSION=$(subst $(findstring $(EXTRAVERSION),$(shell basename $(TOPDIR))),,$(EXTRAVERSION)) +override EXTRAVERSION:=$(subst linux-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL),,$(shell basename $(TOPDIR)))$(EXTRAEXTRAVERSION) XENARCH := $(subst ",,$(CONFIG_XENARCH)) diff --git a/linux-2.6.7-xen-sparse/arch/xen/boot/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/boot/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/boot/Makefile rename to linux-2.6.8.1-xen-sparse/arch/xen/boot/Makefile diff --git a/linux-2.6.7-xen-sparse/arch/xen/configs/xen0_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/configs/xen0_defconfig rename to linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig diff --git a/linux-2.6.7-xen-sparse/arch/xen/configs/xenU_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/configs/xenU_defconfig rename to linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/Kconfig b/linux-2.6.8.1-xen-sparse/arch/xen/i386/Kconfig similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/Kconfig rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/Kconfig diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/i386/Makefile similarity index 98% rename from linux-2.6.7-xen-sparse/arch/xen/i386/Makefile rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/Makefile index aa0870f67b..a95f970f01 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/Makefile +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/Makefile @@ -68,7 +68,8 @@ head-y := arch/xen/i386/kernel/head.o arch/xen/i386/kernel/init_task.o libs-y += arch/i386/lib/ core-y += arch/xen/i386/kernel/ \ - arch/xen/i386/mm/ + arch/xen/i386/mm/ \ + arch/i386/crypto/ # \ # arch/xen/$(mcore-y)/ drivers-$(CONFIG_MATH_EMULATION) += arch/i386/math-emu/ diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/Makefile similarity index 98% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/Makefile rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/Makefile index c991148dda..dd230469d1 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/Makefile +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/Makefile @@ -40,7 +40,6 @@ c-obj-$(CONFIG_ACPI_SRAT) += srat.o c-obj-$(CONFIG_HPET_TIMER) += time_hpet.o c-obj-$(CONFIG_EFI) += efi.o efi_stub.o c-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -c-obj-$(CONFIG_X86_STD_RESOURCES) += std_resources.o EXTRA_AFLAGS := -traditional diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/cpu/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/cpu/Makefile rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/Makefile diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/cpu/common.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/common.c similarity index 98% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/cpu/common.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/common.c index 2a659872ba..6620406951 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/cpu/common.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/cpu/common.c @@ -330,7 +330,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c) generic_identify(c); - printk(KERN_DEBUG "CPU: After generic identify, caps: %08lx %08lx %08lx %08lx\n", + printk(KERN_DEBUG "CPU: After generic identify, caps: %08lx %08lx %08lx %08lx\n", c->x86_capability[0], c->x86_capability[1], c->x86_capability[2], @@ -339,7 +339,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c) if (this_cpu->c_identify) { this_cpu->c_identify(c); - printk(KERN_DEBUG "CPU: After vendor identify, caps: %08lx %08lx %08lx %08lx\n", + printk(KERN_DEBUG "CPU: After vendor identify, caps: %08lx %08lx %08lx %08lx\n", c->x86_capability[0], c->x86_capability[1], c->x86_capability[2], @@ -394,7 +394,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c) /* Now the feature flags better reflect actual CPU features! */ - printk(KERN_DEBUG "CPU: After all inits, caps: %08lx %08lx %08lx %08lx\n", + printk(KERN_DEBUG "CPU: After all inits, caps: %08lx %08lx %08lx %08lx\n", c->x86_capability[0], c->x86_capability[1], c->x86_capability[2], @@ -474,7 +474,6 @@ void early_cpu_detect(void); void __init early_cpu_init(void) { - early_cpu_detect(); intel_cpu_init(); cyrix_init_cpu(); nsc_init_cpu(); @@ -484,6 +483,7 @@ void __init early_cpu_init(void) rise_init_cpu(); nexgen_init_cpu(); umc_init_cpu(); + early_cpu_detect(); #ifdef CONFIG_DEBUG_PAGEALLOC /* pse is not compatible with on-the-fly unmapping, diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/entry.S b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/entry.S similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/entry.S rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/entry.S diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/head.S b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/head.S similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/head.S rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/head.S diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c similarity index 94% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c index 11f2eff9ab..b598dcf360 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -175,24 +174,15 @@ EXPORT_SYMBOL(rtc_lock); EXPORT_SYMBOL_GPL(set_nmi_callback); EXPORT_SYMBOL_GPL(unset_nmi_callback); - -#undef memcpy -#undef memset + #undef memcmp -extern void * memset(void *,int,__kernel_size_t); -extern void * memcpy(void *,const void *,__kernel_size_t); extern int memcmp(const void *,const void *,__kernel_size_t); -EXPORT_SYMBOL_NOVERS(memcpy); -EXPORT_SYMBOL_NOVERS(memset); EXPORT_SYMBOL_NOVERS(memcmp); #ifdef CONFIG_HAVE_DEC_LOCK EXPORT_SYMBOL(atomic_dec_and_lock); #endif -extern int is_sony_vaio_laptop; -EXPORT_SYMBOL(is_sony_vaio_laptop); - EXPORT_SYMBOL(__PAGE_KERNEL); #ifdef CONFIG_HIGHMEM diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/ioport.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ioport.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/ioport.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ioport.c diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/irq.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/irq.c similarity index 99% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/irq.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/irq.c index b79c689474..758245e28e 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/irq.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/irq.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -652,7 +651,7 @@ int request_irq(unsigned int irq, action->handler = handler; action->flags = irqflags; - action->mask = 0; + cpus_clear(action->mask); action->name = devname; action->next = NULL; action->dev_id = dev_id; @@ -1098,7 +1097,7 @@ void init_irq_proc (void) int i; /* create /proc/irq */ - root_irq_dir = proc_mkdir("irq", 0); + root_irq_dir = proc_mkdir("irq", NULL); /* create /proc/irq/prof_cpu_mask */ entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir); @@ -1120,8 +1119,12 @@ void init_irq_proc (void) #ifdef CONFIG_4KSTACKS -static char softirq_stack[NR_CPUS * THREAD_SIZE] __attribute__((__aligned__(THREAD_SIZE), __section__(".bss.page_aligned"))); -static char hardirq_stack[NR_CPUS * THREAD_SIZE] __attribute__((__aligned__(THREAD_SIZE), __section__(".bss.page_aligned"))); +/* + * These should really be __section__(".bss.page_aligned") as well, but + * gcc's 3.0 and earlier don't handle that correctly. + */ +static char softirq_stack[NR_CPUS * THREAD_SIZE] __attribute__((__aligned__(THREAD_SIZE))); +static char hardirq_stack[NR_CPUS * THREAD_SIZE] __attribute__((__aligned__(THREAD_SIZE))); /* * allocate per-cpu stacks for hardirq and for softirq processing diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/ldt.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ldt.c similarity index 99% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/ldt.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ldt.c index 0c6332ce6b..9899654926 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/ldt.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ldt.c @@ -66,7 +66,7 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) #ifdef CONFIG_SMP mask = cpumask_of_cpu(smp_processor_id()); if (!cpus_equal(current->mm->cpu_vm_mask, mask)) - smp_call_function(flush_ldt, 0, 1, 1); + smp_call_function(flush_ldt, NULL, 1, 1); preempt_enable(); #endif } diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/pci-dma.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/pci-dma.c similarity index 97% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/pci-dma.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/pci-dma.c index 46702c5795..6135d057b2 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/pci-dma.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/pci-dma.c @@ -40,7 +40,8 @@ void *dma_alloc_coherent(struct device *dev, size_t size, gfp |= GFP_DMA; #endif - ret = (void *)vstart = __get_free_pages(gfp, order); + vstart = __get_free_pages(gfp, order); + ret = (void *)vstart; if (ret == NULL) return ret; diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/process.c similarity index 99% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/process.c index f519ba1c5e..11cba27734 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/process.c @@ -344,7 +344,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp, unsigned long eflags; childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; - struct_cpy(childregs, regs); + *childregs = *regs; childregs->eax = 0; childregs->esp = esp; p->set_child_tid = p->clear_child_tid = NULL; diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/setup.c similarity index 85% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/setup.c index e2999268a7..1a1c3376d9 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/setup.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/setup.c @@ -47,14 +47,12 @@ #include #include #include -#include +#include #include #include "setup_arch_pre.h" int disable_pse __initdata = 0; -static inline char * __init machine_specific_memory_setup(void); - /* * Machine setup.. */ @@ -125,12 +123,210 @@ unsigned long saved_videomode; #define RAMDISK_LOAD_FLAG 0x4000 static char command_line[COMMAND_LINE_SIZE]; - char saved_command_line[COMMAND_LINE_SIZE]; unsigned char __initdata boot_params[PARAM_SIZE]; -static struct resource code_resource = { "Kernel code", 0x100000, 0 }; -static struct resource data_resource = { "Kernel data", 0, 0 }; +static struct resource data_resource = { + .name = "Kernel data", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +static struct resource code_resource = { + .name = "Kernel code", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +#ifdef CONFIG_XEN_PRIVILEGED_GUEST +static struct resource system_rom_resource = { + .name = "System ROM", + .start = 0xf0000, + .end = 0xfffff, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}; + +static struct resource extension_rom_resource = { + .name = "Extension ROM", + .start = 0xe0000, + .end = 0xeffff, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}; + +static struct resource adapter_rom_resources[] = { { + .name = "Adapter ROM", + .start = 0xc8000, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +} }; + +#define ADAPTER_ROM_RESOURCES \ + (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0]) + +static struct resource video_rom_resource = { + .name = "Video ROM", + .start = 0xc0000, + .end = 0xc7fff, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}; +#endif + +static struct resource video_ram_resource = { + .name = "Video RAM area", + .start = 0xa0000, + .end = 0xbffff, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +static struct resource standard_io_resources[] = { { + .name = "dma1", + .start = 0x0000, + .end = 0x001f, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "pic1", + .start = 0x0020, + .end = 0x0021, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "timer", + .start = 0x0040, + .end = 0x005f, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "keyboard", + .start = 0x0060, + .end = 0x006f, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "dma page reg", + .start = 0x0080, + .end = 0x008f, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "pic2", + .start = 0x00a0, + .end = 0x00a1, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "dma2", + .start = 0x00c0, + .end = 0x00df, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "fpu", + .start = 0x00f0, + .end = 0x00ff, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +} }; + +#define STANDARD_IO_RESOURCES \ + (sizeof standard_io_resources / sizeof standard_io_resources[0]) + +#ifdef CONFIG_XEN_PRIVILEGED_GUEST +#define romsignature(x) (*(unsigned short *)(x) == 0xaa55) + +static int __init romchecksum(unsigned char *rom, unsigned long length) +{ + unsigned char *p, sum = 0; + + for (p = rom; p < rom + length; p++) + sum += *p; + return sum == 0; +} + +static void __init probe_roms(void) +{ + unsigned long start, length, upper; + unsigned char *rom; + int i; + + /* video rom */ + upper = adapter_rom_resources[0].start; + for (start = video_rom_resource.start; start < upper; start += 2048) { + rom = isa_bus_to_virt(start); + if (!romsignature(rom)) + continue; + + video_rom_resource.start = start; + + /* 0 < length <= 0x7f * 512, historically */ + length = rom[2] * 512; + + /* if checksum okay, trust length byte */ + if (length && romchecksum(rom, length)) + video_rom_resource.end = start + length - 1; + + request_resource(&iomem_resource, &video_rom_resource); + break; + } + + start = (video_rom_resource.end + 1 + 2047) & ~2047UL; + if (start < upper) + start = upper; + + /* system rom */ + request_resource(&iomem_resource, &system_rom_resource); + upper = system_rom_resource.start; + + /* check for extension rom (ignore length byte!) */ + rom = isa_bus_to_virt(extension_rom_resource.start); + if (romsignature(rom)) { + length = extension_rom_resource.end - extension_rom_resource.start + 1; + if (romchecksum(rom, length)) { + request_resource(&iomem_resource, &extension_rom_resource); + upper = extension_rom_resource.start; + } + } + + /* check for adapter roms on 2k boundaries */ + for (i = 0; i < ADAPTER_ROM_RESOURCES && start < upper; start += 2048) { + rom = isa_bus_to_virt(start); + if (!romsignature(rom)) + continue; + + /* 0 < length <= 0x7f * 512, historically */ + length = rom[2] * 512; + + /* but accept any length that fits if checksum okay */ + if (!length || start + length > upper || !romchecksum(rom, length)) + continue; + + adapter_rom_resources[i].start = start; + adapter_rom_resources[i].end = start + length - 1; + request_resource(&iomem_resource, &adapter_rom_resources[i]); + + start = adapter_rom_resources[i++].end & ~2047UL; + } +} +#endif /* * Point at the empty zero page to start with. We map the real shared_info @@ -452,13 +648,9 @@ static int __init copy_e820_map(struct e820entry * biosmap, int nr_map) #endif #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) -unsigned char eddnr; -struct edd_info edd[EDDMAXNR]; -unsigned int edd_disk80_sig; +struct edd edd; #ifdef CONFIG_EDD_MODULE -EXPORT_SYMBOL(eddnr); EXPORT_SYMBOL(edd); -EXPORT_SYMBOL(edd_disk80_sig); #endif /** * copy_edd() - Copy the BIOS EDD information @@ -467,12 +659,15 @@ EXPORT_SYMBOL(edd_disk80_sig); */ static inline void copy_edd(void) { - eddnr = EDD_NR; - memcpy(edd, EDD_BUF, sizeof(edd)); - edd_disk80_sig = DISK80_SIGNATURE; + memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); + memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); + edd.mbr_signature_nr = EDD_MBR_SIG_NR; + edd.edd_info_nr = EDD_NR; } #else -#define copy_edd() do {} while (0) +static inline void copy_edd(void) +{ +} #endif /* @@ -481,14 +676,6 @@ static inline void copy_edd(void) */ #define LOWMEMSIZE() (0x9f000) -static void __init setup_memory_region(void) -{ - char *who = machine_specific_memory_setup(); - printk(KERN_INFO "BIOS-provided physical RAM map:\n"); - print_memory_map(who); -} /* setup_memory_region */ - - static void __init parse_cmdline_early (char ** cmdline_p) { char c = ' ', *to = command_line, *from = saved_command_line; @@ -964,6 +1151,7 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat static void __init register_memory(unsigned long max_low_pfn) { unsigned long low_mem_size; + int i; if (efi_enabled) efi_initialize_iomem_resources(&code_resource, &data_resource); @@ -971,10 +1159,11 @@ static void __init register_memory(unsigned long max_low_pfn) legacy_init_iomem_resources(&code_resource, &data_resource); /* EFI systems may still have VGA */ - request_graphics_resource(); + request_resource(&iomem_resource, &video_ram_resource); /* request I/O space for devices used on all i[345]86 PCs */ - request_standard_io_resources(); + for (i = 0; i < STANDARD_IO_RESOURCES; i++) + request_resource(&ioport_resource, &standard_io_resources[i]); /* Tell the PCI layer not to allocate too close to the RAM area.. */ low_mem_size = ((max_low_pfn << PAGE_SHIFT) + 0xfffff) & ~0xfffff; @@ -1035,7 +1224,7 @@ static struct nop { } noptypes[] = { { X86_FEATURE_K8, k8_nops }, { X86_FEATURE_K7, k7_nops }, - { -1, 0 } + { -1, NULL } }; /* Replace instructions with better alternatives for this CPU type. @@ -1089,6 +1278,8 @@ static int __init noreplacement_setup(char *s) __setup("noreplacement", noreplacement_setup); +static char * __init machine_specific_memory_setup(void); + /* * Determine if we were loaded by an EFI loader. If so, then we have also been * passed the efi memmap, systab, etc., so we should use these data structures @@ -1159,8 +1350,10 @@ void __init setup_arch(char **cmdline_p) ARCH_SETUP if (efi_enabled) efi_init(); - else - setup_memory_region(); + else { + printk(KERN_INFO "BIOS-provided physical RAM map:\n"); + print_memory_map(machine_specific_memory_setup()); + } copy_edd(); diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/signal.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/signal.c similarity index 96% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/signal.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/signal.c index 4b516bbf68..a8debd478e 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/signal.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/signal.c @@ -56,16 +56,15 @@ sys_sigsuspend(int history0, int history1, old_sigset_t mask) } asmlinkage int -sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) +sys_rt_sigsuspend(struct pt_regs regs) { - struct pt_regs * regs = (struct pt_regs *) &unewset; sigset_t saveset, newset; /* XXX: Don't preclude handling different sized sigset_t's. */ - if (sigsetsize != sizeof(sigset_t)) + if (regs.ecx != sizeof(sigset_t)) return -EINVAL; - if (copy_from_user(&newset, unewset, sizeof(newset))) + if (copy_from_user(&newset, (sigset_t __user *)regs.ebx, sizeof(newset))) return -EFAULT; sigdelsetmask(&newset, ~_BLOCKABLE); @@ -75,11 +74,11 @@ sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - regs->eax = -EINTR; + regs.eax = -EINTR; while (1) { current->state = TASK_INTERRUPTIBLE; schedule(); - if (do_signal(regs, &saveset)) + if (do_signal(®s, &saveset)) return -EINTR; } } @@ -117,9 +116,13 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, } asmlinkage int -sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) +sys_sigaltstack(unsigned long ebx) { - struct pt_regs *regs = (struct pt_regs *) &uss; + /* This is needed to make gcc realize it doesn't own the "struct pt_regs" */ + struct pt_regs *regs = (struct pt_regs *)&ebx; + const stack_t __user *uss = (const stack_t __user *)ebx; + stack_t __user *uoss = (stack_t __user *)regs->ecx; + return do_sigaltstack(uss, uoss, regs->esp); } @@ -333,12 +336,13 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) /* These symbols are defined with the addresses in the vsyscall page. See vsyscall-sigreturn.S. */ -extern void __kernel_sigreturn, __kernel_rt_sigreturn; +extern void __user __kernel_sigreturn; +extern void __user __kernel_rt_sigreturn; static void setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs) { - void *restorer; + void __user *restorer; struct sigframe __user *frame; int err = 0; @@ -415,7 +419,7 @@ give_sigsegv: static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs * regs) { - void *restorer; + void __user *restorer; struct rt_sigframe __user *frame; int err = 0; diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/sysenter.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/sysenter.c similarity index 96% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/sysenter.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/sysenter.c index b1e49905dc..f8b056fbb1 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/sysenter.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/sysenter.c @@ -45,7 +45,7 @@ static int __init sysenter_setup(void) { unsigned long page = get_zeroed_page(GFP_ATOMIC); - __set_fixmap(FIX_VSYSCALL, __pa(page), PAGE_READONLY); + __set_fixmap(FIX_VSYSCALL, __pa(page), PAGE_READONLY_EXEC); if (1 /* XXXcl not yet */ || !boot_cpu_has(X86_FEATURE_SEP)) { memcpy((void *) page, diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c similarity index 99% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c index 6fa51ede40..fbd059a5f7 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c @@ -578,7 +578,7 @@ void __init hpet_time_init(void) static int time_irq; static struct irqaction irq_timer = { - timer_interrupt, SA_INTERRUPT, 0, "timer", + timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL }; diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/Makefile rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/Makefile diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c similarity index 98% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c index 468e4349e4..a872b661a4 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c @@ -67,7 +67,6 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc) return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR; } - #if 0 static int count2; /* counter for mark_offset_tsc() */ #endif @@ -316,7 +315,8 @@ static int __init cpufreq_tsc(void) { int ret; INIT_WORK(&cpufreq_delayed_get_work, handle_cpufreq_delayed_get, NULL); - ret = cpufreq_register_notifier(&time_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); + ret = cpufreq_register_notifier(&time_cpufreq_notifier_block, + CPUFREQ_TRANSITION_NOTIFIER); if (!ret) cpufreq_init = 1; return ret; diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/traps.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/traps.c similarity index 97% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/traps.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/traps.c index e809dc830a..9cef6bd77e 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/traps.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/traps.c @@ -47,7 +47,6 @@ #include #include -#include #include #include @@ -104,7 +103,7 @@ static int valid_stack_ptr(struct task_struct *task, void *p) } #ifdef CONFIG_FRAME_POINTER -void print_context_stack(struct task_struct *task, unsigned long *stack, +static void print_context_stack(struct task_struct *task, unsigned long *stack, unsigned long ebp) { unsigned long addr; @@ -118,16 +117,17 @@ void print_context_stack(struct task_struct *task, unsigned long *stack, } } #else -void print_context_stack(struct task_struct *task, unsigned long *stack, +static void print_context_stack(struct task_struct *task, unsigned long *stack, unsigned long ebp) { unsigned long addr; while (!kstack_end(stack)) { addr = *stack++; - if (kernel_text_address(addr)) { - printk(" %p: [<%08lx>] ", stack - 4, addr); - print_symbol("%s\n", addr); + if (__kernel_text_address(addr)) { + printk(" [<%08lx>]", addr); + print_symbol(" %s\n", addr); + printk("\n"); } } } @@ -163,7 +163,6 @@ void show_trace(struct task_struct *task, unsigned long * stack) break; printk(" =======================\n"); } - printk("\n"); } void show_stack(struct task_struct *task, unsigned long *esp) @@ -398,7 +397,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ info.si_signo = signr; \ info.si_errno = 0; \ info.si_code = sicode; \ - info.si_addr = (void *)siaddr; \ + info.si_addr = (void __user *)siaddr; \ do_trap(trapnr, signr, str, 0, regs, error_code, &info); \ } @@ -415,7 +414,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ info.si_signo = signr; \ info.si_errno = 0; \ info.si_code = sicode; \ - info.si_addr = (void *)siaddr; \ + info.si_addr = (void __user *)siaddr; \ do_trap(trapnr, signr, str, 1, regs, error_code, &info); \ } @@ -661,8 +660,8 @@ asmlinkage void do_debug(struct pt_regs * regs, long error_code) /* If this is a kernel mode trap, save the user PC on entry to * the kernel, that's what the debugger can make sense of. */ - info.si_addr = ((regs->xcs & 2) == 0) ? (void *)tsk->thread.eip : - (void *)regs->eip; + info.si_addr = ((regs->xcs & 2) == 0) ? (void __user *)tsk->thread.eip : + (void __user *)regs->eip; force_sig_info(SIGTRAP, &info, tsk); /* Disable additional traps. They'll be re-enabled when @@ -688,7 +687,7 @@ clear_TF: * the correct behaviour even in the presence of the asynchronous * IRQ13 behaviour */ -void math_error(void *eip) +void math_error(void __user *eip) { struct task_struct * task; siginfo_t info; @@ -747,10 +746,10 @@ void math_error(void *eip) asmlinkage void do_coprocessor_error(struct pt_regs * regs, long error_code) { ignore_fpu_irq = 1; - math_error((void *)regs->eip); + math_error((void __user *)regs->eip); } -void simd_math_error(void *eip) +void simd_math_error(void __user *eip) { struct task_struct * task; siginfo_t info; @@ -804,7 +803,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs * regs, if (cpu_has_xmm) { /* Handle SIMD FPU exceptions on PIII+ processors. */ ignore_fpu_irq = 1; - simd_math_error((void *)regs->eip); + simd_math_error((void __user *)regs->eip); } else { /* * Handle strange cache flush from user space exception diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vmlinux.lds.S b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/vmlinux.lds.S similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vmlinux.lds.S rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/vmlinux.lds.S diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vsyscall.S b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/vsyscall.S similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vsyscall.S rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/vsyscall.S diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vsyscall.lds b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/vsyscall.lds similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/kernel/vsyscall.lds rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/vsyscall.lds diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/mm/Makefile rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/Makefile diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/fault.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/fault.c similarity index 88% rename from linux-2.6.7-xen-sparse/arch/xen/i386/mm/fault.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/fault.c index d850d279d5..2c6a9ba6f8 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/fault.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/fault.c @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -191,11 +190,16 @@ static int __is_prefetch(struct pt_regs *regs, unsigned long addr) return prefetch; } -static inline int is_prefetch(struct pt_regs *regs, unsigned long addr) +static inline int is_prefetch(struct pt_regs *regs, unsigned long addr, + unsigned long error_code) { if (unlikely(boot_cpu_data.x86_vendor == X86_VENDOR_AMD && - boot_cpu_data.x86 >= 6)) + boot_cpu_data.x86 >= 6)) { + /* Catch an obscure case of prefetch inside an NX page. */ + if (nx_enabled && (error_code & 16)) + return 0; return __is_prefetch(regs, addr); + } return 0; } @@ -267,7 +271,27 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, if (in_atomic() || !mm) goto bad_area_nosemaphore; - down_read(&mm->mmap_sem); + /* When running in the kernel we expect faults to occur only to + * addresses in user space. All other faults represent errors in the + * kernel and should generate an OOPS. Unfortunatly, in the case of an + * erroneous fault occuring in a code path which already holds mmap_sem + * we will deadlock attempting to validate the fault against the + * address space. Luckily the kernel only validly references user + * space from well defined areas of code, which are listed in the + * exceptions table. + * + * As the vast majority of faults will be valid we will only perform + * the source reference check when there is a possibilty of a deadlock. + * Attempt to lock the address space, if we cannot we then validate the + * source. If this is invalid we can skip the address space check, + * thus avoiding the deadlock. + */ + if (!down_read_trylock(&mm->mmap_sem)) { + if ((error_code & 4) == 0 && + !search_exception_tables(regs->eip)) + goto bad_area_nosemaphore; + down_read(&mm->mmap_sem); + } vma = find_vma(mm, address); if (!vma) @@ -360,7 +384,7 @@ bad_area_nosemaphore: * Valid to do another page fault here because this one came * from user space. */ - if (is_prefetch(regs, address)) + if (is_prefetch(regs, address, error_code)) return; tsk->thread.cr2 = address; @@ -370,7 +394,7 @@ bad_area_nosemaphore: info.si_signo = SIGSEGV; info.si_errno = 0; /* info.si_code has been set above */ - info.si_addr = (void *)address; + info.si_addr = (void __user *)address; force_sig_info(SIGSEGV, &info, tsk); return; } @@ -401,7 +425,7 @@ no_context: * had been triggered by is_prefetch fixup_exception would have * handled it. */ - if (is_prefetch(regs, address)) + if (is_prefetch(regs, address, error_code)) return; /* @@ -411,6 +435,14 @@ no_context: bust_spinlocks(1); +#ifdef CONFIG_X86_PAE + if (error_code & 16) { + pte_t *pte = lookup_address(address); + + if (pte && pte_present(*pte) && !pte_exec_kernel(*pte)) + printk(KERN_CRIT "kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n", current->uid); + } +#endif if (address < PAGE_SIZE) printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); else @@ -464,7 +496,7 @@ do_sigbus: goto no_context; /* User space => ok to do another page fault */ - if (is_prefetch(regs, address)) + if (is_prefetch(regs, address, error_code)) return; tsk->thread.cr2 = address; @@ -473,7 +505,7 @@ do_sigbus: info.si_signo = SIGBUS; info.si_errno = 0; info.si_code = BUS_ADRERR; - info.si_addr = (void *)address; + info.si_addr = (void __user *)address; force_sig_info(SIGBUS, &info, tsk); return; diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/highmem.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/highmem.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/mm/highmem.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/highmem.c diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/hypervisor.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/hypervisor.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/mm/hypervisor.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/hypervisor.c diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/init.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/init.c similarity index 88% rename from linux-2.6.7-xen-sparse/arch/xen/i386/mm/init.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/init.c index 339da5061e..12da77b2cb 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/init.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/init.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -84,7 +83,7 @@ static pte_t * __init one_page_table_init(pmd_t *pmd) wrprotect_bootpt((pgd_t *)start_info.pt_base, page_table, 1); return page_table; } - + return pte_offset_kernel(pmd, 0); } @@ -167,6 +166,13 @@ static void __init protect_bootpt_entries(pgd_t *spgd, pgd_t *dpgd, int set, flush_page_update_queue(); } +static inline int is_kernel_text(unsigned long addr) +{ + if (addr >= (unsigned long)_stext && addr <= (unsigned long)__init_end) + return 1; + return 0; +} + /* * This maps the physical memory to kernel virtual address space, a total * of max_low_pfn pages, by creating page tables starting from address @@ -192,16 +198,27 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base) continue; pmd += pmd_idx; for (; pmd_idx < PTRS_PER_PMD && pfn < max_low_pfn; pmd++, pmd_idx++) { + unsigned int address = pfn * PAGE_SIZE + PAGE_OFFSET; + /* Map with big pages if possible, otherwise create normal page tables. */ if (cpu_has_pse) { - set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE)); + unsigned int address2 = (pfn + PTRS_PER_PTE - 1) * PAGE_SIZE + PAGE_OFFSET + PAGE_SIZE-1; + + if (is_kernel_text(address) || is_kernel_text(address2)) + set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE_EXEC)); + else + set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE)); pfn += PTRS_PER_PTE; } else { pte = one_page_table_init(pmd); pte += pte_ofs; - for (; pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; pte++, pfn++, pte_ofs++) - set_pte(pte, pfn_pte(pfn, PAGE_KERNEL)); + for (; pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; pte++, pfn++, pte_ofs++) { + if (is_kernel_text(address)) + set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC)); + else + set_pte(pte, pfn_pte(pfn, PAGE_KERNEL)); + } pte_ofs = 0; } flush_page_update_queue(); @@ -324,7 +341,8 @@ extern void set_highmem_pages_init(int); #define set_highmem_pages_init(bad_ppro) do { } while (0) #endif /* CONFIG_HIGHMEM */ -unsigned long __PAGE_KERNEL = _PAGE_KERNEL; +unsigned long long __PAGE_KERNEL = _PAGE_KERNEL; +unsigned long long __PAGE_KERNEL_EXEC = _PAGE_KERNEL_EXEC; #ifndef CONFIG_DISCONTIGMEM #define remap_numa_kva() do {} while (0) @@ -353,6 +371,7 @@ static void __init pagetable_init (void) if (cpu_has_pge) { set_in_cr4(X86_CR4_PGE); __PAGE_KERNEL |= _PAGE_GLOBAL; + __PAGE_KERNEL_EXEC |= _PAGE_GLOBAL; } kernel_physical_mapping_init(pgd_base); @@ -443,6 +462,79 @@ void __init zone_sizes_init(void) extern void zone_sizes_init(void); #endif /* !CONFIG_DISCONTIGMEM */ +static int disable_nx __initdata = 0; +u64 __supported_pte_mask = ~_PAGE_NX; + +/* + * noexec = on|off + * + * Control non executable mappings. + * + * on Enable + * off Disable + */ +static int __init noexec_setup(char *str) +{ + if (!strncmp(str, "on",2) && cpu_has_nx) { + __supported_pte_mask |= _PAGE_NX; + disable_nx = 0; + } else if (!strncmp(str,"off",3)) { + disable_nx = 1; + __supported_pte_mask &= ~_PAGE_NX; + } + return 1; +} + +__setup("noexec=", noexec_setup); + +#ifdef CONFIG_X86_PAE +int nx_enabled = 0; + +static void __init set_nx(void) +{ + unsigned int v[4], l, h; + + if (cpu_has_pae && (cpuid_eax(0x80000000) > 0x80000001)) { + cpuid(0x80000001, &v[0], &v[1], &v[2], &v[3]); + if ((v[3] & (1 << 20)) && !disable_nx) { + rdmsr(MSR_EFER, l, h); + l |= EFER_NX; + wrmsr(MSR_EFER, l, h); + nx_enabled = 1; + __supported_pte_mask |= _PAGE_NX; + } + } +} + +/* + * Enables/disables executability of a given kernel page and + * returns the previous setting. + */ +int __init set_kernel_exec(unsigned long vaddr, int enable) +{ + pte_t *pte; + int ret = 1; + + if (!nx_enabled) + goto out; + + pte = lookup_address(vaddr); + BUG_ON(!pte); + + if (!pte_exec_kernel(*pte)) + ret = 0; + + if (enable) + pte->pte_high &= ~(1 << (_PAGE_BIT_NX - 32)); + else + pte->pte_high |= 1 << (_PAGE_BIT_NX - 32); + __flush_tlb_all(); +out: + return ret; +} + +#endif + /* * - write protect new L1 pages in old pgd * - write protect new pgd page in old pgd @@ -468,6 +560,12 @@ void __init paging_init(void) int i; #endif +#ifdef CONFIG_X86_PAE + set_nx(); + if (nx_enabled) + printk("NX (Execute Disable) protection: active\n"); +#endif + pagetable_init(); wrprotect_bootpt((pgd_t *)start_info.pt_base, swapper_pg_dir, 1); diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/ioremap.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c similarity index 99% rename from linux-2.6.7-xen-sparse/arch/xen/i386/mm/ioremap.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c index 3fb6ea9aa0..eed6379821 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/ioremap.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/pgtable.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c similarity index 99% rename from linux-2.6.7-xen-sparse/arch/xen/i386/mm/pgtable.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c index 67efdabdc7..aaf7339661 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/pgtable.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c @@ -34,7 +34,7 @@ void show_mem(void) printk("Mem-info:\n"); show_free_areas(); - printk("Free swap: %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); + printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); for_each_pgdat(pgdat) { for (i = 0; i < pgdat->node_spanned_pages; ++i) { page = pgdat->node_mem_map + i; diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/pci/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/pci/Makefile rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/Makefile diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/pci/direct.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/direct.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/i386/pci/direct.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/direct.c diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/pci/irq.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/irq.c similarity index 99% rename from linux-2.6.7-xen-sparse/arch/xen/i386/pci/irq.c rename to linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/irq.c index f6d49f837c..7dc8dfb0ba 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/pci/irq.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/pci/irq.c @@ -22,8 +22,6 @@ #include #include -int broken_hp_bios_irq9; - /* * Never use: 0, 1, 2 (timer, keyboard, and cascade) * Avoid using: 13, 14 and 15 (FP error and IDE). diff --git a/linux-2.6.7-xen-sparse/arch/xen/kernel/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/kernel/Makefile rename to linux-2.6.8.1-xen-sparse/arch/xen/kernel/Makefile diff --git a/linux-2.6.7-xen-sparse/arch/xen/kernel/ctrl_if.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/ctrl_if.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/kernel/ctrl_if.c rename to linux-2.6.8.1-xen-sparse/arch/xen/kernel/ctrl_if.c diff --git a/linux-2.6.7-xen-sparse/arch/xen/kernel/empty.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/empty.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/kernel/empty.c rename to linux-2.6.8.1-xen-sparse/arch/xen/kernel/empty.c diff --git a/linux-2.6.7-xen-sparse/arch/xen/kernel/evtchn.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/evtchn.c similarity index 99% rename from linux-2.6.7-xen-sparse/arch/xen/kernel/evtchn.c rename to linux-2.6.8.1-xen-sparse/arch/xen/kernel/evtchn.c index 87eda48725..05cb3ccdbc 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/kernel/evtchn.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/evtchn.c @@ -384,7 +384,7 @@ static irqreturn_t misdirect_interrupt(int irq, void *dev_id, static struct irqaction misdirect_action = { misdirect_interrupt, SA_INTERRUPT, - 0, + CPU_MASK_NONE, "misdirect", NULL, NULL diff --git a/linux-2.6.7-xen-sparse/arch/xen/kernel/fixup.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/fixup.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/kernel/fixup.c rename to linux-2.6.8.1-xen-sparse/arch/xen/kernel/fixup.c diff --git a/linux-2.6.7-xen-sparse/arch/xen/kernel/process.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/process.c similarity index 89% rename from linux-2.6.7-xen-sparse/arch/xen/kernel/process.c rename to linux-2.6.8.1-xen-sparse/arch/xen/kernel/process.c index f01dc9b8ec..3656196a99 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/kernel/process.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/process.c @@ -15,7 +15,7 @@ void xen_cpu_idle (void) int cpu = smp_processor_id(); local_irq_disable(); - if (need_resched() || !list_empty(&RCU_curlist(cpu))) { + if (need_resched() || RCU_curlist(cpu)) { local_irq_enable(); return; } diff --git a/linux-2.6.7-xen-sparse/arch/xen/kernel/reboot.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/reboot.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/kernel/reboot.c rename to linux-2.6.8.1-xen-sparse/arch/xen/kernel/reboot.c diff --git a/linux-2.6.7-xen-sparse/arch/xen/kernel/xen_proc.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/xen_proc.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/kernel/xen_proc.c rename to linux-2.6.8.1-xen-sparse/arch/xen/kernel/xen_proc.c diff --git a/linux-2.6.7-xen-sparse/drivers/Makefile b/linux-2.6.8.1-xen-sparse/drivers/Makefile similarity index 98% rename from linux-2.6.7-xen-sparse/drivers/Makefile rename to linux-2.6.8.1-xen-sparse/drivers/Makefile index 1e2b996294..f21855a6a2 100644 --- a/linux-2.6.7-xen-sparse/drivers/Makefile +++ b/linux-2.6.8.1-xen-sparse/drivers/Makefile @@ -14,7 +14,6 @@ obj-$(CONFIG_PNP) += pnp/ # char/ comes before serial/ etc so that the VT console is the boot-time # default. - obj-y += char/ obj-y += serial/ obj-$(CONFIG_PARPORT) += parport/ @@ -44,6 +43,7 @@ obj-$(CONFIG_GAMEPORT) += input/gameport/ obj-$(CONFIG_SERIO) += input/serio/ obj-$(CONFIG_I2O) += message/ obj-$(CONFIG_I2C) += i2c/ +obj-$(CONFIG_W1) += w1/ obj-$(CONFIG_PHONE) += telephony/ obj-$(CONFIG_MD) += md/ obj-$(CONFIG_BT) += bluetooth/ diff --git a/linux-2.6.7-xen-sparse/drivers/char/mem.c b/linux-2.6.8.1-xen-sparse/drivers/char/mem.c similarity index 99% rename from linux-2.6.7-xen-sparse/drivers/char/mem.c rename to linux-2.6.8.1-xen-sparse/drivers/char/mem.c index ed3df13f65..e3b99480fe 100644 --- a/linux-2.6.7-xen-sparse/drivers/char/mem.c +++ b/linux-2.6.8.1-xen-sparse/drivers/char/mem.c @@ -40,7 +40,6 @@ #include #include -#include #ifdef CONFIG_IA64 # include diff --git a/linux-2.6.7-xen-sparse/drivers/char/tty_io.c b/linux-2.6.8.1-xen-sparse/drivers/char/tty_io.c similarity index 97% rename from linux-2.6.7-xen-sparse/drivers/char/tty_io.c rename to linux-2.6.8.1-xen-sparse/drivers/char/tty_io.c index daff96d19f..bdb091035f 100644 --- a/linux-2.6.7-xen-sparse/drivers/char/tty_io.c +++ b/linux-2.6.8.1-xen-sparse/drivers/char/tty_io.c @@ -91,6 +91,7 @@ #include #include #include +#include #include #include @@ -131,6 +132,8 @@ int console_use_vt = 1; #ifdef CONFIG_UNIX98_PTYS extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */ extern int pty_limit; /* Config limit on Unix98 ptys */ +static DEFINE_IDR(allocated_ptys); +static DECLARE_MUTEX(allocated_ptys_lock); #endif extern void disable_early_printk(void); @@ -345,18 +348,12 @@ EXPORT_SYMBOL(tty_check_change); static ssize_t hung_up_tty_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { - /* Can't seek (pread) on ttys. */ - if (ppos != &file->f_pos) - return -ESPIPE; return 0; } static ssize_t hung_up_tty_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { - /* Can't seek (pwrite) on ttys. */ - if (ppos != &file->f_pos) - return -ESPIPE; return -EIO; } @@ -648,10 +645,6 @@ static ssize_t tty_read(struct file * file, char __user * buf, size_t count, struct tty_struct * tty; struct inode *inode; - /* Can't seek (pread) on ttys. */ - if (ppos != &file->f_pos) - return -ESPIPE; - tty = (struct tty_struct *)file->private_data; inode = file->f_dentry->d_inode; if (tty_paranoia_check(tty, inode, "tty_read")) @@ -726,10 +719,6 @@ static ssize_t tty_write(struct file * file, const char __user * buf, size_t cou struct tty_struct * tty; struct inode *inode = file->f_dentry->d_inode; - /* Can't seek (pwrite) on ttys. */ - if (ppos != &file->f_pos) - return -ESPIPE; - tty = (struct tty_struct *)file->private_data; if (tty_paranoia_check(tty, inode, "tty_write")) return -EIO; @@ -755,9 +744,6 @@ ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t if (p) { ssize_t res; - /* Can't seek (pwrite) on ttys. */ - if (ppos != &file->f_pos) - return -ESPIPE; res = vfs_write(p, buf, count, &p->f_pos); fput(p); return res; @@ -1068,6 +1054,7 @@ static void release_dev(struct file * filp) { struct tty_struct *tty, *o_tty; int pty_master, tty_closing, o_tty_closing, do_sleep; + int devpts_master, devpts; int idx; char buf[64]; @@ -1082,6 +1069,8 @@ static void release_dev(struct file * filp) idx = tty->index; pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY && tty->driver->subtype == PTY_TYPE_MASTER); + devpts = (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) != 0; + devpts_master = pty_master && devpts; o_tty = tty->link; #ifdef TTY_PARANOIA_CHECK @@ -1298,11 +1287,21 @@ static void release_dev(struct file * filp) o_tty->ldisc = ldiscs[N_TTY]; } - /* + /* * The release_mem function takes care of the details of clearing * the slots and preserving the termios structure. */ release_mem(tty, idx); + +#ifdef CONFIG_UNIX98_PTYS + /* Make this pty number available for reallocation */ + if (devpts) { + down(&allocated_ptys_lock); + idr_remove(&allocated_ptys, idx); + up(&allocated_ptys_lock); + } +#endif + } /* @@ -1325,8 +1324,13 @@ static int tty_open(struct inode * inode, struct file * filp) int index; dev_t device = inode->i_rdev; unsigned short saved_flags = filp->f_flags; + + nonseekable_open(inode, filp); retry_open: noctty = filp->f_flags & O_NOCTTY; + index = -1; + retval = 0; + if (device == MKDEV(TTYAUX_MAJOR,0)) { if (!current->signal->tty) return -ENXIO; @@ -1347,13 +1351,8 @@ retry_open: } #endif if (device == MKDEV(TTYAUX_MAJOR,1)) { - struct console *c = console_drivers; - for (c = console_drivers; c; c = c->next) { - if (!c->device) - continue; - driver = c->device(c, &index); - if (!driver) - continue; + driver = console_device(&index); + if (driver) { /* Don't let /dev/console block */ filp->f_flags |= O_NONBLOCK; noctty = 1; @@ -1364,24 +1363,40 @@ retry_open: #ifdef CONFIG_UNIX98_PTYS if (device == MKDEV(TTYAUX_MAJOR,2)) { + int idr_ret; + /* find a device that is not in use. */ - static int next_ptmx_dev = 0; - retval = -1; - driver = ptm_driver; - while (driver->refcount < pty_limit) { - index = next_ptmx_dev; - next_ptmx_dev = (next_ptmx_dev+1) % driver->num; - if (!init_dev(driver, index, &tty)) - goto ptmx_found; /* ok! */ - } - return -EIO; /* no free ptys */ - ptmx_found: - set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */ - if (devpts_pty_new(tty->link)) { - /* BADNESS - need to destroy both ptm and pts! */ + down(&allocated_ptys_lock); + if (!idr_pre_get(&allocated_ptys, GFP_KERNEL)) { + up(&allocated_ptys_lock); return -ENOMEM; } - noctty = 1; + idr_ret = idr_get_new(&allocated_ptys, NULL, &index); + if (idr_ret < 0) { + up(&allocated_ptys_lock); + if (idr_ret == -EAGAIN) + return -ENOMEM; + return -EIO; + } + if (index >= pty_limit) { + idr_remove(&allocated_ptys, index); + up(&allocated_ptys_lock); + return -EIO; + } + up(&allocated_ptys_lock); + + driver = ptm_driver; + retval = init_dev(driver, index, &tty); + if (retval) { + down(&allocated_ptys_lock); + idr_remove(&allocated_ptys, index); + up(&allocated_ptys_lock); + return retval; + } + + set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */ + if (devpts_pty_new(tty->link)) + retval = -ENOMEM; } else #endif { @@ -1403,10 +1418,12 @@ got_driver: #ifdef TTY_DEBUG_HANGUP printk(KERN_DEBUG "opening %s...", tty->name); #endif - if (tty->driver->open) - retval = tty->driver->open(tty, filp); - else - retval = -ENODEV; + if (!retval) { + if (tty->driver->open) + retval = tty->driver->open(tty, filp); + else + retval = -ENODEV; + } filp->f_flags = saved_flags; if (!retval && test_bit(TTY_EXCLUSIVE, &tty->flags) && !capable(CAP_SYS_ADMIN)) @@ -1418,6 +1435,14 @@ got_driver: tty->name); #endif +#ifdef CONFIG_UNIX98_PTYS + if (index != -1) { + down(&allocated_ptys_lock); + idr_remove(&allocated_ptys, index); + up(&allocated_ptys_lock); + } +#endif + release_dev(filp); if (retval != -ERESTARTSYS) return retval; diff --git a/linux-2.6.7-xen-sparse/drivers/xen/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/Makefile rename to linux-2.6.8.1-xen-sparse/drivers/xen/Makefile diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkback/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkback/Makefile rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkback/Makefile diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkback/blkback.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/blkback.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkback/blkback.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkback/blkback.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkback/common.h b/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/common.h similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkback/common.h rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkback/common.h diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkback/control.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/control.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkback/control.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkback/control.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkback/interface.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/interface.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkback/interface.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkback/interface.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkback/vbd.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/vbd.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkback/vbd.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkback/vbd.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/Kconfig b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/Kconfig similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkfront/Kconfig rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/Kconfig diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkfront/Makefile rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/Makefile diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/block.h b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/block.h similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkfront/block.h rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/block.h diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/vbd.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/vbd.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/blkfront/vbd.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/vbd.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/console/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/console/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/console/Makefile rename to linux-2.6.8.1-xen-sparse/drivers/xen/console/Makefile diff --git a/linux-2.6.7-xen-sparse/drivers/xen/console/console.c b/linux-2.6.8.1-xen-sparse/drivers/xen/console/console.c similarity index 99% rename from linux-2.6.7-xen-sparse/drivers/xen/console/console.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/console/console.c index c7c3d76e69..8657a426c8 100644 --- a/linux-2.6.7-xen-sparse/drivers/xen/console/console.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/console/console.c @@ -621,7 +621,10 @@ const struct consw xennull_con = { .con_bmove = DUMMY, .con_switch = DUMMY, .con_blank = DUMMY, - .con_font_op = DUMMY, + .con_font_set = DUMMY, + .con_font_get = DUMMY, + .con_font_default = DUMMY, + .con_font_copy = DUMMY, .con_set_palette = DUMMY, .con_scrolldelta = DUMMY, }; diff --git a/linux-2.6.7-xen-sparse/drivers/xen/evtchn/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/evtchn/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/evtchn/Makefile rename to linux-2.6.8.1-xen-sparse/drivers/xen/evtchn/Makefile diff --git a/linux-2.6.7-xen-sparse/drivers/xen/evtchn/evtchn.c b/linux-2.6.8.1-xen-sparse/drivers/xen/evtchn/evtchn.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/evtchn/evtchn.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/evtchn/evtchn.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/netback/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/netback/Makefile rename to linux-2.6.8.1-xen-sparse/drivers/xen/netback/Makefile diff --git a/linux-2.6.7-xen-sparse/drivers/xen/netback/common.h b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/common.h similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/netback/common.h rename to linux-2.6.8.1-xen-sparse/drivers/xen/netback/common.h diff --git a/linux-2.6.7-xen-sparse/drivers/xen/netback/control.c b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/control.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/netback/control.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/netback/control.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/netback/interface.c b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/interface.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/netback/interface.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/netback/interface.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/netback/netback.c b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c similarity index 99% rename from linux-2.6.7-xen-sparse/drivers/xen/netback/netback.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c index 74b618d8a4..103bcbd72f 100644 --- a/linux-2.6.7-xen-sparse/drivers/xen/netback/netback.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c @@ -749,8 +749,7 @@ static int __init netback_init(void) { page = virt_to_page(MMAP_VADDR(i)); set_page_count(page, 1); - SetPageForeign(page); - PageForeignDestructor(page) = netif_page_release; + SetPageForeign(page, netif_page_release); } pending_cons = 0; diff --git a/linux-2.6.7-xen-sparse/drivers/xen/netfront/Kconfig b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/Kconfig similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/netfront/Kconfig rename to linux-2.6.8.1-xen-sparse/drivers/xen/netfront/Kconfig diff --git a/linux-2.6.7-xen-sparse/drivers/xen/netfront/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/netfront/Makefile rename to linux-2.6.8.1-xen-sparse/drivers/xen/netfront/Makefile diff --git a/linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c diff --git a/linux-2.6.7-xen-sparse/drivers/xen/privcmd/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/Makefile similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/privcmd/Makefile rename to linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/Makefile diff --git a/linux-2.6.7-xen-sparse/drivers/xen/privcmd/privcmd.c b/linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/privcmd.c similarity index 100% rename from linux-2.6.7-xen-sparse/drivers/xen/privcmd/privcmd.c rename to linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/privcmd.c diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/desc.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/desc.h similarity index 96% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/desc.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/desc.h index b36aaa26b3..3cebc41697 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/desc.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/desc.h @@ -46,8 +46,8 @@ __asm__ __volatile__ ("movw %w3,0(%2)\n\t" \ static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr) { - _set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], - (int)addr, 235, 0x89); + _set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], (int)addr, + offsetof(struct tss_struct, __cacheline_filler) - 1, 0x89); } #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h similarity index 98% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h index 0ba88a13e5..a865309a33 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h @@ -1,6 +1,9 @@ #ifndef _ASM_I386_DMA_MAPPING_H #define _ASM_I386_DMA_MAPPING_H +#include +#include + #include #include #include diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/e820.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/e820.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/e820.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/e820.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/fixmap.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/fixmap.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/fixmap.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/fixmap.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/highmem.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/highmem.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/highmem.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/highmem.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/io.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/io.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/io.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/io.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/do_timer.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/do_timer.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/do_timer.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/do_timer.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/io_ports.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/io_ports.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/io_ports.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/io_ports.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_mpspec.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_mpspec.h similarity index 60% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_mpspec.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_mpspec.h index cf0b2f6437..6b5dadcf1d 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_mpspec.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_mpspec.h @@ -1,11 +1,6 @@ #ifndef __ASM_MACH_MPSPEC_H #define __ASM_MACH_MPSPEC_H -/* - * a maximum of 16 APICs with the current APIC ID architecture. - */ -#define MAX_APICS 16 - #define MAX_IRQ_SOURCES 256 #define MAX_MP_BUSSES 32 diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_reboot.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_reboot.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_reboot.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_reboot.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_resources.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_resources.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_resources.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_resources.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_time.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_time.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_time.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_time.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_timer.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_timer.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_timer.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_timer.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_traps.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_traps.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_traps.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/mach_traps.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/pci-functions.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/pci-functions.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/pci-functions.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/pci-functions.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h similarity index 89% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h index 012932aa87..e4daac8ed3 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h @@ -6,7 +6,7 @@ * use of all of the static functions. **/ -static inline char * __init machine_specific_memory_setup(void) +static char * __init machine_specific_memory_setup(void) { char *who; unsigned long start_pfn, max_pfn; @@ -25,7 +25,7 @@ static inline char * __init machine_specific_memory_setup(void) extern void hypervisor_callback(void); extern void failsafe_callback(void); -static inline void __init machine_specific_arch_setup(void) +static void __init machine_specific_arch_setup(void) { HYPERVISOR_set_callbacks( __KERNEL_CS, (unsigned long)hypervisor_callback, diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h similarity index 62% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h index 957ed99358..b18df6896c 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h @@ -2,4 +2,4 @@ #define ARCH_SETUP machine_specific_arch_setup(); -static inline void __init machine_specific_arch_setup(void); +static void __init machine_specific_arch_setup(void); diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mmu_context.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mmu_context.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/msr.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/msr.h similarity index 97% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/msr.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/msr.h index 452d0690c4..4cc4f318ba 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/msr.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/msr.h @@ -232,6 +232,15 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val) #define MSR_K7_FID_VID_CTL 0xC0010041 #define MSR_K7_FID_VID_STATUS 0xC0010042 +/* extended feature register */ +#define MSR_EFER 0xc0000080 + +/* EFER bits: */ + +/* Execute Disable enable */ +#define _EFER_NX 11 +#define EFER_NX (1<<_EFER_NX) + /* Centaur-Hauls/IDT defined MSRs. */ #define MSR_IDT_FCR1 0x107 #define MSR_IDT_FCR2 0x108 diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/page.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/page.h similarity index 94% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/page.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/page.h index c7999f04bd..d299d7cd02 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/page.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/page.h @@ -59,15 +59,20 @@ static inline unsigned long machine_to_phys(unsigned long machine) * These are used to make use of C type-checking.. */ #ifdef CONFIG_X86_PAE +extern unsigned long long __supported_pte_mask; +extern int nx_enabled; typedef struct { unsigned long pte_low, pte_high; } pte_t; typedef struct { unsigned long long pmd; } pmd_t; typedef struct { unsigned long long pgd; } pgd_t; +typedef struct { unsigned long long pgprot; } pgprot_t; #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) #define HPAGE_SHIFT 21 #else +#define nx_enabled 0 typedef struct { unsigned long pte_low; } pte_t; typedef struct { unsigned long pmd; } pmd_t; typedef struct { unsigned long pgd; } pgd_t; +typedef struct { unsigned long pgprot; } pgprot_t; #define boot_pte_t pte_t /* or would you rather have a typedef */ #if 0 /* XXXcl for MMU_UPDATE_DEBUG */ static inline unsigned long pte_val(pte_t x) @@ -90,7 +95,6 @@ static inline unsigned long pte_val(pte_t x) #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) #endif -typedef struct { unsigned long pgprot; } pgprot_t; static inline unsigned long pmd_val(pmd_t x) { @@ -187,8 +191,10 @@ static __inline__ int get_order(unsigned long size) #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) -#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) +#define VM_DATA_DEFAULT_FLAGS \ + (VM_READ | VM_WRITE | \ + ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) /* VIRT <-> MACHINE conversion */ #define virt_to_machine(_a) (phys_to_machine(__pa(_a))) diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/param.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/param.h similarity index 93% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/param.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/param.h index 8ac120c98a..658b29ed9c 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/param.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/param.h @@ -18,5 +18,6 @@ #endif #define MAXHOSTNAMELEN 64 /* max length of hostname */ +#define COMMAND_LINE_SIZE 256 #endif diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pci.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pci.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pci.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pci.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgalloc.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgalloc.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level-defs.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level-defs.h new file mode 100644 index 0000000000..2afc4fba6f --- /dev/null +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level-defs.h @@ -0,0 +1,21 @@ +#ifndef _I386_PGTABLE_2LEVEL_DEFS_H +#define _I386_PGTABLE_2LEVEL_DEFS_H + +/* + * traditional i386 two-level paging structure: + */ + +#define PGDIR_SHIFT 22 +#define PTRS_PER_PGD 1024 +#define PTRS_PER_PGD_NO_HV (HYPERVISOR_VIRT_START >> PGDIR_SHIFT) + +/* + * the i386 is two-level, so we don't really have any + * PMD directory physically. + */ +#define PMD_SHIFT 22 +#define PTRS_PER_PMD 1 + +#define PTRS_PER_PTE 1024 + +#endif /* _I386_PGTABLE_2LEVEL_DEFS_H */ diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h similarity index 93% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h index f30bd2b83d..c3d554ca70 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h @@ -1,23 +1,6 @@ #ifndef _I386_PGTABLE_2LEVEL_H #define _I386_PGTABLE_2LEVEL_H -/* - * traditional i386 two-level paging structure: - */ - -#define PGDIR_SHIFT 22 -#define PTRS_PER_PGD 1024 -#define PTRS_PER_PGD_NO_HV (HYPERVISOR_VIRT_START >> PGDIR_SHIFT) - -/* - * the i386 is two-level, so we don't really have any - * PMD directory physically. - */ -#define PMD_SHIFT 22 -#define PTRS_PER_PMD 1 - -#define PTRS_PER_PTE 1024 - #define pte_ERROR(e) \ printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low) #define pmd_ERROR(e) \ @@ -119,6 +102,22 @@ static inline pte_t ptep_get_and_clear(pte_t *xp) #define pfn_pte_ma(pfn, prot) __pte_ma(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) #define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) +/* + * All present user pages are user-executable: + */ +static inline int pte_exec(pte_t pte) +{ + return pte_user(pte); +} + +/* + * All present pages are kernel-executable: + */ +static inline int pte_exec_kernel(pte_t pte) +{ + return 1; +} + /* * Bits 0, 6 and 7 are taken, split up the 29 bits of offset * into this range: diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h similarity index 82% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h index 3d10ce434a..a78420491c 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/pgtable.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h @@ -44,19 +44,15 @@ void pgd_dtor(void *, kmem_cache_t *, unsigned long); void pgtable_cache_init(void); void paging_init(void); -#endif /* !__ASSEMBLY__ */ - /* * The Linux x86 paging architecture is 'compile-time dual-mode', it * implements both the traditional 2-level x86 page tables and the * newer 3-level PAE-mode page tables. */ -#ifndef __ASSEMBLY__ #ifdef CONFIG_X86_PAE -# include +# include #else -# include -#endif +# include #endif #define PMD_SIZE (1UL << PMD_SHIFT) @@ -74,8 +70,6 @@ void paging_init(void); #define BOOT_USER_PGD_PTRS (__PAGE_OFFSET >> TWOLEVEL_PGDIR_SHIFT) #define BOOT_KERNEL_PGD_PTRS (1024-BOOT_USER_PGD_PTRS) - -#ifndef __ASSEMBLY__ /* Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the * physical memory until the kernel virtual memory starts. That means that @@ -84,15 +78,17 @@ void paging_init(void); * area for the same reason. ;) */ #define VMALLOC_OFFSET (8*1024*1024) -extern void * high_memory; -#define VMALLOC_START (((unsigned long) high_memory + 2*VMALLOC_OFFSET-1) & \ - ~(VMALLOC_OFFSET-1)) +#define VMALLOC_START (((unsigned long) high_memory + vmalloc_earlyreserve + \ + 2*VMALLOC_OFFSET-1) & ~(VMALLOC_OFFSET-1)) #ifdef CONFIG_HIGHMEM # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) #else # define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) #endif +extern void * high_memory; +extern unsigned long vmalloc_earlyreserve; + /* * The 4MB page is guessing.. Detailed in the infamous "Chapter H" * of the Pentium details, but assuming intel did the straightforward @@ -112,6 +108,7 @@ extern void * high_memory; #define _PAGE_BIT_UNUSED1 9 /* available for programmer */ #define _PAGE_BIT_UNUSED2 10 #define _PAGE_BIT_UNUSED3 11 +#define _PAGE_BIT_NX 63 #define _PAGE_PRESENT 0x001 #define _PAGE_RW 0x002 @@ -128,28 +125,51 @@ extern void * high_memory; #define _PAGE_FILE 0x040 /* set:pagecache unset:swap */ #define _PAGE_PROTNONE 0x080 /* If not present */ +#ifdef CONFIG_X86_PAE +#define _PAGE_NX (1ULL<<_PAGE_BIT_NX) +#else +#define _PAGE_NX 0 +#endif #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) -#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) +#define PAGE_NONE \ + __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) +#define PAGE_SHARED \ + __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED) + +#define PAGE_SHARED_EXEC \ + __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED) +#define PAGE_COPY_NOEXEC \ + __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_NX) +#define PAGE_COPY_EXEC \ + __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) +#define PAGE_COPY \ + PAGE_COPY_NOEXEC +#define PAGE_READONLY \ + __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_NX) +#define PAGE_READONLY_EXEC \ + __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) #define _PAGE_KERNEL \ + (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_NX) +#define _PAGE_KERNEL_EXEC \ (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED) -extern unsigned long __PAGE_KERNEL; -#define __PAGE_KERNEL_RO (__PAGE_KERNEL & ~_PAGE_RW) -#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD) -#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE) +extern unsigned long long __PAGE_KERNEL, __PAGE_KERNEL_EXEC; +#define __PAGE_KERNEL_RO (__PAGE_KERNEL & ~_PAGE_RW) +#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD) +#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE) +#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE) #define PAGE_KERNEL __pgprot(__PAGE_KERNEL) #define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO) +#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) #define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE) #define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE) +#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC) /* * The i386 can't do page protection for execute, and considers that @@ -160,19 +180,19 @@ extern unsigned long __PAGE_KERNEL; #define __P001 PAGE_READONLY #define __P010 PAGE_COPY #define __P011 PAGE_COPY -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY +#define __P100 PAGE_READONLY_EXEC +#define __P101 PAGE_READONLY_EXEC +#define __P110 PAGE_COPY_EXEC +#define __P111 PAGE_COPY_EXEC #define __S000 PAGE_NONE #define __S001 PAGE_READONLY #define __S010 PAGE_SHARED #define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED +#define __S100 PAGE_READONLY_EXEC +#define __S101 PAGE_READONLY_EXEC +#define __S110 PAGE_SHARED_EXEC +#define __S111 PAGE_SHARED_EXEC /* * Define this if things work differently on an i386 and an i486: @@ -201,7 +221,6 @@ extern unsigned long pg0[]; */ static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; } static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; } -static inline int pte_exec(pte_t pte) { return (pte).pte_low & _PAGE_USER; } static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } @@ -222,22 +241,30 @@ static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; retur static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } +#ifdef CONFIG_X86_PAE +# include +#else +# include +#endif + static inline int ptep_test_and_clear_dirty(pte_t *ptep) { - unsigned long pteval = *(unsigned long *)ptep; - int ret = pteval & _PAGE_DIRTY; + pte_t pte = *ptep; + int ret = pte_dirty(pte); if (ret) - queue_l1_entry_update(ptep, pteval & ~_PAGE_DIRTY); + queue_l1_entry_update(ptep, pte_mkclean(pte).pte_low); return ret; } -static inline int ptep_test_and_clear_young(pte_t *ptep) + +static inline int ptep_test_and_clear_young(pte_t *ptep) { - unsigned long pteval = *(unsigned long *)ptep; - int ret = pteval & _PAGE_ACCESSED; + pte_t pte = *ptep; + int ret = pte_young(pte); if (ret) - queue_l1_entry_update(ptep, pteval & ~_PAGE_ACCESSED); + queue_l1_entry_update(ptep, pte_mkold(pte).pte_low); return ret; } + static inline void ptep_set_wrprotect(pte_t *ptep) { pte_t pte = *ptep; @@ -246,9 +273,9 @@ static inline void ptep_set_wrprotect(pte_t *ptep) } static inline void ptep_mkdirty(pte_t *ptep) { - unsigned long pteval = *(unsigned long *)ptep; - if (!(pteval & _PAGE_DIRTY)) - queue_l1_entry_update(ptep, pteval | _PAGE_DIRTY); + pte_t pte = *ptep; + if (!pte_dirty(pte)) + queue_l1_entry_update(ptep, pte_mkdirty(pte).pte_low); } /* @@ -270,6 +297,15 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { pte.pte_low &= _PAGE_CHG_MASK; pte.pte_low |= pgprot_val(newprot); +#ifdef CONFIG_X86_PAE + /* + * Chop off the NX bit (if present), and add the NX portion of + * the newprot (if present): + */ + pte.pte_high &= ~(1 << (_PAGE_BIT_NX - 32)); + pte.pte_high |= (pgprot_val(newprot) >> 32) & \ + (__supported_pte_mask >> 32); +#endif return pte; } @@ -332,6 +368,26 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) #define pte_offset_kernel(dir, address) \ ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) +/* + * Helper function that returns the kernel pagetable entry controlling + * the virtual address 'address'. NULL means no pagetable entry present. + * NOTE: the return type is pte_t but if the pmd is PSE then we return it + * as a pte too. + */ +extern pte_t *lookup_address(unsigned long address); + +/* + * Make a given kernel text page executable/non-executable. + * Returns the previous executability setting of that page (which + * is used to restore the previous state). Used by the SMP bootup code. + * NOTE: this is an __init function for security reasons. + */ +#ifdef CONFIG_X86_PAE + extern int set_kernel_exec(unsigned long vaddr, int enable); +#else + static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;} +#endif + #if defined(CONFIG_HIGHPTE) #define pte_offset_map(dir, address) \ ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE0) + \ diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/processor.h similarity index 98% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/processor.h index b4eafd19f7..7b4ca3fdb9 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/processor.h @@ -271,14 +271,8 @@ static inline void clear_in_cr4 (unsigned long mask) /* * Bus types (default is ISA, but people can check others with these..) - * pc98 indicates PC98 systems (CBUS) */ extern int MCA_bus; -#ifdef CONFIG_X86_PC9800 -#define pc98 1 -#else -#define pc98 0 -#endif static inline void __monitor(const void *eax, unsigned long ecx, unsigned long edx) @@ -315,9 +309,9 @@ extern unsigned int mca_pentium_flag; #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3)) /* - * Size of io_bitmap, covering ports 0 to 0x3ff. + * Size of io_bitmap. */ -#define IO_BITMAP_BITS 1024 +#define IO_BITMAP_BITS 65536 #define IO_BITMAP_BYTES (IO_BITMAP_BITS/8) #define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long)) #define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap) @@ -409,7 +403,7 @@ struct tss_struct { /* * pads the TSS to be cacheline-aligned (size is 0x100) */ - unsigned long __cacheline_filler[5]; + unsigned long __cacheline_filler[37]; /* * .. and then another 0x100 bytes for emergency kernel stack */ diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/segment.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/segment.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/segment.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/segment.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/setup.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/setup.h similarity index 94% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/setup.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/setup.h index 5d7513a392..a8ef8aa22b 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/setup.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/setup.h @@ -56,8 +56,9 @@ extern unsigned char boot_params[PARAM_SIZE]; #define INITRD_START (__pa(start_info.mod_start)) #define INITRD_SIZE (start_info.mod_len) #define EDID_INFO (*(struct edid_info *) (PARAM+0x440)) -#define DISK80_SIGNATURE (*(unsigned int*) (PARAM+DISK80_SIG_BUFFER)) #define EDD_NR (*(unsigned char *) (PARAM+EDDNR)) +#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF)) +#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF)) #define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) #endif /* __ASSEMBLY__ */ diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/system.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/system.h similarity index 98% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/system.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/system.h index 920b1c31db..822c57f29a 100644 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/system.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/system.h @@ -513,13 +513,6 @@ do { \ void disable_hlt(void); void enable_hlt(void); -extern unsigned long dmi_broken; -extern int is_sony_vaio_laptop; extern int es7000_plat; -#define BROKEN_ACPI_Sx 0x0001 -#define BROKEN_INIT_AFTER_S1 0x0002 -#define BROKEN_PNP_BIOS 0x0004 -#define BROKEN_CPUFREQ 0x0008 - #endif diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/timer.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/timer.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/timer.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/timer.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/tlbflush.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/tlbflush.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/tlbflush.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/tlbflush.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/vga.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/vga.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/vga.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/vga.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/xor.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/xor.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/xor.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/xor.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/ctrl_if.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/ctrl_if.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/ctrl_if.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/ctrl_if.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/evtchn.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/evtchn.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/evtchn.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/evtchn.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/multicall.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/multicall.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/multicall.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/multicall.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/proc_cmd.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/proc_cmd.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/proc_cmd.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/proc_cmd.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/queues.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/queues.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/queues.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/queues.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/suspend.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/suspend.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/suspend.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/suspend.h diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/xen_proc.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/xen_proc.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/xen_proc.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/xen_proc.h diff --git a/linux-2.6.7-xen-sparse/include/linux/bio.h b/linux-2.6.8.1-xen-sparse/include/linux/bio.h similarity index 92% rename from linux-2.6.7-xen-sparse/include/linux/bio.h rename to linux-2.6.8.1-xen-sparse/include/linux/bio.h index e4d50adaf2..069345e5b3 100644 --- a/linux-2.6.7-xen-sparse/include/linux/bio.h +++ b/linux-2.6.8.1-xen-sparse/include/linux/bio.h @@ -25,6 +25,15 @@ /* Platforms may set this to teach the BIO layer about IOMMU hardware. */ #include + +#if defined(BIO_VMERGE_MAX_SIZE) && defined(BIO_VMERGE_BOUNDARY) +#define BIOVEC_VIRT_START_SIZE(x) (bvec_to_phys(x) & (BIO_VMERGE_BOUNDARY - 1)) +#define BIOVEC_VIRT_OVERSIZE(x) ((x) > BIO_VMERGE_MAX_SIZE) +#else +#define BIOVEC_VIRT_START_SIZE(x) 0 +#define BIOVEC_VIRT_OVERSIZE(x) 0 +#endif + #ifndef BIO_VMERGE_BOUNDARY #define BIO_VMERGE_BOUNDARY 0 #endif @@ -81,6 +90,15 @@ struct bio { unsigned short bi_hw_segments; unsigned int bi_size; /* residual I/O count */ + + /* + * To keep track of the max hw size, we account for the + * sizes of the first and last virtually mergeable segments + * in this bio + */ + unsigned int bi_hw_front_size; + unsigned int bi_hw_back_size; + unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ struct bio_vec *bi_io_vec; /* the actual vec list */ @@ -102,6 +120,7 @@ struct bio { #define BIO_SEG_VALID 3 /* nr_hw_seg valid */ #define BIO_CLONED 4 /* doesn't own data */ #define BIO_BOUNCED 5 /* bio is a bounce bio */ +#define BIO_USER_MAPPED 6 /* contains user pages */ #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) /* @@ -249,9 +268,11 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); extern int bio_get_nr_vecs(struct block_device *); extern struct bio *bio_map_user(struct request_queue *, struct block_device *, unsigned long, unsigned int, int); -extern void bio_unmap_user(struct bio *, int); +extern void bio_unmap_user(struct bio *); extern void bio_set_pages_dirty(struct bio *bio); extern void bio_check_pages_dirty(struct bio *bio); +extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); +extern int bio_uncopy_user(struct bio *); #ifdef CONFIG_HIGHMEM /* diff --git a/linux-2.6.7-xen-sparse/include/linux/page-flags.h b/linux-2.6.8.1-xen-sparse/include/linux/page-flags.h similarity index 97% rename from linux-2.6.7-xen-sparse/include/linux/page-flags.h rename to linux-2.6.8.1-xen-sparse/include/linux/page-flags.h index 951844c30e..b155a20953 100644 --- a/linux-2.6.7-xen-sparse/include/linux/page-flags.h +++ b/linux-2.6.8.1-xen-sparse/include/linux/page-flags.h @@ -195,16 +195,10 @@ extern unsigned long __read_page_state(unsigned offset); #define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags) #define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags) -#ifndef arch_set_page_uptodate -#define arch_set_page_uptodate(page) do { } while (0) -#endif - #define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags) -#define SetPageUptodate(page) \ - do { \ - arch_set_page_uptodate(page); \ - set_bit(PG_uptodate, &(page)->flags); \ - } while (0) +#ifndef SetPageUptodate +#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) +#endif #define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) #define PageDirty(page) test_bit(PG_dirty, &(page)->flags) @@ -306,7 +300,10 @@ extern unsigned long __read_page_state(unsigned offset); /* A foreign page uses a custom destructor rather than the buddy allocator. */ #ifdef CONFIG_FOREIGN_PAGES #define PageForeign(page) test_bit(PG_foreign, &(page)->flags) -#define SetPageForeign(page) set_bit(PG_foreign, &(page)->flags) +#define SetPageForeign(page, dtor) do { \ + set_bit(PG_foreign, &(page)->flags); \ + (page)->mapping = (void *)dtor; \ +} while (0) #define ClearPageForeign(page) clear_bit(PG_foreign, &(page)->flags) #define PageForeignDestructor(page) \ ( (void (*) (struct page *)) (page)->mapping ) diff --git a/linux-2.6.7-xen-sparse/include/linux/skbuff.h b/linux-2.6.8.1-xen-sparse/include/linux/skbuff.h similarity index 90% rename from linux-2.6.7-xen-sparse/include/linux/skbuff.h rename to linux-2.6.8.1-xen-sparse/include/linux/skbuff.h index 37c4342b9b..ba4e27dbc5 100644 --- a/linux-2.6.7-xen-sparse/include/linux/skbuff.h +++ b/linux-2.6.8.1-xen-sparse/include/linux/skbuff.h @@ -27,6 +27,7 @@ #include #include #include +#include #define HAVE_ALLOC_SKB /* For the drivers to know */ #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ @@ -155,6 +156,7 @@ struct skb_shared_info { * @sk: Socket we are owned by * @stamp: Time we arrived * @dev: Device we arrived on/are leaving by + * @input_dev: Device we arrived on * @real_dev: The real device we are using * @h: Transport layer header * @nh: Network layer header @@ -197,6 +199,7 @@ struct sk_buff { struct sock *sk; struct timeval stamp; struct net_device *dev; + struct net_device *input_dev; struct net_device *real_dev; union { @@ -230,7 +233,7 @@ struct sk_buff { * want to keep them across layers you have to do a skb_clone() * first. This is owned by whoever has the skb queued ATM. */ - char cb[48]; + char cb[40]; unsigned int len, data_len, @@ -262,9 +265,15 @@ struct sk_buff { } private; #endif #ifdef CONFIG_NET_SCHED - __u32 tc_index; /* traffic control index */ + __u32 tc_index; /* traffic control index */ +#ifdef CONFIG_NET_CLS_ACT + __u32 tc_verd; /* traffic control verdict */ + __u32 tc_classid; /* traffic control classid */ + #endif + #endif + /* These elements must be at the end, see alloc_skb() for details. */ unsigned int truesize; atomic_t users; @@ -663,13 +672,15 @@ static inline int skb_pagelen(const struct sk_buff *skb) return len + skb_headlen(skb); } -static inline void skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size) +static inline void skb_fill_page_desc(struct sk_buff *skb, int i, + struct page *page, int off, int size) { skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; - frag->page = page; - frag->page_offset = off; - frag->size = size; - skb_shinfo(skb)->nr_frags = i+1; + + frag->page = page; + frag->page_offset = off; + frag->size = size; + skb_shinfo(skb)->nr_frags = i + 1; } #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) @@ -816,6 +827,30 @@ static inline void skb_reserve(struct sk_buff *skb, unsigned int len) skb->tail += len; } +/* + * CPUs often take a performance hit when accessing unaligned memory + * locations. The actual performance hit varies, it can be small if the + * hardware handles it or large if we have to take an exception and fix it + * in software. + * + * Since an ethernet header is 14 bytes network drivers often end up with + * the IP header at an unaligned offset. The IP header can be aligned by + * shifting the start of the packet by 2 bytes. Drivers should do this + * with: + * + * skb_reserve(NET_IP_ALIGN); + * + * The downside to this alignment of the IP header is that the DMA is now + * unaligned. On some architectures the cost of an unaligned DMA is high + * and this cost outweighs the gains made by aligning the IP header. + * + * Since this trade off varies between architectures, we allow NET_IP_ALIGN + * to be overridden. + */ +#ifndef NET_IP_ALIGN +#define NET_IP_ALIGN 2 +#endif + extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc); static inline void __skb_trim(struct sk_buff *skb, unsigned int len) @@ -975,6 +1010,39 @@ static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len) return skb_pad(skb, len-size); } +static inline int skb_add_data(struct sk_buff *skb, + char __user *from, int copy) +{ + const int off = skb->len; + + if (skb->ip_summed == CHECKSUM_NONE) { + int err = 0; + unsigned int csum = csum_and_copy_from_user(from, + skb_put(skb, copy), + copy, 0, &err); + if (!err) { + skb->csum = csum_block_add(skb->csum, csum, off); + return 0; + } + } else if (!copy_from_user(skb_put(skb, copy), from, copy)) + return 0; + + __skb_trim(skb, off); + return -EFAULT; +} + +static inline int skb_can_coalesce(struct sk_buff *skb, int i, + struct page *page, int off) +{ + if (i) { + struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1]; + + return page == frag->page && + off == frag->page_offset + frag->size; + } + return 0; +} + /** * skb_linearize - convert paged skb to linear one * @skb: buffer to linarize @@ -1038,10 +1106,28 @@ extern unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to, int len, unsigned int csum); extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); +extern void skb_split(struct sk_buff *skb, + struct sk_buff *skb1, const u32 len); extern void skb_init(void); extern void skb_add_mtu(int mtu); +struct skb_iter { + /* Iteration functions set these */ + unsigned char *data; + unsigned int len; + + /* Private to iteration */ + unsigned int nextfrag; + struct sk_buff *fraglist; +}; + +/* Keep iterating until skb_iter_next returns false. */ +extern void skb_iter_first(const struct sk_buff *skb, struct skb_iter *i); +extern int skb_iter_next(const struct sk_buff *skb, struct skb_iter *i); +/* Call this if aborting loop before !skb_iter_next */ +extern void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i); + #ifdef CONFIG_NETFILTER static inline void nf_conntrack_put(struct nf_ct_info *nfct) { @@ -1053,6 +1139,14 @@ static inline void nf_conntrack_get(struct nf_ct_info *nfct) if (nfct) atomic_inc(&nfct->master->use); } +static inline void nf_reset(struct sk_buff *skb) +{ + nf_conntrack_put(skb->nfct); + skb->nfct = NULL; +#ifdef CONFIG_NETFILTER_DEBUG + skb->nf_debug = 0; +#endif +} #ifdef CONFIG_BRIDGE_NETFILTER static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) @@ -1065,9 +1159,10 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge) if (nf_bridge) atomic_inc(&nf_bridge->use); } -#endif - -#endif +#endif /* CONFIG_BRIDGE_NETFILTER */ +#else /* CONFIG_NETFILTER */ +static inline void nf_reset(struct sk_buff *skb) {} +#endif /* CONFIG_NETFILTER */ #endif /* __KERNEL__ */ #endif /* _LINUX_SKBUFF_H */ diff --git a/linux-2.6.7-xen-sparse/mkbuildtree b/linux-2.6.8.1-xen-sparse/mkbuildtree similarity index 100% rename from linux-2.6.7-xen-sparse/mkbuildtree rename to linux-2.6.8.1-xen-sparse/mkbuildtree diff --git a/linux-2.6.7-xen-sparse/mm/page_alloc.c b/linux-2.6.8.1-xen-sparse/mm/page_alloc.c similarity index 92% rename from linux-2.6.7-xen-sparse/mm/page_alloc.c rename to linux-2.6.8.1-xen-sparse/mm/page_alloc.c index 6671262ae0..166246de9a 100644 --- a/linux-2.6.7-xen-sparse/mm/page_alloc.c +++ b/linux-2.6.8.1-xen-sparse/mm/page_alloc.c @@ -38,7 +38,7 @@ DECLARE_BITMAP(node_online_map, MAX_NUMNODES); struct pglist_data *pgdat_list; unsigned long totalram_pages; unsigned long totalhigh_pages; -int nr_swap_pages; +long nr_swap_pages; int numnodes = 1; int sysctl_lower_zone_protection = 0; @@ -55,6 +55,9 @@ EXPORT_SYMBOL(zone_table); static char *zone_names[MAX_NR_ZONES] = { "DMA", "Normal", "HighMem" }; int min_free_kbytes = 1024; +static unsigned long __initdata nr_kernel_pages; +static unsigned long __initdata nr_all_pages; + /* * Temporary debugging check for pages not lying within a given zone. */ @@ -119,7 +122,7 @@ static void prep_compound_page(struct page *page, unsigned long order) int i; int nr_pages = 1 << order; - page[1].mapping = 0; + page[1].mapping = NULL; page[1].index = order; for (i = 0; i < nr_pages; i++) { struct page *p = page + i; @@ -176,20 +179,20 @@ static void destroy_compound_page(struct page *page, unsigned long order) */ static inline void __free_pages_bulk (struct page *page, struct page *base, - struct zone *zone, struct free_area *area, unsigned long mask, - unsigned int order) + struct zone *zone, struct free_area *area, unsigned int order) { - unsigned long page_idx, index; + unsigned long page_idx, index, mask; if (order) destroy_compound_page(page, order); + mask = (~0UL) << order; page_idx = page - base; if (page_idx & ~mask) BUG(); index = page_idx >> (1 + order); - zone->free_pages -= mask; - while (mask + (1 << (MAX_ORDER-1))) { + zone->free_pages += 1 << order; + while (order < MAX_ORDER-1) { struct page *buddy1, *buddy2; BUG_ON(area >= zone->free_area + MAX_ORDER); @@ -198,17 +201,15 @@ static inline void __free_pages_bulk (struct page *page, struct page *base, * the buddy page is still allocated. */ break; - /* - * Move the buddy up one level. - * This code is taking advantage of the identity: - * -mask = 1+~mask - */ - buddy1 = base + (page_idx ^ -mask); + + /* Move the buddy up one level. */ + buddy1 = base + (page_idx ^ (1 << order)); buddy2 = base + page_idx; BUG_ON(bad_range(zone, buddy1)); BUG_ON(bad_range(zone, buddy2)); list_del(&buddy1->lru); mask <<= 1; + order++; area++; index >>= 1; page_idx &= mask; @@ -252,12 +253,11 @@ static int free_pages_bulk(struct zone *zone, int count, struct list_head *list, unsigned int order) { - unsigned long mask, flags; + unsigned long flags; struct free_area *area; struct page *base, *page = NULL; int ret = 0; - mask = (~0UL) << order; base = zone->zone_mem_map; area = zone->free_area + order; spin_lock_irqsave(&zone->lock, flags); @@ -267,7 +267,7 @@ free_pages_bulk(struct zone *zone, int count, page = list_entry(list->prev, struct page, lru); /* have to delete it as __free_pages_bulk list manipulates */ list_del(&page->lru); - __free_pages_bulk(page, base, zone, area, mask, order); + __free_pages_bulk(page, base, zone, area, order); ret++; } spin_unlock_irqrestore(&zone->lock, flags); @@ -290,6 +290,20 @@ void __free_pages_ok(struct page *page, unsigned int order) #define MARK_USED(index, order, area) \ __change_bit((index) >> (1+(order)), (area)->map) +/* + * The order of subdivision here is critical for the IO subsystem. + * Please do not alter this order without good reasons and regression + * testing. Specifically, as large blocks of memory are subdivided, + * the order in which smaller blocks are delivered depends on the order + * they're subdivided in this function. This is the primary factor + * influencing the order in which pages are delivered to the IO + * subsystem according to empirical testing, and this is also justified + * by considering the behavior of a buddy system containing a single + * large block of memory acted on by a series of small allocations. + * This behavior is a critical factor in sglist merging's success. + * + * -- wli + */ static inline struct page * expand(struct zone *zone, struct page *page, unsigned long index, int low, int high, struct free_area *area) @@ -297,14 +311,12 @@ expand(struct zone *zone, struct page *page, unsigned long size = 1 << high; while (high > low) { - BUG_ON(bad_range(zone, page)); area--; high--; size >>= 1; - list_add(&page->lru, &area->free_list); - MARK_USED(index, high, area); - index += size; - page += size; + BUG_ON(bad_range(zone, &page[size])); + list_add(&page[size].lru, &area->free_list); + MARK_USED(index + size, high, area); } return page; } @@ -735,53 +747,12 @@ got_pg: EXPORT_SYMBOL(__alloc_pages); -#ifdef CONFIG_NUMA -/* Early boot: Everything is done by one cpu, but the data structures will be - * used by all cpus - spread them on all nodes. - */ -static __init unsigned long get_boot_pages(unsigned int gfp_mask, unsigned int order) -{ -static int nodenr; - int i = nodenr; - struct page *page; - - for (;;) { - if (i > nodenr + numnodes) - return 0; - if (node_present_pages(i%numnodes)) { - struct zone **z; - /* The node contains memory. Check that there is - * memory in the intended zonelist. - */ - z = NODE_DATA(i%numnodes)->node_zonelists[gfp_mask & GFP_ZONEMASK].zones; - while (*z) { - if ( (*z)->free_pages > (1UL<nr_active + zone->nr_inactive; - - return pages; -} - #ifdef CONFIG_NUMA unsigned int nr_free_pages_pgdat(pg_data_t *pgdat) { @@ -1267,7 +1227,7 @@ static void __init build_zonelists(pg_data_t *pgdat) DECLARE_BITMAP(used_mask, MAX_NUMNODES); /* initialize zonelists */ - for (i = 0; i < MAX_NR_ZONES; i++) { + for (i = 0; i < GFP_ZONETYPES; i++) { zonelist = pgdat->node_zonelists + i; memset(zonelist, 0, sizeof(*zonelist)); zonelist->zones[0] = NULL; @@ -1289,7 +1249,7 @@ static void __init build_zonelists(pg_data_t *pgdat) node_load[node] += load; prev_node = node; load--; - for (i = 0; i < MAX_NR_ZONES; i++) { + for (i = 0; i < GFP_ZONETYPES; i++) { zonelist = pgdat->node_zonelists + i; for (j = 0; zonelist->zones[j] != NULL; j++); @@ -1312,7 +1272,7 @@ static void __init build_zonelists(pg_data_t *pgdat) int i, j, k, node, local_node; local_node = pgdat->node_id; - for (i = 0; i < MAX_NR_ZONES; i++) { + for (i = 0; i < GFP_ZONETYPES; i++) { struct zonelist *zonelist; zonelist = pgdat->node_zonelists + i; @@ -1413,7 +1373,7 @@ static void __init calculate_zone_totalpages(struct pglist_data *pgdat, for (i = 0; i < MAX_NR_ZONES; i++) realtotalpages -= zholes_size[i]; pgdat->node_present_pages = realtotalpages; - printk("On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages); + printk(KERN_DEBUG "On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages); } @@ -1434,7 +1394,7 @@ void __init memmap_init_zone(struct page *start, unsigned long size, int nid, INIT_LIST_HEAD(&page->lru); #ifdef WANT_PAGE_VIRTUAL /* The shift won't overflow because ZONE_NORMAL is below 4G. */ - if (zone != ZONE_HIGHMEM) + if (!is_highmem_idx(zone)) set_page_address(page, __va(start_pfn << PAGE_SHIFT)); #endif start_pfn++; @@ -1474,6 +1434,10 @@ static void __init free_area_init_core(struct pglist_data *pgdat, if (zholes_size) realsize -= zholes_size[j]; + if (j == ZONE_DMA || j == ZONE_NORMAL) + nr_kernel_pages += realsize; + nr_all_pages += realsize; + zone->spanned_pages = size; zone->present_pages = realsize; zone->name = zone_names[j]; @@ -1515,12 +1479,12 @@ static void __init free_area_init_core(struct pglist_data *pgdat, pcp->batch = 1 * batch; INIT_LIST_HEAD(&pcp->list); } - printk(" %s zone: %lu pages, LIFO batch:%lu\n", + printk(KERN_DEBUG " %s zone: %lu pages, LIFO batch:%lu\n", zone_names[j], realsize, batch); INIT_LIST_HEAD(&zone->active_list); INIT_LIST_HEAD(&zone->inactive_list); - atomic_set(&zone->nr_scan_active, 0); - atomic_set(&zone->nr_scan_inactive, 0); + zone->nr_scan_active = 0; + zone->nr_scan_inactive = 0; zone->nr_active = 0; zone->nr_inactive = 0; if (!size) @@ -1868,7 +1832,7 @@ static void setup_per_zone_protection(void) * For each of the different allocation types: * GFP_DMA -> GFP_KERNEL -> GFP_HIGHMEM */ - for (i = 0; i < MAX_NR_ZONES; i++) { + for (i = 0; i < GFP_ZONETYPES; i++) { /* * For each of the zones: * ZONE_HIGHMEM -> ZONE_NORMAL -> ZONE_DMA @@ -1994,9 +1958,9 @@ module_init(init_per_zone_pages_min) * changes. */ int min_free_kbytes_sysctl_handler(ctl_table *table, int write, - struct file *file, void __user *buffer, size_t *length) + struct file *file, void __user *buffer, size_t *length, loff_t *ppos) { - proc_dointvec(table, write, file, buffer, length); + proc_dointvec(table, write, file, buffer, length, ppos); setup_per_zone_pages_min(); setup_per_zone_protection(); return 0; @@ -2008,9 +1972,75 @@ int min_free_kbytes_sysctl_handler(ctl_table *table, int write, * whenever sysctl_lower_zone_protection changes. */ int lower_zone_protection_sysctl_handler(ctl_table *table, int write, - struct file *file, void __user *buffer, size_t *length) + struct file *file, void __user *buffer, size_t *length, loff_t *ppos) { - proc_dointvec_minmax(table, write, file, buffer, length); + proc_dointvec_minmax(table, write, file, buffer, length, ppos); setup_per_zone_protection(); return 0; } + +/* + * allocate a large system hash table from bootmem + * - it is assumed that the hash table must contain an exact power-of-2 + * quantity of entries + */ +void *__init alloc_large_system_hash(const char *tablename, + unsigned long bucketsize, + unsigned long numentries, + int scale, + int consider_highmem, + unsigned int *_hash_shift, + unsigned int *_hash_mask) +{ + unsigned long mem, max, log2qty, size; + void *table; + + /* round applicable memory size up to nearest megabyte */ + mem = consider_highmem ? nr_all_pages : nr_kernel_pages; + mem += (1UL << (20 - PAGE_SHIFT)) - 1; + mem >>= 20 - PAGE_SHIFT; + mem <<= 20 - PAGE_SHIFT; + + /* limit to 1 bucket per 2^scale bytes of low memory (rounded up to + * nearest power of 2 in size) */ + if (scale > PAGE_SHIFT) + mem >>= (scale - PAGE_SHIFT); + else + mem <<= (PAGE_SHIFT - scale); + + mem = 1UL << (long_log2(mem) + 1); + + /* limit allocation size */ + max = (1UL << (PAGE_SHIFT + MAX_SYS_HASH_TABLE_ORDER)) / bucketsize; + if (max > mem) + max = mem; + + /* allow the kernel cmdline to have a say */ + if (!numentries || numentries > max) + numentries = max; + + log2qty = long_log2(numentries); + + do { + size = bucketsize << log2qty; + + table = (void *) alloc_bootmem(size); + + } while (!table && size > PAGE_SIZE); + + if (!table) + panic("Failed to allocate %s hash table\n", tablename); + + printk("%s hash table entries: %d (order: %d, %lu bytes)\n", + tablename, + (1U << log2qty), + long_log2(size) - PAGE_SHIFT, + size); + + if (_hash_shift) + *_hash_shift = log2qty; + if (_hash_mask) + *_hash_mask = (1 << log2qty) - 1; + + return table; +} From e6987671c1d130c8d73fc3a1f3eac736e0fc03d8 Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Thu, 26 Aug 2004 22:20:49 +0000 Subject: [PATCH 02/28] bitkeeper revision 1.1159.54.1 (412e6241CCJDiaJTDiwZxUEAHptmNA) Fix exporting of whole disks as VBDs. --- linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c b/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c index 7a50b14fb2..c60e8fd304 100644 --- a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c +++ b/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c @@ -32,7 +32,7 @@ typedef unsigned char byte; /* from linux/ide.h */ static unsigned int blkif_state = BLKIF_STATE_CLOSED; static unsigned int blkif_evtchn, blkif_irq; -static int blkif_control_rsp_valid; +static volatile int blkif_control_rsp_valid; static blkif_response_t blkif_control_rsp; static blkif_ring_t *blk_ring; @@ -1125,16 +1125,20 @@ static void blkif_status_change(blkif_fe_interface_status_changed_t *status) recovery = 0; wmb(); + blkif_state = BLKIF_STATE_CONNECTED; + /* Kicks things back into life. */ flush_requests(); } else { + /* transtion to connected in case we need to do a + a partion probe on a whole disk */ + blkif_state = BLKIF_STATE_CONNECTED; + /* Probe for discs that are attached to the interface. */ xlvbd_init(); } - - blkif_state = BLKIF_STATE_CONNECTED; /* Kick pending requests. */ spin_lock_irq(&blkif_io_lock); From 9d8a9621ca0564bb17f951ddb7cd6974cac5571e Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Thu, 26 Aug 2004 22:51:10 +0000 Subject: [PATCH 03/28] bitkeeper revision 1.1159.53.3 (412e695eeFpJoA3teQTvadoyC5gOkQ) Fix broken merge. --- .rootkeys | 4 ++-- .../arch/xen/kernel/gnttab.c | 0 .../include/asm-xen/gnttab.h | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/arch/xen/kernel/gnttab.c (100%) rename {linux-2.6.7-xen-sparse => linux-2.6.8.1-xen-sparse}/include/asm-xen/gnttab.h (100%) diff --git a/.rootkeys b/.rootkeys index 5a0b556272..797ec86acd 100644 --- a/.rootkeys +++ b/.rootkeys @@ -125,8 +125,6 @@ 409ba2e7akOFqQUg6Qyg2s28xcXiMg linux-2.4.27-xen-sparse/mm/page_alloc.c 3e5a4e683HKVU-sxtagrDasRB8eBVw linux-2.4.27-xen-sparse/mm/swapfile.c 41180721bNns9Na7w1nJ0ZVt8bhUNA linux-2.4.27-xen-sparse/mm/vmalloc.c -412dfae9eA3_6e6bCGUtg1mj8b56fQ linux-2.6.7-xen-sparse/arch/xen/kernel/gnttab.c -412dfaeazclyNDM0cpnp60Yo4xulpQ linux-2.6.7-xen-sparse/include/asm-xen/gnttab.h 40f562372u3A7_kfbYYixPHJJxYUxA linux-2.6.8.1-xen-sparse/arch/xen/Kconfig 40f56237utH41NPukqHksuNf29IC9A linux-2.6.8.1-xen-sparse/arch/xen/Kconfig.drivers 40f56237penAAlWVBVDpeQZNFIg8CA linux-2.6.8.1-xen-sparse/arch/xen/Makefile @@ -171,6 +169,7 @@ 40f56239pYRq5yshPTkv3ujXKc8K6g linux-2.6.8.1-xen-sparse/arch/xen/kernel/empty.c 40f56238xFQe9T7M_U_FItM-bZIpLw linux-2.6.8.1-xen-sparse/arch/xen/kernel/evtchn.c 4110f478aeQWllIN7J4kouAHiAqrPw linux-2.6.8.1-xen-sparse/arch/xen/kernel/fixup.c +412dfae9eA3_6e6bCGUtg1mj8b56fQ linux-2.6.8.1-xen-sparse/arch/xen/kernel/gnttab.c 40f56239sFcjHiIRmnObRIDF-zaeKQ linux-2.6.8.1-xen-sparse/arch/xen/kernel/process.c 40f562392LBhwmOxVPsYdkYXMxI_ZQ linux-2.6.8.1-xen-sparse/arch/xen/kernel/reboot.c 3f68905c5eiA-lBMQSvXLMWS1ikDEA linux-2.6.8.1-xen-sparse/arch/xen/kernel/xen_proc.c @@ -241,6 +240,7 @@ 40f5623bxUbeGjkRrjDguCy_Gm8RLw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/xor.h 40f5623bYNP7tHE2zX6YQxp9Zq2utQ linux-2.6.8.1-xen-sparse/include/asm-xen/ctrl_if.h 40f5623b3Eqs8pAc5WpPX8_jTzV2qw linux-2.6.8.1-xen-sparse/include/asm-xen/evtchn.h +412dfaeazclyNDM0cpnp60Yo4xulpQ linux-2.6.8.1-xen-sparse/include/asm-xen/gnttab.h 40f5623aGPlsm0u1LTO-NVZ6AGzNRQ linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h 40f5623cndVUFlkxpf7Lfx7xu8madQ linux-2.6.8.1-xen-sparse/include/asm-xen/multicall.h 3f108af1ylCIm82H052FVTfXACBHrw linux-2.6.8.1-xen-sparse/include/asm-xen/proc_cmd.h diff --git a/linux-2.6.7-xen-sparse/arch/xen/kernel/gnttab.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/gnttab.c similarity index 100% rename from linux-2.6.7-xen-sparse/arch/xen/kernel/gnttab.c rename to linux-2.6.8.1-xen-sparse/arch/xen/kernel/gnttab.c diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/gnttab.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/gnttab.h similarity index 100% rename from linux-2.6.7-xen-sparse/include/asm-xen/gnttab.h rename to linux-2.6.8.1-xen-sparse/include/asm-xen/gnttab.h From 004d796c34e9d60411c33cea76d8539f7d481e38 Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 02:47:12 +0000 Subject: [PATCH 04/28] bitkeeper revision 1.1159.53.4 (412ea0b0d3MOd1UTMgtz-Ab-RIhbkQ) linux 2.6.8.1 now correctly accounts system and idle time -- it was testing for ring 0 rather than ring 1. --- .rootkeys | 1 + .../arch/xen/i386/kernel/timers/timer_tsc.c | 2 + .../include/asm-xen/asm-i386/ptrace.h | 62 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/ptrace.h diff --git a/.rootkeys b/.rootkeys index 797ec86acd..bbf5c23855 100644 --- a/.rootkeys +++ b/.rootkeys @@ -230,6 +230,7 @@ 40f5623aEToIXouJgO-ao5d5pcEt1w linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h 40f5623aCCXRPlGpNthVXstGz9ZV3A linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h 40f5623aPCkQQfPtJSooGdhcatrvnQ linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/processor.h +412ea0afQL2CAI-f522TbLjLPMibPQ linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/ptrace.h 40f5623bzLvxr7WoJIxVf2OH4rCBJg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/segment.h 40f5623bG_LzgG6-qwk292nTc5Wabw linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/setup.h 40f5623bgzm_9vwxpzJswlAxg298Gg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c index a872b661a4..05e370f932 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c @@ -355,6 +355,8 @@ static int __init init_tsc(char* override) rdtscll(alarm); + use_tsc=1; + return 0; } diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/ptrace.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/ptrace.h new file mode 100644 index 0000000000..0165ccc542 --- /dev/null +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/ptrace.h @@ -0,0 +1,62 @@ +#ifndef _I386_PTRACE_H +#define _I386_PTRACE_H + +#define EBX 0 +#define ECX 1 +#define EDX 2 +#define ESI 3 +#define EDI 4 +#define EBP 5 +#define EAX 6 +#define DS 7 +#define ES 8 +#define FS 9 +#define GS 10 +#define ORIG_EAX 11 +#define EIP 12 +#define CS 13 +#define EFL 14 +#define UESP 15 +#define SS 16 +#define FRAME_SIZE 17 + +/* this struct defines the way the registers are stored on the + stack during a system call. */ + +struct pt_regs { + long ebx; + long ecx; + long edx; + long esi; + long edi; + long ebp; + long eax; + int xds; + int xes; + long orig_eax; + long eip; + int xcs; + long eflags; + long esp; + int xss; +}; + +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +#define PTRACE_GETFPXREGS 18 +#define PTRACE_SETFPXREGS 19 + +#define PTRACE_OLDSETOPTIONS 21 + +#define PTRACE_GET_THREAD_AREA 25 +#define PTRACE_SET_THREAD_AREA 26 + +#ifdef __KERNEL__ +#define user_mode(regs) ((VM_MASK & (regs)->eflags) || (2 & (regs)->xcs)) +#define instruction_pointer(regs) ((regs)->eip) +#endif + +#endif From 6b974eda29163937e5ce4135659f01a385039932 Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 07:52:29 +0000 Subject: [PATCH 05/28] bitkeeper revision 1.1159.53.5 (412ee83dxDIGZWB_SALrIshFUl9PxQ) tiny revert --- linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c index c60e8fd304..e414259913 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c @@ -1125,10 +1125,11 @@ static void blkif_status_change(blkif_fe_interface_status_changed_t *status) recovery = 0; wmb(); - blkif_state = BLKIF_STATE_CONNECTED; - /* Kicks things back into life. */ flush_requests(); + + /* Now safe to left other peope use interface */ + blkif_state = BLKIF_STATE_CONNECTED; } else { From d89b5451aeb873f9506d488ea32b1fe93aa2f3f1 Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 09:45:06 +0000 Subject: [PATCH 06/28] bitkeeper revision 1.1159.53.6 (412f02a2L7sRmDm5FXr063kbMCR24Q) Include asm/pgalloc.h for direct_remap_area_pages. --- linux-2.6.8.1-xen-sparse/drivers/char/mem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-2.6.8.1-xen-sparse/drivers/char/mem.c b/linux-2.6.8.1-xen-sparse/drivers/char/mem.c index e3b99480fe..ed3df13f65 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/char/mem.c +++ b/linux-2.6.8.1-xen-sparse/drivers/char/mem.c @@ -40,6 +40,7 @@ #include #include +#include #ifdef CONFIG_IA64 # include From 727d8538b2db962619deff7a1521f9176746371d Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 10:19:33 +0000 Subject: [PATCH 07/28] bitkeeper revision 1.1159.53.7 (412f0ab5oS0qMRsN8oxi1yN_HDC1Ew) Prevent vmlinux.lds.s getting built with incorrect arguments (missing -Ui386). --- linux-2.6.8.1-xen-sparse/arch/xen/kernel/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/kernel/Makefile b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/Makefile index d4a167e6e1..3c9542d659 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/kernel/Makefile +++ b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/Makefile @@ -4,7 +4,7 @@ XENARCH := $(subst ",,$(CONFIG_XENARCH)) -$(obj)/vmlinux.lds.s: arch/$(ARCH)/$(XENARCH)/kernel/vmlinux.lds.s +$(obj)/vmlinux.lds.s: @ln -fsn $(srctree)/arch/$(ARCH)/$(XENARCH)/kernel/vmlinux.lds.s $@ extra-y += vmlinux.lds.s From 2baafa79f0d86ce82bb2c948606c849e8a0ecb2d Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 10:37:55 +0000 Subject: [PATCH 08/28] bitkeeper revision 1.1159.55.1 (412f0f038rUapcjNeYZo53E1wq0L8Q) trivial --- linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c index e414259913..12f0fff2ed 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c @@ -32,7 +32,7 @@ typedef unsigned char byte; /* from linux/ide.h */ static unsigned int blkif_state = BLKIF_STATE_CLOSED; static unsigned int blkif_evtchn, blkif_irq; -static volatile int blkif_control_rsp_valid; +static int blkif_control_rsp_valid; static blkif_response_t blkif_control_rsp; static blkif_ring_t *blk_ring; From dcb731aad716c8a46a7e42ed4d414d7f1c7d9792 Mon Sep 17 00:00:00 2001 From: "kaf24@labyrinth.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 12:28:34 +0000 Subject: [PATCH 09/28] bitkeeper revision 1.1159.56.1 (412f28f2oorf9i_6akPMKOUodxF7qg) Towards new device-interface setup code for the frontend drivers. Added a synchronous send-and-get-response call to the control interface API. Modified and extended the domain-controller messaging protocol. --- .../arch/xen/kernel/ctrl_if.c | 72 +++++++++++++++++-- .../drivers/xen/netfront/netfront.c | 9 +-- .../include/asm-xen/ctrl_if.h | 28 ++++++-- tools/python/xen/lowlevel/xu/xu.c | 8 +-- tools/python/xen/xend/server/netif.py | 5 +- .../hypervisor-ifs/io/domain_controller.h | 57 +++++++++++---- 6 files changed, 143 insertions(+), 36 deletions(-) diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/kernel/ctrl_if.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/ctrl_if.c index ef9958e3b7..40d29c70cb 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/kernel/ctrl_if.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/ctrl_if.c @@ -201,7 +201,8 @@ static irqreturn_t ctrl_if_interrupt(int irq, void *dev_id, return IRQ_HANDLED; } -int ctrl_if_send_message_noblock( +int +ctrl_if_send_message_noblock( ctrl_msg_t *msg, ctrl_msg_handler_t hnd, unsigned long id) @@ -245,7 +246,8 @@ int ctrl_if_send_message_noblock( return 0; } -int ctrl_if_send_message_block( +int +ctrl_if_send_message_block( ctrl_msg_t *msg, ctrl_msg_handler_t hnd, unsigned long id, @@ -280,7 +282,59 @@ int ctrl_if_send_message_block( return rc; } -int ctrl_if_enqueue_space_callback(struct tq_struct *task) +/* Allow a reponse-callback handler to find context of a blocked requester. */ +struct rsp_wait { + ctrl_msg_t *msg; /* Buffer for the response message. */ + struct task_struct *task; /* The task that is blocked on the response. */ + int done; /* Indicate to 'task' that response is rcv'ed. */ +}; + +static void __ctrl_if_get_response(ctrl_msg_t *msg, unsigned long id) +{ + struct rsp_wait *wait = (struct rsp_wait *)id; + struct task_struct *task = wait->task; + + memcpy(wait->msg, msg, sizeof(*msg)); + wmb(); + wait->done = 1; + + wake_up_process(task); +} + +int +ctrl_if_send_message_and_get_response( + ctrl_msg_t *msg, + ctrl_msg_t *rmsg, + long wait_state) +{ + struct rsp_wait wait; + int rc; + + wait.msg = rmsg; + wait.done = 0; + wait.task = current; + + if ( (rc = ctrl_if_send_message_block(msg, __ctrl_if_get_response, + (unsigned long)&wait, + wait_state)) != 0 ) + return rc; + + for ( ; ; ) + { + /* NB. Can't easily support TASK_INTERRUPTIBLE here. */ + set_current_state(TASK_UNINTERRUPTIBLE); + if ( wait.done ) + break; + schedule(); + } + + set_current_state(TASK_RUNNING); + return 0; +} + +int +ctrl_if_enqueue_space_callback( + struct tq_struct *task) { control_if_t *ctrl_if = get_ctrl_if(); @@ -299,7 +353,9 @@ int ctrl_if_enqueue_space_callback(struct tq_struct *task) return TX_FULL(ctrl_if); } -void ctrl_if_send_response(ctrl_msg_t *msg) +void +ctrl_if_send_response( + ctrl_msg_t *msg) { control_if_t *ctrl_if = get_ctrl_if(); unsigned long flags; @@ -327,7 +383,8 @@ void ctrl_if_send_response(ctrl_msg_t *msg) ctrl_if_notify_controller(); } -int ctrl_if_register_receiver( +int +ctrl_if_register_receiver( u8 type, ctrl_msg_handler_t hnd, unsigned int flags) @@ -361,7 +418,10 @@ int ctrl_if_register_receiver( return !inuse; } -void ctrl_if_unregister_receiver(u8 type, ctrl_msg_handler_t hnd) +void +ctrl_if_unregister_receiver( + u8 type, + ctrl_msg_handler_t hnd) { unsigned long flags; diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c index 6e3d1ab6dc..71105776b2 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c @@ -814,9 +814,10 @@ static void netif_driver_status_change( int err = 0; int i; - DPRINTK("> nr_interfaces=%d\n", status->nr_interfaces); + DPRINTK("> max_handle=%d\n", status->max_handle); - netctrl.interface_n = status->nr_interfaces; + /* XXX FIXME: Abuse of 'max_handle' as interface count. */ + netctrl.interface_n = status->max_handle; netctrl.connected_n = 0; for ( i = 0; i < netctrl.interface_n; i++ ) @@ -913,7 +914,7 @@ static int __init netif_init(void) cmsg.subtype = CMSG_NETIF_FE_DRIVER_STATUS_CHANGED; cmsg.length = sizeof(netif_fe_driver_status_changed_t); st.status = NETIF_DRIVER_STATUS_UP; - st.nr_interfaces = 0; + st.max_handle = 0; memcpy(cmsg.msg, &st, sizeof(st)); ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE); @@ -999,7 +1000,7 @@ void netif_resume(void) cmsg.subtype = CMSG_NETIF_FE_DRIVER_STATUS_CHANGED; cmsg.length = sizeof(netif_fe_driver_status_changed_t); st.status = NETIF_DRIVER_STATUS_UP; - st.nr_interfaces = 0; + st.max_handle = 0; memcpy(cmsg.msg, &st, sizeof(st)); ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE); #endif diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/ctrl_if.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/ctrl_if.h index c90e010a03..ad1dde6464 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/ctrl_if.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/ctrl_if.h @@ -37,7 +37,8 @@ typedef void (*ctrl_msg_handler_t)(ctrl_msg_t *, unsigned long); * function returns. * 2. If @hnd is NULL then no callback is executed. */ -int ctrl_if_send_message_noblock( +int +ctrl_if_send_message_noblock( ctrl_msg_t *msg, ctrl_msg_handler_t hnd, unsigned long id); @@ -52,12 +53,23 @@ int ctrl_if_send_message_noblock( * function returns. * 2. If @hnd is NULL then no callback is executed. */ -int ctrl_if_send_message_block( +int +ctrl_if_send_message_block( ctrl_msg_t *msg, ctrl_msg_handler_t hnd, unsigned long id, long wait_state); +/* + * Send @msg to the domain controller. Block until the response is received, + * and then copy it into the provided buffer, @rmsg. + */ +int +ctrl_if_send_message_and_get_response( + ctrl_msg_t *msg, + ctrl_msg_t *rmsg, + long wait_state); + /* * Request a callback when there is /possibly/ space to immediately send a * message to the domain controller. This function returns 0 if there is @@ -65,7 +77,9 @@ int ctrl_if_send_message_block( * still be executed. If this function returns 1 then the callback /will/ be * executed when space becomes available. */ -int ctrl_if_enqueue_space_callback(struct tq_struct *task); +int +ctrl_if_enqueue_space_callback( + struct tq_struct *task); /* * Send a response (@msg) to a message from the domain controller. This will @@ -74,7 +88,9 @@ int ctrl_if_enqueue_space_callback(struct tq_struct *task); * 1. The @msg is copied and so can be freed after this function returns. * 2. The @msg may be the original request message, modified in-place. */ -void ctrl_if_send_response(ctrl_msg_t *msg); +void +ctrl_if_send_response( + ctrl_msg_t *msg); /* * Register a receiver for typed messages from the domain controller. The @@ -93,7 +109,9 @@ int ctrl_if_register_receiver( * Unregister a receiver for typed messages from the domain controller. The * handler (@hnd) will not be executed after this function returns. */ -void ctrl_if_unregister_receiver(u8 type, ctrl_msg_handler_t hnd); +void +ctrl_if_unregister_receiver( + u8 type, ctrl_msg_handler_t hnd); /* Suspend/resume notifications. */ void ctrl_if_suspend(void); diff --git a/tools/python/xen/lowlevel/xu/xu.c b/tools/python/xen/lowlevel/xu/xu.c index c1c171383e..f31d54b527 100644 --- a/tools/python/xen/lowlevel/xu/xu.c +++ b/tools/python/xen/lowlevel/xu/xu.c @@ -325,10 +325,10 @@ static PyObject *xu_message_set_response_fields(PyObject *self, PyObject *args) switch ( TYPE(xum->msg.type, xum->msg.subtype) ) { case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED): - P2C(blkif_fe_driver_status_changed_t, nr_interfaces, u32); + P2C(blkif_fe_driver_status_changed_t, max_handle, u32); break; case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_DRIVER_STATUS_CHANGED): - P2C(netif_fe_driver_status_changed_t, nr_interfaces, u32); + P2C(netif_fe_driver_status_changed_t, max_handle, u32); break; } @@ -435,7 +435,7 @@ static PyObject *xu_message_get_payload(PyObject *self, PyObject *args) return dict; case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_DRIVER_STATUS_CHANGED): C2P(netif_fe_driver_status_changed_t, status, Int, Long); - C2P(netif_fe_driver_status_changed_t, nr_interfaces, Int, Long); + C2P(netif_fe_driver_status_changed_t, max_handle, Int, Long); return dict; case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_CONNECT): C2P(netif_fe_interface_connect_t, handle, Int, Long); @@ -630,7 +630,7 @@ static PyObject *xu_message_new(PyObject *self, PyObject *args) break; case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_DRIVER_STATUS_CHANGED): P2C(netif_fe_driver_status_changed_t, status, u32); - P2C(netif_fe_driver_status_changed_t, nr_interfaces, u32); + P2C(netif_fe_driver_status_changed_t, max_handle, u32); break; } diff --git a/tools/python/xen/xend/server/netif.py b/tools/python/xen/xend/server/netif.py index 1ba2169878..be8140da80 100755 --- a/tools/python/xen/xend/server/netif.py +++ b/tools/python/xen/xend/server/netif.py @@ -333,8 +333,9 @@ class NetifController(controller.SplitController): def recv_fe_driver_status_changed(self, msg, req): if not req: return msg = packMsg('netif_fe_driver_status_changed_t', - { 'status' : NETIF_DRIVER_STATUS_UP, - 'nr_interfaces' : len(self.devices) }) + { 'status' : NETIF_DRIVER_STATUS_UP, + ## FIXME: max_handle should be max active interface id + 'max_handle' : len(self.devices) }) self.writeRequest(msg) for dev in self.devices.values(): dev.attach_fe_device() diff --git a/xen/include/hypervisor-ifs/io/domain_controller.h b/xen/include/hypervisor-ifs/io/domain_controller.h index a7f3e4ee08..45090aca0f 100644 --- a/xen/include/hypervisor-ifs/io/domain_controller.h +++ b/xen/include/hypervisor-ifs/io/domain_controller.h @@ -76,6 +76,7 @@ typedef struct { #define CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED 32 #define CMSG_BLKIF_FE_INTERFACE_CONNECT 33 #define CMSG_BLKIF_FE_INTERFACE_DISCONNECT 34 +#define CMSG_BLKIF_FE_INTERFACE_QUERY 35 /* These are used by both front-end and back-end drivers. */ #define blkif_vdev_t u16 @@ -87,7 +88,7 @@ typedef struct { * Notify a guest about a status change on one of its block interfaces. * If the interface is DESTROYED or DOWN then the interface is disconnected: * 1. The shared-memory frame is available for reuse. - * 2. Any unacknowledged messgaes pending on the interface were dropped. + * 2. Any unacknowledged messages pending on the interface were dropped. */ #define BLKIF_INTERFACE_STATUS_DESTROYED 0 /* Interface doesn't exist. */ #define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */ @@ -103,10 +104,13 @@ typedef struct { * CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED: * Notify the domain controller that the front-end driver is DOWN or UP. * When the driver goes DOWN then the controller will send no more - * status-change notifications. When the driver comes UP then the controller - * will send a notification for each interface that currently exists. + * status-change notifications. * If the driver goes DOWN while interfaces are still UP, the domain * will automatically take the interfaces DOWN. + * + * NB. The controller should not send an INTERFACE_STATUS_CHANGED message + * for interfaces that are active when it receives an UP notification. We + * expect that the frontend driver will query those interfaces itself. */ #define BLKIF_DRIVER_STATUS_DOWN 0 #define BLKIF_DRIVER_STATUS_UP 1 @@ -114,11 +118,8 @@ typedef struct { /* IN */ u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */ /* OUT */ - /* - * Tells driver how many interfaces it should expect to immediately - * receive notifications about. - */ - u32 nr_interfaces; /* 4 */ + /* Driver should query interfaces [0..max_handle]. */ + u32 max_handle; /* 4 */ } PACKED blkif_fe_driver_status_changed_t; /* 8 bytes */ /* @@ -142,6 +143,18 @@ typedef struct { u32 handle; /* 0 */ } PACKED blkif_fe_interface_disconnect_t; /* 4 bytes */ +/* + * CMSG_BLKIF_FE_INTERFACE_QUERY: + */ +typedef struct { + /* IN */ + u32 handle; /* 0 */ + /* OUT */ + u32 status; /* 4 */ + u16 evtchn; /* 8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */ + domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */ +} PACKED blkif_fe_interface_query_t; /* 12 bytes */ + /****************************************************************************** * BLOCK-INTERFACE BACKEND DEFINITIONS @@ -332,6 +345,7 @@ typedef struct { #define CMSG_NETIF_FE_DRIVER_STATUS_CHANGED 32 #define CMSG_NETIF_FE_INTERFACE_CONNECT 33 #define CMSG_NETIF_FE_INTERFACE_DISCONNECT 34 +#define CMSG_NETIF_FE_INTERFACE_QUERY 35 /* * CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED: @@ -355,10 +369,13 @@ typedef struct { * CMSG_NETIF_FE_DRIVER_STATUS_CHANGED: * Notify the domain controller that the front-end driver is DOWN or UP. * When the driver goes DOWN then the controller will send no more - * status-change notifications. When the driver comes UP then the controller - * will send a notification for each interface that currently exists. + * status-change notifications. * If the driver goes DOWN while interfaces are still UP, the domain * will automatically take the interfaces DOWN. + * + * NB. The controller should not send an INTERFACE_STATUS_CHANGED message + * for interfaces that are active when it receives an UP notification. We + * expect that the frontend driver will query those interfaces itself. */ #define NETIF_DRIVER_STATUS_DOWN 0 #define NETIF_DRIVER_STATUS_UP 1 @@ -366,11 +383,8 @@ typedef struct { /* IN */ u32 status; /* 0: NETIF_DRIVER_STATUS_??? */ /* OUT */ - /* - * Tells driver how many interfaces it should expect to immediately - * receive notifications about. - */ - u32 nr_interfaces; /* 4 */ + /* Driver should query interfaces [0..max_handle]. */ + u32 max_handle; /* 4 */ } PACKED netif_fe_driver_status_changed_t; /* 8 bytes */ /* @@ -396,6 +410,19 @@ typedef struct { u32 handle; /* 0 */ } PACKED netif_fe_interface_disconnect_t; /* 4 bytes */ +/* + * CMSG_NETIF_FE_INTERFACE_QUERY: + */ +typedef struct { + /* IN */ + u32 handle; /* 0 */ + /* OUT */ + u32 status; /* 4 */ + u16 evtchn; /* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */ + u8 mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */ + domid_t domid; /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */ +} PACKED netif_fe_interface_query_t; /* 18 bytes */ + /****************************************************************************** * NETWORK-INTERFACE BACKEND DEFINITIONS From 1aa1a4d862671a5fa5562c5f59edb9c65c9af2fe Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 12:40:07 +0000 Subject: [PATCH 10/28] bitkeeper revision 1.1159.53.10 (412f2ba7civqPBzGAWhK9meDyFJljw) We now build the 2.6 linux kernel by default. If you still want 2.4, either set LINUX_RELEASE=2.4 or use the 'make linux24' target. --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dace27825d..971c257603 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ dist: all $(MAKE) linux-xenU $(MAKE) linux-xen0 -LINUX_RELEASE ?= 2.4 +LINUX_RELEASE ?= 2.6 LINUX_VER ?= $(shell ( /bin/ls -ld linux-$(LINUX_RELEASE).*-xen-sparse ) 2>/dev/null | \ sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!' ) LINUX26_VER ?= $(shell ( /bin/ls -ld linux-2.6.*-xen-sparse ) 2>/dev/null | \ @@ -123,6 +123,12 @@ linux26: $(MAKE) LINUX_RELEASE=2.6 config-xen0 $(MAKE) LINUX_RELEASE=2.6 linux-xen0 +linux24: + $(MAKE) LINUX_RELEASE=2.4 mk-linux-trees + $(MAKE) LINUX_RELEASE=2.4 config-xenU + $(MAKE) LINUX_RELEASE=2.4 linux-xenU + $(MAKE) LINUX_RELEASE=2.4 config-xen0 + $(MAKE) LINUX_RELEASE=2.4 linux-xen0 clean: delete-symlinks $(MAKE) -C xen clean From f1cd150e1f99263722fe840b4e039ec8e14dca48 Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 13:29:44 +0000 Subject: [PATCH 11/28] bitkeeper revision 1.1159.57.1 (412f374873CWRyXQT5wTVtsSUl961g) Use hypercall batching where possible. --- .../arch/xen/i386/kernel/ldt.c | 5 +- .../arch/xen/i386/kernel/traps.c | 1 + .../arch/xen/i386/mm/hypervisor.c | 128 +++++++++++++++++- .../arch/xen/i386/mm/init.c | 8 +- .../arch/xen/i386/mm/pgtable.c | 6 +- .../drivers/xen/blkfront/blkfront.c | 2 +- .../include/asm-xen/asm-i386/mmu_context.h | 4 +- .../include/asm-xen/asm-i386/pgalloc.h | 2 + .../include/asm-xen/asm-i386/pgtable-2level.h | 6 +- .../include/asm-xen/asm-i386/pgtable.h | 21 ++- .../include/asm-xen/asm-i386/processor.h | 6 - .../include/asm-xen/asm-i386/tlbflush.h | 9 +- .../include/asm-xen/hypervisor.h | 11 ++ 13 files changed, 172 insertions(+), 37 deletions(-) diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ldt.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ldt.c index 9899654926..4dd697384c 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ldt.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/ldt.c @@ -22,8 +22,10 @@ #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ static void flush_ldt(void *null) { - if (current->active_mm) + if (current->active_mm) { load_LDT(¤t->active_mm->context); + flush_page_update_queue(); + } } #endif @@ -90,6 +92,7 @@ static inline int copy_ldt(mm_context_t *new, mm_context_t *old) memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE); make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) / PAGE_SIZE); + flush_page_update_queue(); return 0; } diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/traps.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/traps.c index 9cef6bd77e..2f3529b759 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/traps.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/traps.c @@ -967,6 +967,7 @@ void __init trap_init(void) set_call_gate(&default_ldt[0],lcall7); set_call_gate(&default_ldt[4],lcall27); __make_page_readonly(&default_ldt[0]); + xen_flush_page_update_queue(); /* * Should be a barrier for any external CPU state. diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/hypervisor.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/hypervisor.c index 957555f92a..a57eabcd8c 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/hypervisor.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/hypervisor.c @@ -28,7 +28,7 @@ static spinlock_t update_lock = SPIN_LOCK_UNLOCKED; #define QUEUE_SIZE 2048 #define pte_offset_kernel pte_offset #else -#define QUEUE_SIZE 1 +#define QUEUE_SIZE 128 #endif static mmu_update_t update_queue[QUEUE_SIZE]; @@ -152,6 +152,12 @@ static inline void increment_index(void) if ( unlikely(idx == QUEUE_SIZE) ) __flush_page_update_queue(); } +static inline void increment_index_and_flush(void) +{ + idx++; + __flush_page_update_queue(); +} + void queue_l1_entry_update(pte_t *ptr, unsigned long val) { unsigned long flags; @@ -271,6 +277,126 @@ void queue_machphys_update(unsigned long mfn, unsigned long pfn) spin_unlock_irqrestore(&update_lock, flags); } +/* queue and flush versions of the above */ +void xen_l1_entry_update(pte_t *ptr, unsigned long val) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); +#if MMU_UPDATE_DEBUG > 3 + DEBUG_disallow_pt_read((unsigned long)ptr); +#endif + update_queue[idx].ptr = virt_to_machine(ptr); + update_queue[idx].val = val; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_l2_entry_update(pmd_t *ptr, unsigned long val) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = virt_to_machine(ptr); + update_queue[idx].val = val; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_pt_switch(unsigned long ptr) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = phys_to_machine(ptr); + update_queue[idx].ptr |= MMU_EXTENDED_COMMAND; + update_queue[idx].val = MMUEXT_NEW_BASEPTR; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_tlb_flush(void) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = MMU_EXTENDED_COMMAND; + update_queue[idx].val = MMUEXT_TLB_FLUSH; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_invlpg(unsigned long ptr) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = MMU_EXTENDED_COMMAND; + update_queue[idx].ptr |= ptr & PAGE_MASK; + update_queue[idx].val = MMUEXT_INVLPG; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_pgd_pin(unsigned long ptr) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = phys_to_machine(ptr); + update_queue[idx].ptr |= MMU_EXTENDED_COMMAND; + update_queue[idx].val = MMUEXT_PIN_L2_TABLE; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_pgd_unpin(unsigned long ptr) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = phys_to_machine(ptr); + update_queue[idx].ptr |= MMU_EXTENDED_COMMAND; + update_queue[idx].val = MMUEXT_UNPIN_TABLE; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_pte_pin(unsigned long ptr) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = phys_to_machine(ptr); + update_queue[idx].ptr |= MMU_EXTENDED_COMMAND; + update_queue[idx].val = MMUEXT_PIN_L1_TABLE; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_pte_unpin(unsigned long ptr) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = phys_to_machine(ptr); + update_queue[idx].ptr |= MMU_EXTENDED_COMMAND; + update_queue[idx].val = MMUEXT_UNPIN_TABLE; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_set_ldt(unsigned long ptr, unsigned long len) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = MMU_EXTENDED_COMMAND | ptr; + update_queue[idx].val = MMUEXT_SET_LDT | (len << MMUEXT_CMD_SHIFT); + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + +void xen_machphys_update(unsigned long mfn, unsigned long pfn) +{ + unsigned long flags; + spin_lock_irqsave(&update_lock, flags); + update_queue[idx].ptr = (mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE; + update_queue[idx].val = pfn; + increment_index_and_flush(); + spin_unlock_irqrestore(&update_lock, flags); +} + #ifdef CONFIG_XEN_PHYSDEV_ACCESS unsigned long allocate_empty_lowmem_region(unsigned long pages) diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/init.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/init.c index 12da77b2cb..0b2706b055 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/init.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/init.c @@ -125,6 +125,7 @@ static void __init page_table_range_init (unsigned long start, unsigned long end } } +/* NOTE: caller must call flush_page_update_queue() */ void __init wrprotect_bootpt(pgd_t *pgd, void *page, int set) { pmd_t *pmd; @@ -141,6 +142,7 @@ void __init wrprotect_bootpt(pgd_t *pgd, void *page, int set) pte_val_ma(*pte) | _PAGE_RW); } +/* NOTE: caller must call flush_page_update_queue() */ static void __init protect_bootpt_entries(pgd_t *spgd, pgd_t *dpgd, int set, int pmdupdate, int pmdset) { @@ -163,7 +165,6 @@ static void __init protect_bootpt_entries(pgd_t *spgd, pgd_t *dpgd, int set, } } } - flush_page_update_queue(); } static inline int is_kernel_text(unsigned long addr) @@ -575,14 +576,13 @@ void __init paging_init(void) protect_bootpt_entries((pgd_t *)start_info.pt_base, swapper_pg_dir, 1, 1, 1); queue_pgd_pin(__pa(swapper_pg_dir)); - flush_page_update_queue(); load_cr3(swapper_pg_dir); - __flush_tlb_all(); + __flush_tlb_all(); /* implicit flush */ queue_pgd_unpin(__pa(start_info.pt_base)); - flush_page_update_queue(); protect_bootpt_entries((pgd_t *)start_info.pt_base, swapper_pg_dir, 0, 1, 0); wrprotect_bootpt((pgd_t *)start_info.pt_base, swapper_pg_dir, 0); + flush_page_update_queue(); #ifdef CONFIG_X86_PAE /* diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c index aaf7339661..b6182d9961 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c @@ -180,6 +180,7 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) if (pte) { clear_page(pte); __make_page_readonly(pte); + xen_flush_page_update_queue(); } return pte; } @@ -204,7 +205,10 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) #ifdef CONFIG_HIGHPTE if (pte < highmem_start_page) #endif - __make_page_readonly(phys_to_virt(page_to_pseudophys(pte))); + { + __make_page_readonly(phys_to_virt(page_to_pseudophys(pte))); + flush_page_update_queue(); + } } return pte; } diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c index e414259913..eb8fc0f9f0 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/blkfront/blkfront.c @@ -1263,7 +1263,7 @@ void blkif_completion(blkif_request_t *req) { unsigned long pfn = req->frame_and_sects[i] >> PAGE_SHIFT; unsigned long mfn = phys_to_machine_mapping[pfn]; - queue_machphys_update(mfn, pfn); + xen_machphys_update(mfn, pfn); } break; } diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mmu_context.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mmu_context.h index cea0fd614c..223c7192c6 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mmu_context.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/mmu_context.h @@ -39,7 +39,7 @@ static inline void switch_mm(struct mm_struct *prev, cpu_set(cpu, next->cpu_vm_mask); /* Re-load page tables */ - load_cr3_noflush(next->pgd); + load_cr3(next->pgd); /* * load the LDT, if the LDT is different: @@ -56,7 +56,7 @@ static inline void switch_mm(struct mm_struct *prev, /* We were in lazy tlb mode and leave_mm disabled * tlb flush IPI delivery. We must reload %cr3. */ - load_cr3_noflush(next->pgd); + load_cr3(next->pgd); load_LDT_nolock(&next->context, cpu); } } diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h index f9b4709e50..0ba1e5a542 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h @@ -33,6 +33,7 @@ static inline void pte_free_kernel(pte_t *pte) { free_page((unsigned long)pte); __make_page_writable(pte); + flush_page_update_queue(); } static inline void pte_free(struct page *pte) @@ -43,6 +44,7 @@ static inline void pte_free(struct page *pte) { __make_page_writable(phys_to_virt(page_to_pseudophys(pte))); __free_page(pte); + flush_page_update_queue(); } } diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h index c3d554ca70..1defe99a79 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h @@ -27,14 +27,14 @@ static inline int pgd_present(pgd_t pgd) { return 1; } #define set_pte(pteptr, pteval) (*(pteptr) = pteval) #define set_pte_atomic(pteptr, pteval) (*(pteptr) = pteval) #else -#define set_pte(pteptr, pteval) queue_l1_entry_update(pteptr, (pteval).pte_low) -#define set_pte_atomic(pteptr, pteval) queue_l1_entry_update(pteptr, (pteval).pte_low) +#define set_pte(pteptr, pteval) xen_l1_entry_update(pteptr, (pteval).pte_low) +#define set_pte_atomic(pteptr, pteval) xen_l1_entry_update(pteptr, (pteval).pte_low) #endif /* * (pmds are folded into pgds so this doesn't get actually called, * but the define is needed for a generic inline function.) */ -#define set_pmd(pmdptr, pmdval) queue_l2_entry_update((pmdptr), (pmdval).pmd) +#define set_pmd(pmdptr, pmdval) xen_l2_entry_update((pmdptr), (pmdval).pmd) #define set_pgd(pgdptr, pgdval) ((void)0) #define pgd_page(pgd) \ diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h index a78420491c..6721e85aaf 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h @@ -252,7 +252,7 @@ static inline int ptep_test_and_clear_dirty(pte_t *ptep) pte_t pte = *ptep; int ret = pte_dirty(pte); if (ret) - queue_l1_entry_update(ptep, pte_mkclean(pte).pte_low); + xen_l1_entry_update(ptep, pte_mkclean(pte).pte_low); return ret; } @@ -261,7 +261,7 @@ static inline int ptep_test_and_clear_young(pte_t *ptep) pte_t pte = *ptep; int ret = pte_young(pte); if (ret) - queue_l1_entry_update(ptep, pte_mkold(pte).pte_low); + xen_l1_entry_update(ptep, pte_mkold(pte).pte_low); return ret; } @@ -275,7 +275,7 @@ static inline void ptep_mkdirty(pte_t *ptep) { pte_t pte = *ptep; if (!pte_dirty(pte)) - queue_l1_entry_update(ptep, pte_mkdirty(pte).pte_low); + xen_l1_entry_update(ptep, pte_mkdirty(pte).pte_low); } /* @@ -318,7 +318,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) pmd_t p = *(xp); \ set_pmd(xp, __pmd(0)); \ __make_page_writable((void *)pmd_page_kernel(p)); \ - /* XXXcl queue */ \ + xen_flush_page_update_queue(); \ } while (0) #ifndef CONFIG_DISCONTIGMEM @@ -418,12 +418,13 @@ extern pte_t *lookup_address(unsigned long address); #define update_mmu_cache(vma,address,pte) do { } while (0) #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS -#if 1 +#if 0 #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ do { \ if (__dirty) { \ queue_l1_entry_update((__ptep), (__entry).pte_low); \ - flush_tlb_page(__vma, __address); \ + flush_tlb_page(__vma, __address); \ + xen_flush_page_update_queue(); \ } \ } while (0) #else @@ -434,8 +435,7 @@ extern pte_t *lookup_address(unsigned long address); xen_flush_page_update_queue(); \ HYPERVISOR_update_va_mapping(address>>PAGE_SHIFT, entry, UVMF_INVLPG); \ } else { \ - queue_l1_entry_update((__ptep), (__entry).pte_low); \ - xen_flush_page_update_queue(); \ + xen_l1_entry_update((__ptep), (__entry).pte_low); \ } \ } \ } while (0) @@ -449,6 +449,7 @@ extern pte_t *lookup_address(unsigned long address); #define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) +/* NOTE: make_page* callers must call flush_page_update_queue() */ static inline void __make_page_readonly(void *va) { pgd_t *pgd = pgd_offset_k((unsigned long)va); @@ -474,7 +475,6 @@ static inline void make_page_readonly(void *va) if ( (unsigned long)va >= VMALLOC_START ) __make_page_readonly(machine_to_virt( *(unsigned long *)pte&PAGE_MASK)); - /* XXXcl queue */ } static inline void make_page_writable(void *va) @@ -486,7 +486,6 @@ static inline void make_page_writable(void *va) if ( (unsigned long)va >= VMALLOC_START ) __make_page_writable(machine_to_virt( *(unsigned long *)pte&PAGE_MASK)); - /* XXXcl queue */ } static inline void make_pages_readonly(void *va, unsigned int nr) @@ -496,7 +495,6 @@ static inline void make_pages_readonly(void *va, unsigned int nr) make_page_readonly(va); va = (void *)((unsigned long)va + PAGE_SIZE); } - /* XXXcl queue */ } static inline void make_pages_writable(void *va, unsigned int nr) @@ -506,7 +504,6 @@ static inline void make_pages_writable(void *va, unsigned int nr) make_page_writable(va); va = (void *)((unsigned long)va + PAGE_SIZE); } - /* XXXcl queue */ } static inline unsigned long arbitrary_virt_to_phys(void *va) diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/processor.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/processor.h index 7b4ca3fdb9..b8497743bb 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/processor.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/processor.h @@ -181,12 +181,6 @@ static inline unsigned int cpuid_edx(unsigned int op) } #define load_cr3(pgdir) do { \ - queue_pt_switch(__pa(pgdir)); \ - flush_page_update_queue(); \ - cur_pgd = pgdir; /* XXXsmp */ \ -} while (/* CONSTCOND */0) - -#define load_cr3_noflush(pgdir) do { \ queue_pt_switch(__pa(pgdir)); \ cur_pgd = pgdir; /* XXXsmp */ \ } while (/* CONSTCOND */0) diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/tlbflush.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/tlbflush.h index 59fa36f82d..bb1c124907 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/tlbflush.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/tlbflush.h @@ -6,8 +6,7 @@ #include #define __flush_tlb() do { \ - queue_tlb_flush(); \ - xen_flush_page_update_queue(); \ + xen_tlb_flush(); \ } while (/*CONSTCOND*/0) /* @@ -16,8 +15,7 @@ */ #define __flush_tlb_global() \ do { \ - queue_tlb_flush(); \ - xen_flush_page_update_queue(); \ + xen_tlb_flush(); \ } while (0) extern unsigned long pgkern_mask; @@ -33,8 +31,7 @@ extern unsigned long pgkern_mask; #define cpu_has_invlpg (boot_cpu_data.x86 > 3) #define __flush_tlb_single(addr) do { \ - queue_invlpg(addr); \ - xen_flush_page_update_queue(); \ + xen_invlpg(addr); \ } while (/* CONSTCOND */0) # define __flush_tlb_one(addr) __flush_tlb_single(addr) diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h index a3b180ecb8..4198263d14 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h @@ -58,6 +58,17 @@ void queue_pte_pin(unsigned long ptr); void queue_pte_unpin(unsigned long ptr); void queue_set_ldt(unsigned long ptr, unsigned long bytes); void queue_machphys_update(unsigned long mfn, unsigned long pfn); +void xen_l1_entry_update(pte_t *ptr, unsigned long val); +void xen_l2_entry_update(pmd_t *ptr, unsigned long val); +void xen_pt_switch(unsigned long ptr); +void xen_tlb_flush(void); +void xen_invlpg(unsigned long ptr); +void xen_pgd_pin(unsigned long ptr); +void xen_pgd_unpin(unsigned long ptr); +void xen_pte_pin(unsigned long ptr); +void xen_pte_unpin(unsigned long ptr); +void xen_set_ldt(unsigned long ptr, unsigned long bytes); +void xen_machphys_update(unsigned long mfn, unsigned long pfn); #define MMU_UPDATE_DEBUG 0 #if MMU_UPDATE_DEBUG > 0 From 0bd542b54d619a52d49a5ffb2426104a2fa42392 Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 13:41:23 +0000 Subject: [PATCH 12/28] bitkeeper revision 1.1159.53.11 (412f3a03Su4nmVv7scE_x2v_aEs7fA) Change timestamp format exported by Xen. Now we provide all 64 bits of the processor's TSC. --- .../arch/xen/kernel/time.c | 11 ++++++++--- .../arch/xen/i386/kernel/time.c | 2 +- .../arch/xen/i386/kernel/timers/timer_tsc.c | 7 ++----- xen/arch/x86/time.c | 19 ++++++++----------- xen/include/hypervisor-ifs/arch-x86_32.h | 5 +---- xen/include/hypervisor-ifs/arch-x86_64.h | 9 +-------- 6 files changed, 21 insertions(+), 32 deletions(-) diff --git a/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c b/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c index 23aac6c308..a2ffce3039 100644 --- a/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c +++ b/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c @@ -214,7 +214,8 @@ static void __get_time_values_from_xen(void) rmb(); shadow_tv.tv_sec = HYPERVISOR_shared_info->wc_sec; shadow_tv.tv_usec = HYPERVISOR_shared_info->wc_usec; - shadow_tsc_stamp = HYPERVISOR_shared_info->tsc_timestamp.tsc_bits; + shadow_tsc_stamp = + (u32)(HYPERVISOR_shared_info->tsc_timestamp >> rdtsc_bitshift); shadow_system_time = HYPERVISOR_shared_info->system_time; rmb(); } @@ -604,6 +605,7 @@ void __init time_init(void) { unsigned long long alarm; u64 __cpu_khz, cpu_freq, scale, scale2; + unsigned int cpu_ghz; __cpu_khz = HYPERVISOR_shared_info->cpu_freq; do_div(__cpu_khz, 1000); @@ -615,8 +617,11 @@ void __init time_init(void) xtime.tv_usec = HYPERVISOR_shared_info->wc_usec; processed_system_time = shadow_system_time; - rdtsc_bitshift = HYPERVISOR_shared_info->tsc_timestamp.tsc_bitshift; - cpu_freq = HYPERVISOR_shared_info->cpu_freq; + cpu_freq = HYPERVISOR_shared_info->cpu_freq; + + cpu_ghz = do_div(cpu_freq, 1000000000UL); + for ( rdtsc_bitshift = 0; cpu_ghz != 0; rdtsc_bitshift++, cpu_ghz >>= 1 ) + continue; scale = 1000000LL << (32 + rdtsc_bitshift); do_div(scale, (u32)cpu_freq); diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c index fbd059a5f7..10562570a8 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c @@ -160,7 +160,7 @@ static void __get_time_values_from_xen(void) rmb(); shadow_tv.tv_sec = s->wc_sec; shadow_tv.tv_usec = s->wc_usec; - shadow_tsc_stamp = s->tsc_timestamp.tsc_bits; + shadow_tsc_stamp = (u32)s->tsc_timestamp; shadow_system_time = s->system_time; rmb(); } diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c index 05e370f932..7348d2a081 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c @@ -78,7 +78,6 @@ static int count2; /* counter for mark_offset_tsc() */ */ static unsigned long fast_gettimeoffset_quotient; -unsigned int rdtsc_bitshift; extern u32 shadow_tsc_stamp; extern u64 shadow_system_time; @@ -91,7 +90,7 @@ static unsigned long get_offset_tsc(void) rdtsc(eax,edx); /* .. relative to previous jiffy (32 bits is enough) */ - eax -= (shadow_tsc_stamp << rdtsc_bitshift) & 0xffffffff; + eax -= shadow_tsc_stamp; /* * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient @@ -119,7 +118,7 @@ static unsigned long long monotonic_clock_tsc(void) /* atomically read monotonic base & last_offset */ do { seq = read_seqbegin(&monotonic_lock); - last_offset = monotonic_offset << rdtsc_bitshift; + last_offset = monotonic_offset; base = monotonic_base; } while (read_seqretry(&monotonic_lock, seq)); @@ -349,8 +348,6 @@ static int __init init_tsc(char* override) "0" (eax), "1" (edx)); } - rdtsc_bitshift = HYPERVISOR_shared_info->tsc_timestamp.tsc_bitshift; - set_cyc2ns_scale(cpu_khz/1000); rdtscll(alarm); diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index dfe20e415d..48b2ce9762 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -44,15 +44,14 @@ static unsigned int rdtsc_bitshift; /* Which 32 bits of TSC do we use? */ static u64 cpu_freq; /* CPU frequency (Hz) */ static u32 st_scale_f; /* Cycles -> ns, fractional part */ static u32 st_scale_i; /* Cycles -> ns, integer part */ -static u32 tsc_irq; /* CPU0's TSC at last 'time update' */ +static u32 shifted_tsc_irq; /* CPU0's TSC at last 'time update' */ +static u64 full_tsc_irq; /* ...ditto, but all 64 bits */ static s_time_t stime_irq; /* System time at last 'time update' */ static unsigned long wc_sec, wc_usec; /* UTC time at last 'time update'. */ static rwlock_t time_lock = RW_LOCK_UNLOCKED; static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - u64 full_tsc; - write_lock_irq(&time_lock); #ifdef CONFIG_X86_IO_APIC @@ -71,8 +70,8 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) * Updates TSC timestamp (used to interpolate passage of time between * interrupts). */ - rdtscll(full_tsc); - tsc_irq = (u32)(full_tsc >> rdtsc_bitshift); + rdtscll(full_tsc_irq); + shifted_tsc_irq = (u32)(full_tsc_irq >> rdtsc_bitshift); /* Update jiffies counter. */ (*(unsigned long *)&jiffies)++; @@ -243,7 +242,7 @@ static inline u64 get_time_delta(void) rdtscll(tsc); low = (u32)(tsc >> rdtsc_bitshift); - delta_tsc = (s32)(low - tsc_irq); + delta_tsc = (s32)(low - shifted_tsc_irq); if ( unlikely(delta_tsc < 0) ) delta_tsc = 0; delta = ((u64)delta_tsc * st_scale_f); delta >>= 32; @@ -285,8 +284,7 @@ void update_dom_time(shared_info_t *si) wmb(); si->cpu_freq = cpu_freq; - si->tsc_timestamp.tsc_bitshift = rdtsc_bitshift; - si->tsc_timestamp.tsc_bits = tsc_irq; + si->tsc_timestamp = full_tsc_irq; si->system_time = stime_irq; si->wc_sec = wc_sec; si->wc_usec = wc_usec; @@ -328,7 +326,6 @@ void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base) int __init init_xen_time() { u64 scale; - u64 full_tsc; unsigned int cpu_ghz; cpu_ghz = (unsigned int)(cpu_freq / 1000000000ULL); @@ -341,9 +338,9 @@ int __init init_xen_time() st_scale_i = scale >> 32; /* System time ticks from zero. */ - rdtscll(full_tsc); + rdtscll(full_tsc_irq); stime_irq = (s_time_t)0; - tsc_irq = (u32)(full_tsc >> rdtsc_bitshift); + shifted_tsc_irq = (u32)(full_tsc_irq >> rdtsc_bitshift); /* Wallclock time starts as the initial RTC time. */ wc_sec = get_cmos_time(); diff --git a/xen/include/hypervisor-ifs/arch-x86_32.h b/xen/include/hypervisor-ifs/arch-x86_32.h index 04edd474ea..91a111bd92 100644 --- a/xen/include/hypervisor-ifs/arch-x86_32.h +++ b/xen/include/hypervisor-ifs/arch-x86_32.h @@ -104,10 +104,7 @@ typedef struct unsigned long ss; } PACKED execution_context_t; -typedef struct { - u32 tsc_bits; /* 0: 32 bits read from the CPU's TSC. */ - u32 tsc_bitshift; /* 4: 'tsc_bits' uses N:N+31 of TSC. */ -} PACKED tsc_timestamp_t; /* 8 bytes */ +typedef u64 tsc_timestamp_t; /* RDTSC timestamp */ /* * The following is all CPU context. Note that the i387_ctxt block is filled diff --git a/xen/include/hypervisor-ifs/arch-x86_64.h b/xen/include/hypervisor-ifs/arch-x86_64.h index 701084cec6..7ac8cf8a73 100644 --- a/xen/include/hypervisor-ifs/arch-x86_64.h +++ b/xen/include/hypervisor-ifs/arch-x86_64.h @@ -100,14 +100,7 @@ typedef struct unsigned long ss; } PACKED execution_context_t; -/* - * NB. This may become a 64-bit count with no shift. If this happens then the - * structure size will still be 8 bytes, so no other alignments will change. - */ -typedef struct { - u32 tsc_bits; /* 0: 32 bits read from the CPU's TSC. */ - u32 tsc_bitshift; /* 4: 'tsc_bits' uses N:N+31 of TSC. */ -} PACKED tsc_timestamp_t; /* 8 bytes */ +typedef u64 tsc_timestamp_t; /* RDTSC timestamp */ /* * The following is all CPU context. Note that the i387_ctxt block is filled From bb907155585ca3bf794cf4d41171ad810c207304 Mon Sep 17 00:00:00 2001 From: "akw27@labyrinth.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 14:59:26 +0000 Subject: [PATCH 13/28] bitkeeper revision 1.1159.58.1 (412f4c4egZceX9qbmExr-wa_i_VDWw) Notes on the innerworkings of the blkif drivers. --- .rootkeys | 1 + docs/blkif-drivers-explained.txt | 477 +++++++++++++++++++++++++++++++ 2 files changed, 478 insertions(+) create mode 100644 docs/blkif-drivers-explained.txt diff --git a/.rootkeys b/.rootkeys index bbf5c23855..3498de4277 100644 --- a/.rootkeys +++ b/.rootkeys @@ -12,6 +12,7 @@ 4021053fmeFrEyPHcT8JFiDpLNgtHQ docs/HOWTOs/Xen-HOWTO 4022a73cgxX1ryj1HgS-IwwB6NUi2A docs/HOWTOs/XenDebugger-HOWTO 3f9e7d53iC47UnlfORp9iC1vai6kWw docs/Makefile +412f4bd9sm5mCQ8BkrgKcAKZGadq7Q docs/blkif-drivers-explained.txt 3f9e7d60PWZJeVh5xdnk0nLUdxlqEA docs/eps/xenlogo.eps 3f9e7d63lTwQbp2fnx7yY93epWS-eQ docs/figs/dummy 3f9e7d564bWFB-Czjv1qdmE6o0GqNg docs/interface.tex diff --git a/docs/blkif-drivers-explained.txt b/docs/blkif-drivers-explained.txt new file mode 100644 index 0000000000..8f6f7a498a --- /dev/null +++ b/docs/blkif-drivers-explained.txt @@ -0,0 +1,477 @@ +=== How the Blkif Drivers Work === +Andrew Warfield +andrew.warfield@cl.cam.ac.uk + +The intent of this is to explain at a fairly detailed level how the +split device drivers work in Xen 1.3 (aka 2.0beta). The intended +audience for this, I suppose, is anyone who intends to work with the +existing blkif interfaces and wants something to help them get up to +speed with the code in a hurry. Secondly though, I hope to break out +the general mechanisms that are used in the drivers that are likely to +be necessary to implement other drivers interfaces. + +As a point of warning before starting, it is worth mentioning that I +anticipate much of the specifics described here changing in the near +future. There has been talk about making the blkif protocol +a bit more efficient than it currently is. Keir's addition of grant +tables will change the current remapping code that is used when shared +pages are initially set up. + +Also, writing other control interface types will likely need support +from Xend, which at the moment has a steep learning curve... this +should be addressed in the future. + +For more information on the driver model as a whole, read the +"Reconstructing I/O" technical report +(http://www.cl.cam.ac.uk/Research/SRG/netos/papers/2004-xenngio.pdf). + +==== High-level structure of a split-driver interface ==== + +Why would you want to write a split driver in the first place? As Xen +is a virtual machine manager and focuses on isolation as an initial +design principle, it is generally considered unwise to share physical +access to devices across domains. The reasons for this are obvious: +when device resources are shared, misbehaving code or hardware can +result in the failure of all of the client applications. Moreover, as +virtual machines in Xen are entire OSs, standard device drives that +they might use cannot have multiple instantiations for a single piece +of hardware. In light of all this, the general approach in Xen is to +give a single virtual machine hardware access to a device, and where +other VMs want to share the device, export a higher-level interface to +facilitate that sharing. If you don't want to share, that's fine. +There are currently Xen users actively exploring running two +completely isolated X-Servers on a Xen host, each with it's own video +card, keyboard, and mouse. In these situations, the guests need only +be given physical access to the necessary devices and left to go on +their own. However, for devices such as disks and network interfaces, +where sharing is required, the split driver approach is a good +solution. + +The structure is like this: + + +--------------------------+ +--------------------------+ + | Domain 0 (privileged) | | Domain 1 (unprivileged) | + | | | | + | Xend ( Application ) | | | + | Blkif Backend Driver | | Blkif Frontend Driver | + | Physical Device Driver | | | + +--------------------------+ +--------------------------+ + +--------------------------------------------------------+ + | X E N | + +--------------------------------------------------------+ + + +The Blkif driver is in two parts, which we refer to as frontend (FE) +and a backend (BE). Together, they serve to proxy device requests +between the guest operating system in an unprivileged domain, and the +physical device driver in the physical domain. An additional benefit +to this approach is that the FE driver can provide a single interface +for a whole class of physical devices. The blkif interface mounts +IDE, SCSI, and our own VBD-structured disks, independent of the +physical driver underneath. Moreover, supporting additional OSs only +requires that a new FE driver be written to connect to the existing +backend. + +==== Inter-Domain Communication Mechanisms ==== + +===== Event Channels ===== + +Before getting into the specifics of the block interface driver, it is +worth discussing the mechanisms that are used to communicate between +domains. Two mechanisms are used to allow the construction of +high-performance drivers: event channels and shared-memory rings. + +Event channels are an asynchronous interdomain notification +mechanism. Xen allows channels to be instantiated between two +domains, and domains can request that a virtual irq be attached to +notifications on a given channel. The result of this is that the +frontend domain can send a notification on an event channel, resulting +in an interrupt entry into the backend at a later time. + +The event channel between two domains is instantiated in the Xend code +during driver startup (described later). Xend's channel.py +(tools/python/xen/xend/server/channel.py) defines the function + + +def eventChannel(dom1, dom2): + return xc.evtchn_bind_interdomain(dom1=dom1, dom2=dom2) + + +which maps to xc_evtchn_bind_interdomain() in tools/libxc/xc_evtchn.c, +which in turn generates a hypercall to Xen to patch the event channel +between the domains. Only a privileged domain can request the +creation of an event channel. + +Once the event channel is created in Xend, its ends are passed to both the +front and backend domains over the control channel. The end that is +passed to a domain is just an integer "port" uniquely identifying the +event channel's local connection to that domain. An example of this +setup code is in linux-2.6.x/drivers/xen/blkfront/blkfront.c in +blkif_status_change, which receives several status change events as +the driver starts up. It is passed an event channel end in a +BLKIF_INTERFACE_STATUS_CONNECTED message, and patches it in like this: + + + blkif_evtchn = status->evtchn; + blkif_irq = bind_evtchn_to_irq(blkif_evtchn); + if ( (rc = request_irq(blkif_irq, blkif_int, + SA_SAMPLE_RANDOM, "blkif", NULL)) ) + printk(KERN_ALERT"blkfront request_irq failed (%ld)\n",rc); + + +This code associates a virtual irq with the event channel, and +attaches the function blkif_int() as an interrupt handler for that +irq. blkif_int() simply handles the notification and returns, it does +not need to interact with the channel at all. + +An example of generating a notification can also be seen in blkfront.c: + + +static inline void flush_requests(void) +{ + DISABLE_SCATTERGATHER(); + wmb(); /* Ensure that the frontend can see the requests. */ + blk_ring->req_prod = req_prod; + notify_via_evtchn(blkif_evtchn); +} +}}} + +notify_via_evtchn issues a hypercall to set the event waiting flag on +the other domain's end of the channel. + +===== Communication Rings ===== + +Event channels are strictly a notification mechanism between domains. +To move large chunks of data back and forth, Xen allows domains to +share pages of memory. We use communication rings as a means of +managing access to a shared memory page for message passing between +domains. These rings are not explicitly a mechanism of Xen, which is +only concerned with the actual sharing of the page and not how it is +used, they are however worth discussing as they are used in many +places in the current code and are a useful model for communicating +across a shared page. + +A shared page is set up by a guest first allocating and passing the +address of a page in its own address space to the backend driver. + + + blk_ring = (blkif_ring_t *)__get_free_page(GFP_KERNEL); + blk_ring->req_prod = blk_ring->resp_prod = resp_cons = req_prod = 0; + ... + /* Construct an interface-CONNECT message for the domain controller. */ + cmsg.type = CMSG_BLKIF_FE; + cmsg.subtype = CMSG_BLKIF_FE_INTERFACE_CONNECT; + cmsg.length = sizeof(blkif_fe_interface_connect_t); + up.handle = 0; + up.shmem_frame = virt_to_machine(blk_ring) >> PAGE_SHIFT; + memcpy(cmsg.msg, &up, sizeof(up)); + + +blk_ring will be the shared page. The producer and consumer pointers +are then initialised (these will be discussed soon), and then the +machine address of the page is send to the backend via a control +channel to Xend. This control channel itself uses the notification +and shared memory mechanisms described here, but is set up for each +domain automatically at startup. + +The backend, which is a privileged domain then takes the page address +and maps it into its own address space (in +linux26/drivers/xen/blkback/interface.c:blkif_connect()): + + +void blkif_connect(blkif_be_connect_t *connect) + + ... + unsigned long shmem_frame = connect->shmem_frame; + ... + + if ( (vma = get_vm_area(PAGE_SIZE, VM_IOREMAP)) == NULL ) + { + connect->status = BLKIF_BE_STATUS_OUT_OF_MEMORY; + return; + } + + prot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED); + error = direct_remap_area_pages(&init_mm, VMALLOC_VMADDR(vma->addr), + shmem_frame<blk_ring_base = (blkif_ring_t *)vma->addr +}}} + +The machine address of the page is passed in the shmem_frame field of +the connect message. This is then mapped into the virtual address +space of the backend domain, and saved in the blkif structure +representing this particular backend connection. + +NOTE: New mechanisms will be added very shortly to allow domains to +explicitly grant access to their pages to other domains. This "grant +table" support is in the process of being added to the tree, and will +change the way a shared page is set up. In particular, it will remove +the need of the remapping domain to be privileged. + +Sending data across shared rings: + +Shared rings avoid the potential for write interference between +domains in a very cunning way. A ring is partitioned into a request +and a response region, and domains only work within their own space. +This can be thought of as a double producer-consumer ring -- the ring +is described by four pointers into a circular buffer of fixed-size +records. Pointers may only advance, and may not pass one another. + + + rsp_cons----+ + V + +----+----+----+----+----+----+----+ + | | | free |RSP1|RSP2| + +----+----+----+----+----+----+----+ + req_prod->| | --------> |RSP3| + +----+ +----+ + |REQ8| | |<-rsp_prod + +----+ +----+ + |REQ7| | | + +----+ +----+ + |REQ6| <-------- | | + +----+----+----+----+----+----+----+ + |REQ5|REQ4| free | | | + +----+----+----+----+----+----+----+ + req_cons---------^ + + + +By adopting the convention that every request will receive a response, +not all four pointers need be shared and flow control on the ring +becomes very easy to manage. Each domain manages its own +consumer pointer, and the two producer pointers are visible to both (Xen/include/hypervisor-ifs/io/blkif.h): + + + +/* NB. Ring size must be small enough for sizeof(blkif_ring_t) <=PAGE_SIZE.*/ + #define BLKIF_RING_SIZE 64 + + ... + +/* + * We use a special capitalised type name because it is _essential_ that all + * arithmetic on indexes is done on an integer type of the correct size. + */ +typedef u32 BLKIF_RING_IDX; + +/* + * Ring indexes are 'free running'. That is, they are not stored modulo the + * size of the ring buffer. The following macro converts a free-running counter + * into a value that can directly index a ring-buffer array. + */ +#define MASK_BLKIF_IDX(_i) ((_i)&(BLKIF_RING_SIZE-1)) + +typedef struct { + BLKIF_RING_IDX req_prod; /* 0: Request producer. Updated by front-end. */ + BLKIF_RING_IDX resp_prod; /* 4: Response producer. Updated by back-end. */ + union { /* 8 */ + blkif_request_t req; + blkif_response_t resp; + } PACKED ring[BLKIF_RING_SIZE]; +} PACKED blkif_ring_t; + + + +As shown in the diagram above, the rules for using a shared memory +ring are simple. + + 1. A ring is full when a domain's producer and consumer pointers are + equal (e.g. req_prod == resp_cons). In this situation, the + consumer pointer must be advanced. Furthermore, if the consumer + pointer is equal to the other domain's producer pointer, + (e.g. resp_cons = resp_prod), then the other domain has all the + buffers. + +2. Producer pointers point to the next buffer that will be written to. + (So blk_ring[MASK_BLKIF_IDX(req_prod)] should not be consumed.) + +3. Consumer pointers point to a valid message, so long as they are not + equal to the associated producer pointer. + +4. A domain should only ever write to the message pointed + to by its producer index, and read from the message at it's + consumer. More generally, the domain may be thought of to have + exclusive access to the messages between its consumer and producer, + and should absolutely not read or write outside this region. + +In general, drivers keep a private copy of their producer pointer and +then set the shared version when they are ready for the other end to +process a set of messages. Additionally, it is worth paying attention +to the use of memory barriers (rmb/wmb) in the code, to ensure that +rings that are shared across processors behave as expected. + +==== Structure of the Blkif Drivers ==== + +Now that the communications primitives have been discussed, I'll +quickly cover the general structure of the blkif driver. This is +intended to give a high-level idea of what is going on, in an effort +to make reading the code a more approachable task. + +There are three key software components that are involved in the blkif +drivers (not counting Xen itself). The frontend and backend driver, +and Xend, which coordinates their initial connection. Xend may also +be involved in control-channel signalling in some cases after startup, +for instance to manage reconnection if the backend is restarted. + +===== Frontend Driver Structure ===== + +The frontend domain uses a single event channel and a shared memory +ring to trade control messages with the backend. These are both setup +during domain startup, which will be discussed shortly. The shared +memory ring is called blkif_ring, and the private ring indexes are +resp_cons, and req_prod. The ring is protected by blkif_io_lock. +Additionally, the frontend keeps a list of outstanding requests in +rec_ring[]. These are uniquely identified by a guest-local id number, +which is associated with each request sent to the backend, and +returned with the matching responses. Information about the actual +disks are stored in major_info[], of which only the first nr_vbds +entries are valid. Finally, the global 'recovery' indicates that the +connection between the backend and frontend drivers has been broken +(possibly due to a backend driver crash) and that the frontend is in +recovery mode, in which case it will attempt to reconnect and reissue +outstanding requests. + +The frontend driver is single-threaded and after setup is entered only +through three points: (1) read/write requests from the XenLinux guest +that it is a part of, (2) interrupts from the backend driver on its +event channel (blkif_int()), and (3) control messages from Xend +(blkif_ctrlif_rx). + +===== Backend Driver Structure ===== + +The backend driver is slightly more complex as it must manage any +number of concurrent frontend connections. For each domain it +manages, the backend driver maintains a blkif structure, which +describes all the connection and disk information associated with that +particular domain. This structure is associated with the interrupt +registration, and allows the backend driver to have immediate context +when it takes a notification from some domain. + +All of the blkif structures are stored in a hash table (blkif_hash), +which is indexed by a hash of the domain id, and a "handle", really a +per-domain blkif identifier, in case it wants to have multiple connections. + +The per-connection blkif structure is of type blkif_t. It contains +all of the communication details (event channel, irq, shared memory +ring and indexes), and blk_ring_lock, which is the backend mutex on +the shared ring. The structure also contains vbd_rb, which is a +red-black tree, containing an entry for each device/partition that is +assigned to that domain. This structure is filled by xend passing +disk information to the backend at startup, and is protected by +vbd_lock. Finally, the blkif struct contains a status field, which +describes the state of the connection. + +The backend driver spawns a kernel thread at startup +(blkio_schedule()), which handles requests to and from the actual disk +device drivers. This scheduler thread maintains a list of blkif +structures that have pending requests, and services them round-robin +with a maximum per-round request limit. blkifs are added to the list +in the interrupt handler (blkif_be_int()) using +add_to_blkdev_list_tail(), and removed in the scheduler loop after +calling do_block_io_op(), which processes a batch of requests. The +scheduler thread is explicitly activated at several points in the code +using maybe_trigger_blkio_schedule(). + +Pending requests between the backend driver and the physical device +drivers use another ring, pending_ring. Requests are placed in this +ring in the scheduler thread and issued to the device. A completion +callback, end_block_io_op, indicates that requests have been serviced +and generates a response on the appropriate blkif ring. pending +reqs[] stores a list of outstanding requests with the physical drivers. + +So, control entries to the backend are (1) the blkio scheduler thread, +which sends requests to the real device drivers, (2) end_block_io_op, +which is called as serviced requests complete, (3) blkif_be_int() +handles notifications from the frontend drivers in other domains, and +(4) blkif_ctrlif_rx() handles control messages from xend. + +==== Driver Startup ==== + +Prior to starting a new guest using the frontend driver, the backend +will have been started in a privileged domain. The backend +initialisation code initialises all of its data structures, such as +the blkif hash table, and starts the scheduler thread as a kernel +thread. It then sends a driver status up message to let xend know it +is ready to take frontend connections. + +When a new domain that uses the blkif frontend driver is started, +there are a series of interactions between it, xend, and the specified +backend driver. These interactions are as follows: + +The domain configuration given to xend will specify the backend domain +and disks that the new guest is to use. Prior to actually running the +domain, xend and the backend driver interact to setup the initial +blkif record in the backend. + +(1) Xend sends a BLKIF_BE_CREATE message to backend. + + Backend does blkif_create(), having been passed FE domid and handle. + It creates and initialises a new blkif struct, and puts it in the + hash table. + It then returns a STATUS_OK response to xend. + +(2) Xend sends a BLKIF_BE_VBD_CREATE message to the backend. + + Backend adds a vbd entry in the red-black tree for the + specified (dom, handle) blkif entry. + Sends a STATUS_OK response. + +(3) Xend sends a BLKIF_BE_VBD_GROW message to the backend. + + Backend takes the physical device information passed in the + message and assigns them to the newly created vbd struct. + +(2) and (3) repeat as any additional devices are added to the domain. + +At this point, the backend has enough state to allow the frontend +domain to start. The domain is run, and eventually gets to the +frontend driver initialisation code. After setting up the frontend +data structures, this code continues the communications with xend and +the backend to negotiate a connection: + +(4) Frontend sends Xend a BLKIF_FE_DRIVER_STATUS_CHANGED message. + + This message tells xend that the driver is up. The init function + now spin-waits until driver setup is complete in order to prevent + Linux from attempting to boot before the disks are connected. + +(5) Xend sends the frontend an INTERFACE_STATUS_CHANGED message + + This message specifies that the interface is now disconnected + (instead of closed). + The domain updates it's state, and allocates the shared blk_ring + page. Next, + +(6) Frontend sends Xend a BLKIF_INTERFACE_CONNECT message + + This message specifies the domain and handle, and includes the + address of the newly created page. + +(7) Xend sends the backend a BLKIF_BE_CONNECT message + + The backend fills in the blkif connection information, maps the + shared page, and binds an irq to the event channel. + +(8) Xend sends the frontend an INTERFACE_STATUS_CHANGED message + + This message takes the frontend driver to a CONNECTED state, at + which point it binds an irq to the event channel and calls + xlvbd_init to initialise the individual block devices. + +The frontend Linux is stall spin waiting at this point, until all of +the disks have been probed. Messaging now is directly between the +front and backend domain using the new shared ring and event channel. + +(9) The frontend sends a BLKIF_OP_PROBE directly to the backend. + + This message includes a reference to an additional page, that the + backend can use for it's reply. The backend responds with an array + of the domains disks (as vdisk_t structs) on the provided page. + +The frontend now initialises each disk, calling xlvbd_init_device() +for each one. From c50cb033fa1de3ecc96d84a2a7cc78766e9096dc Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 15:13:26 +0000 Subject: [PATCH 14/28] bitkeeper revision 1.1159.57.2 (412f4f96lcvl1zNFbliRXwffVN2DFg) Add ptep_establish_new and use in page fault path. --- .rootkeys | 2 + .../include/asm-generic/pgtable.h | 136 ++ .../include/asm-xen/asm-i386/pgtable.h | 19 + linux-2.6.8.1-xen-sparse/mm/memory.c | 1822 +++++++++++++++++ 4 files changed, 1979 insertions(+) create mode 100644 linux-2.6.8.1-xen-sparse/include/asm-generic/pgtable.h create mode 100644 linux-2.6.8.1-xen-sparse/mm/memory.c diff --git a/.rootkeys b/.rootkeys index bbf5c23855..42e6c64efa 100644 --- a/.rootkeys +++ b/.rootkeys @@ -202,6 +202,7 @@ 405853f6nbeazrNyEWNHBuoSg2PiPA linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c 4108f5c1ppFXVpQzCOAZ6xXYubsjKA linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/Makefile 3e5a4e65IUfzzMu2kZFlGEB8-rpTaA linux-2.6.8.1-xen-sparse/drivers/xen/privcmd/privcmd.c +412f47e4RKD-R5IS5gEXvcT8L4v8gA linux-2.6.8.1-xen-sparse/include/asm-generic/pgtable.h 40f56239YAjS52QG2FIAQpHDZAdGHg linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/desc.h 4107adf1E5O4ztGHNGMzCCNhcvqNow linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h 40f5623anSzpuEHgiNmQ56fIRfCoaQ linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/e820.h @@ -252,6 +253,7 @@ 4124f66fp5QwbDHEfoUIa7pqO5Xhag linux-2.6.8.1-xen-sparse/include/linux/page-flags.h 4124f66f4NaKNa0xPiGGykn9QaZk3w linux-2.6.8.1-xen-sparse/include/linux/skbuff.h 40f56a0ddHCSs3501MY4hRf22tctOw linux-2.6.8.1-xen-sparse/mkbuildtree +412f46c0LJuKAgSPGoC0Z1DEkLfuLA linux-2.6.8.1-xen-sparse/mm/memory.c 410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.8.1-xen-sparse/mm/page_alloc.c 40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Make.defs 3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile diff --git a/linux-2.6.8.1-xen-sparse/include/asm-generic/pgtable.h b/linux-2.6.8.1-xen-sparse/include/asm-generic/pgtable.h new file mode 100644 index 0000000000..e7d6c37eea --- /dev/null +++ b/linux-2.6.8.1-xen-sparse/include/asm-generic/pgtable.h @@ -0,0 +1,136 @@ +#ifndef _ASM_GENERIC_PGTABLE_H +#define _ASM_GENERIC_PGTABLE_H + +#ifndef __HAVE_ARCH_PTEP_ESTABLISH +/* + * Establish a new mapping: + * - flush the old one + * - update the page tables + * - inform the TLB about the new one + * + * We hold the mm semaphore for reading and vma->vm_mm->page_table_lock. + * + * Note: the old pte is known to not be writable, so we don't need to + * worry about dirty bits etc getting lost. + */ +#define ptep_establish(__vma, __address, __ptep, __entry) \ +do { \ + set_pte(__ptep, __entry); \ + flush_tlb_page(__vma, __address); \ +} while (0) +#endif + +#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS +/* + * Largely same as above, but only sets the access flags (dirty, + * accessed, and writable). Furthermore, we know it always gets set + * to a "more permissive" setting, which allows most architectures + * to optimize this. + */ +#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ +do { \ + set_pte(__ptep, __entry); \ + flush_tlb_page(__vma, __address); \ +} while (0) +#endif + +#ifndef __HAVE_ARCH_PTEP_ESTABLISH_NEW +#define ptep_establish_new(__vma, __address, __ptep, __entry) \ +do { \ + set_pte(__ptep, __entry); \ +} while (0) +#endif + +#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG +static inline int ptep_test_and_clear_young(pte_t *ptep) +{ + pte_t pte = *ptep; + if (!pte_young(pte)) + return 0; + set_pte(ptep, pte_mkold(pte)); + return 1; +} +#endif + +#ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH +#define ptep_clear_flush_young(__vma, __address, __ptep) \ +({ \ + int __young = ptep_test_and_clear_young(__ptep); \ + if (__young) \ + flush_tlb_page(__vma, __address); \ + __young; \ +}) +#endif + +#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY +static inline int ptep_test_and_clear_dirty(pte_t *ptep) +{ + pte_t pte = *ptep; + if (!pte_dirty(pte)) + return 0; + set_pte(ptep, pte_mkclean(pte)); + return 1; +} +#endif + +#ifndef __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH +#define ptep_clear_flush_dirty(__vma, __address, __ptep) \ +({ \ + int __dirty = ptep_test_and_clear_dirty(__ptep); \ + if (__dirty) \ + flush_tlb_page(__vma, __address); \ + __dirty; \ +}) +#endif + +#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR +static inline pte_t ptep_get_and_clear(pte_t *ptep) +{ + pte_t pte = *ptep; + pte_clear(ptep); + return pte; +} +#endif + +#ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH +#define ptep_clear_flush(__vma, __address, __ptep) \ +({ \ + pte_t __pte = ptep_get_and_clear(__ptep); \ + flush_tlb_page(__vma, __address); \ + __pte; \ +}) +#endif + +#ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT +static inline void ptep_set_wrprotect(pte_t *ptep) +{ + pte_t old_pte = *ptep; + set_pte(ptep, pte_wrprotect(old_pte)); +} +#endif + +#ifndef __HAVE_ARCH_PTEP_MKDIRTY +static inline void ptep_mkdirty(pte_t *ptep) +{ + pte_t old_pte = *ptep; + set_pte(ptep, pte_mkdirty(old_pte)); +} +#endif + +#ifndef __HAVE_ARCH_PTE_SAME +#define pte_same(A,B) (pte_val(A) == pte_val(B)) +#endif + +#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY +#define page_test_and_clear_dirty(page) (0) +#endif + +#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG +#define page_test_and_clear_young(page) (0) +#endif + +#ifndef __HAVE_ARCH_PGD_OFFSET_GATE +#define pgd_offset_gate(mm, addr) pgd_offset(mm, addr) +#endif + +#endif /* _ASM_GENERIC_PGTABLE_H */ diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h index 6721e85aaf..a84b1a2308 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgtable.h @@ -436,12 +436,31 @@ extern pte_t *lookup_address(unsigned long address); HYPERVISOR_update_va_mapping(address>>PAGE_SHIFT, entry, UVMF_INVLPG); \ } else { \ xen_l1_entry_update((__ptep), (__entry).pte_low); \ + flush_tlb_page(__vma, __address); \ } \ } \ } while (0) #endif +#define __HAVE_ARCH_PTEP_ESTABLISH +#define ptep_establish(__vma, __address, __ptep, __entry) \ +do { \ + ptep_set_access_flags(__vma, __address, __ptep, __entry, 1); \ +} while (0) + +#define __HAVE_ARCH_PTEP_ESTABLISH_NEW +#define ptep_establish_new(__vma, __address, __ptep, __entry) \ +do { \ + if ( likely((__vma)->vm_mm == current->mm) ) { \ + xen_flush_page_update_queue(); \ + HYPERVISOR_update_va_mapping((__address)>>PAGE_SHIFT, \ + __entry, 0); \ + } else { \ + xen_l1_entry_update((__ptep), (__entry).pte_low); \ + } \ +} while (0) + /* Encode and de-code a swap entry */ #define __swp_type(x) (((x).val >> 1) & 0x1f) #define __swp_offset(x) ((x).val >> 8) diff --git a/linux-2.6.8.1-xen-sparse/mm/memory.c b/linux-2.6.8.1-xen-sparse/mm/memory.c new file mode 100644 index 0000000000..d1f64fccd4 --- /dev/null +++ b/linux-2.6.8.1-xen-sparse/mm/memory.c @@ -0,0 +1,1822 @@ +/* + * linux/mm/memory.c + * + * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds + */ + +/* + * demand-loading started 01.12.91 - seems it is high on the list of + * things wanted, and it should be easy to implement. - Linus + */ + +/* + * Ok, demand-loading was easy, shared pages a little bit tricker. Shared + * pages started 02.12.91, seems to work. - Linus. + * + * Tested sharing by executing about 30 /bin/sh: under the old kernel it + * would have taken more than the 6M I have free, but it worked well as + * far as I could see. + * + * Also corrected some "invalidate()"s - I wasn't doing enough of them. + */ + +/* + * Real VM (paging to/from disk) started 18.12.91. Much more work and + * thought has to go into this. Oh, well.. + * 19.12.91 - works, somewhat. Sometimes I get faults, don't know why. + * Found it. Everything seems to work now. + * 20.12.91 - Ok, making the swap-device changeable like the root. + */ + +/* + * 05.04.94 - Multi-page memory management added for v1.1. + * Idea by Alex Bligh (alex@cconcepts.co.uk) + * + * 16.07.99 - Support of BIGMEM added by Gerhard Wichert, Siemens AG + * (Gerhard.Wichert@pdb.siemens.de) + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#ifndef CONFIG_DISCONTIGMEM +/* use the per-pgdat data instead for discontigmem - mbligh */ +unsigned long max_mapnr; +struct page *mem_map; + +EXPORT_SYMBOL(max_mapnr); +EXPORT_SYMBOL(mem_map); +#endif + +unsigned long num_physpages; +/* + * A number of key systems in x86 including ioremap() rely on the assumption + * that high_memory defines the upper bound on direct map memory, then end + * of ZONE_NORMAL. Under CONFIG_DISCONTIG this means that max_low_pfn and + * highstart_pfn must be the same; there must be no gap between ZONE_NORMAL + * and ZONE_HIGHMEM. + */ +void * high_memory; +struct page *highmem_start_page; +unsigned long vmalloc_earlyreserve; + +EXPORT_SYMBOL(num_physpages); +EXPORT_SYMBOL(highmem_start_page); +EXPORT_SYMBOL(high_memory); +EXPORT_SYMBOL(vmalloc_earlyreserve); + +/* + * We special-case the C-O-W ZERO_PAGE, because it's such + * a common occurrence (no need to read the page to know + * that it's zero - better for the cache and memory subsystem). + */ +static inline void copy_cow_page(struct page * from, struct page * to, unsigned long address) +{ + if (from == ZERO_PAGE(address)) { + clear_user_highpage(to, address); + return; + } + copy_user_highpage(to, from, address); +} + +/* + * Note: this doesn't free the actual pages themselves. That + * has been handled earlier when unmapping all the memory regions. + */ +static inline void free_one_pmd(struct mmu_gather *tlb, pmd_t * dir) +{ + struct page *page; + + if (pmd_none(*dir)) + return; + if (unlikely(pmd_bad(*dir))) { + pmd_ERROR(*dir); + pmd_clear(dir); + return; + } + page = pmd_page(*dir); + pmd_clear(dir); + dec_page_state(nr_page_table_pages); + pte_free_tlb(tlb, page); +} + +static inline void free_one_pgd(struct mmu_gather *tlb, pgd_t * dir) +{ + int j; + pmd_t * pmd; + + if (pgd_none(*dir)) + return; + if (unlikely(pgd_bad(*dir))) { + pgd_ERROR(*dir); + pgd_clear(dir); + return; + } + pmd = pmd_offset(dir, 0); + pgd_clear(dir); + for (j = 0; j < PTRS_PER_PMD ; j++) + free_one_pmd(tlb, pmd+j); + pmd_free_tlb(tlb, pmd); +} + +/* + * This function clears all user-level page tables of a process - this + * is needed by execve(), so that old pages aren't in the way. + * + * Must be called with pagetable lock held. + */ +void clear_page_tables(struct mmu_gather *tlb, unsigned long first, int nr) +{ + pgd_t * page_dir = tlb->mm->pgd; + + page_dir += first; + do { + free_one_pgd(tlb, page_dir); + page_dir++; + } while (--nr); +} + +pte_t fastcall * pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address) +{ + if (!pmd_present(*pmd)) { + struct page *new; + + spin_unlock(&mm->page_table_lock); + new = pte_alloc_one(mm, address); + spin_lock(&mm->page_table_lock); + if (!new) + return NULL; + + /* + * Because we dropped the lock, we should re-check the + * entry, as somebody else could have populated it.. + */ + if (pmd_present(*pmd)) { + pte_free(new); + goto out; + } + inc_page_state(nr_page_table_pages); + pmd_populate(mm, pmd, new); + } +out: + return pte_offset_map(pmd, address); +} + +pte_t fastcall * pte_alloc_kernel(struct mm_struct *mm, pmd_t *pmd, unsigned long address) +{ + if (!pmd_present(*pmd)) { + pte_t *new; + + spin_unlock(&mm->page_table_lock); + new = pte_alloc_one_kernel(mm, address); + spin_lock(&mm->page_table_lock); + if (!new) + return NULL; + + /* + * Because we dropped the lock, we should re-check the + * entry, as somebody else could have populated it.. + */ + if (pmd_present(*pmd)) { + pte_free_kernel(new); + goto out; + } + pmd_populate_kernel(mm, pmd, new); + } +out: + return pte_offset_kernel(pmd, address); +} +#define PTE_TABLE_MASK ((PTRS_PER_PTE-1) * sizeof(pte_t)) +#define PMD_TABLE_MASK ((PTRS_PER_PMD-1) * sizeof(pmd_t)) + +/* + * copy one vm_area from one task to the other. Assumes the page tables + * already present in the new task to be cleared in the whole range + * covered by this vma. + * + * 08Jan98 Merged into one routine from several inline routines to reduce + * variable count and make things faster. -jj + * + * dst->page_table_lock is held on entry and exit, + * but may be dropped within pmd_alloc() and pte_alloc_map(). + */ +int copy_page_range(struct mm_struct *dst, struct mm_struct *src, + struct vm_area_struct *vma) +{ + pgd_t * src_pgd, * dst_pgd; + unsigned long address = vma->vm_start; + unsigned long end = vma->vm_end; + unsigned long cow; + + if (is_vm_hugetlb_page(vma)) + return copy_hugetlb_page_range(dst, src, vma); + + cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE; + src_pgd = pgd_offset(src, address)-1; + dst_pgd = pgd_offset(dst, address)-1; + + for (;;) { + pmd_t * src_pmd, * dst_pmd; + + src_pgd++; dst_pgd++; + + /* copy_pmd_range */ + + if (pgd_none(*src_pgd)) + goto skip_copy_pmd_range; + if (unlikely(pgd_bad(*src_pgd))) { + pgd_ERROR(*src_pgd); + pgd_clear(src_pgd); +skip_copy_pmd_range: address = (address + PGDIR_SIZE) & PGDIR_MASK; + if (!address || (address >= end)) + goto out; + continue; + } + + src_pmd = pmd_offset(src_pgd, address); + dst_pmd = pmd_alloc(dst, dst_pgd, address); + if (!dst_pmd) + goto nomem; + + do { + pte_t * src_pte, * dst_pte; + + /* copy_pte_range */ + + if (pmd_none(*src_pmd)) + goto skip_copy_pte_range; + if (unlikely(pmd_bad(*src_pmd))) { + pmd_ERROR(*src_pmd); + pmd_clear(src_pmd); +skip_copy_pte_range: + address = (address + PMD_SIZE) & PMD_MASK; + if (address >= end) + goto out; + goto cont_copy_pmd_range; + } + + dst_pte = pte_alloc_map(dst, dst_pmd, address); + if (!dst_pte) + goto nomem; + spin_lock(&src->page_table_lock); + src_pte = pte_offset_map_nested(src_pmd, address); + do { + pte_t pte = *src_pte; + struct page *page; + unsigned long pfn; + + /* copy_one_pte */ + + if (pte_none(pte)) + goto cont_copy_pte_range_noset; + /* pte contains position in swap, so copy. */ + if (!pte_present(pte)) { + if (!pte_file(pte)) + swap_duplicate(pte_to_swp_entry(pte)); + set_pte(dst_pte, pte); + goto cont_copy_pte_range_noset; + } + pfn = pte_pfn(pte); + /* the pte points outside of valid memory, the + * mapping is assumed to be good, meaningful + * and not mapped via rmap - duplicate the + * mapping as is. + */ + page = NULL; + if (pfn_valid(pfn)) + page = pfn_to_page(pfn); + + if (!page || PageReserved(page)) { + set_pte(dst_pte, pte); + goto cont_copy_pte_range_noset; + } + + /* + * If it's a COW mapping, write protect it both + * in the parent and the child + */ + if (cow) { + ptep_set_wrprotect(src_pte); + pte = *src_pte; + } + + /* + * If it's a shared mapping, mark it clean in + * the child + */ + if (vma->vm_flags & VM_SHARED) + pte = pte_mkclean(pte); + pte = pte_mkold(pte); + get_page(page); + dst->rss++; + set_pte(dst_pte, pte); + page_dup_rmap(page); +cont_copy_pte_range_noset: + address += PAGE_SIZE; + if (address >= end) { + pte_unmap_nested(src_pte); + pte_unmap(dst_pte); + goto out_unlock; + } + src_pte++; + dst_pte++; + } while ((unsigned long)src_pte & PTE_TABLE_MASK); + pte_unmap_nested(src_pte-1); + pte_unmap(dst_pte-1); + spin_unlock(&src->page_table_lock); + cond_resched_lock(&dst->page_table_lock); +cont_copy_pmd_range: + src_pmd++; + dst_pmd++; + } while ((unsigned long)src_pmd & PMD_TABLE_MASK); + } +out_unlock: + spin_unlock(&src->page_table_lock); +out: + return 0; +nomem: + return -ENOMEM; +} + +static void zap_pte_range(struct mmu_gather *tlb, + pmd_t *pmd, unsigned long address, + unsigned long size, struct zap_details *details) +{ + unsigned long offset; + pte_t *ptep; + + if (pmd_none(*pmd)) + return; + if (unlikely(pmd_bad(*pmd))) { + pmd_ERROR(*pmd); + pmd_clear(pmd); + return; + } + ptep = pte_offset_map(pmd, address); + offset = address & ~PMD_MASK; + if (offset + size > PMD_SIZE) + size = PMD_SIZE - offset; + size &= PAGE_MASK; + if (details && !details->check_mapping && !details->nonlinear_vma) + details = NULL; + for (offset=0; offset < size; ptep++, offset += PAGE_SIZE) { + pte_t pte = *ptep; + if (pte_none(pte)) + continue; + if (pte_present(pte)) { + struct page *page = NULL; + unsigned long pfn = pte_pfn(pte); + if (pfn_valid(pfn)) { + page = pfn_to_page(pfn); + if (PageReserved(page)) + page = NULL; + } + if (unlikely(details) && page) { + /* + * unmap_shared_mapping_pages() wants to + * invalidate cache without truncating: + * unmap shared but keep private pages. + */ + if (details->check_mapping && + details->check_mapping != page->mapping) + continue; + /* + * Each page->index must be checked when + * invalidating or truncating nonlinear. + */ + if (details->nonlinear_vma && + (page->index < details->first_index || + page->index > details->last_index)) + continue; + } + pte = ptep_get_and_clear(ptep); + tlb_remove_tlb_entry(tlb, ptep, address+offset); + if (unlikely(!page)) + continue; + if (unlikely(details) && details->nonlinear_vma + && linear_page_index(details->nonlinear_vma, + address+offset) != page->index) + set_pte(ptep, pgoff_to_pte(page->index)); + if (pte_dirty(pte)) + set_page_dirty(page); + if (pte_young(pte) && !PageAnon(page)) + mark_page_accessed(page); + tlb->freed++; + page_remove_rmap(page); + tlb_remove_page(tlb, page); + continue; + } + /* + * If details->check_mapping, we leave swap entries; + * if details->nonlinear_vma, we leave file entries. + */ + if (unlikely(details)) + continue; + if (!pte_file(pte)) + free_swap_and_cache(pte_to_swp_entry(pte)); + pte_clear(ptep); + } + pte_unmap(ptep-1); +} + +static void zap_pmd_range(struct mmu_gather *tlb, + pgd_t * dir, unsigned long address, + unsigned long size, struct zap_details *details) +{ + pmd_t * pmd; + unsigned long end; + + if (pgd_none(*dir)) + return; + if (unlikely(pgd_bad(*dir))) { + pgd_ERROR(*dir); + pgd_clear(dir); + return; + } + pmd = pmd_offset(dir, address); + end = address + size; + if (end > ((address + PGDIR_SIZE) & PGDIR_MASK)) + end = ((address + PGDIR_SIZE) & PGDIR_MASK); + do { + zap_pte_range(tlb, pmd, address, end - address, details); + address = (address + PMD_SIZE) & PMD_MASK; + pmd++; + } while (address && (address < end)); +} + +static void unmap_page_range(struct mmu_gather *tlb, + struct vm_area_struct *vma, unsigned long address, + unsigned long end, struct zap_details *details) +{ + pgd_t * dir; + + BUG_ON(address >= end); + dir = pgd_offset(vma->vm_mm, address); + tlb_start_vma(tlb, vma); + do { + zap_pmd_range(tlb, dir, address, end - address, details); + address = (address + PGDIR_SIZE) & PGDIR_MASK; + dir++; + } while (address && (address < end)); + tlb_end_vma(tlb, vma); +} + +/* Dispose of an entire struct mmu_gather per rescheduling point */ +#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT) +#define ZAP_BLOCK_SIZE (FREE_PTE_NR * PAGE_SIZE) +#endif + +/* For UP, 256 pages at a time gives nice low latency */ +#if !defined(CONFIG_SMP) && defined(CONFIG_PREEMPT) +#define ZAP_BLOCK_SIZE (256 * PAGE_SIZE) +#endif + +/* No preempt: go for improved straight-line efficiency */ +#if !defined(CONFIG_PREEMPT) +#define ZAP_BLOCK_SIZE (1024 * PAGE_SIZE) +#endif + +/** + * unmap_vmas - unmap a range of memory covered by a list of vma's + * @tlbp: address of the caller's struct mmu_gather + * @mm: the controlling mm_struct + * @vma: the starting vma + * @start_addr: virtual address at which to start unmapping + * @end_addr: virtual address at which to end unmapping + * @nr_accounted: Place number of unmapped pages in vm-accountable vma's here + * @details: details of nonlinear truncation or shared cache invalidation + * + * Returns the number of vma's which were covered by the unmapping. + * + * Unmap all pages in the vma list. Called under page_table_lock. + * + * We aim to not hold page_table_lock for too long (for scheduling latency + * reasons). So zap pages in ZAP_BLOCK_SIZE bytecounts. This means we need to + * return the ending mmu_gather to the caller. + * + * Only addresses between `start' and `end' will be unmapped. + * + * The VMA list must be sorted in ascending virtual address order. + * + * unmap_vmas() assumes that the caller will flush the whole unmapped address + * range after unmap_vmas() returns. So the only responsibility here is to + * ensure that any thus-far unmapped pages are flushed before unmap_vmas() + * drops the lock and schedules. + */ +int unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm, + struct vm_area_struct *vma, unsigned long start_addr, + unsigned long end_addr, unsigned long *nr_accounted, + struct zap_details *details) +{ + unsigned long zap_bytes = ZAP_BLOCK_SIZE; + unsigned long tlb_start = 0; /* For tlb_finish_mmu */ + int tlb_start_valid = 0; + int ret = 0; + int atomic = details && details->atomic; + + for ( ; vma && vma->vm_start < end_addr; vma = vma->vm_next) { + unsigned long start; + unsigned long end; + + start = max(vma->vm_start, start_addr); + if (start >= vma->vm_end) + continue; + end = min(vma->vm_end, end_addr); + if (end <= vma->vm_start) + continue; + + if (vma->vm_flags & VM_ACCOUNT) + *nr_accounted += (end - start) >> PAGE_SHIFT; + + ret++; + while (start != end) { + unsigned long block; + + if (!tlb_start_valid) { + tlb_start = start; + tlb_start_valid = 1; + } + + if (is_vm_hugetlb_page(vma)) { + block = end - start; + unmap_hugepage_range(vma, start, end); + } else { + block = min(zap_bytes, end - start); + unmap_page_range(*tlbp, vma, start, + start + block, details); + } + + start += block; + zap_bytes -= block; + if ((long)zap_bytes > 0) + continue; + if (!atomic && need_resched()) { + int fullmm = tlb_is_full_mm(*tlbp); + tlb_finish_mmu(*tlbp, tlb_start, start); + cond_resched_lock(&mm->page_table_lock); + *tlbp = tlb_gather_mmu(mm, fullmm); + tlb_start_valid = 0; + } + zap_bytes = ZAP_BLOCK_SIZE; + } + } + return ret; +} + +/** + * zap_page_range - remove user pages in a given range + * @vma: vm_area_struct holding the applicable pages + * @address: starting address of pages to zap + * @size: number of bytes to zap + * @details: details of nonlinear truncation or shared cache invalidation + */ +void zap_page_range(struct vm_area_struct *vma, unsigned long address, + unsigned long size, struct zap_details *details) +{ + struct mm_struct *mm = vma->vm_mm; + struct mmu_gather *tlb; + unsigned long end = address + size; + unsigned long nr_accounted = 0; + + if (is_vm_hugetlb_page(vma)) { + zap_hugepage_range(vma, address, size); + return; + } + + lru_add_drain(); + spin_lock(&mm->page_table_lock); + tlb = tlb_gather_mmu(mm, 0); + unmap_vmas(&tlb, mm, vma, address, end, &nr_accounted, details); + tlb_finish_mmu(tlb, address, end); + spin_unlock(&mm->page_table_lock); +} + +/* + * Do a quick page-table lookup for a single page. + * mm->page_table_lock must be held. + */ +struct page * +follow_page(struct mm_struct *mm, unsigned long address, int write) +{ + pgd_t *pgd; + pmd_t *pmd; + pte_t *ptep, pte; + unsigned long pfn; + struct page *page; + + page = follow_huge_addr(mm, address, write); + if (! IS_ERR(page)) + return page; + + pgd = pgd_offset(mm, address); + if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) + goto out; + + pmd = pmd_offset(pgd, address); + if (pmd_none(*pmd)) + goto out; + if (pmd_huge(*pmd)) + return follow_huge_pmd(mm, address, pmd, write); + if (unlikely(pmd_bad(*pmd))) + goto out; + + ptep = pte_offset_map(pmd, address); + if (!ptep) + goto out; + + pte = *ptep; + pte_unmap(ptep); + if (pte_present(pte)) { + if (write && !pte_write(pte)) + goto out; + pfn = pte_pfn(pte); + if (pfn_valid(pfn)) { + page = pfn_to_page(pfn); + if (write && !pte_dirty(pte) && !PageDirty(page)) + set_page_dirty(page); + mark_page_accessed(page); + return page; + } + } + +out: + return NULL; +} + +/* + * Given a physical address, is there a useful struct page pointing to + * it? This may become more complex in the future if we start dealing + * with IO-aperture pages for direct-IO. + */ + +static inline struct page *get_page_map(struct page *page) +{ + if (!pfn_valid(page_to_pfn(page))) + return NULL; + return page; +} + + +static inline int +untouched_anonymous_page(struct mm_struct* mm, struct vm_area_struct *vma, + unsigned long address) +{ + pgd_t *pgd; + pmd_t *pmd; + + /* Check if the vma is for an anonymous mapping. */ + if (vma->vm_ops && vma->vm_ops->nopage) + return 0; + + /* Check if page directory entry exists. */ + pgd = pgd_offset(mm, address); + if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) + return 1; + + /* Check if page middle directory entry exists. */ + pmd = pmd_offset(pgd, address); + if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) + return 1; + + /* There is a pte slot for 'address' in 'mm'. */ + return 0; +} + + +int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, + unsigned long start, int len, int write, int force, + struct page **pages, struct vm_area_struct **vmas) +{ + int i; + unsigned int flags; + + /* + * Require read or write permissions. + * If 'force' is set, we only require the "MAY" flags. + */ + flags = write ? (VM_WRITE | VM_MAYWRITE) : (VM_READ | VM_MAYREAD); + flags &= force ? (VM_MAYREAD | VM_MAYWRITE) : (VM_READ | VM_WRITE); + i = 0; + + do { + struct vm_area_struct * vma; + + vma = find_extend_vma(mm, start); + if (!vma && in_gate_area(tsk, start)) { + unsigned long pg = start & PAGE_MASK; + struct vm_area_struct *gate_vma = get_gate_vma(tsk); + pgd_t *pgd; + pmd_t *pmd; + pte_t *pte; + if (write) /* user gate pages are read-only */ + return i ? : -EFAULT; + pgd = pgd_offset_gate(mm, pg); + if (!pgd) + return i ? : -EFAULT; + pmd = pmd_offset(pgd, pg); + if (!pmd) + return i ? : -EFAULT; + pte = pte_offset_map(pmd, pg); + if (!pte) + return i ? : -EFAULT; + if (!pte_present(*pte)) { + pte_unmap(pte); + return i ? : -EFAULT; + } + if (pages) { + pages[i] = pte_page(*pte); + get_page(pages[i]); + } + pte_unmap(pte); + if (vmas) + vmas[i] = gate_vma; + i++; + start += PAGE_SIZE; + len--; + continue; + } + + if (!vma || (pages && (vma->vm_flags & VM_IO)) + || !(flags & vma->vm_flags)) + return i ? : -EFAULT; + + if (is_vm_hugetlb_page(vma)) { + i = follow_hugetlb_page(mm, vma, pages, vmas, + &start, &len, i); + continue; + } + spin_lock(&mm->page_table_lock); + do { + struct page *map; + int lookup_write = write; + while (!(map = follow_page(mm, start, lookup_write))) { + /* + * Shortcut for anonymous pages. We don't want + * to force the creation of pages tables for + * insanly big anonymously mapped areas that + * nobody touched so far. This is important + * for doing a core dump for these mappings. + */ + if (!lookup_write && + untouched_anonymous_page(mm,vma,start)) { + map = ZERO_PAGE(start); + break; + } + spin_unlock(&mm->page_table_lock); + switch (handle_mm_fault(mm,vma,start,write)) { + case VM_FAULT_MINOR: + tsk->min_flt++; + break; + case VM_FAULT_MAJOR: + tsk->maj_flt++; + break; + case VM_FAULT_SIGBUS: + return i ? i : -EFAULT; + case VM_FAULT_OOM: + return i ? i : -ENOMEM; + default: + BUG(); + } + /* + * Now that we have performed a write fault + * and surely no longer have a shared page we + * shouldn't write, we shouldn't ignore an + * unwritable page in the page table if + * we are forcing write access. + */ + lookup_write = write && !force; + spin_lock(&mm->page_table_lock); + } + if (pages) { + pages[i] = get_page_map(map); + if (!pages[i]) { + spin_unlock(&mm->page_table_lock); + while (i--) + page_cache_release(pages[i]); + i = -EFAULT; + goto out; + } + flush_dcache_page(pages[i]); + if (!PageReserved(pages[i])) + page_cache_get(pages[i]); + } + if (vmas) + vmas[i] = vma; + i++; + start += PAGE_SIZE; + len--; + } while(len && start < vma->vm_end); + spin_unlock(&mm->page_table_lock); + } while(len); +out: + return i; +} + +EXPORT_SYMBOL(get_user_pages); + +static void zeromap_pte_range(pte_t * pte, unsigned long address, + unsigned long size, pgprot_t prot) +{ + unsigned long end; + + address &= ~PMD_MASK; + end = address + size; + if (end > PMD_SIZE) + end = PMD_SIZE; + do { + pte_t zero_pte = pte_wrprotect(mk_pte(ZERO_PAGE(address), prot)); + BUG_ON(!pte_none(*pte)); + set_pte(pte, zero_pte); + address += PAGE_SIZE; + pte++; + } while (address && (address < end)); +} + +static inline int zeromap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, + unsigned long size, pgprot_t prot) +{ + unsigned long base, end; + + base = address & PGDIR_MASK; + address &= ~PGDIR_MASK; + end = address + size; + if (end > PGDIR_SIZE) + end = PGDIR_SIZE; + do { + pte_t * pte = pte_alloc_map(mm, pmd, base + address); + if (!pte) + return -ENOMEM; + zeromap_pte_range(pte, base + address, end - address, prot); + pte_unmap(pte); + address = (address + PMD_SIZE) & PMD_MASK; + pmd++; + } while (address && (address < end)); + return 0; +} + +int zeromap_page_range(struct vm_area_struct *vma, unsigned long address, unsigned long size, pgprot_t prot) +{ + int error = 0; + pgd_t * dir; + unsigned long beg = address; + unsigned long end = address + size; + struct mm_struct *mm = vma->vm_mm; + + dir = pgd_offset(mm, address); + flush_cache_range(vma, beg, end); + if (address >= end) + BUG(); + + spin_lock(&mm->page_table_lock); + do { + pmd_t *pmd = pmd_alloc(mm, dir, address); + error = -ENOMEM; + if (!pmd) + break; + error = zeromap_pmd_range(mm, pmd, address, end - address, prot); + if (error) + break; + address = (address + PGDIR_SIZE) & PGDIR_MASK; + dir++; + } while (address && (address < end)); + /* + * Why flush? zeromap_pte_range has a BUG_ON for !pte_none() + */ + flush_tlb_range(vma, beg, end); + spin_unlock(&mm->page_table_lock); + return error; +} + +/* + * maps a range of physical memory into the requested pages. the old + * mappings are removed. any references to nonexistent pages results + * in null mappings (currently treated as "copy-on-access") + */ +static inline void remap_pte_range(pte_t * pte, unsigned long address, unsigned long size, + unsigned long phys_addr, pgprot_t prot) +{ + unsigned long end; + unsigned long pfn; + + address &= ~PMD_MASK; + end = address + size; + if (end > PMD_SIZE) + end = PMD_SIZE; + pfn = phys_addr >> PAGE_SHIFT; + do { + BUG_ON(!pte_none(*pte)); + if (!pfn_valid(pfn) || PageReserved(pfn_to_page(pfn))) + set_pte(pte, pfn_pte(pfn, prot)); + address += PAGE_SIZE; + pfn++; + pte++; + } while (address && (address < end)); +} + +static inline int remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size, + unsigned long phys_addr, pgprot_t prot) +{ + unsigned long base, end; + + base = address & PGDIR_MASK; + address &= ~PGDIR_MASK; + end = address + size; + if (end > PGDIR_SIZE) + end = PGDIR_SIZE; + phys_addr -= address; + do { + pte_t * pte = pte_alloc_map(mm, pmd, base + address); + if (!pte) + return -ENOMEM; + remap_pte_range(pte, base + address, end - address, address + phys_addr, prot); + pte_unmap(pte); + address = (address + PMD_SIZE) & PMD_MASK; + pmd++; + } while (address && (address < end)); + return 0; +} + +/* Note: this is only safe if the mm semaphore is held when called. */ +int remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long phys_addr, unsigned long size, pgprot_t prot) +{ + int error = 0; + pgd_t * dir; + unsigned long beg = from; + unsigned long end = from + size; + struct mm_struct *mm = vma->vm_mm; + + phys_addr -= from; + dir = pgd_offset(mm, from); + flush_cache_range(vma, beg, end); + if (from >= end) + BUG(); + + spin_lock(&mm->page_table_lock); + do { + pmd_t *pmd = pmd_alloc(mm, dir, from); + error = -ENOMEM; + if (!pmd) + break; + error = remap_pmd_range(mm, pmd, from, end - from, phys_addr + from, prot); + if (error) + break; + from = (from + PGDIR_SIZE) & PGDIR_MASK; + dir++; + } while (from && (from < end)); + /* + * Why flush? remap_pte_range has a BUG_ON for !pte_none() + */ + flush_tlb_range(vma, beg, end); + spin_unlock(&mm->page_table_lock); + return error; +} + +EXPORT_SYMBOL(remap_page_range); + +/* + * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when + * servicing faults for write access. In the normal case, do always want + * pte_mkwrite. But get_user_pages can cause write faults for mappings + * that do not have writing enabled, when used by access_process_vm. + */ +static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma) +{ + if (likely(vma->vm_flags & VM_WRITE)) + pte = pte_mkwrite(pte); + return pte; +} + +/* + * We hold the mm semaphore for reading and vma->vm_mm->page_table_lock + */ +static inline void break_cow(struct vm_area_struct * vma, struct page * new_page, unsigned long address, + pte_t *page_table) +{ + pte_t entry; + + flush_cache_page(vma, address); + entry = maybe_mkwrite(pte_mkdirty(mk_pte(new_page, vma->vm_page_prot)), + vma); + ptep_establish(vma, address, page_table, entry); + update_mmu_cache(vma, address, entry); +} + +/* + * This routine handles present pages, when users try to write + * to a shared page. It is done by copying the page to a new address + * and decrementing the shared-page counter for the old page. + * + * Goto-purists beware: the only reason for goto's here is that it results + * in better assembly code.. The "default" path will see no jumps at all. + * + * Note that this routine assumes that the protection checks have been + * done by the caller (the low-level page fault routine in most cases). + * Thus we can safely just mark it writable once we've done any necessary + * COW. + * + * We also mark the page dirty at this point even though the page will + * change only once the write actually happens. This avoids a few races, + * and potentially makes it more efficient. + * + * We hold the mm semaphore and the page_table_lock on entry and exit + * with the page_table_lock released. + */ +static int do_wp_page(struct mm_struct *mm, struct vm_area_struct * vma, + unsigned long address, pte_t *page_table, pmd_t *pmd, pte_t pte) +{ + struct page *old_page, *new_page; + unsigned long pfn = pte_pfn(pte); + pte_t entry; + + if (unlikely(!pfn_valid(pfn))) { + /* + * This should really halt the system so it can be debugged or + * at least the kernel stops what it's doing before it corrupts + * data, but for the moment just pretend this is OOM. + */ + pte_unmap(page_table); + printk(KERN_ERR "do_wp_page: bogus page at address %08lx\n", + address); + spin_unlock(&mm->page_table_lock); + return VM_FAULT_OOM; + } + old_page = pfn_to_page(pfn); + + if (!TestSetPageLocked(old_page)) { + int reuse = can_share_swap_page(old_page); + unlock_page(old_page); + if (reuse) { + flush_cache_page(vma, address); + entry = maybe_mkwrite(pte_mkyoung(pte_mkdirty(pte)), + vma); + ptep_set_access_flags(vma, address, page_table, entry, 1); + update_mmu_cache(vma, address, entry); + pte_unmap(page_table); + spin_unlock(&mm->page_table_lock); + return VM_FAULT_MINOR; + } + } + pte_unmap(page_table); + + /* + * Ok, we need to copy. Oh, well.. + */ + if (!PageReserved(old_page)) + page_cache_get(old_page); + spin_unlock(&mm->page_table_lock); + + if (unlikely(anon_vma_prepare(vma))) + goto no_new_page; + new_page = alloc_page_vma(GFP_HIGHUSER, vma, address); + if (!new_page) + goto no_new_page; + copy_cow_page(old_page,new_page,address); + + /* + * Re-check the pte - we dropped the lock + */ + spin_lock(&mm->page_table_lock); + page_table = pte_offset_map(pmd, address); + if (likely(pte_same(*page_table, pte))) { + if (PageReserved(old_page)) + ++mm->rss; + else + page_remove_rmap(old_page); + break_cow(vma, new_page, address, page_table); + lru_cache_add_active(new_page); + page_add_anon_rmap(new_page, vma, address); + + /* Free the old page.. */ + new_page = old_page; + } + pte_unmap(page_table); + page_cache_release(new_page); + page_cache_release(old_page); + spin_unlock(&mm->page_table_lock); + return VM_FAULT_MINOR; + +no_new_page: + page_cache_release(old_page); + return VM_FAULT_OOM; +} + +/* + * Helper function for unmap_mapping_range(). + */ +static inline void unmap_mapping_range_list(struct prio_tree_root *root, + struct zap_details *details) +{ + struct vm_area_struct *vma = NULL; + struct prio_tree_iter iter; + pgoff_t vba, vea, zba, zea; + + while ((vma = vma_prio_tree_next(vma, root, &iter, + details->first_index, details->last_index)) != NULL) { + vba = vma->vm_pgoff; + vea = vba + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) - 1; + /* Assume for now that PAGE_CACHE_SHIFT == PAGE_SHIFT */ + zba = details->first_index; + if (zba < vba) + zba = vba; + zea = details->last_index; + if (zea > vea) + zea = vea; + zap_page_range(vma, + ((zba - vba) << PAGE_SHIFT) + vma->vm_start, + (zea - zba + 1) << PAGE_SHIFT, details); + } +} + +/** + * unmap_mapping_range - unmap the portion of all mmaps + * in the specified address_space corresponding to the specified + * page range in the underlying file. + * @address_space: the address space containing mmaps to be unmapped. + * @holebegin: byte in first page to unmap, relative to the start of + * the underlying file. This will be rounded down to a PAGE_SIZE + * boundary. Note that this is different from vmtruncate(), which + * must keep the partial page. In contrast, we must get rid of + * partial pages. + * @holelen: size of prospective hole in bytes. This will be rounded + * up to a PAGE_SIZE boundary. A holelen of zero truncates to the + * end of the file. + * @even_cows: 1 when truncating a file, unmap even private COWed pages; + * but 0 when invalidating pagecache, don't throw away private data. + */ +void unmap_mapping_range(struct address_space *mapping, + loff_t const holebegin, loff_t const holelen, int even_cows) +{ + struct zap_details details; + pgoff_t hba = holebegin >> PAGE_SHIFT; + pgoff_t hlen = (holelen + PAGE_SIZE - 1) >> PAGE_SHIFT; + + /* Check for overflow. */ + if (sizeof(holelen) > sizeof(hlen)) { + long long holeend = + (holebegin + holelen + PAGE_SIZE - 1) >> PAGE_SHIFT; + if (holeend & ~(long long)ULONG_MAX) + hlen = ULONG_MAX - hba + 1; + } + + details.check_mapping = even_cows? NULL: mapping; + details.nonlinear_vma = NULL; + details.first_index = hba; + details.last_index = hba + hlen - 1; + details.atomic = 1; /* A spinlock is held */ + if (details.last_index < details.first_index) + details.last_index = ULONG_MAX; + + spin_lock(&mapping->i_mmap_lock); + /* Protect against page fault */ + atomic_inc(&mapping->truncate_count); + + if (unlikely(!prio_tree_empty(&mapping->i_mmap))) + unmap_mapping_range_list(&mapping->i_mmap, &details); + + /* + * In nonlinear VMAs there is no correspondence between virtual address + * offset and file offset. So we must perform an exhaustive search + * across *all* the pages in each nonlinear VMA, not just the pages + * whose virtual address lies outside the file truncation point. + */ + if (unlikely(!list_empty(&mapping->i_mmap_nonlinear))) { + struct vm_area_struct *vma; + list_for_each_entry(vma, &mapping->i_mmap_nonlinear, + shared.vm_set.list) { + details.nonlinear_vma = vma; + zap_page_range(vma, vma->vm_start, + vma->vm_end - vma->vm_start, &details); + } + } + spin_unlock(&mapping->i_mmap_lock); +} +EXPORT_SYMBOL(unmap_mapping_range); + +/* + * Handle all mappings that got truncated by a "truncate()" + * system call. + * + * NOTE! We have to be ready to update the memory sharing + * between the file and the memory map for a potential last + * incomplete page. Ugly, but necessary. + */ +int vmtruncate(struct inode * inode, loff_t offset) +{ + struct address_space *mapping = inode->i_mapping; + unsigned long limit; + + if (inode->i_size < offset) + goto do_expand; + /* + * truncation of in-use swapfiles is disallowed - it would cause + * subsequent swapout to scribble on the now-freed blocks. + */ + if (IS_SWAPFILE(inode)) + goto out_busy; + i_size_write(inode, offset); + unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); + truncate_inode_pages(mapping, offset); + goto out_truncate; + +do_expand: + limit = current->rlim[RLIMIT_FSIZE].rlim_cur; + if (limit != RLIM_INFINITY && offset > limit) + goto out_sig; + if (offset > inode->i_sb->s_maxbytes) + goto out_big; + i_size_write(inode, offset); + +out_truncate: + if (inode->i_op && inode->i_op->truncate) + inode->i_op->truncate(inode); + return 0; +out_sig: + send_sig(SIGXFSZ, current, 0); +out_big: + return -EFBIG; +out_busy: + return -ETXTBSY; +} + +EXPORT_SYMBOL(vmtruncate); + +/* + * Primitive swap readahead code. We simply read an aligned block of + * (1 << page_cluster) entries in the swap area. This method is chosen + * because it doesn't cost us any seek time. We also make sure to queue + * the 'original' request together with the readahead ones... + * + * This has been extended to use the NUMA policies from the mm triggering + * the readahead. + * + * Caller must hold down_read on the vma->vm_mm if vma is not NULL. + */ +void swapin_readahead(swp_entry_t entry, unsigned long addr,struct vm_area_struct *vma) +{ +#ifdef CONFIG_NUMA + struct vm_area_struct *next_vma = vma ? vma->vm_next : NULL; +#endif + int i, num; + struct page *new_page; + unsigned long offset; + + /* + * Get the number of handles we should do readahead io to. + */ + num = valid_swaphandles(entry, &offset); + for (i = 0; i < num; offset++, i++) { + /* Ok, do the async read-ahead now */ + new_page = read_swap_cache_async(swp_entry(swp_type(entry), + offset), vma, addr); + if (!new_page) + break; + page_cache_release(new_page); +#ifdef CONFIG_NUMA + /* + * Find the next applicable VMA for the NUMA policy. + */ + addr += PAGE_SIZE; + if (addr == 0) + vma = NULL; + if (vma) { + if (addr >= vma->vm_end) { + vma = next_vma; + next_vma = vma ? vma->vm_next : NULL; + } + if (vma && addr < vma->vm_start) + vma = NULL; + } else { + if (next_vma && addr >= next_vma->vm_start) { + vma = next_vma; + next_vma = vma->vm_next; + } + } +#endif + } + lru_add_drain(); /* Push any new pages onto the LRU now */ +} + +/* + * We hold the mm semaphore and the page_table_lock on entry and + * should release the pagetable lock on exit.. + */ +static int do_swap_page(struct mm_struct * mm, + struct vm_area_struct * vma, unsigned long address, + pte_t *page_table, pmd_t *pmd, pte_t orig_pte, int write_access) +{ + struct page *page; + swp_entry_t entry = pte_to_swp_entry(orig_pte); + pte_t pte; + int ret = VM_FAULT_MINOR; + + pte_unmap(page_table); + spin_unlock(&mm->page_table_lock); + page = lookup_swap_cache(entry); + if (!page) { + swapin_readahead(entry, address, vma); + page = read_swap_cache_async(entry, vma, address); + if (!page) { + /* + * Back out if somebody else faulted in this pte while + * we released the page table lock. + */ + spin_lock(&mm->page_table_lock); + page_table = pte_offset_map(pmd, address); + if (likely(pte_same(*page_table, orig_pte))) + ret = VM_FAULT_OOM; + else + ret = VM_FAULT_MINOR; + pte_unmap(page_table); + spin_unlock(&mm->page_table_lock); + goto out; + } + + /* Had to read the page from swap area: Major fault */ + ret = VM_FAULT_MAJOR; + inc_page_state(pgmajfault); + } + + mark_page_accessed(page); + lock_page(page); + + /* + * Back out if somebody else faulted in this pte while we + * released the page table lock. + */ + spin_lock(&mm->page_table_lock); + page_table = pte_offset_map(pmd, address); + if (unlikely(!pte_same(*page_table, orig_pte))) { + pte_unmap(page_table); + spin_unlock(&mm->page_table_lock); + unlock_page(page); + page_cache_release(page); + ret = VM_FAULT_MINOR; + goto out; + } + + /* The page isn't present yet, go ahead with the fault. */ + + swap_free(entry); + if (vm_swap_full()) + remove_exclusive_swap_page(page); + + mm->rss++; + pte = mk_pte(page, vma->vm_page_prot); + if (write_access && can_share_swap_page(page)) { + pte = maybe_mkwrite(pte_mkdirty(pte), vma); + write_access = 0; + } + unlock_page(page); + + flush_icache_page(vma, page); + set_pte(page_table, pte); + page_add_anon_rmap(page, vma, address); + + if (write_access) { + if (do_wp_page(mm, vma, address, + page_table, pmd, pte) == VM_FAULT_OOM) + ret = VM_FAULT_OOM; + goto out; + } + + /* No need to invalidate - it was non-present before */ + update_mmu_cache(vma, address, pte); + pte_unmap(page_table); + spin_unlock(&mm->page_table_lock); +out: + return ret; +} + +/* + * We are called with the MM semaphore and page_table_lock + * spinlock held to protect against concurrent faults in + * multithreaded programs. + */ +static int +do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, + pte_t *page_table, pmd_t *pmd, int write_access, + unsigned long addr) +{ + pte_t entry; + struct page * page = ZERO_PAGE(addr); + + /* Read-only mapping of ZERO_PAGE. */ + entry = pte_wrprotect(mk_pte(ZERO_PAGE(addr), vma->vm_page_prot)); + + /* ..except if it's a write access */ + if (write_access) { + /* Allocate our own private page. */ + pte_unmap(page_table); + spin_unlock(&mm->page_table_lock); + + if (unlikely(anon_vma_prepare(vma))) + goto no_mem; + page = alloc_page_vma(GFP_HIGHUSER, vma, addr); + if (!page) + goto no_mem; + clear_user_highpage(page, addr); + + spin_lock(&mm->page_table_lock); + page_table = pte_offset_map(pmd, addr); + + if (!pte_none(*page_table)) { + pte_unmap(page_table); + page_cache_release(page); + spin_unlock(&mm->page_table_lock); + goto out; + } + mm->rss++; + entry = maybe_mkwrite(pte_mkdirty(mk_pte(page, + vma->vm_page_prot)), + vma); + lru_cache_add_active(page); + mark_page_accessed(page); + page_add_anon_rmap(page, vma, addr); + } + + ptep_establish_new(vma, addr, page_table, entry); + pte_unmap(page_table); + + /* No need to invalidate - it was non-present before */ + update_mmu_cache(vma, addr, entry); + spin_unlock(&mm->page_table_lock); +out: + return VM_FAULT_MINOR; +no_mem: + return VM_FAULT_OOM; +} + +/* + * do_no_page() tries to create a new page mapping. It aggressively + * tries to share with existing pages, but makes a separate copy if + * the "write_access" parameter is true in order to avoid the next + * page fault. + * + * As this is called only for pages that do not currently exist, we + * do not need to flush old virtual caches or the TLB. + * + * This is called with the MM semaphore held and the page table + * spinlock held. Exit with the spinlock released. + */ +static int +do_no_page(struct mm_struct *mm, struct vm_area_struct *vma, + unsigned long address, int write_access, pte_t *page_table, pmd_t *pmd) +{ + struct page * new_page; + struct address_space *mapping = NULL; + pte_t entry; + int sequence = 0; + int ret = VM_FAULT_MINOR; + int anon = 0; + + if (!vma->vm_ops || !vma->vm_ops->nopage) + return do_anonymous_page(mm, vma, page_table, + pmd, write_access, address); + pte_unmap(page_table); + spin_unlock(&mm->page_table_lock); + + if (vma->vm_file) { + mapping = vma->vm_file->f_mapping; + sequence = atomic_read(&mapping->truncate_count); + } + smp_rmb(); /* Prevent CPU from reordering lock-free ->nopage() */ +retry: + new_page = vma->vm_ops->nopage(vma, address & PAGE_MASK, &ret); + + /* no page was available -- either SIGBUS or OOM */ + if (new_page == NOPAGE_SIGBUS) + return VM_FAULT_SIGBUS; + if (new_page == NOPAGE_OOM) + return VM_FAULT_OOM; + + /* + * Should we do an early C-O-W break? + */ + if (write_access && !(vma->vm_flags & VM_SHARED)) { + struct page *page; + + if (unlikely(anon_vma_prepare(vma))) + goto oom; + page = alloc_page_vma(GFP_HIGHUSER, vma, address); + if (!page) + goto oom; + copy_user_highpage(page, new_page, address); + page_cache_release(new_page); + new_page = page; + anon = 1; + } + + spin_lock(&mm->page_table_lock); + /* + * For a file-backed vma, someone could have truncated or otherwise + * invalidated this page. If unmap_mapping_range got called, + * retry getting the page. + */ + if (mapping && + (unlikely(sequence != atomic_read(&mapping->truncate_count)))) { + sequence = atomic_read(&mapping->truncate_count); + spin_unlock(&mm->page_table_lock); + page_cache_release(new_page); + goto retry; + } + page_table = pte_offset_map(pmd, address); + + /* + * This silly early PAGE_DIRTY setting removes a race + * due to the bad i386 page protection. But it's valid + * for other architectures too. + * + * Note that if write_access is true, we either now have + * an exclusive copy of the page, or this is a shared mapping, + * so we can make it writable and dirty to avoid having to + * handle that later. + */ + /* Only go through if we didn't race with anybody else... */ + if (pte_none(*page_table)) { + if (!PageReserved(new_page)) + ++mm->rss; + flush_icache_page(vma, new_page); + entry = mk_pte(new_page, vma->vm_page_prot); + if (write_access) + entry = maybe_mkwrite(pte_mkdirty(entry), vma); + ptep_establish_new(vma, address, page_table, entry); + if (anon) { + lru_cache_add_active(new_page); + page_add_anon_rmap(new_page, vma, address); + } else + page_add_file_rmap(new_page); + pte_unmap(page_table); + } else { + /* One of our sibling threads was faster, back out. */ + pte_unmap(page_table); + page_cache_release(new_page); + spin_unlock(&mm->page_table_lock); + goto out; + } + + /* no need to invalidate: a not-present page shouldn't be cached */ + update_mmu_cache(vma, address, entry); + spin_unlock(&mm->page_table_lock); +out: + return ret; +oom: + page_cache_release(new_page); + ret = VM_FAULT_OOM; + goto out; +} + +/* + * Fault of a previously existing named mapping. Repopulate the pte + * from the encoded file_pte if possible. This enables swappable + * nonlinear vmas. + */ +static int do_file_page(struct mm_struct * mm, struct vm_area_struct * vma, + unsigned long address, int write_access, pte_t *pte, pmd_t *pmd) +{ + unsigned long pgoff; + int err; + + BUG_ON(!vma->vm_ops || !vma->vm_ops->nopage); + /* + * Fall back to the linear mapping if the fs does not support + * ->populate: + */ + if (!vma->vm_ops || !vma->vm_ops->populate || + (write_access && !(vma->vm_flags & VM_SHARED))) { + pte_clear(pte); + return do_no_page(mm, vma, address, write_access, pte, pmd); + } + + pgoff = pte_to_pgoff(*pte); + + pte_unmap(pte); + spin_unlock(&mm->page_table_lock); + + err = vma->vm_ops->populate(vma, address & PAGE_MASK, PAGE_SIZE, vma->vm_page_prot, pgoff, 0); + if (err == -ENOMEM) + return VM_FAULT_OOM; + if (err) + return VM_FAULT_SIGBUS; + return VM_FAULT_MAJOR; +} + +/* + * These routines also need to handle stuff like marking pages dirty + * and/or accessed for architectures that don't do it in hardware (most + * RISC architectures). The early dirtying is also good on the i386. + * + * There is also a hook called "update_mmu_cache()" that architectures + * with external mmu caches can use to update those (ie the Sparc or + * PowerPC hashed page tables that act as extended TLBs). + * + * Note the "page_table_lock". It is to protect against kswapd removing + * pages from under us. Note that kswapd only ever _removes_ pages, never + * adds them. As such, once we have noticed that the page is not present, + * we can drop the lock early. + * + * The adding of pages is protected by the MM semaphore (which we hold), + * so we don't need to worry about a page being suddenly been added into + * our VM. + * + * We enter with the pagetable spinlock held, we are supposed to + * release it when done. + */ +static inline int handle_pte_fault(struct mm_struct *mm, + struct vm_area_struct * vma, unsigned long address, + int write_access, pte_t *pte, pmd_t *pmd) +{ + pte_t entry; + + entry = *pte; + if (!pte_present(entry)) { + /* + * If it truly wasn't present, we know that kswapd + * and the PTE updates will not touch it later. So + * drop the lock. + */ + if (pte_none(entry)) + return do_no_page(mm, vma, address, write_access, pte, pmd); + if (pte_file(entry)) + return do_file_page(mm, vma, address, write_access, pte, pmd); + return do_swap_page(mm, vma, address, pte, pmd, entry, write_access); + } + + if (write_access) { + if (!pte_write(entry)) + return do_wp_page(mm, vma, address, pte, pmd, entry); + + entry = pte_mkdirty(entry); + } + entry = pte_mkyoung(entry); + ptep_set_access_flags(vma, address, pte, entry, write_access); + update_mmu_cache(vma, address, entry); + pte_unmap(pte); + spin_unlock(&mm->page_table_lock); + return VM_FAULT_MINOR; +} + +/* + * By the time we get here, we already hold the mm semaphore + */ +int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct * vma, + unsigned long address, int write_access) +{ + pgd_t *pgd; + pmd_t *pmd; + + __set_current_state(TASK_RUNNING); + pgd = pgd_offset(mm, address); + + inc_page_state(pgfault); + + if (is_vm_hugetlb_page(vma)) + return VM_FAULT_SIGBUS; /* mapping truncation does this. */ + + /* + * We need the page table lock to synchronize with kswapd + * and the SMP-safe atomic PTE updates. + */ + spin_lock(&mm->page_table_lock); + pmd = pmd_alloc(mm, pgd, address); + + if (pmd) { + pte_t * pte = pte_alloc_map(mm, pmd, address); + if (pte) + return handle_pte_fault(mm, vma, address, write_access, pte, pmd); + } + spin_unlock(&mm->page_table_lock); + return VM_FAULT_OOM; +} + +/* + * Allocate page middle directory. + * + * We've already handled the fast-path in-line, and we own the + * page table lock. + * + * On a two-level page table, this ends up actually being entirely + * optimized away. + */ +pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address) +{ + pmd_t *new; + + spin_unlock(&mm->page_table_lock); + new = pmd_alloc_one(mm, address); + spin_lock(&mm->page_table_lock); + if (!new) + return NULL; + + /* + * Because we dropped the lock, we should re-check the + * entry, as somebody else could have populated it.. + */ + if (pgd_present(*pgd)) { + pmd_free(new); + goto out; + } + pgd_populate(mm, pgd, new); +out: + return pmd_offset(pgd, address); +} + +int make_pages_present(unsigned long addr, unsigned long end) +{ + int ret, len, write; + struct vm_area_struct * vma; + + vma = find_vma(current->mm, addr); + write = (vma->vm_flags & VM_WRITE) != 0; + if (addr >= end) + BUG(); + if (end > vma->vm_end) + BUG(); + len = (end+PAGE_SIZE-1)/PAGE_SIZE-addr/PAGE_SIZE; + ret = get_user_pages(current, current->mm, addr, + len, write, 0, NULL, NULL); + if (ret < 0) + return ret; + return ret == len ? 0 : -1; +} + +/* + * Map a vmalloc()-space virtual address to the physical page. + */ +struct page * vmalloc_to_page(void * vmalloc_addr) +{ + unsigned long addr = (unsigned long) vmalloc_addr; + struct page *page = NULL; + pgd_t *pgd = pgd_offset_k(addr); + pmd_t *pmd; + pte_t *ptep, pte; + + if (!pgd_none(*pgd)) { + pmd = pmd_offset(pgd, addr); + if (!pmd_none(*pmd)) { + preempt_disable(); + ptep = pte_offset_map(pmd, addr); + pte = *ptep; + if (pte_present(pte)) + page = pte_page(pte); + pte_unmap(ptep); + preempt_enable(); + } + } + return page; +} + +EXPORT_SYMBOL(vmalloc_to_page); + +#if !defined(CONFIG_ARCH_GATE_AREA) + +#if defined(AT_SYSINFO_EHDR) +struct vm_area_struct gate_vma; + +static int __init gate_vma_init(void) +{ + gate_vma.vm_mm = NULL; + gate_vma.vm_start = FIXADDR_USER_START; + gate_vma.vm_end = FIXADDR_USER_END; + gate_vma.vm_page_prot = PAGE_READONLY; + gate_vma.vm_flags = 0; + return 0; +} +__initcall(gate_vma_init); +#endif + +struct vm_area_struct *get_gate_vma(struct task_struct *tsk) +{ +#ifdef AT_SYSINFO_EHDR + return &gate_vma; +#else + return NULL; +#endif +} + +int in_gate_area(struct task_struct *task, unsigned long addr) +{ +#ifdef AT_SYSINFO_EHDR + if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END)) + return 1; +#endif + return 0; +} + +#endif From 07a4c4d3f5f0db6ab64d354763f29557f44cf376 Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 15:27:33 +0000 Subject: [PATCH 15/28] bitkeeper revision 1.1159.59.1 (412f52e5pzGsSRKxWkXlLmoWzjYc7g) Add debugging for locked critical regions. Allows us to assert that certain things don't happen while in a c.r.: currently these include taking page faults and GPFs, and also we disallow use of the user-space access macros (uaccess.h). --- xen/arch/x86/nmi.c | 1 + xen/arch/x86/traps.c | 6 +++ xen/common/kernel.c | 41 +++++++++++++++ xen/include/asm-x86/spinlock.h | 27 ++++------ xen/include/asm-x86/x86_32/uaccess.h | 4 ++ xen/include/xen/spinlock.h | 77 +++++++++++++++++++++++----- 6 files changed, 125 insertions(+), 31 deletions(-) diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index ec12834ee7..d2554aeffc 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -288,6 +288,7 @@ void nmi_watchdog_tick (struct pt_regs * regs) if ( alert_counter[cpu] == 5*nmi_hz ) { console_force_unlock(); + disable_criticalregion_checking(); die("NMI Watchdog detected LOCKUP on CPU", regs, cpu); } } diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 46d557f59d..24f1d401d2 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -315,6 +315,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, long error_code) perfc_incrc(page_faults); + ASSERT_no_criticalregion(); + if ( unlikely(addr >= LDT_VIRT_START) && (addr < (LDT_VIRT_START + (d->mm.ldt_ents*LDT_ENTRY_SIZE))) ) { @@ -413,6 +415,8 @@ asmlinkage void do_general_protection(struct pt_regs *regs, long error_code) trap_info_t *ti; unsigned long fixup; + ASSERT_no_criticalregion(); + /* Badness if error in ring 0, or result of an interrupt. */ if ( !(regs->xcs & 3) || (error_code & 1) ) goto gp_in_kernel; @@ -493,6 +497,7 @@ asmlinkage void do_general_protection(struct pt_regs *regs, long error_code) asmlinkage void mem_parity_error(struct pt_regs *regs) { console_force_unlock(); + disable_criticalregion_checking(); printk("\n\n"); @@ -513,6 +518,7 @@ asmlinkage void mem_parity_error(struct pt_regs *regs) asmlinkage void io_check_error(struct pt_regs *regs) { console_force_unlock(); + disable_criticalregion_checking(); printk("\n\n"); diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 3e37bded7d..6d70547321 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -389,3 +389,44 @@ long do_ni_hypercall(void) /* No-op hypercall. */ return -ENOSYS; } + +/* + * Lock debugging + */ + +#ifndef NDEBUG + +static int crit_count[NR_CPUS]; +static int crit_checking = 1; + +void disable_criticalregion_checking(void) +{ + crit_checking = 0; +} + +void criticalregion_enter(void) +{ + int cpu = smp_processor_id(); + ASSERT(crit_count[cpu] >= 0); + crit_count[cpu]++; +} + +void criticalregion_exit(void) +{ + int cpu = smp_processor_id(); + crit_count[cpu]--; + ASSERT(crit_count[cpu] >= 0); +} + +void ASSERT_no_criticalregion(void) +{ + int cpu = smp_processor_id(); + if ( (crit_count[cpu] == 0) || !crit_checking ) + return; + disable_criticalregion_checking(); + ASSERT(crit_count[cpu] >= 0); /* -ve count is a special kind of bogus! */ + ASSERT(crit_count[cpu] == 0); /* we should definitely take this path */ + ASSERT(1); /* NEVER GET HERE! */ +} + +#endif /* !NDEBUG */ diff --git a/xen/include/asm-x86/spinlock.h b/xen/include/asm-x86/spinlock.h index dd9869d331..1d864188da 100644 --- a/xen/include/asm-x86/spinlock.h +++ b/xen/include/asm-x86/spinlock.h @@ -17,7 +17,7 @@ typedef struct { #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) #define spin_is_locked(x) (*(volatile char *)(&(x)->lock) <= 0) -static inline void spin_lock(spinlock_t *lock) +static inline void _raw_spin_lock(spinlock_t *lock) { __asm__ __volatile__ ( "1: lock; decb %0 \n" @@ -31,7 +31,7 @@ static inline void spin_lock(spinlock_t *lock) : "=m" (lock->lock) : : "memory" ); } -static inline void spin_unlock(spinlock_t *lock) +static inline void _raw_spin_unlock(spinlock_t *lock) { #if !defined(CONFIG_X86_OOSTORE) ASSERT(spin_is_locked(lock)); @@ -47,7 +47,7 @@ static inline void spin_unlock(spinlock_t *lock) #endif } -static inline int spin_trylock(spinlock_t *lock) +static inline int _raw_spin_trylock(spinlock_t *lock) { char oldval; __asm__ __volatile__( @@ -64,7 +64,7 @@ static inline int spin_trylock(spinlock_t *lock) * are any critical regions that cannot form part of such a set, they can use * standard spin_[un]lock(). */ -#define spin_lock_recursive(_lock) \ +#define _raw_spin_lock_recursive(_lock) \ do { \ int cpu = smp_processor_id(); \ if ( likely((_lock)->recurse_cpu != cpu) ) \ @@ -75,7 +75,7 @@ static inline int spin_trylock(spinlock_t *lock) (_lock)->recurse_cnt++; \ } while ( 0 ) -#define spin_unlock_recursive(_lock) \ +#define _raw_spin_unlock_recursive(_lock) \ do { \ if ( likely(--(_lock)->recurse_cnt == 0) ) \ { \ @@ -97,32 +97,23 @@ typedef struct { * On x86, we implement read-write locks as a 32-bit counter * with the high bit (sign) being the "contended" bit. */ -static inline void read_lock(rwlock_t *rw) +static inline void _raw_read_lock(rwlock_t *rw) { __build_read_lock(rw, "__read_lock_failed"); } -static inline void write_lock(rwlock_t *rw) +static inline void _raw_write_lock(rwlock_t *rw) { __build_write_lock(rw, "__write_lock_failed"); } -#define read_unlock(rw) \ +#define _raw_read_unlock(rw) \ __asm__ __volatile__ ( \ "lock ; incl %0" : \ "=m" ((rw)->lock) : : "memory" ) -#define write_unlock(rw) \ +#define _raw_write_unlock(rw) \ __asm__ __volatile__ ( \ "lock ; addl $" RW_LOCK_BIAS_STR ",%0" : \ "=m" ((rw)->lock) : : "memory" ) -static inline int write_trylock(rwlock_t *lock) -{ - atomic_t *count = (atomic_t *)lock; - if ( atomic_sub_and_test(RW_LOCK_BIAS, count) ) - return 1; - atomic_add(RW_LOCK_BIAS, count); - return 0; -} - #endif /* __ASM_SPINLOCK_H */ diff --git a/xen/include/asm-x86/x86_32/uaccess.h b/xen/include/asm-x86/x86_32/uaccess.h index 776639782c..58829fa204 100644 --- a/xen/include/asm-x86/x86_32/uaccess.h +++ b/xen/include/asm-x86/x86_32/uaccess.h @@ -243,6 +243,7 @@ struct __large_struct { unsigned long buf[100]; }; * aliasing issues. */ #define __put_user_asm(x, addr, err, itype, rtype, ltype, errret) \ + ASSERT_no_criticalregion(); \ __asm__ __volatile__( \ "1: mov"itype" %"rtype"1,%2\n" \ "2:\n" \ @@ -291,6 +292,7 @@ do { \ } while (0) #define __get_user_asm(x, addr, err, itype, rtype, ltype, errret) \ + ASSERT_no_criticalregion(); \ __asm__ __volatile__( \ "1: mov"itype" %2,%"rtype"1\n" \ "2:\n" \ @@ -334,6 +336,7 @@ unsigned long __copy_from_user_ll(void *to, const void __user *from, unsigned lo static always_inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) { + ASSERT_no_criticalregion(); if (__builtin_constant_p(n)) { unsigned long ret; @@ -372,6 +375,7 @@ __copy_to_user(void __user *to, const void *from, unsigned long n) static always_inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) { + ASSERT_no_criticalregion(); if (__builtin_constant_p(n)) { unsigned long ret; diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index b74b5f802f..0b4503d999 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -48,14 +48,13 @@ typedef struct { int gcc_is_buggy; } spinlock_t; #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } #endif -#define spin_lock_init(lock) do { } while(0) -#define spin_lock(lock) (void)(lock) /* Not "unused variable". */ -#define spin_is_locked(lock) (0) -#define spin_trylock(lock) ({1; }) -#define spin_unlock_wait(lock) do { } while(0) -#define spin_unlock(lock) do { } while(0) -#define spin_lock_recursive(lock) do { } while(0) -#define spin_unlock_recursive(lock) do { } while(0) +#define spin_lock_init(lock) do { } while(0) +#define spin_is_locked(lock) (0) +#define _raw_spin_lock(lock) (void)(lock) +#define _raw_spin_trylock(lock) ({1; }) +#define _raw_spin_unlock(lock) do { } while(0) +#define _raw_spin_lock_recursive(lock) do { } while(0) +#define _raw_spin_unlock_recursive(lock) do { } while(0) #if (__GNUC__ > 2) typedef struct { } rwlock_t; @@ -65,11 +64,63 @@ typedef struct { int gcc_is_buggy; } rwlock_t; #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } #endif -#define rwlock_init(lock) do { } while(0) -#define read_lock(lock) (void)(lock) /* Not "unused variable". */ -#define read_unlock(lock) do { } while(0) -#define write_lock(lock) (void)(lock) /* Not "unused variable". */ -#define write_unlock(lock) do { } while(0) +#define rwlock_init(lock) do { } while(0) +#define _raw_read_lock(lock) (void)(lock) /* Not "unused variable". */ +#define _raw_read_unlock(lock) do { } while(0) +#define _raw_write_lock(lock) (void)(lock) /* Not "unused variable". */ +#define _raw_write_unlock(lock) do { } while(0) + +#endif + +#ifndef NDEBUG + +extern void criticalregion_enter(void); +extern void criticalregion_exit(void); +extern void ASSERT_no_criticalregion(void); +extern void disable_criticalregion_checking(void); + +#define spin_lock(_lock) \ + do { criticalregion_enter(); _raw_spin_lock(_lock); } while (0) +#define spin_unlock(_lock) \ + do { _raw_spin_unlock(_lock); criticalregion_exit(); } while (0) +#define spin_lock_recursive(_lock) \ + do { criticalregion_enter(); _raw_spin_lock_recursive(_lock); } while (0) +#define spin_unlock_recursive(_lock) \ + do { _raw_spin_unlock_recursive(_lock); criticalregion_exit(); } while (0) +#define read_lock(_lock) \ + do { criticalregion_enter(); _raw_read_lock(_lock); } while (0) +#define read_unlock(_lock) \ + do { _raw_read_unlock(_lock); criticalregion_exit(); } while (0) +#define write_lock(_lock) \ + do { criticalregion_enter(); _raw_write_lock(_lock); } while (0) +#define write_unlock(_lock) \ + do { _raw_write_unlock(_lock); criticalregion_exit(); } while (0) + +static inline int spin_trylock(spinlock_t *lock) +{ + criticalregion_enter(); + if ( !_raw_spin_trylock(lock) ) + { + criticalregion_exit(); + return 0; + } + return 1; +} + +#else + +#define ASSERT_no_criticalregion() ((void)0) +#define disable_criticalregion_checking() ((void)0) + +#define spin_lock(_lock) _raw_spin_lock(_lock) +#define spin_trylock(_lock) _raw_spin_trylock(_lock) +#define spin_unlock(_lock) _raw_spin_unlock(_lock) +#define spin_lock_recursive(_lock) _raw_spin_lock_recursive(_lock) +#define spin_unlock_recursive(_lock) _raw_spin_unlock_recursive(_lock) +#define read_lock(_lock) _raw_read_lock(_lock) +#define read_unlock(_lock) _raw_read_unlock(_lock) +#define write_lock(_lock) _raw_write_lock(_lock) +#define write_unlock(_lock) _raw_write_unlock(_lock) #endif From 9f208db7c69f39adbe059f22e7309a4060bd6b62 Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 15:29:02 +0000 Subject: [PATCH 16/28] bitkeeper revision 1.1159.60.1 (412f533e1b2O_B8bnbDfqpz-zNyv3w) Enable Linux 2.6 to use Xen's writable pagetable interface by default. If you experience weird crashes, try disabling this option. --- linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig | 2 +- linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig index fa9420f276..17400d6eec 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig @@ -10,7 +10,7 @@ CONFIG_NO_IDLE_HZ=y # CONFIG_XEN_PRIVILEGED_GUEST=y CONFIG_XEN_PHYSDEV_ACCESS=y -# CONFIG_XEN_WRITABLE_PAGETABLES is not set +CONFIG_XEN_WRITABLE_PAGETABLES=y CONFIG_FOREIGN_PAGES=y CONFIG_PAGESIZED_SKBS=y CONFIG_X86=y diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig index 653c7bbaf0..09546ab0a3 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig @@ -10,7 +10,7 @@ CONFIG_NO_IDLE_HZ=y # # CONFIG_XEN_PRIVILEGED_GUEST is not set # CONFIG_XEN_PHYSDEV_ACCESS is not set -# CONFIG_XEN_WRITABLE_PAGETABLES is not set +CONFIG_XEN_WRITABLE_PAGETABLES=y # CONFIG_FOREIGN_PAGES is not set # CONFIG_PAGESIZED_SKBS is not set CONFIG_X86=y From bfc32f815413ddf338bca18fa6eedddeba46818f Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 15:57:04 +0000 Subject: [PATCH 17/28] bitkeeper revision 1.1159.61.1 (412f59d0QmtgAMJvSE3LvKxxaMUfZg) Call domain_crash() instead of BUG() if something goes wrong with writabel pagetables. --- xen/arch/x86/memory.c | 69 +++++++++++++++++++++++++++++-------------- xen/common/domain.c | 3 ++ 2 files changed, 50 insertions(+), 22 deletions(-) diff --git a/xen/arch/x86/memory.c b/xen/arch/x86/memory.c index 778edf0ee1..f6a5657798 100644 --- a/xen/arch/x86/memory.c +++ b/xen/arch/x86/memory.c @@ -1488,8 +1488,10 @@ void ptwr_reconnect_disconnected(unsigned long addr) addr, ptwr_info[cpu].disconnected << L2_PAGETABLE_SHIFT)); pl2e = &linear_l2_table[ptwr_info[cpu].disconnected]; - if (__get_user(pte, writable_pte)) - BUG(); + if (__get_user(pte, writable_pte)) { + MEM_LOG("ptwr: Could not read pte at %p\n", writable_pte); + domain_crash(); + } pfn = pte >> PAGE_SHIFT; page = &frame_table[pfn]; @@ -1512,8 +1514,10 @@ void ptwr_reconnect_disconnected(unsigned long addr) continue; if (unlikely(l1_pgentry_val(ol1e) & _PAGE_PRESENT)) put_page_from_l1e(ol1e, current); - if (unlikely(!get_page_from_l1e(nl1e, current))) - BUG(); + if (unlikely(!get_page_from_l1e(nl1e, current))) { + MEM_LOG("ptwr: Could not re-validate l1 page\n"); + domain_crash(); + } } unmap_domain_mem(pl1e); update_l2e(pl2e, *pl2e, nl2e); @@ -1525,13 +1529,17 @@ void ptwr_reconnect_disconnected(unsigned long addr) frame_table[pfn].u.inuse.domain->domain)); ptwr_info[cpu].disconnected = ENTRIES_PER_L2_PAGETABLE; /* make pt page write protected */ - if (__get_user(pte, writable_pte)) - BUG(); + if (__get_user(pte, writable_pte)) { + MEM_LOG("ptwr: Could not read pte at %p\n", writable_pte); + domain_crash(); + } PTWR_PRINTK(("[A] writable_l1 at %p is %08lx\n", writable_pte, pte)); pte &= ~_PAGE_RW; - if (__put_user(pte, writable_pte)) - BUG(); + if (__put_user(pte, writable_pte)) { + MEM_LOG("ptwr: Could not update pte at %p\n", writable_pte); + domain_crash(); + } __flush_tlb_one(ptwr_info[cpu].writable_l1); PTWR_PRINTK(("[A] writable_l1 at %p now %08lx\n", writable_pte, pte)); @@ -1564,8 +1572,10 @@ void ptwr_flush_inactive(void) for (idx = 0; idx < ptwr_info[cpu].writable_idx; idx++) { unsigned long *writable_pte = (unsigned long *)&linear_pg_table [ptwr_info[cpu].writables[idx]>>PAGE_SHIFT]; - if (__get_user(pte, writable_pte)) - BUG(); + if (__get_user(pte, writable_pte)) { + MEM_LOG("ptwr: Could not read pte at %p\n", writable_pte); + domain_crash(); + } pfn = pte >> PAGE_SHIFT; page = &frame_table[pfn]; PTWR_PRINTK(("[I] alloc l1 page %p\n", page)); @@ -1579,8 +1589,10 @@ void ptwr_flush_inactive(void) continue; if (unlikely(l1_pgentry_val(ol1e) & _PAGE_PRESENT)) put_page_from_l1e(ol1e, current); - if (unlikely(!get_page_from_l1e(nl1e, current))) - BUG(); + if (unlikely(!get_page_from_l1e(nl1e, current))) { + MEM_LOG("ptwr: Could not re-validate l1 page\n"); + domain_crash(); + } } unmap_domain_mem(pl1e); @@ -1588,8 +1600,10 @@ void ptwr_flush_inactive(void) PTWR_PRINTK(("[I] writable_l1 at %p is %08lx\n", writable_pte, pte)); pte &= ~_PAGE_RW; - if (__put_user(pte, writable_pte)) - BUG(); + if (__put_user(pte, writable_pte)) { + MEM_LOG("ptwr: Could not update pte at %p\n", writable_pte); + domain_crash(); + } __flush_tlb_one(ptwr_info[cpu].writables[idx]); PTWR_PRINTK(("[I] writable_l1 at %p now %08lx\n", writable_pte, pte)); @@ -1690,8 +1704,11 @@ int ptwr_do_page_fault(unsigned long addr) PTWR_PRINTK(("update %p pte to %08lx\n", &linear_pg_table[addr>>PAGE_SHIFT], pte)); if ( __put_user(pte, (unsigned long *) - &linear_pg_table[addr>>PAGE_SHIFT]) ) - BUG(); + &linear_pg_table[addr>>PAGE_SHIFT]) ) { + MEM_LOG("ptwr: Could not update pte at %p\n", (unsigned long *) + &linear_pg_table[addr>>PAGE_SHIFT]); + domain_crash(); + } return 1; } } @@ -1713,8 +1730,11 @@ static void ptwr_init_backpointers(void) page = &frame_table[pde >> PAGE_SHIFT]; /* assert that page is an l1_page_table XXXcl maybe l2? */ - if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table ) - BUG(); + if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table ) { + MEM_LOG("ptwr: Inconsistent pagetable: pde %x is not an l1 page\n", + pde >> PAGE_SHIFT); + domain_crash(); + } page->u.inuse.type_info &= ~PGT_va_mask; page->u.inuse.type_info |= va_idx << PGT_va_shift; } @@ -1739,8 +1759,10 @@ void ptwr_status(void) unsigned long *writable_pte = (unsigned long *)&linear_pg_table [ptwr_info[cpu].writables[i]>>PAGE_SHIFT]; - if ( __get_user(pte, writable_pte) ) - BUG(); + if ( __get_user(pte, writable_pte) ) { + MEM_LOG("ptwr: Could not read pte at %p\n", writable_pte); + domain_crash(); + } pfn = pte >> PAGE_SHIFT; page = &frame_table[pfn]; @@ -1757,8 +1779,11 @@ void ptwr_status(void) ptwr_info[cpu].disconnected << L2_PAGETABLE_SHIFT); pl2e = &linear_l2_table[ptwr_info[cpu].disconnected]; - if ( __get_user(pte, (unsigned long *)ptwr_info[cpu].writable_l1) ) - BUG(); + if ( __get_user(pte, (unsigned long *)ptwr_info[cpu].writable_l1) ) { + MEM_LOG("ptwr: Could not read pte at %p\n", (unsigned long *) + ptwr_info[cpu].writable_l1); + domain_crash(); + } pfn = pte >> PAGE_SHIFT; page = &frame_table[pfn]; diff --git a/xen/common/domain.c b/xen/common/domain.c index 55621847d0..314f875511 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -152,6 +152,9 @@ void domain_crash(void) { struct domain *d; + if (current->domain == 0) + BUG(); + set_bit(DF_CRASHED, ¤t->flags); d = find_domain_by_id(0); From 9b83ae02b774e13d3aa218e747fa5cbeef505d0b Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 16:01:06 +0000 Subject: [PATCH 18/28] bitkeeper revision 1.1159.62.1 (412f5ac2sXlMhMeRveH20BE_o6ZJVw) Allow shadow p.t. code to do unsafe things with shadow locks held. --- xen/arch/x86/shadow.c | 14 +++++++------- xen/common/kernel.c | 16 ++++++++++++---- xen/include/asm-x86/shadow.h | 21 +++++++++++---------- xen/include/xen/spinlock.h | 11 +++++++++++ 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c index e1fac065d0..672f48ef9f 100644 --- a/xen/arch/x86/shadow.c +++ b/xen/arch/x86/shadow.c @@ -443,7 +443,7 @@ int shadow_mode_control(struct domain *d, dom0_shadow_control_t *sc) domain_pause(d); synchronise_pagetables(~0UL); - spin_lock(&d->mm.shadow_lock); + shadow_lock(&d->mm); if ( cmd == DOM0_SHADOW_CONTROL_OP_OFF ) { @@ -470,7 +470,7 @@ int shadow_mode_control(struct domain *d, dom0_shadow_control_t *sc) rc = -EINVAL; } - spin_unlock(&d->mm.shadow_lock); + shadow_unlock(&d->mm); domain_unpause(d); @@ -620,19 +620,19 @@ int shadow_fault( unsigned long va, long error_code ) // take the lock and reread gpte - spin_lock(¤t->mm.shadow_lock); + shadow_lock(m); if ( unlikely(__get_user(gpte, (unsigned long*)&linear_pg_table[va>>PAGE_SHIFT])) ) { SH_VVLOG("shadow_fault - EXIT: read gpte faulted" ); - spin_unlock(&m->shadow_lock); + shadow_unlock(m); return 0; // propagate to guest } if ( unlikely(!(gpte & _PAGE_PRESENT)) ) { SH_VVLOG("shadow_fault - EXIT: gpte not present (%lx)",gpte ); - spin_unlock(&m->shadow_lock); + shadow_unlock(m); return 0; // we're not going to be able to help } @@ -645,7 +645,7 @@ int shadow_fault( unsigned long va, long error_code ) else { // write fault on RO page SH_VVLOG("shadow_fault - EXIT: write fault on RO page (%lx)",gpte ); - spin_unlock(&m->shadow_lock); + shadow_unlock(m); return 0; // propagate to guest // not clear whether we should set accessed bit here... } @@ -737,7 +737,7 @@ int shadow_fault( unsigned long va, long error_code ) check_pagetable( current, current->mm.pagetable, "post-sf" ); - spin_unlock(&m->shadow_lock); + shadow_unlock(m); return 1; // let's try the faulting instruction again... diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 6d70547321..2c67cf7506 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -396,12 +396,20 @@ long do_ni_hypercall(void) #ifndef NDEBUG -static int crit_count[NR_CPUS]; -static int crit_checking = 1; +static int crit_count[NR_CPUS], crit_checking_disabled[NR_CPUS]; void disable_criticalregion_checking(void) { - crit_checking = 0; + int cpu = smp_processor_id(); + ASSERT(crit_checking_disabled[cpu] >= 0); + crit_checking_disabled[cpu]++; +} + +void enable_criticalregion_checking(void) +{ + int cpu = smp_processor_id(); + crit_checking_disabled[cpu]--; + ASSERT(crit_checking_disabled[cpu] >= 0); } void criticalregion_enter(void) @@ -421,7 +429,7 @@ void criticalregion_exit(void) void ASSERT_no_criticalregion(void) { int cpu = smp_processor_id(); - if ( (crit_count[cpu] == 0) || !crit_checking ) + if ( (crit_count[cpu] == 0) || crit_checking_disabled[cpu] ) return; disable_criticalregion_checking(); ASSERT(crit_count[cpu] >= 0); /* -ve count is a special kind of bogus! */ diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index f874b6be4a..5a1994cabb 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -26,6 +26,8 @@ #define shadow_mode(_d) ((_d)->mm.shadow_mode) #define shadow_lock_init(_d) spin_lock_init(&(_d)->mm.shadow_lock) +#define shadow_lock(_m) spin_lock_nochecking(&(_m)->shadow_lock) +#define shadow_unlock(_m) spin_unlock_nochecking(&(_m)->shadow_lock) extern void shadow_mode_init(void); extern int shadow_mode_control(struct domain *p, dom0_shadow_control_t *sc); @@ -134,9 +136,9 @@ static inline int mark_dirty( struct mm_struct *m, unsigned int mfn ) int rc; ASSERT(local_irq_is_enabled()); //if(spin_is_locked(&m->shadow_lock)) printk("+"); - spin_lock(&m->shadow_lock); + shadow_lock(m); rc = __mark_dirty( m, mfn ); - spin_unlock(&m->shadow_lock); + shadow_unlock(m); return rc; } @@ -388,20 +390,21 @@ static inline unsigned long get_shadow_status( struct mm_struct *m, ASSERT(local_irq_is_enabled()); //if(spin_is_locked(&m->shadow_lock)) printk("*"); - spin_lock(&m->shadow_lock); + shadow_lock(m); if( m->shadow_mode == SHM_logdirty ) __mark_dirty( m, gpfn ); res = __shadow_status( m, gpfn ); - if (!res) spin_unlock(&m->shadow_lock); + if (!res) + shadow_unlock(m); return res; } static inline void put_shadow_status( struct mm_struct *m ) { - spin_unlock(&m->shadow_lock); + shadow_unlock(m); } @@ -583,11 +586,9 @@ static inline void shadow_mk_pagetable( struct mm_struct *mm ) if ( unlikely(mm->shadow_mode) ) { ASSERT(local_irq_is_enabled()); - spin_lock(&mm->shadow_lock); - - __shadow_mk_pagetable( mm ); - - spin_unlock(&mm->shadow_lock); + shadow_lock(mm); + __shadow_mk_pagetable(mm); + shadow_unlock(mm); } SH_VVLOG("leaving shadow_mk_pagetable( gptbase=%08lx, mode=%d ) sh=%08lx", diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index 0b4503d999..fc2409f13d 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -78,6 +78,7 @@ extern void criticalregion_enter(void); extern void criticalregion_exit(void); extern void ASSERT_no_criticalregion(void); extern void disable_criticalregion_checking(void); +extern void enable_criticalregion_checking(void); #define spin_lock(_lock) \ do { criticalregion_enter(); _raw_spin_lock(_lock); } while (0) @@ -111,6 +112,7 @@ static inline int spin_trylock(spinlock_t *lock) #define ASSERT_no_criticalregion() ((void)0) #define disable_criticalregion_checking() ((void)0) +#define enable_criticalregion_checking() ((void)0) #define spin_lock(_lock) _raw_spin_lock(_lock) #define spin_trylock(_lock) _raw_spin_trylock(_lock) @@ -124,4 +126,13 @@ static inline int spin_trylock(spinlock_t *lock) #endif +/* + * Use these if you have taken special care to ensure that certain unsafe + * things can occur in your critical region (e.g., faults, user-space + * accesses). + */ +#define spin_lock_nochecking(_lock) _raw_spin_lock(_lock) +#define spin_trylock_nochecking(_lock) _raw_spin_trylock(_lock) +#define spin_unlock_nochecking(_lock) _raw_spin_unlock(_lock) + #endif /* __SPINLOCK_H__ */ From 8cf1f5455e404e817129adac073c91b1d96c413b Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 18:21:51 +0000 Subject: [PATCH 19/28] bitkeeper revision 1.1159.63.1 (412f7bbf5smbnLknRPslkbedgaBzzw) Only update the tls descriptors if they are changed. --- .../arch/xen/i386/kernel/process.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/process.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/process.c index 11cba27734..75816caf32 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/process.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/process.c @@ -556,7 +556,15 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas * Load the per-thread Thread-Local Storage descriptor. * This is load_TLS(next, cpu) with multicalls. */ -#define C(i) queue_multicall3(__HYPERVISOR_update_descriptor, virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i]), ((u32 *)&next->tls_array[i])[0], ((u32 *)&next->tls_array[i])[1]) +#define C(i) do { \ + if (unlikely(next->tls_array[i].a != prev->tls_array[i].a || \ + next->tls_array[i].b != prev->tls_array[i].b)) \ + queue_multicall3(__HYPERVISOR_update_descriptor, \ + virt_to_machine(&get_cpu_gdt_table(cpu) \ + [GDT_ENTRY_TLS_MIN + i]), \ + ((u32 *)&next->tls_array[i])[0], \ + ((u32 *)&next->tls_array[i])[1]); \ +} while (0) C(0); C(1); C(2); #undef C From c876e88e21bbe9ce9f168d463675def4fbc2f741 Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 22:22:11 +0000 Subject: [PATCH 20/28] bitkeeper revision 1.1159.53.19 (412fb413bkA_ye03VIpzrhJS_8WuZg) Update config files for 2.6.8.1 and enable device-mapper snapshot/mirror targets and raid. --- .../arch/xen/configs/xen0_defconfig | 34 ++++++++++++++----- .../arch/xen/configs/xenU_defconfig | 14 ++++++-- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig index 17400d6eec..960c332306 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig @@ -21,7 +21,6 @@ CONFIG_X86=y # CONFIG_EXPERIMENTAL=y # CONFIG_CLEAN_COMPILE is not set -# CONFIG_STANDALONE is not set CONFIG_BROKEN=y CONFIG_BROKEN_ON_SMP=y @@ -40,6 +39,7 @@ CONFIG_HOTPLUG=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set +# CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y @@ -126,6 +126,7 @@ CONFIG_PCMCIA=m # CONFIG_PCMCIA_DEBUG is not set CONFIG_YENTA=m CONFIG_CARDBUS=y +# CONFIG_PD6729 is not set # CONFIG_I82092 is not set # CONFIG_I82365 is not set # CONFIG_TCIC is not set @@ -169,6 +170,8 @@ CONFIG_BINFMT_ELF=y # # Generic Driver Options # +# CONFIG_STANDALONE is not set +CONFIG_PREVENT_FIRMWARE_BUILD=y # CONFIG_FW_LOADER is not set # CONFIG_DEBUG_DRIVER is not set @@ -204,6 +207,7 @@ CONFIG_BLK_DEV_SD=y # SCSI low-level drivers # CONFIG_BLK_DEV_3W_XXXX_RAID=y +# CONFIG_SCSI_3W_9XXX is not set # CONFIG_SCSI_7000FASST is not set # CONFIG_SCSI_ACARD is not set # CONFIG_SCSI_AHA152X is not set @@ -232,6 +236,7 @@ CONFIG_SCSI_MEGARAID=y CONFIG_SCSI_SATA=y # CONFIG_SCSI_SATA_SVW is not set CONFIG_SCSI_ATA_PIIX=y +# CONFIG_SCSI_SATA_NV is not set CONFIG_SCSI_SATA_PROMISE=y CONFIG_SCSI_SATA_SX4=y CONFIG_SCSI_SATA_SIL=y @@ -301,7 +306,7 @@ CONFIG_SCSI_QLA2XXX=y CONFIG_BLK_DEV_LOOP=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set CONFIG_BLK_DEV_NBD=y -# CONFIG_BLK_DEV_CARMEL is not set +# CONFIG_BLK_DEV_SX8 is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y @@ -311,15 +316,18 @@ CONFIG_BLK_DEV_INITRD=y # Multi-device support (RAID and LVM) # CONFIG_MD=y -CONFIG_BLK_DEV_MD=m +CONFIG_BLK_DEV_MD=y # CONFIG_MD_LINEAR is not set -CONFIG_MD_RAID0=m -CONFIG_MD_RAID1=m -# CONFIG_MD_RAID5 is not set +CONFIG_MD_RAID0=y +CONFIG_MD_RAID1=y +CONFIG_MD_RAID5=y # CONFIG_MD_RAID6 is not set # CONFIG_MD_MULTIPATH is not set CONFIG_BLK_DEV_DM=y # CONFIG_DM_CRYPT is not set +CONFIG_DM_SNAPSHOT=y +CONFIG_DM_MIRROR=y +# CONFIG_DM_ZERO is not set # # ATA/ATAPI/MFM/RLL support @@ -330,6 +338,7 @@ CONFIG_BLK_DEV_IDE=y # # Please see Documentation/ide.txt for help/info on IDE drives # +# CONFIG_BLK_DEV_IDE_SATA is not set # CONFIG_BLK_DEV_HD_IDE is not set CONFIG_BLK_DEV_IDEDISK=y # CONFIG_IDEDISK_MULTI_MODE is not set @@ -467,6 +476,8 @@ CONFIG_IP_NF_IPTABLES=m # CONFIG_IP_NF_COMPAT_IPCHAINS is not set # CONFIG_IP_NF_COMPAT_IPFWADM is not set # CONFIG_IP_NF_RAW is not set +# CONFIG_IP_NF_MATCH_ADDRTYPE is not set +# CONFIG_IP_NF_MATCH_REALM is not set # # Bridge: Netfilter Configuration @@ -489,13 +500,13 @@ CONFIG_BRIDGE=y # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set -# CONFIG_NET_FASTROUTE is not set # CONFIG_NET_HW_FLOWCONTROL is not set # # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set # # Network testing @@ -583,6 +594,7 @@ CONFIG_8139TOO_PIO=y # CONFIG_TLAN is not set CONFIG_VIA_RHINE=y # CONFIG_VIA_RHINE_MMIO is not set +# CONFIG_VIA_VELOCITY is not set # CONFIG_NET_POCKET is not set # @@ -792,6 +804,8 @@ CONFIG_ZISOFS_FS=y CONFIG_FAT_FS=m CONFIG_MSDOS_FS=m CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_NTFS_FS is not set # @@ -881,6 +895,7 @@ CONFIG_NLS_CODEPAGE_437=y # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set # CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set @@ -916,10 +931,12 @@ CONFIG_CRYPTO_DES=m # CONFIG_CRYPTO_BLOWFISH is not set # CONFIG_CRYPTO_TWOFISH is not set # CONFIG_CRYPTO_SERPENT is not set -CONFIG_CRYPTO_AES=m +# CONFIG_CRYPTO_AES_586 is not set # CONFIG_CRYPTO_CAST5 is not set # CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_TEA is not set # CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_KHAZAD is not set # CONFIG_CRYPTO_DEFLATE is not set # CONFIG_CRYPTO_MICHAEL_MIC is not set CONFIG_CRYPTO_CRC32C=m @@ -928,6 +945,7 @@ CONFIG_CRYPTO_CRC32C=m # # Library routines # +# CONFIG_CRC_CCITT is not set CONFIG_CRC32=y CONFIG_LIBCRC32C=y CONFIG_ZLIB_INFLATE=y diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig index 09546ab0a3..09bfb25851 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig @@ -21,7 +21,6 @@ CONFIG_X86=y # CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y -CONFIG_STANDALONE=y CONFIG_BROKEN_ON_SMP=y # @@ -38,6 +37,7 @@ CONFIG_HOTPLUG=y # CONFIG_IKCONFIG is not set # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y @@ -127,6 +127,8 @@ CONFIG_BINFMT_ELF=y # # Generic Driver Options # +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y # CONFIG_FW_LOADER is not set # @@ -228,13 +230,13 @@ CONFIG_IP_PNP=y # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set -# CONFIG_NET_FASTROUTE is not set # CONFIG_NET_HW_FLOWCONTROL is not set # # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set # # Network testing @@ -323,6 +325,8 @@ CONFIG_ZISOFS_FS=y CONFIG_FAT_FS=m CONFIG_MSDOS_FS=m CONFIG_VFAT_FS=m +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_NTFS_FS is not set # @@ -410,6 +414,7 @@ CONFIG_NLS_CODEPAGE_437=y # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set # CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set @@ -445,10 +450,12 @@ CONFIG_CRYPTO_MD5=m # CONFIG_CRYPTO_BLOWFISH is not set # CONFIG_CRYPTO_TWOFISH is not set # CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_AES is not set +# CONFIG_CRYPTO_AES_586 is not set # CONFIG_CRYPTO_CAST5 is not set # CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_TEA is not set # CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_KHAZAD is not set # CONFIG_CRYPTO_DEFLATE is not set # CONFIG_CRYPTO_MICHAEL_MIC is not set CONFIG_CRYPTO_CRC32C=m @@ -457,6 +464,7 @@ CONFIG_CRYPTO_CRC32C=m # # Library routines # +# CONFIG_CRC_CCITT is not set # CONFIG_CRC32 is not set CONFIG_LIBCRC32C=m CONFIG_ZLIB_INFLATE=y From d3d0ac23f3b8761f58853491503207e21333260b Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Fri, 27 Aug 2004 23:59:14 +0000 Subject: [PATCH 21/28] bitkeeper revision 1.1159.53.20 (412fcad23hK1z2MEUvJpOm8rSZ01xg) Call blkdev_put from vbd destroy functions. Patch by Michael Vrable. --- linux-2.6.8.1-xen-sparse/drivers/xen/blkback/vbd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/vbd.c b/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/vbd.c index 765f467608..b530128366 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/vbd.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/blkback/vbd.c @@ -305,6 +305,9 @@ void vbd_destroy(blkif_be_vbd_destroy_t *destroy) while ( x != NULL ) { t = x->next; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + blkdev_put(x->bdev); +#endif kfree(x); x = t; } @@ -330,6 +333,9 @@ void destroy_all_vbds(blkif_t *blkif) while ( x != NULL ) { t = x->next; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + blkdev_put(x->bdev); +#endif kfree(x); x = t; } From 2dd00b89d70b23423443a0b7ac6177dde0ed811e Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Sat, 28 Aug 2004 09:23:15 +0000 Subject: [PATCH 22/28] bitkeeper revision 1.1159.53.21 (41304f03AEY0D00K1DyuV8kwtvilfQ) Always enable our console so that we get console output even if the actual console is on the vga or other display. --- linux-2.6.8.1-xen-sparse/drivers/xen/console/console.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/console/console.c b/linux-2.6.8.1-xen-sparse/drivers/xen/console/console.c index 8657a426c8..d8a28bf153 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/console/console.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/console/console.c @@ -158,6 +158,10 @@ void xen_console_init(void) if ( xc_mode == XC_DEFAULT ) xc_mode = XC_SERIAL; kcons_info.write = kcons_write_dom0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + if ( xc_mode == XC_SERIAL ) + kcons_info.flags |= CON_ENABLED; +#endif } else { From 1d9f9b80cd64df00afb6b99451cdb39a10c3324d Mon Sep 17 00:00:00 2001 From: "mwilli2@equilibrium.research" Date: Sat, 28 Aug 2004 15:58:24 +0000 Subject: [PATCH 23/28] bitkeeper revision 1.1159.64.1 (4130aba0phC6BxiRx2cnmE5EUnUgTQ) Update version numbers. Need some update of the actual instructions, particularly in README.CD. --- BitKeeper/etc/logging_ok | 1 + README | 30 +++---- README.CD | 80 +++++++++---------- docs/HOWTOs/Console-HOWTO | 8 +- docs/interface.tex | 2 +- docs/user.tex | 40 +++++----- .../arch/xen/kernel/head.S | 2 +- .../arch/xen/i386/kernel/head.S | 2 +- tools/libxc/xc_linux_build.c | 4 +- xen/Makefile | 6 +- xen/common/elf.c | 4 +- 11 files changed, 91 insertions(+), 88 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index fb81d871d0..be1a4e4e40 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -28,6 +28,7 @@ laudney@eclipse.(none) lynx@idefix.cl.cam.ac.uk maw48@labyrinth.cl.cam.ac.uk mjw@wray-m-3.hpl.hp.com +mwilli2@equilibrium.research mwilli2@equilibrium.research.intel-research.net rac61@labyrinth.cl.cam.ac.uk rgr22@boulderdash.cl.cam.ac.uk diff --git a/README b/README index 45aab89f64..c2d38ed878 100644 --- a/README +++ b/README @@ -1,14 +1,14 @@ -############################# - __ __ _ _____ - \ \/ /___ _ __ / | |___ / - \ // _ \ '_ \ | | |_ \ - / \ __/ | | | | |_ ___) | - /_/\_\___|_| |_| |_(_)____/ - -############################# +############################### +__ __ ____ ___ +\ \/ /___ _ __ |___ \ / _ \ + \ // _ \ '_ \ __) || | | | + / \ __/ | | | / __/ | |_| | +/_/\_\___|_| |_| |_____(_)___/ + +############################### University of Cambridge Computer Laboratory -15 Jun 2004 +28 Aug 2004 http://www.cl.cam.ac.uk/netos/xen @@ -149,10 +149,10 @@ Building Xen and XenLinux ========================= The public master BK repository for the 2.0 release lives at: -bk://xen.bkbits.net/xeno-2.0.bk +bk://xen.bkbits.net/xen-2.0.bk To fetch a local copy, install the BitKeeper tools, then run: -'bk clone bk://xen.bkbits.net/xeno-2.0.bk' +'bk clone bk://xen.bkbits.net/xen-2.0.bk' You can do a complete build of Xen, the control tools, and the XenLinux kernel images with "make world". This can take 10 minutes @@ -164,8 +164,8 @@ can then install everything to the standard system directories Take a look in install/boot/: install/boot/xen.gz The Xen 'kernel' (formerly image.gz) - install/boot/vmlinuz-2.4.26-xen0 Domain 0 XenLinux kernel (xenolinux.gz) - install/boot/vmlinuz-2.4.26-xenU Unprivileged XenLinux kernel + install/boot/vmlinuz-2.4.27-xen0 Domain 0 XenLinux kernel (xenolinux.gz) + install/boot/vmlinuz-2.4.27-xenU Unprivileged XenLinux kernel The difference between the two Linux kernels that are built is due to the configuration file used for each. The "U" suffixed @@ -176,7 +176,7 @@ your non-privileged domains. The install/boot directory will also contain the config files used for building the XenLinux kernels, and also versions of Xen and XenLinux kernels that contain debug symbols (xen-syms and -vmlinux-syms-2.4.26-xen0) which are essential for interpreting crash +vmlinux-syms-2.4.27-xen0) which are essential for interpreting crash dumps. Inspect the Makefile if you want to see what goes on during a @@ -185,7 +185,7 @@ more complicated. The makefile needs a 'pristine' linux kernel tree which it will then add the Xen architecture files to. You can tell the makefile the location of the appropriate linux compressed tar file by setting the LINUX_SRC environment variable -(e.g. "LINUX_SRC=/tmp/linux-2.4.26.tar.gz make world") or by placing +(e.g. "LINUX_SRC=/tmp/linux-2.4.27.tar.gz make world") or by placing the tar file somewhere in the search path of LINUX_SRC_PATH which defaults to ".:..". If the makefile can't find a suitable kernel tar file it attempts to download it from kernel.org, but this won't work diff --git a/README.CD b/README.CD index 3ea9eb7639..77b1db826d 100644 --- a/README.CD +++ b/README.CD @@ -1,15 +1,15 @@ -############################# - __ __ _ _____ - \ \/ /___ _ __ / | |___ / - \ // _ \ '_ \ | | |_ \ - / \ __/ | | | | |_ ___) | - /_/\_\___|_| |_| |_(_)____/ - -############################# +############################### +__ __ ____ ___ +\ \/ /___ _ __ |___ \ / _ \ + \ // _ \ '_ \ __) || | | | + / \ __/ | | | / __/ | |_| | +/_/\_\___|_| |_| |_____(_)___/ - XenDemoCD 1.3 +############################### + + XenDemoCD 2.0 University of Cambridge Computer Laboratory - 24 Jan 2004 + 28 Aug 2004 http://www.cl.cam.ac.uk/netos/xen @@ -18,10 +18,10 @@ Welcome to the Xen Demo CD! Executive Summary ================= -This CD is a standalone demo of the Xen Virtual Machine Monitor (VMM) -and Linux-2.4 OS port (Xenlinux). It runs entirely off the CD, -without requiring hard disk installation. This is achieved using a RAM -disk to store mutable file system data while using the CD for +This CD is a standalone demo of the Xen Virtual Machine Monitor (VMM), + Linux-2.4 and Linux-2.6 OS port (Xenlinux). It runs entirely off the +CD, without requiring hard disk installation. This is achieved using a +RAM disk to store mutable file system data while using the CD for everything else. The CD can also be used for installing Xen/Xenlinux to disk, and includes a source code snapshot along with all of the tools required to build it. @@ -51,9 +51,9 @@ To try out the Demo, boot from CD (you may need to change your BIOS configuration to do this), then select one of the four boot options from the Grub menu: - Xen / linux-2.4.26 - Xen / linux-2.4.26 using cmdline IP configuration - Xen / linux-2.4.26 in "safe mode" + Xen / linux-2.4.27 + Xen / linux-2.4.27 using cmdline IP configuration + Xen / linux-2.4.27 in "safe mode" linux-2.4.22 The last option is a plain linux kernel that runs on the bare machine, @@ -119,7 +119,7 @@ work with Xen, and you'll only be able to configure a VGA X server. We're working on a fix for this for the next release. If you want to browse the Xen / Xenlinux source, it's all located -under /usr/local/src/xeno-1.3, complete with BitKeeper +under /usr/local/src/xen-2.0.bk, complete with BitKeeper repository. We've also included source code and configuration information for the various benchmarks we used in the SOSP paper. @@ -149,7 +149,7 @@ high-level management tools will be developed in due course. Within the source repository the tools live in tools/examples/ but are installed in /usr/local/bin/ on the CD. -Starting a new domain is achieved using xc_dom_create.py which +Starting a new domain is achieved using the command 'xm create' which allocates resources to a new domain, populates it with a kernel image (and optionally a ramdisk) and then starts it. @@ -177,17 +177,13 @@ The 'mem' variable can be used to change the default memory allocation of 64MB. For example to start a domain with two IP addresses and 72MB: - xc_dom_create.py -Dip=128.23.45.34,169.254.1.1 -Dmem=72 + xm create ip=128.23.45.34,169.254.1.1mem=72 -[multiple variables may also be set with a single '-D' flag by -separating them with ':'. Also, it's possible to use DNS hostnames -rather than IP addresses.] - -When invoked with the '-n' option xc_dom_create.py will do a dry run +When invoked with the '-n' option 'xm create' will do a dry run and just print out what resources and configuration the domain will have e.g.: - [root@xendemo]# xc_dom_create.py -D ip=commando-1.xeno,169.254.2.3 -Dmem=100 + [root@xendemo]# xm create -n ip=commando-1.xeno,169.254.2.3 mem=100 Parsing config file 'defaults' VM image : "/boot/xenlinux.gz" @@ -197,15 +193,15 @@ have e.g.: VM block device(s) : "phy:cdrom,hdd,r" VM cmdline : "ip=128.232.38.51:169.254.1.0:128.232.32.1:255.255.240.0::eth0:off root=/dev/ram0 rw init=/linuxrc 4 LOCALIP=169.254.2.3" -xc_dom_create.py will print the local TCP port to which you should +xm create will print the local TCP port to which you should connect to perform console I/O. A suitable console client is provided by the Python module xenctl.console_client: running this module from the command line with and parameters will start a terminal session. This module is also installed as /usr/bin/xencons, from a copy in tools/misc/xencons. An alternative to manually running -a terminal client is to specify '-c' to xc_dom_create.py, or add +a terminal client is to specify '-c' to xm create, or add 'auto_console=True' to the defaults file. This will cause -xc_dom_create.py to automatically become the console terminal after +'xm create' to automatically become the console terminal after starting the domain. The 169.254.x.x network is special in that it is the 'link local' @@ -239,17 +235,18 @@ To access the new virtual machine remotely, use: ssh -p2201 root@IP.address.Of.Domain0 # use 2202 for domain 2 etc. -You can manipulate running domains using the xc_dom_control.py tool. +You can manipulate running domains using the xm tool. Invoking it without arguments prints some usage information. -To see what domains are running, run 'xc_dom_control.py list'. Using the +To see what domains are running, run 'xm list'. Using the tool you can change scheduling parameters, pause a domain, send it a shutdown request, or blow it away with the 'destroy' command. You can even suspend it to disk (but you probably won't have enough memory to do the latter if you're running off the demo CD). -To find usage information for xc_dom_control.py, run the script with -no arguments. +To find usage information for xm, run the script with no arguments or +with the 'help' argument. To get help on a particular xm command, use +'xm cmdname help'. Troubleshooting Problems @@ -352,7 +349,7 @@ essentially involves copying the contents of the CD on to a suitably formated disk partition, and then installing or updating the Grub bootloader. -This is a bootable CD that loads Xen, and then a Linux 2.4.22 OS image +This is a bootable CD that loads Xen, and then a Linux 2.4.27 OS image ported to run on Xen. The CD contains a copy of a file system based on the RedHat 9 distribution that is able to run directly off the CD ("live ISO"), using a "tmpfs" RAM-based file system for root (/etc @@ -400,9 +397,9 @@ config file. A typical Grub menu option might look like: -title Xen / Xenlinux 2.4.26 +title Xen 2.0 / Xenlinux 2.4.27 kernel /boot/xen.gz dom0_mem=131072 com1=115200 noht watchdog - module /boot/vmlinuz-2.4.26-xen0 root=/dev/sda4 ro + module /boot/vmlinuz-2.4.27-xen0 root=/dev/sda4 ro The first line specifies which Xen image to use, and what command line arguments to pass to Xen. In this case we set the maximum amount of @@ -421,7 +418,7 @@ require a second "module" line. Installing the Xen tools and source =================================== -The tools and source live in the /usr/local/src/xen-2.0 directory on +The tools and source live in the /usr/local/src/xen-2.0.bk directory on the CD (and may also be downloaded from the project downloads page). You'll need to copy them to some mutable storage before using them. @@ -480,9 +477,10 @@ Installing the file systems from the CD If you haven't got an existing Linux installation onto which you can just drop down the Xen and Xenlinux images, then the file systems on -the CD provide a quick way of doing an install. However, you're -probably better off in the long run doing a proper Redhat, Fedora, -Debian etc install rather than just doing the hack described below: +the CD provide a quick way of doing an install. However, you would be +better off in the long run doing a proper install of your preferred +distro and installing Xen onto that, rather than just doing the hack +described below: Choose one or two partitions, depending on whether you want a separate /usr or not. Make file systems on it/them e.g.: @@ -529,7 +527,7 @@ figuring out what's happened. Debug a Xenlinux image just as you would any other Linux kernel. We supply a handy debug terminal program which you can find in -/usr/local/src/xen-1.0/xeno-1.0.bk/tools/misc/miniterm/ +/usr/local/src/xen-2.0.bk/tools/misc/miniterm/ This should be built and executed on another machine that is connected via a null modem cable. Documentation is included. Alternatively, if the Xen machine is connected to a serial-port server diff --git a/docs/HOWTOs/Console-HOWTO b/docs/HOWTOs/Console-HOWTO index 4abdf52921..d033dc7055 100644 --- a/docs/HOWTOs/Console-HOWTO +++ b/docs/HOWTOs/Console-HOWTO @@ -1,10 +1,10 @@ - New console I/O infrastructure in Xen 1.3 + New console I/O infrastructure in Xen 2.0 ========================================= Keir Fraser, University of Cambridge, 3rd June 2004 I thought I'd write a quick note about using the new console I/O - infrastructure in Xen 1.3. Significant new features compared with 1.2, + infrastructure in Xen 2.0. Significant new features compared with 1.2, and with older revisions of 1.3, include: - bi-directional console access - log in to a Xenolinux guest OS via its virtual console @@ -80,6 +80,6 @@ Virtual console for other domains # xencons localhost 9600 An alternative to manually running a terminal client is to specify - '-c' to xc_dom_create.py, or add 'auto_console=True' to the defaults - file. This will cause xc_dom_create.py to automatically become the + '-c' to xm create, or add 'auto_console=True' to the defaults + file. This will cause xm create to automatically become the console terminal after starting the domain. diff --git a/docs/interface.tex b/docs/interface.tex index d4f5e53a13..988f0aa19a 100644 --- a/docs/interface.tex +++ b/docs/interface.tex @@ -15,7 +15,7 @@ \vfill \begin{tabular}{l} {\Huge \bf Interface manual} \\[4mm] -{\huge Xen v1.3 for x86} \\[80mm] +{\huge Xen v2.0 for x86} \\[80mm] {\Large Xen is Copyright (c) 2004, The Xen Team} \\[3mm] {\Large University of Cambridge, UK} \\[20mm] diff --git a/docs/user.tex b/docs/user.tex index 3aa22849ee..242a2be708 100644 --- a/docs/user.tex +++ b/docs/user.tex @@ -77,7 +77,7 @@ following OSs have either been ported already or a port is in progress: \begin{itemize} \item Dragonfly BSD -\item FreeBSD 4.8 +\item FreeBSD 5.3 \item Linux 2.4 \item Linux 2.6 \item NetBSD 2.0 @@ -85,8 +85,8 @@ progress: \item Windows XP \end{itemize} -Right now, Linux 2.4 and 2.6 are available for on Xen 2.0. NetBSD -port will be updated to run on Xen 2.0, hopefully in time for the Xen +Right now, Linux 2.4 and 2.6 are available for Xen 2.0. NetBSD +port will be updated to run on Xen 2.0, hopefully in time for the NetBSD 2.0 release. It is intended that Xen support be integrated into the official releases of Linux 2.6, NetBSD 2.0, FreeBSD and Dragonfly BSD. @@ -289,16 +289,16 @@ line. \subsection{Using Bitkeeper} The public master BK repository for the 2.0 release lives at: \\ -{\tt bk://xen.bkbits.net/xeno-unstable.bk}. You can use Bitkeeper to +{\tt bk://xen.bkbits.net/xen-2.0.bk}. You can use Bitkeeper to download it and keep it updated with the latest features and fixes. Change to the directory in which you want to put the source code, then run: \begin{verbatim} -# bk clone bk://xen.bkbits.net/xeno-unstable.bk +# bk clone bk://xen.bkbits.net/xeno-2.0.bk \end{verbatim} -Under your current directory, a new directory named 'xeno-unstable.bk' +Under your current directory, a new directory named `xeno-2.0.bk' has been created, which contains all the source code for the Xen hypervisor and the Xen tools. The directory also contains `sparse' Linux source trees, containing only the files that differ between @@ -307,8 +307,8 @@ XenLinux and standard Linux. Once you have cloned the repository, you can update to the newest changes to the repository by running: \begin{verbatim} -# cd xeno-unstable.bk # to change into the local repository -# bk pull # to update the repository +# cd xeno-2.0.bk # to change into the local repository +# bk pull # to update the repository \end{verbatim} \subsection{Without Bitkeeper} @@ -494,18 +494,22 @@ require a more complex setup, you will want to write a custom configuration file --- details of the configuration file formats are included in Chapter~\ref{cha:config}. -The \path{xmdefaults} file is a template description that is intended +The \path{xmdefconfig1} file is a simple template configuration file +for describing a single VM. + +The \path{xmdefconfig2} file is a template description that is intended to be reused for multiple virtual machines. Setting the value of the -{\tt vmid} variable fills in parts of this template. +{\tt vmid} variable on the {\tt xm} command line +fills in parts of this template. -\subsection{Editing \path{xmdefaults}} +\subsection{Editing \path{xmdefconfig}} -At minimum, you should edit the following variables in \path{xmdefaults}: +At minimum, you should edit the following variables in \path{xmdefconfig}: \begin{description} \item[kernel] Set this to the path of the kernel you compiled for use with Xen. [e.g. {\tt kernel = - '/root/xeno-unstable.bk/install/boot/vmlinuz-2.4.27-xenU'}] + '/root/xeno-2.0.bk/install/boot/vmlinuz-2.4.27-xenU'}] \item[memory] Set this to the size of the domain's memory in megabytes. [e.g. {\tt memory = 64 } ] \item[disk] Set the first entry in this list to calculate the offset @@ -535,8 +539,8 @@ virtual machine with virtual machine ID 1. The {\tt -c} switch causes {\tt xm} to turn into the domain's console after creation. The {\tt vmid=1} sets the {\tt vmid} variable used in -the {\tt xmdefaults} file. The tool uses the -\path{/etc/xen/xmdefaults} file, since no custom configuration file +the {\tt xmdefconfig} file. The tool uses the +\path{/etc/xen/xmdefconfig} file, since no custom configuration file was specified on the command line. \chapter{Domain management tasks} @@ -678,7 +682,7 @@ Xen configuration files contain the following standard variables: \end{description} It is also possible to include Python scripting commands in -configuration files. This is done in the \path{xmdefaults} file in +configuration files. This is done in the \path{xmdefconfig} file in order to handle the {\tt vmid} variable. @@ -743,7 +747,7 @@ The available {\em switches } and {\em arguments}are dependent on the declarations of the form {\tt variable=value} and may be used to set / override any of the values in the configuration file being used, including the standard variables described above and any custom -variables (for instance, the \path{xmdefaults} file uses a {\tt vmid} +variables (for instance, the \path{xmdefconfig} file uses a {\tt vmid} variable). The available commands are as follows: @@ -1021,7 +1025,7 @@ IO privileges can be assigned to allow a domain to drive PCI devices itself. This is used for to support driver domains. Setting backend privileges is currently only supported in SXP format -config files (??? is this true - there's nothing in xmdefaults, +config files (??? is this true - there's nothing in xmdefconfig, anyhow). To allow a domain to function as a backend for others, somewhere within the {\tt vm} element of its configuration file must be a {\tt backend} element of the form {\tt (backend ({\em type}))} diff --git a/linux-2.4.27-xen-sparse/arch/xen/kernel/head.S b/linux-2.4.27-xen-sparse/arch/xen/kernel/head.S index cf5aa93fce..d0b5e5cddd 100644 --- a/linux-2.4.27-xen-sparse/arch/xen/kernel/head.S +++ b/linux-2.4.27-xen-sparse/arch/xen/kernel/head.S @@ -1,6 +1,6 @@ .section __xen_guest - .asciz "GUEST_OS=linux,GUEST_VER=2.4,XEN_VER=1.3,VIRT_BASE=0xC0000000" + .asciz "GUEST_OS=linux,GUEST_VER=2.4,XEN_VER=2.0,VIRT_BASE=0xC0000000" .text #include diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/head.S b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/head.S index 254038000e..ff81f18dd9 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/head.S +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/head.S @@ -1,6 +1,6 @@ .section __xen_guest - .asciz "GUEST_OS=linux,GUEST_VER=2.6,XEN_VER=1.3" + .asciz "GUEST_OS=linux,GUEST_VER=2.6,XEN_VER=2.0" .text #include diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index c272ecb2c2..41569b8057 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -601,9 +601,9 @@ static int parseelfimage(char *elfbase, guestinfo = elfbase + shdr->sh_offset; if ( (strstr(guestinfo, "GUEST_OS=linux") == NULL) || - (strstr(guestinfo, "XEN_VER=1.3") == NULL) ) + (strstr(guestinfo, "XEN_VER=2.0") == NULL) ) { - ERROR("Will only load Linux images built for Xen v1.3"); + ERROR("Will only load Linux images built for Xen v2.0"); ERROR("Actually saw: '%s'", guestinfo); return -EINVAL; } diff --git a/xen/Makefile b/xen/Makefile index d65f8df8ca..7cf34537b5 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -1,9 +1,9 @@ # This is the correct place to edit the build version. # All other places this is stored (eg. compile.h) should be autogenerated. -export XEN_VERSION = 1 -export XEN_SUBVERSION = 3 -export XEN_EXTRAVERSION = "-devel" +export XEN_VERSION = 2 +export XEN_SUBVERSION = 0 +export XEN_EXTRAVERSION = "-beta" export BASEDIR := $(shell pwd) diff --git a/xen/common/elf.c b/xen/common/elf.c index d5912fe341..1d8384e3bd 100644 --- a/xen/common/elf.c +++ b/xen/common/elf.c @@ -69,9 +69,9 @@ int parseelfimage(char *elfbase, printk("Xen-ELF header found: '%s'\n", guestinfo); if ( (strstr(guestinfo, "GUEST_OS=linux") == NULL) || - (strstr(guestinfo, "XEN_VER=1.3") == NULL) ) + (strstr(guestinfo, "XEN_VER=2.0") == NULL) ) { - printk("ERROR: Xen will only load Linux built for Xen v1.3\n"); + printk("ERROR: Xen will only load Linux built for Xen v2.0\n"); return -EINVAL; } From 1b36232f484eab86abaf4ea689ac3bf50e310601 Mon Sep 17 00:00:00 2001 From: "iap10@labyrinth.cl.cam.ac.uk" Date: Sun, 29 Aug 2004 19:21:04 +0000 Subject: [PATCH 24/28] bitkeeper revision 1.1159.53.23 (41322ca03sWRZNXdK0Mvozxq8UHHEQ) Update xen-clone script to cope with 2.6 now being the default build. --- tools/misc/xen-clone | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/misc/xen-clone b/tools/misc/xen-clone index ce650f5dd8..63fccb841d 100755 --- a/tools/misc/xen-clone +++ b/tools/misc/xen-clone @@ -70,9 +70,9 @@ then cd ${DEST_BK_REP} ln -sf ../install install make -j4 world - make -j4 linux26 + make -j4 linux24 cd ../install/boot - [ -r vmlinuz-2.4.*-xen0 ] && ln -s vmlinuz-2.4.*-xen0 xenolinux.gz + [ -r vmlinuz-2.6.*-xen0 ] && ln -s vmlinuz-2.6.*-xen0 xenolinux.gz else # old style repository without 'make world' From 6e04b88dcb28c374c6ac8ee863be7572cebe166c Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Mon, 30 Aug 2004 22:26:01 +0000 Subject: [PATCH 25/28] bitkeeper revision 1.1159.65.1 (4133a979YYvSU8Cjqbo3qyIcdTx6pw) Grant-issuing side of Linux grant-table code. The grant-receiving side is still to be implemented. --- .../include/asm-xen/fixmap.h | 2 +- .../arch/xen/kernel/gnttab.c | 192 +++++++++++++++++- .../include/asm-xen/asm-i386/fixmap.h | 1 + .../include/asm-xen/hypervisor.h | 11 + 4 files changed, 203 insertions(+), 3 deletions(-) diff --git a/linux-2.4.27-xen-sparse/include/asm-xen/fixmap.h b/linux-2.4.27-xen-sparse/include/asm-xen/fixmap.h index 338bd4ba2c..bc6e2c2004 100644 --- a/linux-2.4.27-xen-sparse/include/asm-xen/fixmap.h +++ b/linux-2.4.27-xen-sparse/include/asm-xen/fixmap.h @@ -52,7 +52,7 @@ enum fixed_addresses { FIX_NETRING2_BASE, FIX_NETRING3_BASE, FIX_SHARED_INFO, - + FIX_GNTTAB, #ifdef CONFIG_VGA_CONSOLE #define NR_FIX_BTMAPS 32 /* 128KB For the Dom0 VGA Console A0000-C0000 */ #else diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/kernel/gnttab.c b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/gnttab.c index 008dfa9779..c76df4b1e4 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/kernel/gnttab.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/kernel/gnttab.c @@ -11,17 +11,112 @@ #include #include +#include +#include +#include #include +#ifndef set_fixmap_ma +#define set_fixmap_ma set_fixmap +#endif + +#if 1 +#define ASSERT(_p) \ + if ( !(_p) ) { printk(KERN_ALERT"Assertion '%s': line %d, file %s\n", \ + #_p , __LINE__, __FILE__); *(int*)0=0; } +#else +#define ASSERT(_p) ((void)0) +#endif + EXPORT_SYMBOL(gnttab_grant_foreign_access); EXPORT_SYMBOL(gnttab_end_foreign_access); EXPORT_SYMBOL(gnttab_grant_foreign_transfer); EXPORT_SYMBOL(gnttab_end_foreign_transfer); +struct gntent_auxinfo { + u16 write_pin, read_pin; /* reference counts */ + u16 inuse; + grant_ref_t next; /* hash chain */ +}; + +#define NR_GRANT_REFS 512 + +static struct gntent_auxinfo auxtab[NR_GRANT_REFS]; +static grant_ref_t gnttab_free_head; +static spinlock_t gnttab_lock; + +#define HASH_INVALID (0xFFFFU) +#define GNTTAB_HASH_SZ 512 +#define GNTTAB_HASH(_f) ((_f) & (GNTTAB_HASH_SZ-1)) +static grant_ref_t gnttab_hash[GNTTAB_HASH_SZ]; + +static grant_entry_t *shared; + +/* + * Lock-free grant-entry allocator + */ + +static inline grant_ref_t +get_free_entry( + void) +{ + grant_ref_t fh, nfh = gnttab_free_head; + do { fh = nfh; } + while ( unlikely((nfh = cmpxchg(&gnttab_free_head, fh, + auxtab[fh].next)) != fh) ); + return fh; +} + +static inline void +put_free_entry( + grant_ref_t ref) +{ + grant_ref_t fh, nfh = gnttab_free_head; + do { auxtab[ref].next = fh = nfh; wmb(); } + while ( unlikely((nfh = cmpxchg(&gnttab_free_head, fh, ref)) != fh) ); +} + +/* + * Public interface functions + */ + grant_ref_t gnttab_grant_foreign_access( domid_t domid, unsigned long frame, int readonly) { + unsigned long flags; + grant_ref_t ref; + + spin_lock_irqsave(&gnttab_lock, flags); + + for ( ref = gnttab_hash[GNTTAB_HASH(frame)]; + ref != HASH_INVALID; + ref = auxtab[ref].next ) + { + if ( auxtab[ref].inuse && (shared[ref].frame == frame) ) + { + if ( readonly ) + auxtab[ref].read_pin++; + else if ( auxtab[ref].write_pin++ == 0 ) + clear_bit(_GTF_readonly, (unsigned long *)&shared[ref].flags); + goto done; + } + } + + ref = get_free_entry(); + auxtab[ref].inuse = 1; + auxtab[ref].read_pin = !!readonly; + auxtab[ref].write_pin = !readonly; + auxtab[ref].next = gnttab_hash[GNTTAB_HASH(frame)]; + gnttab_hash[GNTTAB_HASH(frame)] = ref; + + shared[ref].frame = frame; + shared[ref].domid = domid; + wmb(); + shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0); + + done: + spin_unlock_irqrestore(&gnttab_lock, flags); return 0; } @@ -29,18 +124,111 @@ void gnttab_end_foreign_access( grant_ref_t ref, int readonly) { + unsigned long flags, frame = shared[ref].frame; + grant_ref_t *pref; + u16 sflags, nsflags; + + spin_lock_irqsave(&gnttab_lock, flags); + + if ( readonly ) + { + if ( (auxtab[ref].read_pin-- == 0) && (auxtab[ref].write_pin == 0) ) + goto delete; + } + else if ( auxtab[ref].write_pin-- == 0 ) + { + if ( auxtab[ref].read_pin == 0 ) + goto delete; + nsflags = shared[ref].flags; + do { + if ( (sflags = nsflags) & GTF_writing ) + printk(KERN_ALERT "WARNING: g.e. still in use for writing!\n"); + } + while ( (nsflags = cmpxchg(&shared[ref].flags, sflags, + sflags | GTF_readonly)) != sflags ); + } + + goto out; + + delete: + nsflags = shared[ref].flags; + do { + if ( (sflags = nsflags) & (GTF_reading|GTF_writing) ) + printk(KERN_ALERT "WARNING: g.e. still in use!\n"); + } + while ( (nsflags = cmpxchg(&shared[ref].flags, sflags, 0)) != sflags ); + + pref = &gnttab_hash[GNTTAB_HASH(frame)]; + while ( *pref != ref ) + pref = &auxtab[*pref].next; + *pref = auxtab[ref].next; + + auxtab[ref].inuse = 0; + put_free_entry(ref); + + out: + spin_unlock_irqrestore(&gnttab_lock, flags); } grant_ref_t gnttab_grant_foreign_transfer( domid_t domid) { - return 0; + grant_ref_t ref = get_free_entry(); + + shared[ref].frame = 0; + shared[ref].domid = domid; + wmb(); + shared[ref].flags = GTF_accept_transfer; + + return ref; } unsigned long gnttab_end_foreign_transfer( grant_ref_t ref) { - return 0; + unsigned long frame = 0; + u16 flags; + + flags = shared[ref].flags; + ASSERT(flags == (GTF_accept_transfer | GTF_transfer_committed)); + + /* + * If a transfer is committed then wait for the frame address to appear. + * Otherwise invalidate the grant entry against future use. + */ + if ( likely(flags != GTF_accept_transfer) || + (cmpxchg(&shared[ref].flags, flags, 0) != GTF_accept_transfer) ) + while ( unlikely((frame = shared[ref].frame) == 0) ) + cpu_relax(); + + put_free_entry(ref); + + return frame; +} + +void __init gnttab_init(void) +{ + int i; + gnttab_op_t gntop; + unsigned long frame; + + spin_lock_init(&gnttab_lock); + + for ( i = 0; i < GNTTAB_HASH_SZ; i++ ) + { + gnttab_hash[i] = HASH_INVALID; + auxtab[i].next = i+1; + } + + gntop.cmd = GNTTABOP_setup_table; + gntop.u.setup_table.dom = DOMID_SELF; + gntop.u.setup_table.nr_frames = 1; + gntop.u.setup_table.frame_list = &frame; + if ( HYPERVISOR_grant_table_op(&gntop) != 0 ) + BUG(); + + set_fixmap_ma(FIX_GNTTAB, frame << PAGE_SHIFT); + shared = (grant_entry_t *)fix_to_virt(FIX_GNTTAB); } diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/fixmap.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/fixmap.h index 0bfb839f20..89b3ba6532 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/fixmap.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/fixmap.h @@ -75,6 +75,7 @@ enum fixed_addresses { FIX_PCIE_MCFG, #endif FIX_SHARED_INFO, + FIX_GNTTAB, #ifdef CONFIG_XEN_PRIVILEGED_GUEST #define NR_FIX_ISAMAPS 256 FIX_ISAMAP_END, diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h index 4198263d14..4d7ddc55a7 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/hypervisor.h @@ -466,6 +466,17 @@ static inline int HYPERVISOR_physdev_op(void *physdev_op) return ret; } +static inline int HYPERVISOR_grant_table_op(void *gnttab_op) +{ + int ret; + __asm__ __volatile__ ( + TRAP_INSTR + : "=a" (ret) : "0" (__HYPERVISOR_grant_table_op), + "b" (gnttab_op) : "memory" ); + + return ret; +} + static inline int HYPERVISOR_update_va_mapping_otherdomain( unsigned long page_nr, pte_t new_val, unsigned long flags, domid_t domid) { From aa7dadf6b99d1c6ac722af2cfa1f05b1179072b8 Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Mon, 30 Aug 2004 23:00:31 +0000 Subject: [PATCH 26/28] bitkeeper revision 1.1159.53.25 (4133b18fZ5FTt-fwTtgweJYFwIKErw) Remove redundant multicall_op from libxc. --- tools/libxc/xc_private.h | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h index 9da98a25ab..aee4bf90e6 100644 --- a/tools/libxc/xc_private.h +++ b/tools/libxc/xc_private.h @@ -106,28 +106,6 @@ static inline int do_dom0_op(int xc_handle, dom0_op_t *op) out1: return ret; } -static inline int do_multicall_op(int xc_handle, - void *call_list, int nr_calls) -{ - int ret = -1; - privcmd_hypercall_t hypercall; - - hypercall.op = __HYPERVISOR_multicall; - hypercall.arg[0] = (unsigned long)call_list; - hypercall.arg[1] = (unsigned long)nr_calls; - - if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 ) - { - if ( errno == EACCES ) - fprintf(stderr, "Dom0 operation failed -- need to" - " rebuild the user-space tool set?\n"); - goto out1; - } - - out1: return ret; -} - - static inline int do_dom_mem_op(int xc_handle, unsigned int memop, unsigned int *extent_list, From 2e9844c42ca2b5a8822bf5cb3f6e297236dafee0 Mon Sep 17 00:00:00 2001 From: "smh22@tempest.cl.cam.ac.uk" Date: Tue, 31 Aug 2004 16:16:02 +0000 Subject: [PATCH 27/28] bitkeeper revision 1.1159.53.26 (4134a442HH6rsQy1xHC2QfjcaXY5iw) user.tex: tweak --- docs/user.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/user.tex b/docs/user.tex index 242a2be708..41fb148da4 100644 --- a/docs/user.tex +++ b/docs/user.tex @@ -295,10 +295,10 @@ download it and keep it updated with the latest features and fixes. Change to the directory in which you want to put the source code, then run: \begin{verbatim} -# bk clone bk://xen.bkbits.net/xeno-2.0.bk +# bk clone bk://xen.bkbits.net/xen-2.0.bk \end{verbatim} -Under your current directory, a new directory named `xeno-2.0.bk' +Under your current directory, a new directory named `xen-2.0.bk' has been created, which contains all the source code for the Xen hypervisor and the Xen tools. The directory also contains `sparse' Linux source trees, containing only the files that differ between @@ -307,7 +307,7 @@ XenLinux and standard Linux. Once you have cloned the repository, you can update to the newest changes to the repository by running: \begin{verbatim} -# cd xeno-2.0.bk # to change into the local repository +# cd xen-2.0.bk # to change into the local repository # bk pull # to update the repository \end{verbatim} @@ -509,7 +509,7 @@ At minimum, you should edit the following variables in \path{xmdefconfig}: \begin{description} \item[kernel] Set this to the path of the kernel you compiled for use with Xen. [e.g. {\tt kernel = - '/root/xeno-2.0.bk/install/boot/vmlinuz-2.4.27-xenU'}] + '/root/xen-2.0.bk/install/boot/vmlinuz-2.4.27-xenU'}] \item[memory] Set this to the size of the domain's memory in megabytes. [e.g. {\tt memory = 64 } ] \item[disk] Set the first entry in this list to calculate the offset From 8a1d582d657e5d3b0fa4aa746aec33557bd65a65 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Tue, 31 Aug 2004 19:38:26 +0000 Subject: [PATCH 28/28] bitkeeper revision 1.1159.53.27 (4134d3b2RKqSKYYMoQoESXU2EtGiiQ) Build fixes and move set_current() earlier in boot (Charles Coffing). --- xen/arch/x86/memory.c | 4 ++-- xen/common/kernel.c | 17 +++++++---------- xen/include/xen/spinlock.h | 2 -- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/memory.c b/xen/arch/x86/memory.c index f6a5657798..3dfa8b3460 100644 --- a/xen/arch/x86/memory.c +++ b/xen/arch/x86/memory.c @@ -1042,7 +1042,7 @@ static int do_extended_command(unsigned long ptr, unsigned long val) if ( unlikely(e->tot_pages == e->max_pages) || unlikely(!gnttab_prepare_for_transfer(e, d, gntref)) ) { - MEM_LOG("Transferee has no reservation headroom (%ld,%ld), or " + MEM_LOG("Transferee has no reservation headroom (%d,%d), or " "provided a bad grant ref.\n", e->tot_pages, e->max_pages); spin_unlock(&e->page_alloc_lock); put_domain(e); @@ -1731,7 +1731,7 @@ static void ptwr_init_backpointers(void) page = &frame_table[pde >> PAGE_SHIFT]; /* assert that page is an l1_page_table XXXcl maybe l2? */ if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table ) { - MEM_LOG("ptwr: Inconsistent pagetable: pde %x is not an l1 page\n", + MEM_LOG("ptwr: Inconsistent pagetable: pde %lx not an l1 page\n", pde >> PAGE_SHIFT); domain_crash(); } diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 2c67cf7506..9b2a3cd70c 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -183,6 +183,9 @@ void cmain(multiboot_info_t *mbi) } } + /* Must do this early -- e.g., spinlocks rely on get_current(). */ + set_current(&idle0_task); + /* We initialise the serial devices very early so we can get debugging. */ serial_init_stage1(); @@ -218,8 +221,6 @@ void cmain(multiboot_info_t *mbi) for ( ; ; ) ; } - set_current(&idle0_task); - xenheap_phys_end = opt_xenheap_megabytes << 20; max_mem = max_page = (mbi->mem_upper+1024) >> (PAGE_SHIFT - 10); @@ -401,20 +402,14 @@ static int crit_count[NR_CPUS], crit_checking_disabled[NR_CPUS]; void disable_criticalregion_checking(void) { int cpu = smp_processor_id(); - ASSERT(crit_checking_disabled[cpu] >= 0); crit_checking_disabled[cpu]++; } -void enable_criticalregion_checking(void) -{ - int cpu = smp_processor_id(); - crit_checking_disabled[cpu]--; - ASSERT(crit_checking_disabled[cpu] >= 0); -} - void criticalregion_enter(void) { int cpu = smp_processor_id(); + if ( crit_checking_disabled[cpu] ) + return; ASSERT(crit_count[cpu] >= 0); crit_count[cpu]++; } @@ -422,6 +417,8 @@ void criticalregion_enter(void) void criticalregion_exit(void) { int cpu = smp_processor_id(); + if ( crit_checking_disabled[cpu] ) + return; crit_count[cpu]--; ASSERT(crit_count[cpu] >= 0); } diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index fc2409f13d..8998c29894 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -78,7 +78,6 @@ extern void criticalregion_enter(void); extern void criticalregion_exit(void); extern void ASSERT_no_criticalregion(void); extern void disable_criticalregion_checking(void); -extern void enable_criticalregion_checking(void); #define spin_lock(_lock) \ do { criticalregion_enter(); _raw_spin_lock(_lock); } while (0) @@ -112,7 +111,6 @@ static inline int spin_trylock(spinlock_t *lock) #define ASSERT_no_criticalregion() ((void)0) #define disable_criticalregion_checking() ((void)0) -#define enable_criticalregion_checking() ((void)0) #define spin_lock(_lock) _raw_spin_lock(_lock) #define spin_trylock(_lock) _raw_spin_trylock(_lock)