diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2004-10-14 15:33:33 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2004-10-14 15:33:33 -0400 |
| commit | e58d2eb090023ea4b8e1fe0af2a1bb5314ecfdcb (patch) | |
| tree | bfc1440ee2d3558f78c690d807b7bc788201b301 | |
| parent | 5c6f34a71be8749b386e5a773fea0f4784da6a51 (diff) | |
| parent | 8b5915b08dda13ffe1f70f00322dcc34ce161904 (diff) | |
Merge pobox.com:/spare/repo/linux-2.6
into pobox.com:/spare/repo/libata-2.6
57 files changed, 286 insertions, 340 deletions
diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c index f1189ccd9344..b60d234d1d27 100644 --- a/arch/h8300/kernel/ptrace.c +++ b/arch/h8300/kernel/ptrace.c @@ -107,7 +107,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) /* read the word at location addr in the USER area. */ case PTRACE_PEEKUSR: { - unsigned long tmp; + unsigned long tmp = 0; if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { ret = -EIO; diff --git a/arch/h8300/lib/checksum.c b/arch/h8300/lib/checksum.c index 6691d0b935b7..5aa688d9242d 100644 --- a/arch/h8300/lib/checksum.c +++ b/arch/h8300/lib/checksum.c @@ -32,6 +32,7 @@ of the assembly has to go. */ #include <net/checksum.h> +#include <linux/module.h> static inline unsigned short from32to16(unsigned long x) { diff --git a/arch/h8300/platform/h8300h/generic/timer.c b/arch/h8300/platform/h8300h/generic/timer.c index ffc0349b74f9..6590f89e521a 100644 --- a/arch/h8300/platform/h8300h/generic/timer.c +++ b/arch/h8300/platform/h8300h/generic/timer.c @@ -32,7 +32,7 @@ #define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */ -int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) +void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) { /* setup 8bit timer ch2 */ ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2); /* set interval */ @@ -69,7 +69,7 @@ void platform_timer_eoi(void) #define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8 /* Timer input freq. */ -int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) +void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) { *(unsigned short *)GRA= H8300_TIMER_FREQ / HZ; /* set interval */ *(unsigned short *)TCNT=0; /* clear counter */ diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S index 0af6f4b4a289..4895559ee807 100644 --- a/arch/ia64/kernel/fsys.S +++ b/arch/ia64/kernel/fsys.S @@ -234,7 +234,7 @@ ENTRY(fsys_gettimeofday) cmp.eq p9,p0 = 1,r8 // MMIO64 ? extr r2 = r21,24,8 // time_interpolator->jitter cmp.eq p10,p0 = 2,r8 // MMIO32 ? - cmp.lt p11,p0 = 2,r8 // function? + cmp.ltu p11,p0 = 2,r8 // function or other clock (p11) br.cond.spnt.many fsys_fallback_syscall ;; setf.sig f7 = r3 // Setup for scaling of counter @@ -338,7 +338,7 @@ ENTRY(fsys_clock_gettime) .prologue .altrp b6 .body - cmp4.lt p6, p0 = CLOCK_MONOTONIC, r32 + cmp4.ltu p6, p0 = CLOCK_MONOTONIC, r32 // Fallback if this is not CLOCK_REALTIME or CLOCK_MONOTONIC (p6) br.spnt.few fsys_fallback_syscall mov r31 = r33 diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S index 45d8ea855d35..29b0d8d0c68e 100644 --- a/arch/m32r/kernel/entry.S +++ b/arch/m32r/kernel/entry.S @@ -3,6 +3,7 @@ * * Copyright (c) 2001, 2002 Hirokazu Takata, Hitoshi Yamamoto, H. Kondo * Copyright (c) 2003 Hitoshi Yamamoto + * Copyright (c) 2004 Hirokazu Takata <takata at linux-m32r.org> * * Taken from i386 version. * Copyright (C) 1991, 1992 Linus Torvalds @@ -798,7 +799,7 @@ ENTRY(sys_call_table) .long sys_swapon .long sys_reboot .long old_readdir - .long old_mmap /* 90 */ + .long sys_ni_syscall /* 90 - old_mmap syscall holder */ .long sys_munmap .long sys_truncate .long sys_ftruncate @@ -993,15 +994,6 @@ ENTRY(sys_call_table) .long sys_mq_getsetattr .long sys_ni_syscall /* reserved for kexec */ .long sys_waitid - .long sys_perfctr_info - .long sys_vperfctr_open - .long sys_vperfctr_control - .long sys_vperfctr_unlink - .long sys_vperfctr_iresume - .long sys_vperfctr_read /* 290 */ - .long sys_add_key - .long sys_request_key - .long sys_keyctl syscall_table_size=(.-sys_call_table) diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c index 6236466135d4..f34fa19ac1e4 100644 --- a/arch/m32r/kernel/sys_m32r.c +++ b/arch/m32r/kernel/sys_m32r.c @@ -7,8 +7,6 @@ * Taken from i386 version. */ -/* $Id$ */ - #include <linux/config.h> #include <linux/errno.h> #include <linux/sched.h> @@ -88,10 +86,9 @@ sys_pipe(unsigned long r0, unsigned long r1, unsigned long r2, return error; } -static inline long do_mmap2( - unsigned long addr, unsigned long len, +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, - int fd, unsigned long pgoff) + unsigned long fd, unsigned long pgoff) { int error = -EBADF; struct file *file = NULL; @@ -113,62 +110,6 @@ out: return error; } -asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, - unsigned long prot, unsigned long flags, - unsigned long fd, unsigned long pgoff) -{ - return do_mmap2(addr, len, prot, flags, fd, pgoff); -} - -/* - * Perform the select(nd, in, out, ex, tv) and mmap() system - * calls. Linux/M32R didn't use to be able to handle more than - * 4 system call parameters, so these system calls used a memory - * block for parameter passing.. - */ - -struct mmap_arg_struct { - unsigned long addr; - unsigned long len; - unsigned long prot; - unsigned long flags; - unsigned long fd; - unsigned long offset; -}; - -asmlinkage int old_mmap(struct mmap_arg_struct *arg) -{ - struct mmap_arg_struct a; - int err = -EFAULT; - - if (copy_from_user(&a, arg, sizeof(a))) - goto out; - - err = -EINVAL; - if (a.offset & ~PAGE_MASK) - goto out; - err = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, - a.offset>>PAGE_SHIFT); -out: - return err; -} - -struct sel_arg_struct { - unsigned long n; - fd_set __user *inp, *outp, *exp; - struct timeval __user *tvp; -}; - -asmlinkage int old_select(struct sel_arg_struct __user *arg) -{ - struct sel_arg_struct a; - - if (copy_from_user(&a, arg, sizeof(a))) - return -EFAULT; - /* sys_select() does the appropriate kernel locking */ - return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); -} - /* * sys_ipc() is the de-multiplexer for the SysV IPC calls.. * diff --git a/arch/ppc64/mm/hash_low.S b/arch/ppc64/mm/hash_low.S index f179979c0383..68dd4b9adf96 100644 --- a/arch/ppc64/mm/hash_low.S +++ b/arch/ppc64/mm/hash_low.S @@ -263,7 +263,7 @@ _GLOBAL(htab_call_hpte_updatepp) /* if we failed because typically the HPTE wasn't really here * we try an insertion. */ - cmpi 0,r3,-1 + cmpdi 0,r3,-1 beq- htab_insert_pte /* Clear the BUSY bit and Write out the PTE */ diff --git a/arch/um/Kconfig b/arch/um/Kconfig index e63389482650..78b22b893e34 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig @@ -143,7 +143,6 @@ config SMP will appear to be running simultaneously. If the host is a multiprocessor, then UML processes may run simultaneously, depending on the host scheduler. - CONFIG_SMP will be set to whatever this option is set to. It is safe to leave this unchanged. config NR_CPUS @@ -179,6 +178,7 @@ config KERNEL_HALF_GIGS config HIGHMEM bool "Highmem support" + depends on BROKEN config KERNEL_STACK_ORDER int "Kernel stack size order" @@ -226,6 +226,7 @@ source "crypto/Kconfig" source "lib/Kconfig" menu "SCSI support" +depends on BROKEN config SCSI tristate "SCSI support" @@ -242,6 +243,8 @@ endmenu source "drivers/md/Kconfig" -source "drivers/mtd/Kconfig" +if BROKEN + source "drivers/mtd/Kconfig" +endif source "arch/um/Kconfig.debug" diff --git a/arch/um/Kconfig_block b/arch/um/Kconfig_block index ce872e1a6375..8f2ba090c73f 100644 --- a/arch/um/Kconfig_block +++ b/arch/um/Kconfig_block @@ -54,6 +54,7 @@ config BLK_DEV_INITRD config MMAPPER tristate "Example IO memory driver" + depends on BROKEN help The User-Mode Linux port can provide support for IO Memory emulation with this option. This allows a host file to be diff --git a/arch/um/Kconfig_char b/arch/um/Kconfig_char index 8a6afe659c0e..09f47388c7c5 100644 --- a/arch/um/Kconfig_char +++ b/arch/um/Kconfig_char @@ -72,6 +72,10 @@ config XTERM_CHAN well, since UML's gdb currently requires an xterm. It is safe to say 'Y' here. +config NOCONFIG_CHAN + bool + default !(XTERM_CHAN && TTY_CHAN && PTY_CHAN && PORT_CHAN && FD_CHAN && NULL_CHAN) + config CON_ZERO_CHAN string "Default main console channel initialization" default "fd:0,fd:1" diff --git a/arch/um/Kconfig_net b/arch/um/Kconfig_net index 94c6bf098644..1c2f9a70d91d 100644 --- a/arch/um/Kconfig_net +++ b/arch/um/Kconfig_net @@ -135,7 +135,7 @@ config UML_NET_MCAST config UML_NET_PCAP bool "pcap transport" - depends on UML_NET + depends on UML_NET && BROKEN help The pcap transport makes a pcap packet stream on the host look like an ethernet device inside UML. This is useful for making diff --git a/arch/um/Makefile b/arch/um/Makefile index f400ac083770..0406c1a90714 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -5,20 +5,13 @@ ARCH_DIR = arch/um OS := $(shell uname -s) +#We require it or things break. +SHELL := /bin/bash -# Recalculate MODLIB to reflect the EXTRAVERSION changes (via KERNELRELEASE) -# The way the toplevel Makefile is written EXTRAVERSION is not supposed -# to be changed outside the toplevel Makefile, but recalculating MODLIB is -# a sufficient workaround until we no longer need architecture dependent -# EXTRAVERSION... -MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) - -ifeq ($(CONFIG_DEBUG_INFO),y) -CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -endif +filechk_gen_header = $< -core-y += $(ARCH_DIR)/kernel/ \ - $(ARCH_DIR)/drivers/ \ +core-y += $(ARCH_DIR)/kernel/ \ + $(ARCH_DIR)/drivers/ \ $(ARCH_DIR)/sys-$(SUBARCH)/ # Have to precede the include because the included Makefiles reference them. @@ -31,13 +24,6 @@ ARCH_SYMLINKS = include/asm-um/arch $(ARCH_DIR)/include/sysdep $(ARCH_DIR)/os \ GEN_HEADERS += $(ARCH_DIR)/include/task.h $(ARCH_DIR)/include/kern_constants.h -# This target adds dependencies to "prepare". They are defined in the included -# Makefiles (see Makefile-i386). - -.PHONY: sys_prepare -sys_prepare: - @: - MAKEFILE-$(CONFIG_MODE_TT) += Makefile-tt MAKEFILE-$(CONFIG_MODE_SKAS) += Makefile-skas @@ -45,11 +31,12 @@ ifneq ($(MAKEFILE-y),) include $(addprefix $(ARCH_DIR)/,$(MAKEFILE-y)) endif +ARCH_INCLUDE := -I$(ARCH_DIR)/include +SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH) + include $(ARCH_DIR)/Makefile-$(SUBARCH) include $(ARCH_DIR)/Makefile-os-$(OS) -ARCH_INCLUDE = -I$(ARCH_DIR)/include - # -Derrno=kernel_errno - This turns all kernel references to errno into # kernel_errno to separate them from the libc errno. This allows -fno-common # in CFLAGS. Otherwise, it would cause ld to complain about the two different @@ -59,7 +46,7 @@ CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ -D_LARGEFILE64_SOURCE $(ARCH_INCLUDE) -Derrno=kernel_errno \ -Dsigprocmask=kernel_sigprocmask $(MODE_INCLUDE) -CFLAGS += $(call check_gcc,-fno-unit-at-a-time,) +CFLAGS += $(call cc-option,-fno-unit-at-a-time,) LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc @@ -72,23 +59,17 @@ CONFIG_KERNEL_HALF_GIGS ?= 0 SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000) ifeq ($(CONFIG_MODE_SKAS), y) -$(SYS_HEADERS) : $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h +$(SYS_HEADERS) : $(ARCH_DIR)/include/skas_ptregs.h endif -include/linux/version.h: arch/$(ARCH)/Makefile - -$(ARCH_DIR)/vmlinux.lds.S : - touch $@ - -prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) - -LDFLAGS_vmlinux = -r +prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \ + $(ARCH_DIR)/kernel/vmlinux.lds.S # These aren't in Makefile-tt because they are needed in the !CONFIG_MODE_TT + # CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case. LINK_TT = -static -LD_SCRIPT_TT := uml.lds +LD_SCRIPT_TT := uml.lds.S ifeq ($(CONFIG_STATIC_LINK),y) LINK-y += $(LINK_TT) @@ -118,13 +99,14 @@ CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \ -DELF_FORMAT=\"$(ELF_FORMAT)\" $(CPP_MODE_TT) \ -DKERNEL_STACK_SIZE=$(STACK_SIZE)) -export CPPFLAGS_$(LD_SCRIPT-y) = $(CPPFLAGS_vmlinux.lds) -P -C -Uum - -LD_SCRIPT-y := $(ARCH_DIR)/kernel/$(LD_SCRIPT-y) - -linux: vmlinux $(LD_SCRIPT-y) - $(CC) -Wl,-T,$(LD_SCRIPT-y) $(LINK-y) $(LINK_WRAPS) \ - -o linux vmlinux -L/usr/lib -lutil +CFLAGS_vmlinux = $(LINK-y) $(LINK_WRAPS) +define cmd_vmlinux__ + $(CC) $(CFLAGS_vmlinux) -o $@ \ + -Wl,-T,$(vmlinux-lds) $(vmlinux-init) \ + -Wl,--start-group $(vmlinux-main) -Wl,--end-group \ + -L/usr/lib -lutil \ + $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^) +endef USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS)) @@ -135,76 +117,72 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ # To get a definition of F_SETSIG USER_CFLAGS += -D_GNU_SOURCE -# From main Makefile, these options are set after including the ARCH makefile. -# So copy them here. - -ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -USER_CFLAGS += -Os -else -USER_CFLAGS += -O2 -endif - -ifndef CONFIG_FRAME_POINTER -USER_CFLAGS += -fomit-frame-pointer -endif - -ifdef CONFIG_DEBUG_INFO -USER_CFLAGS += -g -endif - -CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/uml.lds \ - $(ARCH_DIR)/dyn_link.ld.s $(ARCH_DIR)/include/uml-config.h \ - $(GEN_HEADERS) +#When cleaning we don't include .config, so we don't include +#TT or skas makefiles and don't clean skas_ptregs.h. +CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ + $(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \ - $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) + $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os archmrproper: @: archclean: + $(Q)$(MAKE) $(clean)=$(ARCH_DIR)/util @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ -o -name '*.gcov' \) -type f -print | xargs rm -f +#We need to re-preprocess this when the symlink dest changes. +#So we touch it. +$(ARCH_DIR)/kernel/vmlinux.lds.S: FORCE + @echo ' SYMLINK $@' + $(Q)ln -sf $(LD_SCRIPT-y) $@ + $(Q)touch $@ + $(SYMLINK_HEADERS): - cd $(TOPDIR)/$(dir $@) ; \ + @echo ' SYMLINK $@' + $(Q)cd $(TOPDIR)/$(dir $@) ; \ ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@) include/asm-um/arch: - cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch + @echo ' SYMLINK $@' + $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch $(ARCH_DIR)/include/sysdep: - cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep + @echo ' SYMLINK $@' + $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep $(ARCH_DIR)/os: - cd $(ARCH_DIR) && ln -sf os-$(OS) os + @echo ' SYMLINK $@' + $(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os # Generated files define filechk_umlconfig sed 's/ CONFIG/ UML_CONFIG/' endef -$(ARCH_DIR)/include/uml-config.h : $(TOPDIR)/include/linux/autoconf.h +$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h $(call filechk,umlconfig) -filechk_gen_header = $< +$(ARCH_DIR)/include/task.h: $(ARCH_DIR)/util/mk_task + $(call filechk,gen_header) -$(ARCH_DIR)/include/task.h : $(ARCH_DIR)/util/mk_task +$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/util/mk_constants $(call filechk,gen_header) -$(ARCH_DIR)/include/kern_constants.h : $(ARCH_DIR)/util/mk_constants +$(ARCH_DIR)/include/skas_ptregs.h: $(ARCH_DIR)/kernel/skas/util/mk_ptregs $(call filechk,gen_header) -$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants : $(ARCH_DIR)/util \ - sys_prepare FORCE ; +$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants: $(ARCH_DIR)/util \ + FORCE ; -$(ARCH_DIR)/util: FORCE - $(Q)$(MAKE) $(build)=$@ +$(ARCH_DIR)/kernel/skas/util/mk_ptregs: $(ARCH_DIR)/kernel/skas/util FORCE ; -export SUBARCH USER_CFLAGS OS +$(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h FORCE + $(Q)$(MAKE) $(build)=$@ -all: linux +$(ARCH_DIR)/kernel/skas/util: scripts_basic FORCE + $(Q)$(MAKE) $(build)=$@ -define archhelp - echo '* linux - Binary kernel image (./linux)' -endef +export SUBARCH USER_CFLAGS OS diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 index 0c3af647baa5..9a6cf6e5b529 100644 --- a/arch/um/Makefile-i386 +++ b/arch/um/Makefile-i386 @@ -1,12 +1,12 @@ ifeq ($(CONFIG_HOST_2G_2G), y) -TOP_ADDR = 0x80000000 +TOP_ADDR := 0x80000000 else -TOP_ADDR = 0xc0000000 +TOP_ADDR := 0xc0000000 endif ifeq ($(CONFIG_MODE_SKAS),y) ifneq ($(CONFIG_MODE_TT),y) - START = 0x8048000 + START := 0x8048000 endif endif @@ -16,37 +16,30 @@ ifneq ($(CONFIG_GPROF),y) ARCH_CFLAGS += -DUM_FASTCALL endif -ELF_ARCH = $(SUBARCH) -ELF_FORMAT = elf32-$(SUBARCH) +ELF_ARCH := $(SUBARCH) +ELF_FORMAT := elf32-$(SUBARCH) OBJCOPYFLAGS := -O binary -R .note -R .comment -S -SYS_DIR := $(ARCH_DIR)/include/sysdep-i386 SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util -SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h - -sys_prepare: $(SYS_DIR)/sc.h +SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h prepare: $(SYS_HEADERS) -filechk_$(SYS_DIR)/sc.h := $(SYS_UTIL_DIR)/mk_sc - $(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc - $(call filechk,$@) - -filechk_$(SYS_DIR)/thread.h := $(SYS_UTIL_DIR)/mk_thread + $(call filechk,gen_header) $(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread - $(call filechk,$@) + $(call filechk,gen_header) -$(SYS_UTIL_DIR)/mk_sc: scripts/basic/fixdep include/config/MARKER FORCE ; +$(SYS_UTIL_DIR)/mk_sc: scripts_basic FORCE $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ -$(SYS_UTIL_DIR)/mk_thread: $(ARCH_SYMLINKS) $(GEN_HEADERS) sys_prepare FORCE ; +$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_SYMLINKS) $(GEN_HEADERS) FORCE $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@ -$(SYS_UTIL_DIR): include/asm FORCE +$(SYS_UTIL_DIR): scripts_basic include/asm FORCE $(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) CLEAN_FILES += $(SYS_HEADERS) diff --git a/arch/um/Makefile-skas b/arch/um/Makefile-skas index b505e16c4001..fb3050ff91d4 100644 --- a/arch/um/Makefile-skas +++ b/arch/um/Makefile-skas @@ -9,12 +9,9 @@ CFLAGS-$(CONFIG_GCOV) += -fprofile-arcs -ftest-coverage CFLAGS-$(CONFIG_GPROF) += $(PROFILE) LINK-$(CONFIG_GPROF) += $(PROFILE) -MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/skas/include +MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/kernel/skas/include LINK_SKAS = -Wl,-rpath,/lib -LD_SCRIPT_SKAS = dyn.lds +LD_SCRIPT_SKAS = dyn.lds.S -GEN_HEADERS += $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h - -$(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h : - $(Q)$(MAKE) $(build)=$(ARCH_DIR)/kernel/skas $@ +GEN_HEADERS += $(ARCH_DIR)/include/skas_ptregs.h diff --git a/arch/um/Makefile-tt b/arch/um/Makefile-tt index 8d58a3083193..eed367d9cdc5 100644 --- a/arch/um/Makefile-tt +++ b/arch/um/Makefile-tt @@ -3,5 +3,4 @@ # Licensed under the GPL # -MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/tt/include - +MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/kernel/tt/include diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 1eaeecf66966..7a8d75086469 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c @@ -19,6 +19,7 @@ #include "line.h" #include "os.h" +#ifdef CONFIG_NOCONFIG_CHAN static void *not_configged_init(char *str, int device, struct chan_opts *opts) { printk(KERN_ERR "Using a channel type which is configured out of " @@ -87,6 +88,7 @@ static struct chan_ops not_configged_ops = { .free = not_configged_free, .winch = 0, }; +#endif /* CONFIG_NOCONFIG_CHAN */ void generic_close(int fd, void *unused) { diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index fe814aa2830d..53fba09adda8 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -396,14 +396,13 @@ int thread_fd = -1; */ int intr_count = 0; -static void ubd_finish(struct request *req, int error) +/* call ubd_finish if you need to serialize */ +static void __ubd_finish(struct request *req, int error) { int nsect; if(error){ - spin_lock(&ubd_io_lock); end_request(req, 0); - spin_unlock(&ubd_io_lock); return; } nsect = req->current_nr_sectors; @@ -412,11 +411,17 @@ static void ubd_finish(struct request *req, int error) req->errors = 0; req->nr_sectors -= nsect; req->current_nr_sectors = 0; - spin_lock(&ubd_io_lock); end_request(req, 1); +} + +static inline void ubd_finish(struct request *req, int error) +{ + spin_lock(&ubd_io_lock); + __ubd_finish(req, error); spin_unlock(&ubd_io_lock); } +/* Called without ubd_io_lock held */ static void ubd_handler(void) { struct io_thread_req req; @@ -768,9 +773,11 @@ int ubd_driver_init(void){ unsigned long stack; int err; + /* Set by CONFIG_BLK_DEV_UBD_SYNC or ubd=sync.*/ if(global_openflags.s){ - printk(KERN_INFO "ubd : Synchronous mode\n"); - return(0); + printk(KERN_INFO "ubd: Synchronous mode\n"); + /* Letting ubd=sync be like using ubd#s= instead of ubd#= is + * enough. So use anyway the io thread. */ } stack = alloc_stack(0, 0); io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *), @@ -965,6 +972,7 @@ static int prepare_mmap_request(struct ubd *dev, int fd, __u64 offset, return(0); } +/* Called with ubd_io_lock held */ static int prepare_request(struct request *req, struct io_thread_req *io_req) { struct gendisk *disk = req->rq_disk; @@ -977,9 +985,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req) if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ printk("Write attempted on readonly ubd device %s\n", disk->disk_name); - spin_lock(&ubd_io_lock); end_request(req, 0); - spin_unlock(&ubd_io_lock); return(1); } @@ -1029,6 +1035,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req) return(0); } +/* Called with ubd_io_lock held */ static void do_ubd_request(request_queue_t *q) { struct io_thread_req io_req; @@ -1040,7 +1047,7 @@ static void do_ubd_request(request_queue_t *q) err = prepare_request(req, &io_req); if(!err){ do_io(&io_req); - ubd_finish(req, io_req.error); + __ubd_finish(req, io_req.error); } } } diff --git a/arch/um/include/Makefile b/arch/um/include/Makefile deleted file mode 100644 index cc5dad08d17c..000000000000 --- a/arch/um/include/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all : sc.h - -sc.h : ../util/mk_sc - ../util/mk_sc > $@ - -../util/mk_sc : - $(MAKE) -C ../util mk_sc diff --git a/arch/um/include/sysdep-i386/checksum.h b/arch/um/include/sysdep-i386/checksum.h index bac91c1b88da..bb6b343f19c0 100644 --- a/arch/um/include/sysdep-i386/checksum.h +++ b/arch/um/include/sysdep-i386/checksum.h @@ -103,7 +103,8 @@ static inline unsigned short ip_fast_csum(unsigned char * iph, are modified, we must also specify them as outputs, or gcc will assume they contain their original values. */ : "=r" (sum), "=r" (iph), "=r" (ihl) - : "1" (iph), "2" (ihl)); + : "1" (iph), "2" (ihl) + : "memory"); return(sum); } diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index fe9f301e1a31..9fa9711ec51e 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile @@ -4,11 +4,7 @@ # extra-y := vmlinux.lds - -# Descend into ../util for make clean. This is here because it doesn't work -# in arch/um/Makefile. - -subdir- = ../util +clean-files := vmlinux.lds.S obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \ helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \ @@ -29,24 +25,16 @@ obj-$(CONFIG_MODE_SKAS) += skas/ user-objs-$(CONFIG_TTY_LOG) += tty_log.o USER_OBJS := $(filter %_user.o,$(obj-y)) $(user-objs-y) config.o helper.o \ - main.o process.o tempfile.o time.o tty_log.o umid.o user_util.o + main.o process.o tempfile.o time.o tty_log.o umid.o user_util.o frame.o USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -CFLAGS_frame.o := $(patsubst -fomit-frame-pointer,,$(USER_CFLAGS)) - -# This has to be separate because it needs be compiled with frame pointers -# regardless of how the rest of the kernel is built. - -$(obj)/frame.o: $(src)/frame.c - $(CC) $(CFLAGS_$(notdir $@)) -c -o $@ $< +CFLAGS_frame.o := -fno-omit-frame-pointer $(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< + $(CC) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) -c -o $@ $< QUOTE = 'my $$config=`cat $(TOPDIR)/.config`; $$config =~ s/"/\\"/g ; $$config =~ s/\n/\\n"\n"/g ; while(<STDIN>) { $$_ =~ s/CONFIG/$$config/; print $$_ }' -$(obj)/config.o : $(obj)/config.c - quiet_cmd_quote = QUOTE $@ cmd_quote = $(PERL) -e $(QUOTE) < $< > $@ diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index 91a1466d6690..2b82509550fe 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c @@ -441,6 +441,8 @@ int um_request_irq(unsigned int irq, int fd, int type, err = activate_fd(irq, fd, type, dev_id); return(err); } +EXPORT_SYMBOL(um_request_irq); +EXPORT_SYMBOL(reactivate_fd); /* this was setup_x86_irq but it seems pretty generic */ int setup_irq(unsigned int irq, struct irqaction * new) diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c index fda0496f4050..a867e18c6bf9 100644 --- a/arch/um/kernel/ksyms.c +++ b/arch/um/kernel/ksyms.c @@ -60,6 +60,7 @@ EXPORT_SYMBOL(strncpy_from_user_skas); EXPORT_SYMBOL(copy_to_user_skas); EXPORT_SYMBOL(copy_from_user_skas); #endif +EXPORT_SYMBOL(uml_strdup); EXPORT_SYMBOL(os_stat_fd); EXPORT_SYMBOL(os_stat_file); diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index f498ed3cb023..3253bc0e3a5c 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -8,6 +8,7 @@ #include "linux/slab.h" #include "linux/vmalloc.h" #include "linux/bootmem.h" +#include "linux/module.h" #include "asm/types.h" #include "asm/pgtable.h" #include "kern_util.h" @@ -36,7 +37,7 @@ static struct rb_node **find_rb(void *virt) struct phys_desc *d; while(*n != NULL){ - d = rb_entry(n, struct phys_desc, rb); + d = rb_entry(*n, struct phys_desc, rb); if(d->virt == virt) return(n); @@ -56,7 +57,7 @@ static struct phys_desc *find_phys_mapping(void *virt) if(*n == NULL) return(NULL); - return(rb_entry(n, struct phys_desc, rb)); + return(rb_entry(*n, struct phys_desc, rb)); } static void insert_phys_mapping(struct phys_desc *desc) @@ -220,6 +221,10 @@ void physmem_forget_descriptor(int fd) kfree(desc); } +EXPORT_SYMBOL(physmem_forget_descriptor); +EXPORT_SYMBOL(physmem_remove_mapping); +EXPORT_SYMBOL(physmem_subst_mapping); + void arch_free_page(struct page *page, int order) { void *virt; diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile index bc53682e0333..37d3f7e9790d 100644 --- a/arch/um/kernel/skas/Makefile +++ b/arch/um/kernel/skas/Makefile @@ -3,26 +3,14 @@ # Licensed under the GPL # -obj-y = exec_kern.o exec_user.o mem.o mem_user.o mmu.o process.o \ +obj-y := exec_kern.o exec_user.o mem.o mem_user.o mmu.o process.o \ process_kern.o syscall_kern.o syscall_user.o time.o tlb.o trap_user.o \ uaccess.o sys-$(SUBARCH)/ -hostprogs-y := util/mk_ptregs -clean-files := include/skas_ptregs.h +subdir-y := util USER_OBJS = $(filter %_user.o,$(obj-y)) process.o time.o USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(TOPDIR)/arch/um/include/skas_ptregs.h : $(src)/util/mk_ptregs - @echo -n ' Generating $@' - @$< > $@.tmp - @if [ -r $@ ] && cmp -s $@ $@.tmp; then \ - echo ' (unchanged)'; \ - rm -f $@.tmp; \ - else \ - echo ' (updated)'; \ - mv -f $@.tmp $@; \ - fi - $(USER_OBJS) : %.o: %.c $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< diff --git a/arch/um/kernel/skas/util/Makefile b/arch/um/kernel/skas/util/Makefile index 08e95a65ea19..a26e0c34a762 100644 --- a/arch/um/kernel/skas/util/Makefile +++ b/arch/um/kernel/skas/util/Makefile @@ -1,9 +1,2 @@ -all: mk_ptregs - -mk_ptregs : mk_ptregs.o - $(HOSTCC) -o mk_ptregs mk_ptregs.o - -mk_ptregs.o : mk_ptregs.c - $(HOSTCC) -c $< - -clean-files := mk_ptregs *.o *~ +hostprogs-y := mk_ptregs +always := $(hostprogs-y) diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c index c36bff0a94c3..5ce5668825fc 100644 --- a/arch/um/kernel/time_kern.c +++ b/arch/um/kernel/time_kern.c @@ -44,7 +44,9 @@ int timer_irq_inited = 0; static int first_tick; static unsigned long long prev_usecs; +#ifdef CONFIG_UML_REAL_TIME_CLOCK static long long delta; /* Deviation per interval */ +#endif #define MILLION 1000000 @@ -60,7 +62,7 @@ void timer_irq(union uml_pt_regs *regs) } if(first_tick){ -#if defined(CONFIG_UML_REAL_TIME_CLOCK) +#ifdef CONFIG_UML_REAL_TIME_CLOCK /* We've had 1 tick */ unsigned long long usecs = os_usecs(); diff --git a/arch/um/kernel/vmlinux.lds.S b/arch/um/kernel/vmlinux.lds.S deleted file mode 100644 index db0445e2286d..000000000000 --- a/arch/um/kernel/vmlinux.lds.S +++ /dev/null @@ -1,11 +0,0 @@ -#include <asm-generic/vmlinux.lds.h> - -OUTPUT_FORMAT(ELF_FORMAT) -OUTPUT_ARCH(ELF_ARCH) -ENTRY(_start) -jiffies = jiffies_64; - -SECTIONS -{ -#include "asm/common.lds.S" -} diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile index d489f4b4ee5a..0f65a9259b0d 100644 --- a/arch/um/sys-i386/Makefile +++ b/arch/um/sys-i386/Makefile @@ -8,10 +8,13 @@ USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) SYMLINKS = bitops.c semaphore.c highmem.c module.c -SYMLINKS := $(foreach f,$(SYMLINKS),$(src)/$f) +# this needs to be before the foreach, because clean-files does not accept +# complete paths like $(src)/$f. clean-files := $(SYMLINKS) +SYMLINKS := $(foreach f,$(SYMLINKS),$(src)/$f) + bitops.c-dir = lib semaphore.c-dir = kernel highmem.c-dir = mm diff --git a/arch/um/sys-i386/util/Makefile b/arch/um/sys-i386/util/Makefile index 5998287619e5..34860f9ca7b0 100644 --- a/arch/um/sys-i386/util/Makefile +++ b/arch/um/sys-i386/util/Makefile @@ -6,8 +6,3 @@ mk_thread-objs := mk_thread_kern.o mk_thread_user.o HOSTCFLAGS_mk_thread_kern.o := $(CFLAGS) $(CPPFLAGS) HOSTCFLAGS_mk_thread_user.o := $(USER_CFLAGS) - -clean : - $(RM) -f $(build-targets) - -archmrproper : clean diff --git a/drivers/input/serio/parkbd.c b/drivers/input/serio/parkbd.c index 07cc9c3b05fe..a859df676487 100644 --- a/drivers/input/serio/parkbd.c +++ b/drivers/input/serio/parkbd.c @@ -160,6 +160,7 @@ static struct serio * __init parkbd_allocate_serio(void) serio = kmalloc(sizeof(struct serio), GFP_KERNEL); if (serio) { + memset(serio, 0, sizeof(struct serio)); serio->type = parkbd_mode; serio->write = parkbd_write, strlcpy(serio->name, "PARKBD AT/XT keyboard adapter", sizeof(serio->name)); diff --git a/drivers/mtd/maps/lubbock-flash.c b/drivers/mtd/maps/lubbock-flash.c index 53e708b2eb2c..881eab98438a 100644 --- a/drivers/mtd/maps/lubbock-flash.c +++ b/drivers/mtd/maps/lubbock-flash.c @@ -1,5 +1,5 @@ /* - * $Id: lubbock-flash.c,v 1.15 2004/07/12 21:59:44 dwmw2 Exp $ + * $Id: lubbock-flash.c,v 1.18 2004/09/28 18:54:40 nico Exp $ * * Map driver for the Lubbock developer platform. * @@ -15,11 +15,13 @@ #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> +#include <linux/dma-mapping.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> #include <asm/io.h> #include <asm/hardware.h> +#include <asm/arch/pxa-regs.h> #include <asm/arch/lubbock.h> @@ -82,16 +84,14 @@ static int __init init_lubbock(void) lubbock_maps[flashboot].name = "Lubbock Boot ROM"; for (i = 0; i < 2; i++) { - lubbock_maps[i].virt = (unsigned long)ioremap(lubbock_maps[i].phys, WINDOW_SIZE); + lubbock_maps[i].virt = (void __iomem *)ioremap(lubbock_maps[i].phys, WINDOW_SIZE); if (!lubbock_maps[i].virt) { printk(KERN_WARNING "Failed to ioremap %s\n", lubbock_maps[i].name); if (!ret) ret = -ENOMEM; continue; } - lubbock_maps[i].cached = __ioremap(lubbock_maps[i].phys, - WINDOW_SIZE, - L_PTE_CACHEABLE, 1); + lubbock_maps[i].cached = ioremap_cached(lubbock_maps[i].phys, WINDOW_SIZE); if (!lubbock_maps[i].cached) printk(KERN_WARNING "Failed to ioremap cached %s\n", lubbock_maps[i].name); simple_map_init(&lubbock_maps[i]); diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index b57fe5524113..e88017d6fd38 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -373,7 +373,10 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max child->bridge_ctl = bctl; cmax = pci_scan_child_bus(child); - if (cmax > max) max = cmax; + if (cmax > max) + max = cmax; + if (child->subordinate > max) + max = child->subordinate; } else { /* * We need to assign a number to this bus which we always diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c index 8c959719794d..4dca34fdf767 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/cyber2000fb.c @@ -1166,7 +1166,7 @@ static struct fb_videomode __devinitdata cyber2000fb_default_mode = { .vmode = FB_VMODE_NONINTERLACED }; -static char igs_regs[] __devinitdata = { +static char igs_regs[] = { EXT_CRT_IRQ, 0, EXT_CRT_TEST, 0, EXT_SYNC_CTL, 0, @@ -1289,7 +1289,7 @@ cyberpro_alloc_fb_info(unsigned int id, char *name) return cfb; } -static void __devinit +static void cyberpro_free_fb_info(struct cfb_info *cfb) { if (cfb) { diff --git a/fs/proc/array.c b/fs/proc/array.c index fc5c7846df32..272908775622 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -360,7 +360,11 @@ int proc_pid_stat(struct task_struct *task, char * buffer) read_unlock(&tasklist_lock); /* Temporary variable needed for gcc-2.96 */ - start_time = jiffies_64_to_clock_t(task->start_time - INITIAL_JIFFIES); + /* convert timespec -> nsec*/ + start_time = (unsigned long long)task->start_time.tv_sec * NSEC_PER_SEC + + task->start_time.tv_nsec; + /* convert nsec -> ticks */ + start_time = nsec_to_clock_t(start_time); res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \ %lu %lu %lu %lu %lu %ld %ld %ld %ld %d %ld %llu %lu %ld %lu %lu %lu %lu %lu \ diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index ef764054fcdf..a5d382cff479 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c @@ -818,13 +818,15 @@ xfs_ioctl( if (!capable(CAP_SYS_ADMIN)) return -EPERM; - freeze_bdev(inode->i_sb->s_bdev); + if (inode->i_sb->s_frozen == SB_UNFROZEN) + freeze_bdev(inode->i_sb->s_bdev); return 0; case XFS_IOC_THAW: if (!capable(CAP_SYS_ADMIN)) return -EPERM; - thaw_bdev(inode->i_sb->s_bdev, inode->i_sb); + if (inode->i_sb->s_frozen != SB_UNFROZEN) + thaw_bdev(inode->i_sb->s_bdev, inode->i_sb); return 0; case XFS_IOC_GOINGDOWN: { diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index b59d034a8d12..854b656c98bc 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c @@ -339,16 +339,16 @@ linvfs_write_inode( int sync) { vnode_t *vp = LINVFS_GET_VP(inode); - int error, flags = FLUSH_INODE; + int error = 0, flags = FLUSH_INODE; - error = 0; if (vp) { vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); if (sync) flags |= FLUSH_SYNC; VOP_IFLUSH(vp, flags, error); } - return error; + + return -error; } STATIC void @@ -491,8 +491,14 @@ xfssyncd( break; spin_lock(&vfsp->vfs_sync_lock); - if (!timeleft) { - timeleft = (xfs_syncd_centisecs * HZ) / 100; + /* + * We can get woken by laptop mode, to do a sync - + * that's the (only!) case where the list would be + * empty with time remaining. + */ + if (!timeleft || list_empty(&vfsp->vfs_sync_list)) { + if (!timeleft) + timeleft = (xfs_syncd_centisecs * HZ) / 100; INIT_LIST_HEAD(&vfsp->vfs_sync_work.w_list); list_add_tail(&vfsp->vfs_sync_work.w_list, &vfsp->vfs_sync_list); @@ -595,9 +601,10 @@ linvfs_sync_super( if (unlikely(laptop_mode)) { int prev_sync_seq = vfsp->vfs_sync_seq; + /* * The disk must be active because we're syncing. - * We schedule syncd now (now that the disk is + * We schedule xfssyncd now (now that the disk is * active) instead of later (when it might not be). */ wake_up_process(vfsp->vfs_sync_task); diff --git a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h index 4de833f99ee3..aab70136c4e8 100644 --- a/fs/xfs/linux-2.6/xfs_vfs.h +++ b/fs/xfs/linux-2.6/xfs_vfs.h @@ -216,4 +216,8 @@ extern void bhv_insert_all_vfsops(struct vfs *); extern void bhv_remove_all_vfsops(struct vfs *, int); extern void bhv_remove_vfsops(struct vfs *, int); +#define fs_frozen(vfsp) ((vfsp)->vfs_super->s_frozen) +#define fs_check_frozen(vfsp, level) \ + vfs_check_frozen(vfsp->vfs_super, level); + #endif /* __XFS_VFS_H__ */ diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 4e4e966d17ac..ebc2f27ce9e1 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -590,9 +590,6 @@ xfs_fs_goingdown( xfs_mount_t *mp, __uint32_t inflags) { - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - switch (inflags) { case XFS_FSOP_GOING_FLAGS_DEFAULT: { struct vfs *vfsp = XFS_MTOVFS(mp); @@ -602,7 +599,7 @@ xfs_fs_goingdown( xfs_force_shutdown(mp, XFS_FORCE_UMOUNT); thaw_bdev(sb->s_bdev, sb); } - + break; } case XFS_FSOP_GOING_FLAGS_LOGFLUSH: diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 58117edbbc2f..7db33af12520 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -811,7 +811,7 @@ xfs_log_need_covered(xfs_mount_t *mp) xlog_t *log = mp->m_log; vfs_t *vfsp = XFS_MTOVFS(mp); - if (vfsp->vfs_super->s_frozen || XFS_FORCED_SHUTDOWN(mp) || + if (fs_frozen(vfsp) || XFS_FORCED_SHUTDOWN(mp) || (vfsp->vfs_flag & VFS_RDONLY)) return 0; diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index c2bbc9a2c8b8..3db0e2200775 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c @@ -131,7 +131,7 @@ xfs_trans_alloc( xfs_mount_t *mp, uint type) { - vfs_check_frozen(XFS_MTOVFS(mp)->vfs_super, SB_FREEZE_TRANS); + fs_check_frozen(XFS_MTOVFS(mp), SB_FREEZE_TRANS); atomic_inc(&mp->m_active_trans); return (_xfs_trans_alloc(mp, type)); diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 29573197c3ee..cf791b073e76 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -13,11 +13,19 @@ * Note: the old pte is known to not be writable, so we don't need to * worry about dirty bits etc getting lost. */ +#ifndef __HAVE_ARCH_SET_PTE_ATOMIC #define ptep_establish(__vma, __address, __ptep, __entry) \ do { \ set_pte(__ptep, __entry); \ flush_tlb_page(__vma, __address); \ } while (0) +#else /* __HAVE_ARCH_SET_PTE_ATOMIC */ +#define ptep_establish(__vma, __address, __ptep, __entry) \ +do { \ + set_pte_atomic(__ptep, __entry); \ + flush_tlb_page(__vma, __address); \ +} while (0) +#endif /* __HAVE_ARCH_SET_PTE_ATOMIC */ #endif #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h index 893e6f1c7efd..94b7a46a6043 100644 --- a/include/asm-h8300/bitops.h +++ b/include/asm-h8300/bitops.h @@ -273,6 +273,8 @@ found_middle: return result + __ffs(tmp); } +#define find_first_bit(addr, size) find_next_bit(addr, size, 0) + /* * Every architecture must define this function. It's the fastest * way of searching a 140-bit bitmap where the first 100 bits are diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h index e48ab3d07c83..80a24b01d47e 100644 --- a/include/asm-i386/pgtable-3level.h +++ b/include/asm-i386/pgtable-3level.h @@ -54,6 +54,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte) smp_wmb(); ptep->pte_low = pte.pte_low; } +#define __HAVE_ARCH_SET_PTE_ATOMIC #define set_pte_atomic(pteptr,pteval) \ set_64bit((unsigned long long *)(pteptr),pte_val(pteval)) #define set_pmd(pmdptr,pmdval) \ diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h index 31aca939104f..a506573b7b69 100644 --- a/include/asm-m32r/unistd.h +++ b/include/asm-m32r/unistd.h @@ -294,25 +294,16 @@ #define __NR_mq_getsetattr (__NR_mq_open+5) #define __NR_sys_kexec_load 283 #define __NR_waitid 284 -#define __NR_perfctr_info 285 -#define __NR_vperfctr_open (__NR_perfctr_info+1) -#define __NR_vperfctr_control (__NR_perfctr_info+2) -#define __NR_vperfctr_unlink (__NR_perfctr_info+3) -#define __NR_vperfctr_iresume (__NR_perfctr_info+4) -#define __NR_vperfctr_read (__NR_perfctr_info+5) -#define __NR_add_key 291 -#define __NR_request_key 292 -#define __NR_keyctl 293 -#define NR_syscalls 294 +#define NR_syscalls 285 -/* user-visible error numbers are in the range -1 - -128: see +/* user-visible error numbers are in the range -1 - -124: see * <asm-m32r/errno.h> */ #define __syscall_return(type, res) \ do { \ - if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \ + if ((unsigned long)(res) >= (unsigned long)(-(124 + 1))) { \ /* Avoid using "res" which is declared to be in register r0; \ errno might expand to a function call and clobber it. */ \ int __err = -(res); \ diff --git a/include/asm-um/dma-mapping.h b/include/asm-um/dma-mapping.h index 2ea88281161d..13e6291f7151 100644 --- a/include/asm-um/dma-mapping.h +++ b/include/asm-um/dma-mapping.h @@ -1,6 +1,8 @@ #ifndef _ASM_DMA_MAPPING_H #define _ASM_DMA_MAPPING_H +#include <asm/scatterlist.h> + static inline int dma_supported(struct device *dev, u64 mask) { diff --git a/include/asm-um/smp.h b/include/asm-um/smp.h index ee768c27ca0e..4412d5d9c26b 100644 --- a/include/asm-um/smp.h +++ b/include/asm-um/smp.h @@ -8,10 +8,6 @@ #include "asm/current.h" #include "linux/cpumask.h" -extern cpumask_t cpu_online_map; -extern cpumask_t cpu_possible_map; - - #define smp_processor_id() (current_thread->cpu) #define cpu_logical_map(n) (n) #define cpu_number_map(n) (n) @@ -19,8 +15,6 @@ extern cpumask_t cpu_possible_map; extern int hard_smp_processor_id(void); #define NO_PROC_ID -1 -#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map) - extern int ncpus; diff --git a/include/linux/acct.h b/include/linux/acct.h index b46ce1ac1c6a..a6ab17c49aa1 100644 --- a/include/linux/acct.h +++ b/include/linux/acct.h @@ -172,17 +172,24 @@ static inline u32 jiffies_to_AHZ(unsigned long x) #endif } -static inline u64 jiffies_64_to_AHZ(u64 x) +static inline u64 nsec_to_AHZ(u64 x) { -#if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0 -#if HZ != AHZ - do_div(x, HZ / AHZ); -#endif -#else - x *= TICK_NSEC; +#if (NSEC_PER_SEC % AHZ) == 0 do_div(x, (NSEC_PER_SEC / AHZ)); +#elif (AHZ % 512) == 0 + x *= AHZ/512; + do_div(x, (NSEC_PER_SEC / 512)); +#else + /* + * max relative error 5.7e-8 (1.8s per year) for AHZ <= 1024, + * overflow after 64.99 years. + * exact for AHZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ... + */ + x *= 9; + do_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (AHZ/2)) + / AHZ)); #endif - return x; + return x; } #endif /* __KERNEL */ diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 232d8fdb557c..7153aef34d5c 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -40,6 +40,8 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr) void *addr = kmap_atomic(page, KM_USER0); clear_user_page(addr, vaddr, page); kunmap_atomic(addr, KM_USER0); + /* Make sure this page is cleared on other CPU's too before using it */ + smp_wmb(); } static inline void clear_highpage(struct page *page) @@ -73,6 +75,8 @@ static inline void copy_user_highpage(struct page *to, struct page *from, unsign copy_user_page(vto, vfrom, vaddr, to); kunmap_atomic(vfrom, KM_USER0); kunmap_atomic(vto, KM_USER1); + /* Make sure this page is cleared on other CPU's too before using it */ + smp_wmb(); } static inline void copy_highpage(struct page *to, struct page *from) diff --git a/include/linux/sched.h b/include/linux/sched.h index 90f5cb645116..8810b551082a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -508,7 +508,7 @@ struct task_struct { struct timer_list real_timer; unsigned long utime, stime; unsigned long nvcsw, nivcsw; /* context switch counts */ - u64 start_time; + struct timespec start_time; /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ unsigned long min_flt, maj_flt; /* process credentials */ diff --git a/include/linux/times.h b/include/linux/times.h index ff00f334ffaa..0c5aa078dad4 100644 --- a/include/linux/times.h +++ b/include/linux/times.h @@ -55,6 +55,26 @@ static inline u64 jiffies_64_to_clock_t(u64 x) } #endif +static inline u64 nsec_to_clock_t(u64 x) +{ +#if (NSEC_PER_SEC % USER_HZ) == 0 + do_div(x, (NSEC_PER_SEC / USER_HZ)); +#elif (USER_HZ % 512) == 0 + x *= USER_HZ/512; + do_div(x, (NSEC_PER_SEC / 512)); +#else + /* + * max relative error 5.7e-8 (1.8s per year) for USER_HZ <= 1024, + * overflow after 64.99 years. + * exact for HZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ... + */ + x *= 9; + do_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (USER_HZ/2)) + / USER_HZ)); +#endif + return x; +} + struct tms { clock_t tms_utime; clock_t tms_stime; diff --git a/kernel/acct.c b/kernel/acct.c index daf23c4efab4..fb6989a34f6e 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -384,6 +384,8 @@ static void do_acct_process(long exitcode, struct file *file) unsigned long vsize; unsigned long flim; u64 elapsed; + u64 run_time; + struct timespec uptime; /* * First check to see if there is enough free_space to continue @@ -401,7 +403,13 @@ static void do_acct_process(long exitcode, struct file *file) ac.ac_version = ACCT_VERSION | ACCT_BYTEORDER; strlcpy(ac.ac_comm, current->comm, sizeof(ac.ac_comm)); - elapsed = jiffies_64_to_AHZ(get_jiffies_64() - current->start_time); + /* calculate run_time in nsec*/ + do_posix_clock_monotonic_gettime(&uptime); + run_time = (u64)uptime.tv_sec*NSEC_PER_SEC + uptime.tv_nsec; + run_time -= (u64)current->start_time.tv_sec*NSEC_PER_SEC + + current->start_time.tv_nsec; + /* convert nsec -> AHZ */ + elapsed = nsec_to_AHZ(run_time); #if ACCT_VERSION==3 ac.ac_etime = encode_float(elapsed); #else diff --git a/kernel/fork.c b/kernel/fork.c index 8c7ba481c9a5..70f604c3937b 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -992,7 +992,7 @@ static task_t *copy_process(unsigned long clone_flags, p->utime = p->stime = 0; p->lock_depth = -1; /* -1 = no lock */ - p->start_time = get_jiffies_64(); + do_posix_clock_monotonic_gettime(&p->start_time); p->security = NULL; p->io_context = NULL; p->io_wait = NULL; @@ -1146,7 +1146,8 @@ fork_out: bad_fork_cleanup_namespace: exit_namespace(p); bad_fork_cleanup_mm: - mmput(p->mm); + if (p->mm) + mmput(p->mm); bad_fork_cleanup_signal: exit_signal(p); bad_fork_cleanup_sighand: diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index ef5c42101748..7ba8941b834b 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c @@ -219,11 +219,6 @@ static __init int init_posix_timers(void) .clock_set = do_posix_clock_monotonic_settime }; -#ifdef CONFIG_TIME_INTERPOLATION - /* Clocks are more accurate with time interpolators */ - clock_realtime.res = clock_monotonic.res = time_interpolator_resolution(); -#endif - register_posix_clock(CLOCK_REALTIME, &clock_realtime); register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic); diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 48f6dde410b3..3868e29e85be 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -26,6 +26,7 @@ /** * oom_badness - calculate a numeric value for how bad this task has been * @p: task struct of which task we should calculate + * @p: current uptime in seconds * * The formula used is relatively simple and documented inline in the * function. The main rationale is that we want to select a good task @@ -41,7 +42,7 @@ * of least surprise ... (be careful when you change it) */ -static unsigned long badness(struct task_struct *p) +static unsigned long badness(struct task_struct *p, unsigned long uptime) { unsigned long points, cpu_time, run_time, s; @@ -56,12 +57,16 @@ static unsigned long badness(struct task_struct *p) points = p->mm->total_vm; /* - * CPU time is in seconds and run time is in minutes. There is no - * particular reason for this other than that it turned out to work - * very well in practice. + * CPU time is in tens of seconds and run time is in thousands + * of seconds. There is no particular reason for this other than + * that it turned out to work very well in practice. */ cpu_time = (p->utime + p->stime) >> (SHIFT_HZ + 3); - run_time = (get_jiffies_64() - p->start_time) >> (SHIFT_HZ + 10); + + if (uptime >= p->start_time.tv_sec) + run_time = (uptime - p->start_time.tv_sec) >> 10; + else + run_time = 0; s = int_sqrt(cpu_time); if (s) @@ -111,10 +116,12 @@ static struct task_struct * select_bad_process(void) unsigned long maxpoints = 0; struct task_struct *g, *p; struct task_struct *chosen = NULL; + struct timespec uptime; + do_posix_clock_monotonic_gettime(&uptime); do_each_thread(g, p) if (p->pid) { - unsigned long points = badness(p); + unsigned long points = badness(p, uptime.tv_sec); if (points > maxpoints) { chosen = p; maxpoints = points; diff --git a/mm/page-writeback.c b/mm/page-writeback.c index ab9fb2dfbece..343998d46bb0 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -153,11 +153,9 @@ get_dirty_limits(struct writeback_state *wbs, long *pbackground, long *pdirty) if (dirty_ratio < 5) dirty_ratio = 5; - /* - * Keep the ratio between dirty_ratio and background_ratio roughly - * what the sysctls are after dirty_ratio has been scaled (above). - */ - background_ratio = dirty_background_ratio * dirty_ratio/vm_dirty_ratio; + background_ratio = dirty_background_ratio; + if (background_ratio >= dirty_ratio) + background_ratio = dirty_ratio / 2; background = (background_ratio * total_pages) / 100; dirty = (dirty_ratio * total_pages) / 100; diff --git a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c index 8fdeb69ff86f..d9f09e61d83c 100644 --- a/net/sunrpc/svcauth.c +++ b/net/sunrpc/svcauth.c @@ -183,7 +183,7 @@ auth_domain_lookup(struct auth_domain *item, int set) } /* Didn't find anything */ if (!set) - goto out_noset; + goto out_nada; auth_domain_cache.entries++; out_set: set_bit(CACHE_HASHED, &item->h.flags); @@ -193,6 +193,8 @@ out_set: cache_fresh(&auth_domain_cache, &item->h, item->h.expiry_time); cache_get(&item->h); return item; +out_nada: + tmp = NULL; out_noset: read_unlock(&auth_domain_cache.hash_lock); return tmp; diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index d25ed880944a..f844e402b53c 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2466,21 +2466,14 @@ static int selinux_file_ioctl(struct file *file, unsigned int cmd, return error; } -static int selinux_file_mmap(struct file *file, unsigned long prot, unsigned long flags) +static int file_map_prot_check(struct file *file, unsigned long prot, int shared) { - u32 av; - int rc; - - rc = secondary_ops->file_mmap(file, prot, flags); - if (rc) - return rc; - if (file) { /* read access is always possible with a mapping */ - av = FILE__READ; + u32 av = FILE__READ; /* write access only matters if the mapping is shared */ - if ((flags & MAP_TYPE) == MAP_SHARED && (prot & PROT_WRITE)) + if (shared && (prot & PROT_WRITE)) av |= FILE__WRITE; if (prot & PROT_EXEC) @@ -2491,6 +2484,18 @@ static int selinux_file_mmap(struct file *file, unsigned long prot, unsigned lon return 0; } +static int selinux_file_mmap(struct file *file, unsigned long prot, unsigned long flags) +{ + int rc; + + rc = secondary_ops->file_mmap(file, prot, flags); + if (rc) + return rc; + + return file_map_prot_check(file, prot, + (flags & MAP_TYPE) == MAP_SHARED); +} + static int selinux_file_mprotect(struct vm_area_struct *vma, unsigned long prot) { @@ -2500,7 +2505,7 @@ static int selinux_file_mprotect(struct vm_area_struct *vma, if (rc) return rc; - return selinux_file_mmap(vma->vm_file, prot, vma->vm_flags); + return file_map_prot_check(vma->vm_file, prot, vma->vm_flags&VM_SHARED); } static int selinux_file_lock(struct file *file, unsigned int cmd) @@ -2625,6 +2630,11 @@ static int selinux_task_alloc_security(struct task_struct *tsk) tsec2->exec_sid = tsec1->exec_sid; tsec2->create_sid = tsec1->create_sid; + /* Retain ptracer SID across fork, if any. + This will be reset by the ptrace hook upon any + subsequent ptrace_attach operations. */ + tsec2->ptrace_sid = tsec1->ptrace_sid; + return 0; } |
