diff options
| author | Tony Luck <aegl@agluck-lia64.sc.intel.com> | 2004-10-19 20:43:18 +0000 |
|---|---|---|
| committer | Tony Luck <aegl@agluck-lia64.sc.intel.com> | 2004-10-19 20:43:18 +0000 |
| commit | b9588f656d39e855080bd72362ffd7c151a9ac41 (patch) | |
| tree | aa48a1ff991fff7f40c70a3b096687587c71ab30 | |
| parent | 5de570b5cb958fe9ff07c4a988e1afd7512313f2 (diff) | |
| parent | 31a3791056e43c6dd7386b8bc0f5fb94848c5a61 (diff) | |
Merge agluck-lia64.sc.intel.com:/data/home/aegl/BK/work/sgi-reorg
into agluck-lia64.sc.intel.com:/data/home/aegl/BK/linux-ia64-release-2.6.10
86 files changed, 621 insertions, 517 deletions
@@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 9 -EXTRAVERSION = -rc4 +EXTRAVERSION = NAME=Zonked Quokka # *DOCUMENTATION* 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/ppc/Kconfig b/arch/ppc/Kconfig index 81d55092fde0..46139ac97563 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig @@ -35,10 +35,6 @@ config GENERIC_NVRAM bool default y -config GENERIC_IOMAP - bool - default y - source "init/Kconfig" menu "Processor" diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index d51e3de8de12..08cdddee7ac1 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c @@ -1709,6 +1709,32 @@ pci_init_resource(struct resource *res, unsigned long start, unsigned long end, res->child = NULL; } +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len) + return NULL; + if (max && len > max) + len = max; + if (flags & IORESOURCE_IO) + return ioport_map(start, len); + if (flags & IORESOURCE_MEM) + return (void __iomem *) start; + /* What? */ + return NULL; +} + +void pci_iounmap(struct pci_dev *dev, void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); + + /* * Null PCI config access functions, for the case when we can't * find a hose. diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c index c16d4cce4677..30482852c9c2 100644 --- a/arch/ppc/mm/pgtable.c +++ b/arch/ppc/mm/pgtable.c @@ -22,6 +22,7 @@ #include <linux/config.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/types.h> #include <linux/mm.h> #include <linux/vmalloc.h> @@ -271,6 +272,18 @@ void iounmap(void *addr) vunmap((void *) (PAGE_MASK & (unsigned long)addr)); } +void __iomem *ioport_map(unsigned long port, unsigned int len) +{ + return (void __iomem *) (port + _IO_BASE); +} + +void ioport_unmap(void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(ioport_map); +EXPORT_SYMBOL(ioport_unmap); + int map_page(unsigned long va, phys_addr_t pa, int flags) { diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile index acb62477981e..020b64fac5fe 100644 --- a/arch/ppc64/kernel/Makefile +++ b/arch/ppc64/kernel/Makefile @@ -19,7 +19,7 @@ pci-obj-$(CONFIG_PPC_ISERIES) += iSeries_pci.o iSeries_pci_reset.o \ iSeries_IoMmTable.o pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_dma_direct.o -obj-$(CONFIG_PCI) += pci.o pci_iommu.o $(pci-obj-y) +obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y) obj-$(CONFIG_PPC_ISERIES) += iSeries_irq.o \ iSeries_VpdInfo.o XmPciLpEvent.o \ diff --git a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c index 7466f68bc10b..6e87e56315b7 100644 --- a/arch/ppc64/kernel/eeh.c +++ b/arch/ppc64/kernel/eeh.c @@ -697,121 +697,6 @@ void eeh_remove_device(struct pci_dev *dev) } EXPORT_SYMBOL(eeh_remove_device); -/* - * Here comes the EEH implementation of the IOMAP - * interfaces. - */ -unsigned int fastcall ioread8(void __iomem *addr) -{ - return readb(addr); -} -unsigned int fastcall ioread16(void __iomem *addr) -{ - return readw(addr); -} -unsigned int fastcall ioread32(void __iomem *addr) -{ - return readl(addr); -} -EXPORT_SYMBOL(ioread8); -EXPORT_SYMBOL(ioread16); -EXPORT_SYMBOL(ioread32); - -void fastcall iowrite8(u8 val, void __iomem *addr) -{ - writeb(val, addr); -} -void fastcall iowrite16(u16 val, void __iomem *addr) -{ - writew(val, addr); -} -void fastcall iowrite32(u32 val, void __iomem *addr) -{ - writel(val, addr); -} -EXPORT_SYMBOL(iowrite8); -EXPORT_SYMBOL(iowrite16); -EXPORT_SYMBOL(iowrite32); - -/* - * These are the "repeat read/write" functions. Note the - * non-CPU byte order. We do things in "IO byteorder" - * here. - * - * FIXME! We could make these do EEH handling if we really - * wanted. Not clear if we do. - */ -void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) -{ - _insb((u8 __force *) addr, dst, count); -} -void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) -{ - _insw_ns((u16 __force *) addr, dst, count); -} -void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) -{ - _insl_ns((u32 __force *) addr, dst, count); -} -EXPORT_SYMBOL(ioread8_rep); -EXPORT_SYMBOL(ioread16_rep); -EXPORT_SYMBOL(ioread32_rep); - -void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) -{ - _outsb((u8 __force *) addr, src, count); -} -void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) -{ - _outsw_ns((u16 __force *) addr, src, count); -} -void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) -{ - _outsl_ns((u32 __force *) addr, src, count); -} -EXPORT_SYMBOL(iowrite8_rep); -EXPORT_SYMBOL(iowrite16_rep); -EXPORT_SYMBOL(iowrite32_rep); - -void __iomem *ioport_map(unsigned long port, unsigned int len) -{ - if (!_IO_IS_VALID(port)) - return NULL; - return (void __iomem *) (port+pci_io_base); -} - -void ioport_unmap(void __iomem *addr) -{ - /* Nothing to do */ -} -EXPORT_SYMBOL(ioport_map); -EXPORT_SYMBOL(ioport_unmap); - -void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) -{ - unsigned long start = pci_resource_start(dev, bar); - unsigned long len = pci_resource_len(dev, bar); - unsigned long flags = pci_resource_flags(dev, bar); - - if (!len) - return NULL; - if (max && len > max) - len = max; - if (flags & IORESOURCE_IO) - return ioport_map(start, len); - if (flags & IORESOURCE_MEM) - return (void __iomem *) start; - /* What? */ - return NULL; -} - -void pci_iounmap(struct pci_dev *dev, void __iomem *addr) -{ - /* Nothing to do */ -} -EXPORT_SYMBOL(pci_iomap); -EXPORT_SYMBOL(pci_iounmap); - static int proc_eeh_show(struct seq_file *m, void *v) { unsigned int cpu; diff --git a/arch/ppc64/kernel/iomap.c b/arch/ppc64/kernel/iomap.c new file mode 100644 index 000000000000..b70a9240c717 --- /dev/null +++ b/arch/ppc64/kernel/iomap.c @@ -0,0 +1,119 @@ +#include <linux/init.h> +#include <linux/pci.h> +#include <linux/mm.h> +#include <asm/io.h> + +/* + * Here comes the ppc64 implementation of the IOMAP + * interfaces. + */ +unsigned int fastcall ioread8(void __iomem *addr) +{ + return readb(addr); +} +unsigned int fastcall ioread16(void __iomem *addr) +{ + return readw(addr); +} +unsigned int fastcall ioread32(void __iomem *addr) +{ + return readl(addr); +} +EXPORT_SYMBOL(ioread8); +EXPORT_SYMBOL(ioread16); +EXPORT_SYMBOL(ioread32); + +void fastcall iowrite8(u8 val, void __iomem *addr) +{ + writeb(val, addr); +} +void fastcall iowrite16(u16 val, void __iomem *addr) +{ + writew(val, addr); +} +void fastcall iowrite32(u32 val, void __iomem *addr) +{ + writel(val, addr); +} +EXPORT_SYMBOL(iowrite8); +EXPORT_SYMBOL(iowrite16); +EXPORT_SYMBOL(iowrite32); + +/* + * These are the "repeat read/write" functions. Note the + * non-CPU byte order. We do things in "IO byteorder" + * here. + * + * FIXME! We could make these do EEH handling if we really + * wanted. Not clear if we do. + */ +void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insb((u8 __force *) addr, dst, count); +} +void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insw_ns((u16 __force *) addr, dst, count); +} +void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insl_ns((u32 __force *) addr, dst, count); +} +EXPORT_SYMBOL(ioread8_rep); +EXPORT_SYMBOL(ioread16_rep); +EXPORT_SYMBOL(ioread32_rep); + +void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsb((u8 __force *) addr, src, count); +} +void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsw_ns((u16 __force *) addr, src, count); +} +void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsl_ns((u32 __force *) addr, src, count); +} +EXPORT_SYMBOL(iowrite8_rep); +EXPORT_SYMBOL(iowrite16_rep); +EXPORT_SYMBOL(iowrite32_rep); + +void __iomem *ioport_map(unsigned long port, unsigned int len) +{ + if (!_IO_IS_VALID(port)) + return NULL; + return (void __iomem *) (port+pci_io_base); +} + +void ioport_unmap(void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(ioport_map); +EXPORT_SYMBOL(ioport_unmap); + +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len) + return NULL; + if (max && len > max) + len = max; + if (flags & IORESOURCE_IO) + return ioport_map(start, len); + if (flags & IORESOURCE_MEM) + return (void __iomem *) start; + /* What? */ + return NULL; +} + +void pci_iounmap(struct pci_dev *dev, void __iomem *addr) +{ + /* Nothing to do */ +} +EXPORT_SYMBOL(pci_iomap); +EXPORT_SYMBOL(pci_iounmap); diff --git a/arch/ppc64/kernel/prom_init.c b/arch/ppc64/kernel/prom_init.c index f7b44772cba2..f62bda79e102 100644 --- a/arch/ppc64/kernel/prom_init.c +++ b/arch/ppc64/kernel/prom_init.c @@ -590,12 +590,15 @@ static void reserve_mem(unsigned long base, unsigned long size) unsigned long top = base + size; unsigned long cnt = RELOC(mem_reserve_cnt); + if (size == 0) + return; + /* We need to always keep one empty entry so that we * have our terminator with "size" set to 0 since we are * dumb and just copy this entire array to the boot params */ base = _ALIGN_DOWN(base, PAGE_SIZE); - top = _ALIGN_DOWN(top, PAGE_SIZE); + top = _ALIGN_UP(top, PAGE_SIZE); size = top - base; if (cnt >= (MEM_RESERVE_MAP_SIZE - 1)) diff --git a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c index 923c0ff0102e..75ced752807e 100644 --- a/arch/ppc64/kernel/smp.c +++ b/arch/ppc64/kernel/smp.c @@ -390,7 +390,8 @@ out: static inline int __devinit smp_startup_cpu(unsigned int lcpu) { int status; - unsigned long start_here = __pa(pseries_secondary_smp_init); + unsigned long start_here = __pa((u32)*((unsigned long *) + pseries_secondary_smp_init)); unsigned int pcpu; /* At boot time the cpus are already spinning in hold 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/arch/x86_64/kernel/suspend_asm.S b/arch/x86_64/kernel/suspend_asm.S index 48ad06289d49..8a39998106fa 100644 --- a/arch/x86_64/kernel/suspend_asm.S +++ b/arch/x86_64/kernel/suspend_asm.S @@ -39,29 +39,28 @@ ENTRY(swsusp_arch_resume) /* set up cr3 */ leaq init_level4_pgt(%rip),%rax subq $__START_KERNEL_map,%rax - movq %rax,%cr3 + movq %rax,%cr3 movq mmu_cr4_features(%rip), %rax movq %rax, %rdx - andq $~(1<<7), %rdx # PGE - movq %rdx, %cr4; # turn off PGE - movq %cr3, %rcx; # flush TLB - movq %rcx, %cr3; - movq %rax, %cr4; # turn PGE back on + movq %rdx, %cr4; # turn off PGE + movq %cr3, %rcx; # flush TLB + movq %rcx, %cr3; + movq %rax, %cr4; # turn PGE back on movl nr_copy_pages(%rip), %eax xorl %ecx, %ecx - movq $0, loop(%rip) + movq $0, %r10 testl %eax, %eax - je .L108 + jz done .L105: xorl %esi, %esi - movq $0, loop2(%rip) + movq $0, %r11 jmp .L104 .p2align 4,,7 -.L111: - movq loop(%rip), %rcx +copy_one_page: + movq %r10, %rcx .L104: movq pagedir_nosave(%rip), %rdx movq %rcx, %rax @@ -71,27 +70,26 @@ ENTRY(swsusp_arch_resume) movzbl (%rsi,%rax), %eax movb %al, (%rsi,%rcx) - movq %cr3, %rax; # flush TLB - movq %rax, %cr3; + movq %cr3, %rax; # flush TLB + movq %rax, %cr3; - movq loop2(%rip), %rax + movq %r11, %rax incq %rax cmpq $4095, %rax movq %rax, %rsi - movq %rax, loop2(%rip) - jbe .L111 - movq loop(%rip), %rax + movq %rax, %r11 + jbe copy_one_page + movq %r10, %rax incq %rax movq %rax, %rcx - movq %rax, loop(%rip) + movq %rax, %r10 mov nr_copy_pages(%rip), %eax cmpq %rax, %rcx jb .L105 -.L108: - .align 4 +done: movl $24, %eax + movl %eax, %ds - movl %eax, %ds movq saved_context_esp(%rip), %rsp movq saved_context_ebp(%rip), %rbp movq saved_context_eax(%rip), %rax @@ -111,10 +109,3 @@ ENTRY(swsusp_arch_resume) pushq saved_context_eflags(%rip) ; popfq call swsusp_restore ret - - .section .data.nosave -loop: - .quad 0 -loop2: - .quad 0 - .previous diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 9317f3f3191c..6e17867db85c 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -235,6 +235,8 @@ firmware_data_write(struct kobject *kobj, struct firmware *fw; ssize_t retval; + if (!capable(CAP_SYS_RAWIO)) + return -EPERM; down(&fw_lock); fw = fw_priv->fw; if (test_bit(FW_STATUS_DONE, &fw_priv->status)) { diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index df0b4b72a4ab..7bec505ad95e 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c @@ -1778,7 +1778,7 @@ static struct pci_driver agp_intel_pci_driver = { .name = "agpgart-intel", .id_table = agp_intel_pci_table, .probe = agp_intel_probe, - .remove = agp_intel_remove, + .remove = __devexit_p(agp_intel_remove), .resume = agp_intel_resume, }; diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig index d2903255ef7f..8f62f70d0e42 100644 --- a/drivers/input/joystick/Kconfig +++ b/drivers/input/joystick/Kconfig @@ -249,7 +249,7 @@ config JOYSTICK_AMIGA config JOYSTICK_JOYDUMP tristate "Gameport data dumper" - depends on INPUT && INPUT_JOYSTICK + depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you want to dump data from your joystick into the system log for debugging purposes. Say N if you are making a production 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/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 37c9dcfd9696..c1e3536c2147 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c @@ -603,6 +603,8 @@ static void put_chip(struct map_info *map, struct flchip *chip, unsigned long ad } spin_unlock(&shared->lock); } + } else { + spin_unlock(&shared->lock); } } 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/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index 276b485d211b..76d722f34a9c 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c @@ -362,7 +362,7 @@ static void rpaphp_eeh_remove_bus_device(struct pci_dev *dev) int rpaphp_unconfig_pci_adapter(struct slot *slot) { int retval = 0; - struct list_head *ln; + struct list_head *ln, *tmp; dbg("Entry %s: slot[%s]\n", __FUNCTION__, slot->name); if (list_empty(&slot->dev.pci_funcs)) { @@ -373,7 +373,7 @@ int rpaphp_unconfig_pci_adapter(struct slot *slot) goto exit; } /* remove the devices from the pci core */ - list_for_each (ln, &slot->dev.pci_funcs) { + list_for_each_safe (ln, tmp, &slot->dev.pci_funcs) { struct rpaphp_pci_func *func; func = list_entry(ln, struct rpaphp_pci_func, sibling); 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/usb/class/usblp.c b/drivers/usb/class/usblp.c index 5ed263886048..da91bbd6735c 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -397,10 +397,6 @@ static void usblp_cleanup (struct usblp *usblp) { info("usblp%d: removed", usblp->minor); - usb_buffer_free (usblp->dev, USBLP_BUF_SIZE, - usblp->writebuf, usblp->writeurb->transfer_dma); - usb_buffer_free (usblp->dev, USBLP_BUF_SIZE, - usblp->readbuf, usblp->readurb->transfer_dma); kfree (usblp->device_id_string); kfree (usblp->statusbuf); usb_free_urb(usblp->writeurb); @@ -1159,6 +1155,10 @@ static void usblp_disconnect(struct usb_interface *intf) usb_set_intfdata (intf, NULL); usblp_unlink_urbs(usblp); + usb_buffer_free (usblp->dev, USBLP_BUF_SIZE, + usblp->writebuf, usblp->writeurb->transfer_dma); + usb_buffer_free (usblp->dev, USBLP_BUF_SIZE, + usblp->readbuf, usblp->readurb->transfer_dma); if (!usblp->used) usblp_cleanup (usblp); diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index eff0308b7b04..d28de0b8ceba 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -303,13 +303,16 @@ static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep) /* init to our chosen defaults, notably so that we NAK OUT * packets until the driver queues a read (+note erratum 0112) */ - writel ( (1 << SET_NAK_OUT_PACKETS_MODE) + tmp = (1 << SET_NAK_OUT_PACKETS_MODE) | (1 << SET_NAK_OUT_PACKETS) | (1 << CLEAR_EP_HIDE_STATUS_PHASE) - | (1 << CLEAR_INTERRUPT_MODE) - | (1 << CLEAR_ENDPOINT_TOGGLE) - | (1 << CLEAR_ENDPOINT_HALT) - , &ep->regs->ep_rsp); + | (1 << CLEAR_INTERRUPT_MODE); + + if (ep->num != 0) { + tmp |= (1 << CLEAR_ENDPOINT_TOGGLE) + | (1 << CLEAR_ENDPOINT_HALT); + } + writel (tmp, &ep->regs->ep_rsp); /* scrub most status bits, and flush any fifo state */ writel ( (1 << TIMEOUT) @@ -1920,8 +1923,6 @@ static void ep0_start (struct net2280 *dev) , &dev->usb->stdrsp); writel ( (1 << USB_ROOT_PORT_WAKEUP_ENABLE) | (1 << SELF_POWERED_USB_DEVICE) - /* erratum 0102 workaround */ - | ((dev->chiprev == 0100) ? 0 : 1) << SUSPEND_IMMEDIATELY | (1 << REMOTE_WAKEUP_SUPPORT) | (dev->softconnect << USB_DETECT_ENABLE) | (1 << SELF_POWERED_STATUS) @@ -2047,6 +2048,8 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) stop_activity (dev, driver); spin_unlock_irqrestore (&dev->lock, flags); + net2280_pullup (&dev->gadget, 0); + driver->unbind (&dev->gadget); dev->gadget.dev.driver = NULL; dev->driver = NULL; @@ -2552,8 +2555,6 @@ static void handle_stat1_irqs (struct net2280 *dev, u32 stat) if (stat & (1 << SUSPEND_REQUEST_INTERRUPT)) { if (dev->driver->suspend) dev->driver->suspend (&dev->gadget); - /* we use SUSPEND_IMMEDIATELY */ - stat &= ~(1 << SUSPEND_REQUEST_INTERRUPT); } else { if (dev->driver->resume) dev->driver->resume (&dev->gadget); diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 408d4f98fa3e..e25adf501967 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -695,9 +695,18 @@ static void ehci_work (struct ehci_hcd *ehci, struct pt_regs *regs) timer_action_done (ehci, TIMER_IO_WATCHDOG); if (ehci->reclaim_ready) end_unlink_async (ehci, regs); + + /* another CPU may drop ehci->lock during a schedule scan while + * it reports urb completions. this flag guards against bogus + * attempts at re-entrant schedule scanning. + */ + if (ehci->scanning) + return; + ehci->scanning = 1; scan_async (ehci, regs); if (ehci->next_uframe != -1) scan_periodic (ehci, regs); + ehci->scanning = 0; /* the IO watchdog guards against hardware or driver bugs that * misplace IRQs, and should let us run completely without IRQs. diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 6439a4be911d..0e8541133ff1 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h @@ -53,6 +53,7 @@ struct ehci_hcd { /* one per controller */ struct ehci_qh *async; struct ehci_qh *reclaim; unsigned reclaim_ready : 1; + unsigned scanning : 1; /* periodic schedule support */ #define DEFAULT_I_TDPS 1024 /* some HCs can do less */ diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index fb8d25a94d9d..35baacd7706d 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c @@ -926,6 +926,8 @@ static void hid_irq_in(struct urb *urb, struct pt_regs *regs) case -ENOENT: case -ESHUTDOWN: return; + case -ETIMEDOUT: /* NAK */ + break; default: /* error */ warn("input irq status %d received", urb->status); } @@ -1859,8 +1861,8 @@ hiddev_init_fail: static void __exit hid_exit(void) { - hiddev_exit(); usb_deregister(&hid_driver); + hiddev_exit(); } module_init(hid_init); diff --git a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c index 3c741a8f5b73..3376654ca051 100644 --- a/drivers/usb/media/konicawc.c +++ b/drivers/usb/media/konicawc.c @@ -362,8 +362,8 @@ static void konicawc_isoc_irq(struct urb *urb, struct pt_regs *regs) else if (!urb->status && !cam->last_data_urb->status) len = konicawc_compress_iso(uvd, cam->last_data_urb, urb); - resubmit_urb(uvd, urb); resubmit_urb(uvd, cam->last_data_urb); + resubmit_urb(uvd, urb); cam->last_data_urb = NULL; uvd->stats.urb_length = len; uvd->stats.data_count += len; diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index eef146950bb7..3ac69f2c2510 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -1546,13 +1546,17 @@ static void digi_close( struct usb_serial_port *port, struct file *filp ) dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_count ); + /* if disconnected, just clear flags */ + if (!usb_get_intfdata(port->serial->interface)) + goto exit; + /* do cleanup only after final close on this port */ spin_lock_irqsave( &priv->dp_port_lock, flags ); priv->dp_in_close = 1; spin_unlock_irqrestore( &priv->dp_port_lock, flags ); /* tell line discipline to process only XON/XOFF */ - tty->closing = 1; + tty->closing = 1; /* wait for output to drain */ if( (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) { @@ -1616,6 +1620,7 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co tty->closing = 0; +exit: spin_lock_irqsave( &priv->dp_port_lock, flags ); priv->dp_write_urb_in_use = 0; priv->dp_in_close = 0; 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/ext3/inode.c b/fs/ext3/inode.c index 7650d0dad351..0e48f620d9e8 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -1579,6 +1579,12 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb, offset, nr_segs, ext3_direct_io_get_blocks, NULL); + /* + * Reacquire the handle: ext3_direct_io_get_block() can restart the + * transaction + */ + handle = journal_current_handle(); + out_stop: if (handle) { int err; 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/linkage.h b/include/asm-i386/linkage.h index e48009fd93c7..af3d8571c5c7 100644 --- a/include/asm-i386/linkage.h +++ b/include/asm-i386/linkage.h @@ -5,6 +5,10 @@ #define FASTCALL(x) x __attribute__((regparm(3))) #define fastcall __attribute__((regparm(3))) +#ifdef CONFIG_REGPARM +# define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret)) +#endif + #ifdef CONFIG_X86_ALIGNMENT_16 #define __ALIGN .align 16,0x90 #define __ALIGN_STR ".align 16,0x90" 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-ppc/io.h b/include/asm-ppc/io.h index 748856f5955a..5abdd426b04f 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h @@ -398,6 +398,79 @@ static inline int isa_check_signature(unsigned long io_addr, return 0; } +/* + * Here comes the ppc implementation of the IOMAP + * interfaces. + */ +static inline unsigned int ioread8(void __iomem *addr) +{ + return readb(addr); +} + +static inline unsigned int ioread16(void __iomem *addr) +{ + return readw(addr); +} + +static inline unsigned int ioread32(void __iomem *addr) +{ + return readl(addr); +} + +static inline void iowrite8(u8 val, void __iomem *addr) +{ + writeb(val, addr); +} + +static inline void iowrite16(u16 val, void __iomem *addr) +{ + writew(val, addr); +} + +static inline void iowrite32(u32 val, void __iomem *addr) +{ + writel(val, addr); +} + +static inline void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insb((u8 __force *) addr, dst, count); +} + +static inline void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insw_ns((u16 __force *) addr, dst, count); +} + +static inline void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) +{ + _insl_ns((u32 __force *) addr, dst, count); +} + +static inline void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsb((u8 __force *) addr, src, count); +} + +static inline void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsw_ns((u16 __force *) addr, src, count); +} + +static inline void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) +{ + _outsl_ns((u32 __force *) addr, src, count); +} + +/* Create a virtual mapping cookie for an IO port range */ +extern void __iomem *ioport_map(unsigned long port, unsigned int nr); +extern void ioport_unmap(void __iomem *); + +/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ +struct pci_dev; +extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); +extern void pci_iounmap(struct pci_dev *dev, void __iomem *); + #endif /* _PPC_IO_H */ #ifdef CONFIG_8260_PCI9 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/linkage.h b/include/linux/linkage.h index 09955c0ce848..338f7795d8a0 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -14,6 +14,10 @@ #define asmlinkage CPP_ASMLINKAGE #endif +#ifndef prevent_tail_call +# define prevent_tail_call(ret) do { } while (0) +#endif + #ifndef __ALIGN #define __ALIGN .align 4,0x90 #define __ALIGN_STR ".align 4,0x90" 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/exit.c b/kernel/exit.c index 6860b509dd11..6ec1f96fa92b 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1376,6 +1376,8 @@ asmlinkage long sys_waitid(int which, pid_t pid, struct siginfo __user *infop, int options, struct rusage __user *ru) { + long ret; + if (options & ~(WNOHANG|WNOWAIT|WEXITED|WSTOPPED|WCONTINUED)) return -EINVAL; if (!(options & (WEXITED|WSTOPPED|WCONTINUED))) @@ -1398,15 +1400,25 @@ asmlinkage long sys_waitid(int which, pid_t pid, return -EINVAL; } - return do_wait(pid, options, infop, NULL, ru); + ret = do_wait(pid, options, infop, NULL, ru); + + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, int options, struct rusage __user *ru) { + long ret; + if (options & ~(WNOHANG|WUNTRACED|__WNOTHREAD|__WCLONE|__WALL)) return -EINVAL; - return do_wait(pid, options | WEXITED, NULL, stat_addr, ru); + ret = do_wait(pid, options | WEXITED, NULL, stat_addr, ru); + + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } #ifdef __ARCH_WANT_SYS_WAITPID 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/mm/vmscan.c b/mm/vmscan.c index a6e04da6154a..1f0d7fb0396e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -181,7 +181,7 @@ static int shrink_slab(unsigned long scanned, unsigned int gfp_mask, struct shrinker *shrinker; if (scanned == 0) - return 0; + scanned = SWAP_CLUSTER_MAX; if (!down_read_trylock(&shrinker_rwsem)) return 0; @@ -1065,7 +1065,8 @@ scan: total_reclaimed += sc.nr_reclaimed; if (zone->all_unreclaimable) continue; - if (zone->pages_scanned > zone->present_pages * 2) + if (zone->pages_scanned >= (zone->nr_active + + zone->nr_inactive) * 4) zone->all_unreclaimable = 1; /* * If we've done a decent amount of scanning and @@ -1102,8 +1103,10 @@ out: zone->prev_priority = zone->temp_priority; } - if (!all_zones_ok) + if (!all_zones_ok) { + cond_resched(); goto loop_again; + } return total_reclaimed; } diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index cceea09bddc0..927b72c89fb3 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -246,7 +246,7 @@ gss_parse_init_downcall(struct gss_api_mech *gm, struct xdr_netobj *buf, spin_lock_init(&ctx->gc_seq_lock); atomic_set(&ctx->count,1); - if (simple_get_bytes(&p, end, uid, sizeof(uid))) + if (simple_get_bytes(&p, end, uid, sizeof(*uid))) goto err_free_ctx; /* FIXME: discarded timeout for now */ if (simple_get_bytes(&p, end, &timeout, sizeof(timeout))) 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; } |
