From 9fa6202d8ccbf651ded74dbcb9f368775ca02858 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Tue, 18 Apr 2006 13:14:02 -0400 Subject: [PATCH] --- yaml --- r: 26023 b: refs/heads/master c: d4a30e7e66c004da26dfe5229af7c10fe9853a7a h: refs/heads/master i: 26021: 13a9bcf71da6aa1124c575d374310ec5a4fad869 26019: 2782712712e1b397fb241450cc13a8bc7985cb9e 26015: 8fa73504e537dbe3fe292e3b9d149c15d860e89b v: v3 --- [refs] | 2 +- trunk/Documentation/vm/hugetlbpage.txt | 11 +- trunk/README | 23 +-- trunk/arch/i386/kernel/apm.c | 2 +- trunk/arch/i386/kernel/cpuid.c | 2 +- trunk/arch/i386/kernel/kprobes.c | 18 +- trunk/arch/i386/kernel/msr.c | 2 +- trunk/arch/i386/mach-voyager/voyager_cat.c | 1 + trunk/arch/ia64/kernel/kprobes.c | 10 +- trunk/arch/m32r/kernel/entry.S | 55 +++--- trunk/arch/m32r/kernel/process.c | 4 - trunk/arch/m32r/kernel/signal.c | 4 - trunk/arch/powerpc/kernel/kprobes.c | 14 +- trunk/arch/sparc64/kernel/kprobes.c | 12 +- trunk/arch/um/drivers/cow_user.c | 2 +- trunk/arch/um/include/longjmp.h | 4 +- .../um/include/sysdep-i386/kernel-offsets.h | 2 - .../um/include/sysdep-x86_64/kernel-offsets.h | 2 - trunk/arch/um/os-Linux/mem.c | 118 +---------- trunk/arch/um/os-Linux/process.c | 8 +- trunk/arch/um/os-Linux/skas/process.c | 36 ++-- trunk/arch/um/os-Linux/start_up.c | 24 ++- trunk/arch/um/os-Linux/trap.c | 4 +- trunk/arch/um/os-Linux/uaccess.c | 4 +- trunk/arch/um/os-Linux/util.c | 2 +- trunk/arch/um/sys-i386/signal.c | 6 +- trunk/arch/um/sys-i386/stub_segv.c | 4 +- trunk/arch/um/sys-x86_64/stub_segv.c | 10 +- trunk/arch/x86_64/kernel/kprobes.c | 10 +- trunk/drivers/char/ipmi/ipmi_bt_sm.c | 2 +- trunk/drivers/char/ipmi/ipmi_si_intf.c | 4 +- trunk/drivers/char/tty_io.c | 8 +- trunk/drivers/i2c/chips/m41t00.c | 8 +- trunk/drivers/ide/pci/alim15x3.c | 2 - trunk/drivers/ide/pci/atiixp.c | 1 - trunk/drivers/ide/pci/pdc202xx_old.c | 2 + trunk/drivers/ide/setup-pci.c | 13 ++ trunk/drivers/parport/parport_pc.c | 20 +- trunk/drivers/pnp/manager.c | 4 +- trunk/drivers/serial/m32r_sio.c | 1 + trunk/drivers/video/aty/radeon_base.c | 2 +- trunk/drivers/video/fbmem.c | 14 +- trunk/drivers/video/savage/savagefb_driver.c | 8 +- trunk/fs/Kconfig | 6 - trunk/fs/exec.c | 2 +- trunk/fs/locks.c | 9 +- trunk/fs/proc/base.c | 21 +- trunk/fs/splice.c | 185 ++++++------------ trunk/include/asm-i386/atomic.h | 5 +- trunk/include/asm-m32r/assembler.h | 5 - trunk/include/asm-m32r/mappi3/mappi3_pld.h | 22 +-- trunk/include/asm-m32r/ptrace.h | 25 ++- trunk/include/asm-m32r/semaphore.h | 64 +++++- trunk/include/asm-m32r/sigcontext.h | 2 - trunk/include/asm-m32r/system.h | 67 ++++--- trunk/include/asm-x86_64/percpu.h | 2 +- trunk/include/linux/ide.h | 1 + trunk/include/linux/pci_ids.h | 4 - trunk/include/linux/sched.h | 3 +- trunk/kernel/exit.c | 2 +- trunk/kernel/fork.c | 2 +- trunk/kernel/power/snapshot.c | 9 +- trunk/lib/Kconfig.debug | 2 +- trunk/mm/oom_kill.c | 71 +++---- trunk/mm/page_alloc.c | 10 +- trunk/mm/slob.c | 10 +- trunk/net/sunrpc/auth_gss/gss_krb5_crypto.c | 11 +- trunk/scripts/kconfig/conf.c | 3 +- trunk/security/selinux/ss/mls.c | 2 +- trunk/usr/gen_init_cpio.c | 4 +- 70 files changed, 439 insertions(+), 595 deletions(-) diff --git a/[refs] b/[refs] index 28802f6e55bd..4bd309ec2174 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0efd9323f32c137b5cf48bc6582cd08556e7cdfc +refs/heads/master: d4a30e7e66c004da26dfe5229af7c10fe9853a7a diff --git a/trunk/Documentation/vm/hugetlbpage.txt b/trunk/Documentation/vm/hugetlbpage.txt index 687104bfd09a..2803f63c1a27 100644 --- a/trunk/Documentation/vm/hugetlbpage.txt +++ b/trunk/Documentation/vm/hugetlbpage.txt @@ -32,16 +32,7 @@ The output of "cat /proc/meminfo" will have lines like: ..... HugePages_Total: xxx HugePages_Free: yyy -HugePages_Rsvd: www -Hugepagesize: zzz kB - -where: -HugePages_Total is the size of the pool of hugepages. -HugePages_Free is the number of hugepages in the pool that are not yet -allocated. -HugePages_Rsvd is short for "reserved," and is the number of hugepages -for which a commitment to allocate from the pool has been made, but no -allocation has yet been made. It's vaguely analogous to overcommit. +Hugepagesize: zzz KB /proc/filesystems should also show a filesystem of type "hugetlbfs" configured in the kernel. diff --git a/trunk/README b/trunk/README index 3e264723b863..05e055530bbb 100644 --- a/trunk/README +++ b/trunk/README @@ -165,31 +165,10 @@ CONFIGURING the kernel: "make xconfig" X windows (Qt) based configuration tool. "make gconfig" X windows (Gtk) based configuration tool. "make oldconfig" Default all questions based on the contents of - your existing ./.config file and asking about - new config symbols. + your existing ./.config file. "make silentoldconfig" Like above, but avoids cluttering the screen with questions already answered. - "make defconfig" Create a ./.config file by using the default - symbol values from arch/$ARCH/defconfig. - "make allyesconfig" - Create a ./.config file by setting symbol - values to 'y' as much as possible. - "make allmodconfig" - Create a ./.config file by setting symbol - values to 'm' as much as possible. - "make allnoconfig" Create a ./.config file by setting symbol - values to 'n' as much as possible. - "make randconfig" Create a ./.config file by setting symbol - values to random values. - - The allyesconfig/allmodconfig/allnoconfig/randconfig variants can - also use the environment variable KCONFIG_ALLCONFIG to specify a - filename that contains config options that the user requires to be - set to a specific value. If KCONFIG_ALLCONFIG=filename is not used, - "make *config" checks for a file named "all{yes/mod/no/random}.config" - for symbol values that are to be forced. If this file is not found, - it checks for a file named "all.config" to contain forced values. NOTES on "make config": - having unnecessary drivers will make the kernel bigger, and can diff --git a/trunk/arch/i386/kernel/apm.c b/trunk/arch/i386/kernel/apm.c index df0e1745f189..da30a374dd4e 100644 --- a/trunk/arch/i386/kernel/apm.c +++ b/trunk/arch/i386/kernel/apm.c @@ -1079,7 +1079,7 @@ static int apm_console_blank(int blank) break; } - if (error == APM_NOT_ENGAGED) { + if (error == APM_NOT_ENGAGED && state != APM_STATE_READY) { static int tried; int eng_error; if (tried++ == 0) { diff --git a/trunk/arch/i386/kernel/cpuid.c b/trunk/arch/i386/kernel/cpuid.c index 1d9a4abcdfc7..006141d1c12a 100644 --- a/trunk/arch/i386/kernel/cpuid.c +++ b/trunk/arch/i386/kernel/cpuid.c @@ -168,7 +168,7 @@ static int cpuid_class_device_create(int i) return err; } -static int cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) +static int __devinit cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/trunk/arch/i386/kernel/kprobes.c b/trunk/arch/i386/kernel/kprobes.c index 043f5292e70a..f19768789e8a 100644 --- a/trunk/arch/i386/kernel/kprobes.c +++ b/trunk/arch/i386/kernel/kprobes.c @@ -43,7 +43,7 @@ DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); /* insert a jmp code */ -static __always_inline void set_jmp_op(void *from, void *to) +static inline void set_jmp_op(void *from, void *to) { struct __arch_jmp_op { char op; @@ -57,7 +57,7 @@ static __always_inline void set_jmp_op(void *from, void *to) /* * returns non-zero if opcodes can be boosted. */ -static __always_inline int can_boost(kprobe_opcode_t opcode) +static inline int can_boost(kprobe_opcode_t opcode) { switch (opcode & 0xf0 ) { case 0x70: @@ -88,7 +88,7 @@ static __always_inline int can_boost(kprobe_opcode_t opcode) /* * returns non-zero if opcode modifies the interrupt flag. */ -static int __kprobes is_IF_modifier(kprobe_opcode_t opcode) +static inline int is_IF_modifier(kprobe_opcode_t opcode) { switch (opcode) { case 0xfa: /* cli */ @@ -138,7 +138,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p) mutex_unlock(&kprobe_mutex); } -static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; @@ -146,7 +146,7 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) kcb->prev_kprobe.saved_eflags = kcb->kprobe_saved_eflags; } -static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; @@ -154,7 +154,7 @@ static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) kcb->kprobe_saved_eflags = kcb->prev_kprobe.saved_eflags; } -static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, +static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; @@ -164,7 +164,7 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, kcb->kprobe_saved_eflags &= ~IF_MASK; } -static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) +static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) { regs->eflags |= TF_MASK; regs->eflags &= ~IF_MASK; @@ -507,7 +507,7 @@ static void __kprobes resume_execution(struct kprobe *p, * Interrupts are disabled on entry as trap1 is an interrupt gate and they * remain disabled thoroughout this function. */ -static int __kprobes post_kprobe_handler(struct pt_regs *regs) +static inline int post_kprobe_handler(struct pt_regs *regs) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); @@ -543,7 +543,7 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs) return 1; } -static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) +static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); diff --git a/trunk/arch/i386/kernel/msr.c b/trunk/arch/i386/kernel/msr.c index 7a328230e540..1d0a55e68760 100644 --- a/trunk/arch/i386/kernel/msr.c +++ b/trunk/arch/i386/kernel/msr.c @@ -251,7 +251,7 @@ static int msr_class_device_create(int i) return err; } -static int msr_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) +static int __devinit msr_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/trunk/arch/i386/mach-voyager/voyager_cat.c b/trunk/arch/i386/mach-voyager/voyager_cat.c index 10d21df14531..3039539de51e 100644 --- a/trunk/arch/i386/mach-voyager/voyager_cat.c +++ b/trunk/arch/i386/mach-voyager/voyager_cat.c @@ -120,6 +120,7 @@ static struct resource qic_res = { * It writes num_bits of the data buffer in msg starting at start_bit. * Note: This function assumes that any unused bit in the data stream * is set to zero so that the ors will work correctly */ +#define BITS_PER_BYTE 8 static void cat_pack(__u8 *msg, const __u16 start_bit, __u8 *data, const __u16 num_bits) { diff --git a/trunk/arch/ia64/kernel/kprobes.c b/trunk/arch/ia64/kernel/kprobes.c index f9039f88d01d..789881ca83d4 100644 --- a/trunk/arch/ia64/kernel/kprobes.c +++ b/trunk/arch/ia64/kernel/kprobes.c @@ -251,7 +251,7 @@ static void __kprobes prepare_break_inst(uint template, uint slot, update_kprobe_inst_flag(template, slot, major_opcode, kprobe_inst, p); } -static void __kprobes get_kprobe_inst(bundle_t *bundle, uint slot, +static inline void get_kprobe_inst(bundle_t *bundle, uint slot, unsigned long *kprobe_inst, uint *major_opcode) { unsigned long kprobe_inst_p0, kprobe_inst_p1; @@ -278,7 +278,7 @@ static void __kprobes get_kprobe_inst(bundle_t *bundle, uint slot, } /* Returns non-zero if the addr is in the Interrupt Vector Table */ -static int __kprobes in_ivt_functions(unsigned long addr) +static inline int in_ivt_functions(unsigned long addr) { return (addr >= (unsigned long)__start_ivt_text && addr < (unsigned long)__end_ivt_text); @@ -308,19 +308,19 @@ static int __kprobes valid_kprobe_addr(int template, int slot, return 0; } -static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; } -static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; } -static void __kprobes set_current_kprobe(struct kprobe *p, +static inline void set_current_kprobe(struct kprobe *p, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; diff --git a/trunk/arch/m32r/kernel/entry.S b/trunk/arch/m32r/kernel/entry.S index 920bb742b7a2..3871b65f0c82 100644 --- a/trunk/arch/m32r/kernel/entry.S +++ b/trunk/arch/m32r/kernel/entry.S @@ -20,7 +20,7 @@ * Stack layout in 'ret_from_system_call': * ptrace needs to have all regs on the stack. * if the order here is changed, it needs to be - * updated in fork.c:copy_thread, signal.c:do_signal, + * updated in fork.c:copy_process, signal.c:do_signal, * ptrace.c and ptrace.h * * M32Rx/M32R2 M32R @@ -41,17 +41,18 @@ * @(0x38,sp) - syscall_nr ditto * @(0x3c,sp) - acc0h @(0x3c,sp) - acch * @(0x40,sp) - acc0l @(0x40,sp) - accl - * @(0x44,sp) - acc1h @(0x44,sp) - dummy_acc1h - * @(0x48,sp) - acc1l @(0x48,sp) - dummy_acc1l - * @(0x4c,sp) - psw ditto - * @(0x50,sp) - bpc ditto - * @(0x54,sp) - bbpsw ditto - * @(0x58,sp) - bbpc ditto - * @(0x5c,sp) - spu (cr3) ditto - * @(0x60,sp) - fp (r13) ditto - * @(0x64,sp) - lr (r14) ditto - * @(0x68,sp) - spi (cr2) ditto - * @(0x6c,sp) - orig_r0 ditto + * @(0x44,sp) - acc1h @(0x44,sp) - psw + * @(0x48,sp) - acc1l @(0x48,sp) - bpc + * @(0x4c,sp) - psw @(0x4c,sp) - bbpsw + * @(0x50,sp) - bpc @(0x50,sp) - bbpc + * @(0x54,sp) - bbpsw @(0x54,sp) - spu (cr3) + * @(0x58,sp) - bbpc @(0x58,sp) - fp (r13) + * @(0x5c,sp) - spu (cr3) @(0x5c,sp) - lr (r14) + * @(0x60,sp) - fp (r13) @(0x60,sp) - spi (cr12) + * @(0x64,sp) - lr (r14) @(0x64,sp) - orig_r0 + * @(0x68,sp) - spi (cr2) + * @(0x6c,sp) - orig_r0 + * */ #include @@ -101,12 +102,6 @@ #define ACC0L(reg) @(0x40,reg) #define ACC1H(reg) @(0x44,reg) #define ACC1L(reg) @(0x48,reg) -#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) -#define ACCH(reg) @(0x3C,reg) -#define ACCL(reg) @(0x40,reg) -#else -#error unknown isa configuration -#endif #define PSW(reg) @(0x4C,reg) #define BPC(reg) @(0x50,reg) #define BBPSW(reg) @(0x54,reg) @@ -116,6 +111,21 @@ #define LR(reg) @(0x64,reg) #define SP(reg) @(0x68,reg) #define ORIG_R0(reg) @(0x6C,reg) +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) +#define ACCH(reg) @(0x3C,reg) +#define ACCL(reg) @(0x40,reg) +#define PSW(reg) @(0x44,reg) +#define BPC(reg) @(0x48,reg) +#define BBPSW(reg) @(0x4C,reg) +#define BBPC(reg) @(0x50,reg) +#define SPU(reg) @(0x54,reg) +#define FP(reg) @(0x58,reg) /* FP = R13 */ +#define LR(reg) @(0x5C,reg) +#define SP(reg) @(0x60,reg) +#define ORIG_R0(reg) @(0x64,reg) +#else +#error unknown isa configuration +#endif CF_MASK = 0x00000001 TF_MASK = 0x00000100 @@ -132,7 +142,7 @@ VM_MASK = 0x00020000 #endif ENTRY(ret_from_fork) - pop r0 + ld r0, @sp+ bl schedule_tail GET_THREAD_INFO(r8) bra syscall_exit @@ -221,7 +231,7 @@ restore_all: RESTORE_ALL # perform work that needs to be done immediately before resumption - # r9 : flags + # r9 : frags ALIGN work_pending: and3 r4, r9, #_TIF_NEED_RESCHED @@ -310,7 +320,7 @@ ENTRY(ei_handler) ; GET_ICU_STATUS; seth r0, #shigh(M32R_ICU_ISTS_ADDR) ld r0, @(low(M32R_ICU_ISTS_ADDR),r0) - push r0 + st r0, @-sp #if defined(CONFIG_SMP) /* * If IRQ == 0 --> Nothing to do, Not write IMASK @@ -547,7 +557,7 @@ check_end: #endif /* CONFIG_PLAT_M32104UT */ bl do_IRQ #endif /* CONFIG_SMP */ - pop r14 + ld r14, @sp+ seth r0, #shigh(M32R_ICU_IMASK_ADDR) st r14, @(low(M32R_ICU_IMASK_ADDR),r0) #else @@ -1005,3 +1015,4 @@ ENTRY(sys_call_table) .long sys_waitid syscall_table_size=(.-sys_call_table) + diff --git a/trunk/arch/m32r/kernel/process.c b/trunk/arch/m32r/kernel/process.c index 065f5e719058..5dfc7ea45cf7 100644 --- a/trunk/arch/m32r/kernel/process.c +++ b/trunk/arch/m32r/kernel/process.c @@ -116,10 +116,6 @@ void cpu_idle (void) void machine_restart(char *__unused) { -#if defined(CONFIG_PLAT_MAPPI3) - outw(1, (unsigned long)PLD_REBOOT); -#endif - printk("Please push reset button!\n"); while (1) cpu_relax(); diff --git a/trunk/arch/m32r/kernel/signal.c b/trunk/arch/m32r/kernel/signal.c index 6498ee70bb73..cb33097fefc4 100644 --- a/trunk/arch/m32r/kernel/signal.c +++ b/trunk/arch/m32r/kernel/signal.c @@ -118,8 +118,6 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) COPY(acch); COPY(accl); - COPY(dummy_acc1h); - COPY(dummy_acc1l); #else #error unknown isa configuration #endif @@ -205,8 +203,6 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) COPY(acch); COPY(accl); - COPY(dummy_acc1h); - COPY(dummy_acc1l); #else #error unknown isa configuration #endif diff --git a/trunk/arch/powerpc/kernel/kprobes.c b/trunk/arch/powerpc/kernel/kprobes.c index 856ef1a832b9..ad7a90212204 100644 --- a/trunk/arch/powerpc/kernel/kprobes.c +++ b/trunk/arch/powerpc/kernel/kprobes.c @@ -88,7 +88,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p) mutex_unlock(&kprobe_mutex); } -static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) +static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) { kprobe_opcode_t insn = *p->ainsn.insn; @@ -101,21 +101,21 @@ static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) regs->nip = (unsigned long)p->ainsn.insn; } -static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; kcb->prev_kprobe.saved_msr = kcb->kprobe_saved_msr; } -static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; kcb->kprobe_saved_msr = kcb->prev_kprobe.saved_msr; } -static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, +static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; @@ -141,7 +141,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe *rp, } } -static int __kprobes kprobe_handler(struct pt_regs *regs) +static inline int kprobe_handler(struct pt_regs *regs) { struct kprobe *p; int ret = 0; @@ -334,7 +334,7 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) regs->nip = (unsigned long)p->addr + 4; } -static int __kprobes post_kprobe_handler(struct pt_regs *regs) +static inline int post_kprobe_handler(struct pt_regs *regs) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); @@ -370,7 +370,7 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs) return 1; } -static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) +static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); diff --git a/trunk/arch/sparc64/kernel/kprobes.c b/trunk/arch/sparc64/kernel/kprobes.c index 2e1c824c1cc9..ffc7309e9f22 100644 --- a/trunk/arch/sparc64/kernel/kprobes.c +++ b/trunk/arch/sparc64/kernel/kprobes.c @@ -63,7 +63,7 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) flushi(p->addr); } -static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; @@ -71,7 +71,7 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) kcb->prev_kprobe.orig_tstate_pil = kcb->kprobe_orig_tstate_pil; } -static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; @@ -79,7 +79,7 @@ static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) kcb->kprobe_orig_tstate_pil = kcb->prev_kprobe.orig_tstate_pil; } -static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, +static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; @@ -87,7 +87,7 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, kcb->kprobe_orig_tstate_pil = (regs->tstate & TSTATE_PIL); } -static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs, +static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { regs->tstate |= TSTATE_PIL; @@ -273,7 +273,7 @@ static void __kprobes resume_execution(struct kprobe *p, kcb->kprobe_orig_tstate_pil); } -static int __kprobes post_kprobe_handler(struct pt_regs *regs) +static inline int post_kprobe_handler(struct pt_regs *regs) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); @@ -300,7 +300,7 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs) return 1; } -static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) +static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); diff --git a/trunk/arch/um/drivers/cow_user.c b/trunk/arch/um/drivers/cow_user.c index 6ab852bfcd3a..0ec4052db9c5 100644 --- a/trunk/arch/um/drivers/cow_user.c +++ b/trunk/arch/um/drivers/cow_user.c @@ -100,7 +100,7 @@ struct cow_header_v3_broken { __u32 alignment; __u32 cow_format; char backing_file[PATH_LEN_V3]; -} __attribute__((packed)); +}; /* COW format definitions - for now, we have only the usual COW bitmap */ #define COW_BITMAP 0 diff --git a/trunk/arch/um/include/longjmp.h b/trunk/arch/um/include/longjmp.h index 8e7053013f7b..018b3819ab0b 100644 --- a/trunk/arch/um/include/longjmp.h +++ b/trunk/arch/um/include/longjmp.h @@ -4,11 +4,11 @@ #include #include "os.h" -#define UML_LONGJMP(buf, val) do { \ +#define UML_SIGLONGJMP(buf, val) do { \ longjmp(*buf, val); \ } while(0) -#define UML_SETJMP(buf, enable) ({ \ +#define UML_SIGSETJMP(buf, enable) ({ \ int n; \ enable = get_signals(); \ n = setjmp(*buf); \ diff --git a/trunk/arch/um/include/sysdep-i386/kernel-offsets.h b/trunk/arch/um/include/sysdep-i386/kernel-offsets.h index 2c13de321f2f..82f96c574144 100644 --- a/trunk/arch/um/include/sysdep-i386/kernel-offsets.h +++ b/trunk/arch/um/include/sysdep-i386/kernel-offsets.h @@ -1,7 +1,6 @@ #include #include #include -#include #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) @@ -17,7 +16,6 @@ void foo(void) { OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs); - DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); #ifdef CONFIG_MODE_TT OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); #endif diff --git a/trunk/arch/um/include/sysdep-x86_64/kernel-offsets.h b/trunk/arch/um/include/sysdep-x86_64/kernel-offsets.h index 939cc475757a..5ce93abd0b54 100644 --- a/trunk/arch/um/include/sysdep-x86_64/kernel-offsets.h +++ b/trunk/arch/um/include/sysdep-x86_64/kernel-offsets.h @@ -4,7 +4,6 @@ #include #include #include -#include #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) @@ -19,7 +18,6 @@ void foo(void) { - DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); #ifdef CONFIG_MODE_TT OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); #endif diff --git a/trunk/arch/um/os-Linux/mem.c b/trunk/arch/um/os-Linux/mem.c index c6432e729241..71bb90a7606d 100644 --- a/trunk/arch/um/os-Linux/mem.c +++ b/trunk/arch/um/os-Linux/mem.c @@ -8,7 +8,6 @@ #include #include #include -#include #include "kern_util.h" #include "user.h" #include "user_util.h" @@ -20,7 +19,6 @@ #include -static char *default_tmpdir = "/tmp"; static char *tempdir = NULL; static void __init find_tempdir(void) @@ -36,7 +34,7 @@ static void __init find_tempdir(void) break; } if((dir == NULL) || (*dir == '\0')) - dir = default_tmpdir; + dir = "/tmp"; tempdir = malloc(strlen(dir) + 2); if(tempdir == NULL){ @@ -48,96 +46,6 @@ static void __init find_tempdir(void) strcat(tempdir, "/"); } -/* This will return 1, with the first character in buf being the - * character following the next instance of c in the file. This will - * read the file as needed. If there's an error, -errno is returned; - * if the end of the file is reached, 0 is returned. - */ -static int next(int fd, char *buf, int size, char c) -{ - int n; - char *ptr; - - while((ptr = strchr(buf, c)) == NULL){ - n = read(fd, buf, size - 1); - if(n == 0) - return 0; - else if(n < 0) - return -errno; - - buf[n] = '\0'; - } - - ptr++; - memmove(buf, ptr, strlen(ptr) + 1); - return 1; -} - -static int checked_tmpdir = 0; - -/* Look for a tmpfs mounted at /dev/shm. I couldn't find a cleaner - * way to do this than to parse /proc/mounts. statfs will return the - * same filesystem magic number and fs id for both /dev and /dev/shm - * when they are both tmpfs, so you can't tell if they are different - * filesystems. Also, there seems to be no other way of finding the - * mount point of a filesystem from within it. - * - * If a /dev/shm tmpfs entry is found, then we switch to using it. - * Otherwise, we stay with the default /tmp. - */ -static void which_tmpdir(void) -{ - int fd, found; - char buf[128] = { '\0' }; - - if(checked_tmpdir) - return; - - checked_tmpdir = 1; - - printf("Checking for tmpfs mount on /dev/shm..."); - - fd = open("/proc/mounts", O_RDONLY); - if(fd < 0){ - printf("failed to open /proc/mounts, errno = %d\n", errno); - return; - } - - while(1){ - found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), ' '); - if(found != 1) - break; - - if(!strncmp(buf, "/dev/shm", strlen("/dev/shm"))) - goto found; - - found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), '\n'); - if(found != 1) - break; - } - -err: - if(found == 0) - printf("nothing mounted on /dev/shm\n"); - else if(found < 0) - printf("read returned errno %d\n", -found); - - return; - -found: - found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), ' '); - if(found != 1) - goto err; - - if(strncmp(buf, "tmpfs", strlen("tmpfs"))){ - printf("not tmpfs\n"); - return; - } - - printf("OK\n"); - default_tmpdir = "/dev/shm"; -} - /* * This proc still used in tt-mode * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger). @@ -148,7 +56,6 @@ int make_tempfile(const char *template, char **out_tempname, int do_unlink) char *tempname; int fd; - which_tmpdir(); tempname = malloc(MAXPATHLEN); find_tempdir(); @@ -230,26 +137,3 @@ int create_mem_file(unsigned long long len) } return(fd); } - - -void check_tmpexec(void) -{ - void *addr; - int err, fd = create_tmp_file(UM_KERN_PAGE_SIZE); - - addr = mmap(NULL, UM_KERN_PAGE_SIZE, - PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); - printf("Checking PROT_EXEC mmap in %s...",tempdir); - fflush(stdout); - if(addr == MAP_FAILED){ - err = errno; - perror("failed"); - if(err == EPERM) - printf("%s must be not mounted noexec\n",tempdir); - exit(1); - } - printf("OK\n"); - munmap(addr, UM_KERN_PAGE_SIZE); - - close(fd); -} diff --git a/trunk/arch/um/os-Linux/process.c b/trunk/arch/um/os-Linux/process.c index 3505f44f8a25..8176b0b52047 100644 --- a/trunk/arch/um/os-Linux/process.c +++ b/trunk/arch/um/os-Linux/process.c @@ -190,7 +190,7 @@ int os_unmap_memory(void *addr, int len) } #ifndef MADV_REMOVE -#define MADV_REMOVE KERNEL_MADV_REMOVE +#define MADV_REMOVE 0x5 /* remove these pages & resources */ #endif int os_drop_memory(void *addr, int length) @@ -216,7 +216,7 @@ int can_drop_memory(void) } addr = mmap64(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, 0); + MAP_PRIVATE, fd, 0); if(addr == MAP_FAILED){ printk("Mapping test memory file failed, err = %d\n", -errno); return 0; @@ -266,11 +266,11 @@ void init_new_thread_signals(int altstack) int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) { - jmp_buf buf; + sigjmp_buf buf; int n, enable; *jmp_ptr = &buf; - n = UML_SETJMP(&buf, enable); + n = UML_SIGSETJMP(&buf, enable); if(n != 0) return(n); (*fn)(arg); diff --git a/trunk/arch/um/os-Linux/skas/process.c b/trunk/arch/um/os-Linux/skas/process.c index 0776bc18ca85..045ae0037456 100644 --- a/trunk/arch/um/os-Linux/skas/process.c +++ b/trunk/arch/um/os-Linux/skas/process.c @@ -434,7 +434,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, void (*handler)(int)) { unsigned long flags; - jmp_buf switch_buf, fork_buf; + sigjmp_buf switch_buf, fork_buf; int enable; *switch_buf_ptr = &switch_buf; @@ -450,7 +450,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, */ flags = get_signals(); block_signals(); - if(UML_SETJMP(&fork_buf, enable) == 0) + if(UML_SIGSETJMP(&fork_buf, enable) == 0) new_thread_proc(stack, handler); remove_sigstack(); @@ -466,35 +466,35 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, void thread_wait(void *sw, void *fb) { - jmp_buf buf, **switch_buf = sw, *fork_buf; + sigjmp_buf buf, **switch_buf = sw, *fork_buf; int enable; *switch_buf = &buf; fork_buf = fb; - if(UML_SETJMP(&buf, enable) == 0) + if(UML_SIGSETJMP(&buf, enable) == 0) siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); } void switch_threads(void *me, void *next) { - jmp_buf my_buf, **me_ptr = me, *next_buf = next; + sigjmp_buf my_buf, **me_ptr = me, *next_buf = next; int enable; *me_ptr = &my_buf; - if(UML_SETJMP(&my_buf, enable) == 0) - UML_LONGJMP(next_buf, 1); + if(UML_SIGSETJMP(&my_buf, enable) == 0) + UML_SIGLONGJMP(next_buf, 1); } -static jmp_buf initial_jmpbuf; +static sigjmp_buf initial_jmpbuf; /* XXX Make these percpu */ static void (*cb_proc)(void *arg); static void *cb_arg; -static jmp_buf *cb_back; +static sigjmp_buf *cb_back; int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) { - jmp_buf **switch_buf = switch_buf_ptr; + sigjmp_buf **switch_buf = switch_buf_ptr; int n, enable; set_handler(SIGWINCH, (__sighandler_t) sig_handler, @@ -502,7 +502,7 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) SIGVTALRM, -1); *fork_buf_ptr = &initial_jmpbuf; - n = UML_SETJMP(&initial_jmpbuf, enable); + n = UML_SIGSETJMP(&initial_jmpbuf, enable); switch(n){ case INIT_JMP_NEW_THREAD: new_thread_proc((void *) stack, new_thread_handler); @@ -512,7 +512,7 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) break; case INIT_JMP_CALLBACK: (*cb_proc)(cb_arg); - UML_LONGJMP(cb_back, 1); + UML_SIGLONGJMP(cb_back, 1); break; case INIT_JMP_HALT: kmalloc_ok = 0; @@ -523,12 +523,12 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) default: panic("Bad sigsetjmp return in start_idle_thread - %d\n", n); } - UML_LONGJMP(*switch_buf, 1); + UML_SIGLONGJMP(*switch_buf, 1); } void initial_thread_cb_skas(void (*proc)(void *), void *arg) { - jmp_buf here; + sigjmp_buf here; int enable; cb_proc = proc; @@ -536,8 +536,8 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg) cb_back = &here; block_signals(); - if(UML_SETJMP(&here, enable) == 0) - UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); + if(UML_SIGSETJMP(&here, enable) == 0) + UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); unblock_signals(); cb_proc = NULL; @@ -548,13 +548,13 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg) void halt_skas(void) { block_signals(); - UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT); + UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_HALT); } void reboot_skas(void) { block_signals(); - UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); + UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); } void switch_mm_skas(struct mm_id *mm_idp) diff --git a/trunk/arch/um/os-Linux/start_up.c b/trunk/arch/um/os-Linux/start_up.c index 503148504009..387e26af301a 100644 --- a/trunk/arch/um/os-Linux/start_up.c +++ b/trunk/arch/um/os-Linux/start_up.c @@ -296,7 +296,29 @@ static void __init check_ptrace(void) check_sysemu(); } -extern void check_tmpexec(void); +extern int create_tmp_file(unsigned long long len); + +static void check_tmpexec(void) +{ + void *addr; + int err, fd = create_tmp_file(UM_KERN_PAGE_SIZE); + + addr = mmap(NULL, UM_KERN_PAGE_SIZE, + PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); + printf("Checking PROT_EXEC mmap in /tmp..."); + fflush(stdout); + if(addr == MAP_FAILED){ + err = errno; + perror("failed"); + if(err == EPERM) + printf("/tmp must be not mounted noexec\n"); + exit(1); + } + printf("OK\n"); + munmap(addr, UM_KERN_PAGE_SIZE); + + close(fd); +} void os_early_checks(void) { diff --git a/trunk/arch/um/os-Linux/trap.c b/trunk/arch/um/os-Linux/trap.c index 90b29ae9af46..a9f6b26f9828 100644 --- a/trunk/arch/um/os-Linux/trap.c +++ b/trunk/arch/um/os-Linux/trap.c @@ -35,7 +35,7 @@ void os_fill_handlinfo(struct kern_handlers h) void do_longjmp(void *b, int val) { - jmp_buf *buf = b; + sigjmp_buf *buf = b; - UML_LONGJMP(buf, val); + UML_SIGLONGJMP(buf, val); } diff --git a/trunk/arch/um/os-Linux/uaccess.c b/trunk/arch/um/os-Linux/uaccess.c index e523719330b2..166fb66995df 100644 --- a/trunk/arch/um/os-Linux/uaccess.c +++ b/trunk/arch/um/os-Linux/uaccess.c @@ -16,9 +16,9 @@ unsigned long __do_user_copy(void *to, const void *from, int n, unsigned long *faddrp = (unsigned long *) fault_addr, ret; int enable; - jmp_buf jbuf; + sigjmp_buf jbuf; *fault_catcher = &jbuf; - if(UML_SETJMP(&jbuf, enable) == 0){ + if(UML_SIGSETJMP(&jbuf, enable) == 0){ (*op)(to, from, n); ret = 0; *faulted_out = 0; diff --git a/trunk/arch/um/os-Linux/util.c b/trunk/arch/um/os-Linux/util.c index c47a2a7ce70e..e32065e2fdc8 100644 --- a/trunk/arch/um/os-Linux/util.c +++ b/trunk/arch/um/os-Linux/util.c @@ -104,7 +104,7 @@ void setup_hostinfo(void) int setjmp_wrapper(void (*proc)(void *, void *), ...) { va_list args; - jmp_buf buf; + sigjmp_buf buf; int n; n = sigsetjmp(buf, 1); diff --git a/trunk/arch/um/sys-i386/signal.c b/trunk/arch/um/sys-i386/signal.c index 0709fc6670c2..618fd8594643 100644 --- a/trunk/arch/um/sys-i386/signal.c +++ b/trunk/arch/um/sys-i386/signal.c @@ -57,7 +57,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, return(0); } -int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *to_fp, +int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate __user *to_fp, struct pt_regs *regs, unsigned long sp) { struct sigcontext sc; @@ -132,7 +132,7 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from, return(err); } -int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp, +int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate __user *fp, struct sigcontext *from, int fpsize, unsigned long sp) { struct _fpstate __user *to_fp; @@ -167,7 +167,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from) return(ret); } -static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp, +static int copy_sc_to_user(struct sigcontext *to, struct _fpstate __user *fp, struct pt_regs *from, unsigned long sp) { return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), diff --git a/trunk/arch/um/sys-i386/stub_segv.c b/trunk/arch/um/sys-i386/stub_segv.c index 2355dc19c46c..a37f672ec964 100644 --- a/trunk/arch/um/sys-i386/stub_segv.c +++ b/trunk/arch/um/sys-i386/stub_segv.c @@ -27,6 +27,6 @@ stub_segv_handler(int sig) * the stack in its original form when we do the sigreturn here, by * hand. */ - __asm__ __volatile__("mov %0,%%esp ; movl %1, %%eax ; " - "int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); + __asm__("mov %0,%%esp ; movl %1, %%eax ; " + "int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); } diff --git a/trunk/arch/um/sys-x86_64/stub_segv.c b/trunk/arch/um/sys-x86_64/stub_segv.c index 1c967026c957..a27099533198 100644 --- a/trunk/arch/um/sys-x86_64/stub_segv.c +++ b/trunk/arch/um/sys-x86_64/stub_segv.c @@ -33,7 +33,7 @@ stub_segv_handler(int sig) struct ucontext *uc; int pid; - __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :); + __asm__("movq %%rdx, %0" : "=g" (uc) :); GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), &uc->uc_mcontext); @@ -44,8 +44,8 @@ stub_segv_handler(int sig) * the signal frame. So, we use the ucontext pointer, which we know * already, to get the signal frame pointer, and add 8 to that. */ - __asm__ __volatile__("movq %0, %%rsp; movq %1, %%rax ; syscall": : - "g" ((unsigned long) - container_of(uc, struct rt_sigframe, uc) + 8), - "g" (__NR_rt_sigreturn)); + __asm__("movq %0, %%rsp; movq %1, %%rax ; syscall": : + "g" ((unsigned long) container_of(uc, struct rt_sigframe, + uc) + 8), + "g" (__NR_rt_sigreturn)); } diff --git a/trunk/arch/x86_64/kernel/kprobes.c b/trunk/arch/x86_64/kernel/kprobes.c index 1eaa5dae6174..accbff3fec49 100644 --- a/trunk/arch/x86_64/kernel/kprobes.c +++ b/trunk/arch/x86_64/kernel/kprobes.c @@ -53,7 +53,7 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); /* * returns non-zero if opcode modifies the interrupt flag. */ -static __always_inline int is_IF_modifier(kprobe_opcode_t *insn) +static inline int is_IF_modifier(kprobe_opcode_t *insn) { switch (*insn) { case 0xfa: /* cli */ @@ -84,7 +84,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) * If it does, return the address of the 32-bit displacement word. * If not, return null. */ -static s32 __kprobes *is_riprel(u8 *insn) +static inline s32 *is_riprel(u8 *insn) { #define W(row,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,ba,bb,bc,bd,be,bf) \ (((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) | \ @@ -229,7 +229,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p) mutex_unlock(&kprobe_mutex); } -static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; @@ -237,7 +237,7 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) kcb->prev_kprobe.saved_rflags = kcb->kprobe_saved_rflags; } -static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; @@ -245,7 +245,7 @@ static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) kcb->kprobe_saved_rflags = kcb->prev_kprobe.saved_rflags; } -static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, +static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; diff --git a/trunk/drivers/char/ipmi/ipmi_bt_sm.c b/trunk/drivers/char/ipmi/ipmi_bt_sm.c index 0030cd8e2e95..58dcdee1cd71 100644 --- a/trunk/drivers/char/ipmi/ipmi_bt_sm.c +++ b/trunk/drivers/char/ipmi/ipmi_bt_sm.c @@ -165,7 +165,7 @@ static int bt_start_transaction(struct si_sm_data *bt, { unsigned int i; - if ((size < 2) || (size > (IPMI_MAX_MSG_LENGTH - 2))) + if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH)) return -1; if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED)) diff --git a/trunk/drivers/char/ipmi/ipmi_si_intf.c b/trunk/drivers/char/ipmi/ipmi_si_intf.c index b36eef0e9d19..a86c0f29953e 100644 --- a/trunk/drivers/char/ipmi/ipmi_si_intf.c +++ b/trunk/drivers/char/ipmi/ipmi_si_intf.c @@ -2198,11 +2198,11 @@ static inline void wait_for_timer_and_thread(struct smi_info *smi_info) } } -static __devinitdata struct ipmi_default_vals +static struct ipmi_default_vals { int type; int port; -} ipmi_defaults[] = +} __devinit ipmi_defaults[] = { { .type = SI_KCS, .port = 0xca2 }, { .type = SI_SMIC, .port = 0xca9 }, diff --git a/trunk/drivers/char/tty_io.c b/trunk/drivers/char/tty_io.c index f07637a8f88f..841f0bd3eaaf 100644 --- a/trunk/drivers/char/tty_io.c +++ b/trunk/drivers/char/tty_io.c @@ -2723,11 +2723,7 @@ static void __do_SAK(void *arg) } task_lock(p); if (p->files) { - /* - * We don't take a ref to the file, so we must - * hold ->file_lock instead. - */ - spin_lock(&p->files->file_lock); + rcu_read_lock(); fdt = files_fdtable(p->files); for (i=0; i < fdt->max_fds; i++) { filp = fcheck_files(p->files, i); @@ -2742,7 +2738,7 @@ static void __do_SAK(void *arg) break; } } - spin_unlock(&p->files->file_lock); + rcu_read_unlock(); } task_unlock(p); } while_each_thread(g, p); diff --git a/trunk/drivers/i2c/chips/m41t00.c b/trunk/drivers/i2c/chips/m41t00.c index 99ab4ec34390..27fc9ff2961a 100644 --- a/trunk/drivers/i2c/chips/m41t00.c +++ b/trunk/drivers/i2c/chips/m41t00.c @@ -131,13 +131,13 @@ m41t00_set(void *arg) if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0) || (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f) < 0) - || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x3f) + || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x7f) < 0) - || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x3f) + || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x7f) < 0) - || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x1f) + || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x7f) < 0) - || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0xff) + || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0x7f) < 0)) dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n"); diff --git a/trunk/drivers/ide/pci/alim15x3.c b/trunk/drivers/ide/pci/alim15x3.c index 8b24b4f2a839..cf84350efc55 100644 --- a/trunk/drivers/ide/pci/alim15x3.c +++ b/trunk/drivers/ide/pci/alim15x3.c @@ -731,8 +731,6 @@ static unsigned int __devinit ata66_ali15x3 (ide_hwif_t *hwif) if(m5229_revision <= 0x20) tmpbyte = (tmpbyte & (~0x02)) | 0x01; - else if (m5229_revision == 0xc7) - tmpbyte |= 0x03; else tmpbyte |= 0x01; diff --git a/trunk/drivers/ide/pci/atiixp.c b/trunk/drivers/ide/pci/atiixp.c index 900efd1da587..df9ee9a78435 100644 --- a/trunk/drivers/ide/pci/atiixp.c +++ b/trunk/drivers/ide/pci/atiixp.c @@ -348,7 +348,6 @@ static struct pci_device_id atiixp_pci_tbl[] = { { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); diff --git a/trunk/drivers/ide/pci/pdc202xx_old.c b/trunk/drivers/ide/pci/pdc202xx_old.c index 7ce5bf783688..6f8f8645b02c 100644 --- a/trunk/drivers/ide/pci/pdc202xx_old.c +++ b/trunk/drivers/ide/pci/pdc202xx_old.c @@ -798,6 +798,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .flags = IDEPCI_FLAG_FORCE_PDC, },{ /* 2 */ .name = "PDC20263", .init_setup = init_setup_pdc202ata4, @@ -818,6 +819,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = { .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, + .flags = IDEPCI_FLAG_FORCE_PDC, },{ /* 4 */ .name = "PDC20267", .init_setup = init_setup_pdc202xx, diff --git a/trunk/drivers/ide/setup-pci.c b/trunk/drivers/ide/setup-pci.c index 462ed3006c30..7ebf992e8c2f 100644 --- a/trunk/drivers/ide/setup-pci.c +++ b/trunk/drivers/ide/setup-pci.c @@ -580,6 +580,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a int port; int at_least_one_hwif_enabled = 0; ide_hwif_t *hwif, *mate = NULL; + static int secondpdc = 0; u8 tmp; index->all = 0xf0f0; @@ -591,9 +592,21 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a for (port = 0; port <= 1; ++port) { ide_pci_enablebit_t *e = &(d->enablebits[port]); + /* + * If this is a Promise FakeRaid controller, + * the 2nd controller will be marked as + * disabled while it is actually there and enabled + * by the bios for raid purposes. + * Skip the normal "is it enabled" test for those. + */ + if ((d->flags & IDEPCI_FLAG_FORCE_PDC) && + (secondpdc++==1) && (port==1)) + goto controller_ok; + if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || (tmp & e->mask) != e->val)) continue; /* port not enabled */ +controller_ok: if (d->channels <= port) break; diff --git a/trunk/drivers/parport/parport_pc.c b/trunk/drivers/parport/parport_pc.c index 48bbf32fd980..d5890027f8af 100644 --- a/trunk/drivers/parport/parport_pc.c +++ b/trunk/drivers/parport/parport_pc.c @@ -97,7 +97,7 @@ static struct superio_struct { /* For Super-IO chips autodetection */ int io; int irq; int dma; -} superios[NR_SUPERIOS] = { {0,},}; +} superios[NR_SUPERIOS] __devinitdata = { {0,},}; static int user_specified; #if defined(CONFIG_PARPORT_PC_SUPERIO) || \ @@ -1557,7 +1557,7 @@ static int __devinit get_superio_dma (struct parport *p) return PARPORT_DMA_NONE; } -static int get_superio_irq (struct parport *p) +static int __devinit get_superio_irq (struct parport *p) { int i=0; while( (superios[i].io != p->base) && (iprivate_data; unsigned char r = 0xc; @@ -1712,7 +1712,7 @@ static int parport_ECR_present(struct parport *pb) * be misdetected here is rather academic. */ -static int parport_PS2_supported(struct parport *pb) +static int __devinit parport_PS2_supported(struct parport *pb) { int ok = 0; @@ -1868,7 +1868,7 @@ static int __devinit parport_ECP_supported(struct parport *pb) } #endif -static int parport_ECPPS2_supported(struct parport *pb) +static int __devinit parport_ECPPS2_supported(struct parport *pb) { const struct parport_pc_private *priv = pb->private_data; int result; @@ -1886,7 +1886,7 @@ static int parport_ECPPS2_supported(struct parport *pb) /* EPP mode detection */ -static int parport_EPP_supported(struct parport *pb) +static int __devinit parport_EPP_supported(struct parport *pb) { const struct parport_pc_private *priv = pb->private_data; @@ -1931,7 +1931,7 @@ static int parport_EPP_supported(struct parport *pb) return 1; } -static int parport_ECPEPP_supported(struct parport *pb) +static int __devinit parport_ECPEPP_supported(struct parport *pb) { struct parport_pc_private *priv = pb->private_data; int result; @@ -2073,7 +2073,7 @@ static int __devinit irq_probe_SPP(struct parport *pb) * When ECP is available we can autoprobe for IRQs. * NOTE: If we can autoprobe it, we can register the IRQ. */ -static int parport_irq_probe(struct parport *pb) +static int __devinit parport_irq_probe(struct parport *pb) { struct parport_pc_private *priv = pb->private_data; @@ -2779,7 +2779,7 @@ static struct parport_pc_pci { /* If set, this is called after probing for ports. If 'failed' * is non-zero we couldn't use any of the ports. */ void (*postinit_hook) (struct pci_dev *pdev, int failed); -} cards[] = { +} cards[] __devinitdata = { /* siig_1p_10x */ { 1, { { 2, 3 }, } }, /* siig_2p_10x */ { 2, { { 2, 3 }, { 4, 5 }, } }, /* siig_1p_20x */ { 1, { { 0, 1 }, } }, diff --git a/trunk/drivers/pnp/manager.c b/trunk/drivers/pnp/manager.c index 6fff109bdab6..c4256aa32bcb 100644 --- a/trunk/drivers/pnp/manager.c +++ b/trunk/drivers/pnp/manager.c @@ -479,7 +479,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev) int pnp_start_dev(struct pnp_dev *dev) { if (!pnp_can_write(dev)) { - pnp_info("Device %s does not support activation.", dev->dev.bus_id); + pnp_info("Device %s does not supported activation.", dev->dev.bus_id); return -EINVAL; } @@ -503,7 +503,7 @@ int pnp_start_dev(struct pnp_dev *dev) int pnp_stop_dev(struct pnp_dev *dev) { if (!pnp_can_disable(dev)) { - pnp_info("Device %s does not support disabling.", dev->dev.bus_id); + pnp_info("Device %s does not supported disabling.", dev->dev.bus_id); return -EINVAL; } if (dev->protocol->disable(dev)<0) { diff --git a/trunk/drivers/serial/m32r_sio.c b/trunk/drivers/serial/m32r_sio.c index 321a40f33b50..e9c10c0a30fc 100644 --- a/trunk/drivers/serial/m32r_sio.c +++ b/trunk/drivers/serial/m32r_sio.c @@ -1057,6 +1057,7 @@ static void m32r_sio_console_write(struct console *co, const char *s, { struct uart_sio_port *up = &m32r_sio_ports[co->index]; unsigned int ier; + int i; /* * First save the UER then disable the interrupts diff --git a/trunk/drivers/video/aty/radeon_base.c b/trunk/drivers/video/aty/radeon_base.c index 387a18a47ac2..9a6b5b39b88e 100644 --- a/trunk/drivers/video/aty/radeon_base.c +++ b/trunk/drivers/video/aty/radeon_base.c @@ -2265,7 +2265,7 @@ static struct bin_attribute edid2_attr = { }; -static int __devinit radeonfb_pci_register (struct pci_dev *pdev, +static int radeonfb_pci_register (struct pci_dev *pdev, const struct pci_device_id *ent) { struct fb_info *info; diff --git a/trunk/drivers/video/fbmem.c b/trunk/drivers/video/fbmem.c index 372aa1776827..8d8eadb64853 100644 --- a/trunk/drivers/video/fbmem.c +++ b/trunk/drivers/video/fbmem.c @@ -674,19 +674,13 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) total_size = info->fix.smem_len; if (p > total_size) - return -EFBIG; + return 0; - if (count > total_size) { - err = -EFBIG; + if (count >= total_size) count = total_size; - } - - if (count + p > total_size) { - if (!err) - err = -ENOSPC; + if (count + p > total_size) count = total_size - p; - } buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); @@ -728,7 +722,7 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) kfree(buffer); - return (cnt) ? cnt : err; + return (err) ? err : cnt; } #ifdef CONFIG_KMOD diff --git a/trunk/drivers/video/savage/savagefb_driver.c b/trunk/drivers/video/savage/savagefb_driver.c index 0da624e6524f..10e6b3aab9ea 100644 --- a/trunk/drivers/video/savage/savagefb_driver.c +++ b/trunk/drivers/video/savage/savagefb_driver.c @@ -73,7 +73,7 @@ /* --------------------------------------------------------------------- */ -static char *mode_option __devinitdata = NULL; +static char *mode_option __initdata = NULL; #ifdef MODULE @@ -1545,7 +1545,7 @@ static int __devinit savage_map_mmio (struct fb_info *info) return 0; } -static void savage_unmap_mmio (struct fb_info *info) +static void __devinit savage_unmap_mmio (struct fb_info *info) { struct savagefb_par *par = info->par; DBG ("savage_unmap_mmio"); @@ -1597,7 +1597,7 @@ static int __devinit savage_map_video (struct fb_info *info, return 0; } -static void savage_unmap_video (struct fb_info *info) +static void __devinit savage_unmap_video (struct fb_info *info) { struct savagefb_par *par = info->par; @@ -1614,7 +1614,7 @@ static void savage_unmap_video (struct fb_info *info) } } -static int savage_init_hw (struct savagefb_par *par) +static int __devinit savage_init_hw (struct savagefb_par *par) { unsigned char config1, m, n, n1, n2, sr8, cr3f, cr66 = 0, tmp; diff --git a/trunk/fs/Kconfig b/trunk/fs/Kconfig index f9b5842c8d2d..2524629dc835 100644 --- a/trunk/fs/Kconfig +++ b/trunk/fs/Kconfig @@ -842,12 +842,6 @@ config TMPFS config HUGETLBFS bool "HugeTLB file system support" depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || BROKEN - help - hugetlbfs is a filesystem backing for HugeTLB pages, based on - ramfs. For architectures that support it, say Y here and read - for details. - - If unsure, say N. config HUGETLB_PAGE def_bool HUGETLBFS diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index 3a79d97ac234..4121bb559739 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -712,7 +712,7 @@ static int de_thread(struct task_struct *tsk) attach_pid(current, PIDTYPE_PID, current->pid); attach_pid(current, PIDTYPE_PGID, current->signal->pgrp); attach_pid(current, PIDTYPE_SID, current->signal->session); - list_add_tail_rcu(¤t->tasks, &init_task.tasks); + list_add_tail(¤t->tasks, &init_task.tasks); current->group_leader = current; leader->group_leader = current; diff --git a/trunk/fs/locks.c b/trunk/fs/locks.c index efad798824dc..dda83d6cd48b 100644 --- a/trunk/fs/locks.c +++ b/trunk/fs/locks.c @@ -2230,12 +2230,7 @@ void steal_locks(fl_owner_t from) lock_kernel(); j = 0; - - /* - * We are not taking a ref to the file structures, so - * we need to acquire ->file_lock. - */ - spin_lock(&files->file_lock); + rcu_read_lock(); fdt = files_fdtable(files); for (;;) { unsigned long set; @@ -2253,7 +2248,7 @@ void steal_locks(fl_owner_t from) set >>= 1; } } - spin_unlock(&files->file_lock); + rcu_read_unlock(); unlock_kernel(); } EXPORT_SYMBOL(steal_locks); diff --git a/trunk/fs/proc/base.c b/trunk/fs/proc/base.c index 6cc77dc3f3ff..a3a3eecef689 100644 --- a/trunk/fs/proc/base.c +++ b/trunk/fs/proc/base.c @@ -297,20 +297,16 @@ static int proc_fd_link(struct inode *inode, struct dentry **dentry, struct vfsm files = get_files_struct(task); if (files) { - /* - * We are not taking a ref to the file structure, so we must - * hold ->file_lock. - */ - spin_lock(&files->file_lock); + rcu_read_lock(); file = fcheck_files(files, fd); if (file) { *mnt = mntget(file->f_vfsmnt); *dentry = dget(file->f_dentry); - spin_unlock(&files->file_lock); + rcu_read_unlock(); put_files_struct(files); return 0; } - spin_unlock(&files->file_lock); + rcu_read_unlock(); put_files_struct(files); } return -ENOENT; @@ -1527,12 +1523,7 @@ static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry, if (!files) goto out_unlock; inode->i_mode = S_IFLNK; - - /* - * We are not taking a ref to the file structure, so we must - * hold ->file_lock. - */ - spin_lock(&files->file_lock); + rcu_read_lock(); file = fcheck_files(files, fd); if (!file) goto out_unlock2; @@ -1540,7 +1531,7 @@ static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry, inode->i_mode |= S_IRUSR | S_IXUSR; if (file->f_mode & 2) inode->i_mode |= S_IWUSR | S_IXUSR; - spin_unlock(&files->file_lock); + rcu_read_unlock(); put_files_struct(files); inode->i_op = &proc_pid_link_inode_operations; inode->i_size = 64; @@ -1550,7 +1541,7 @@ static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry, return NULL; out_unlock2: - spin_unlock(&files->file_lock); + rcu_read_unlock(); put_files_struct(files); out_unlock: iput(inode); diff --git a/trunk/fs/splice.c b/trunk/fs/splice.c index 22fac87e90b3..8d57e89924a6 100644 --- a/trunk/fs/splice.c +++ b/trunk/fs/splice.c @@ -50,8 +50,7 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *info, struct page *page = buf->page; struct address_space *mapping = page_mapping(page); - lock_page(page); - + WARN_ON(!PageLocked(page)); WARN_ON(!PageUptodate(page)); /* @@ -66,10 +65,8 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *info, if (PagePrivate(page)) try_to_release_page(page, mapping_gfp_mask(mapping)); - if (!remove_mapping(mapping, page)) { - unlock_page(page); + if (!remove_mapping(mapping, page)) return 1; - } buf->flags |= PIPE_BUF_FLAG_STOLEN | PIPE_BUF_FLAG_LRU; return 0; @@ -148,8 +145,8 @@ static struct pipe_buf_operations page_cache_pipe_buf_ops = { * pipe buffer operations. Otherwise very similar to the regular pipe_writev(). */ static ssize_t move_to_pipe(struct pipe_inode_info *pipe, struct page **pages, - int nr_pages, unsigned long len, - unsigned int offset, unsigned int flags) + int nr_pages, unsigned long offset, + unsigned long len, unsigned int flags) { int ret, do_wakeup, i; @@ -246,16 +243,14 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, unsigned int flags) { struct address_space *mapping = in->f_mapping; - unsigned int loff, offset, nr_pages; + unsigned int offset, nr_pages; struct page *pages[PIPE_BUFFERS]; struct page *page; - pgoff_t index, end_index; - loff_t isize; - size_t bytes; + pgoff_t index; int i, error; index = *ppos >> PAGE_CACHE_SHIFT; - loff = offset = *ppos & ~PAGE_CACHE_MASK; + offset = *ppos & ~PAGE_CACHE_MASK; nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; if (nr_pages > PIPE_BUFFERS) @@ -273,7 +268,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, * Now fill in the holes: */ error = 0; - bytes = 0; for (i = 0; i < nr_pages; i++, index++) { find_page: /* @@ -281,6 +275,14 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, */ page = find_get_page(mapping, index); if (!page) { + /* + * If in nonblock mode then dont block on + * readpage (we've kicked readahead so there + * will be asynchronous progress): + */ + if (flags & SPLICE_F_NONBLOCK) + break; + /* * page didn't exist, allocate one */ @@ -302,13 +304,6 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, * If the page isn't uptodate, we may need to start io on it */ if (!PageUptodate(page)) { - /* - * If in nonblock mode then dont block on waiting - * for an in-flight io page - */ - if (flags & SPLICE_F_NONBLOCK) - break; - lock_page(page); /* @@ -341,41 +336,13 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, goto find_page; break; } - - /* - * i_size must be checked after ->readpage(). - */ - isize = i_size_read(mapping->host); - end_index = (isize - 1) >> PAGE_CACHE_SHIFT; - if (unlikely(!isize || index > end_index)) { - page_cache_release(page); - break; - } - - /* - * if this is the last page, see if we need to shrink - * the length and stop - */ - if (end_index == index) { - loff = PAGE_CACHE_SIZE - (isize & ~PAGE_CACHE_MASK); - if (bytes + loff > isize) { - page_cache_release(page); - break; - } - /* - * force quit after adding this page - */ - nr_pages = i; - } } fill_it: pages[i] = page; - bytes += PAGE_CACHE_SIZE - loff; - loff = 0; } if (i) - return move_to_pipe(pipe, pages, i, bytes, offset, flags); + return move_to_pipe(pipe, pages, i, offset, len, flags); return error; } @@ -402,20 +369,17 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos, while (len) { ret = __generic_file_splice_read(in, ppos, pipe, len, flags); - if (ret < 0) + if (ret <= 0) break; - else if (!ret) { - if (spliced) - break; - if (flags & SPLICE_F_NONBLOCK) { - ret = -EAGAIN; - break; - } - } *ppos += ret; len -= ret; spliced += ret; + + if (!(flags & SPLICE_F_NONBLOCK)) + continue; + ret = -EAGAIN; + break; } if (spliced) @@ -510,12 +474,14 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf, if (sd->flags & SPLICE_F_MOVE) { /* * If steal succeeds, buf->page is now pruned from the vm - * side (LRU and page cache) and we can reuse it. The page - * will also be looked on successful return. + * side (LRU and page cache) and we can reuse it. */ if (buf->ops->steal(info, buf)) goto find_page; + /* + * this will also set the page locked + */ page = buf->page; if (add_to_page_cache(page, mapping, index, gfp_mask)) goto find_page; @@ -524,27 +490,15 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf, lru_cache_add(page); } else { find_page: - page = find_lock_page(mapping, index); - if (!page) { - ret = -ENOMEM; - page = page_cache_alloc_cold(mapping); - if (unlikely(!page)) - goto out_nomem; - - /* - * This will also lock the page - */ - ret = add_to_page_cache_lru(page, mapping, index, - gfp_mask); - if (unlikely(ret)) - goto out; - } + ret = -ENOMEM; + page = find_or_create_page(mapping, index, gfp_mask); + if (!page) + goto out_nomem; /* - * We get here with the page locked. If the page is also - * uptodate, we don't need to do more. If it isn't, we - * may need to bring it in if we are not going to overwrite - * the full page. + * If the page is uptodate, it is also locked. If it isn't + * uptodate, we can mark it uptodate if we are filling the + * full page. Otherwise we need to read it in first... */ if (!PageUptodate(page)) { if (sd->len < PAGE_CACHE_SIZE) { @@ -566,8 +520,10 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf, ret = -EIO; goto out; } - } else + } else { + WARN_ON(!PageLocked(page)); SetPageUptodate(page); + } } } @@ -596,10 +552,10 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf, mark_page_accessed(page); balance_dirty_pages_ratelimited(mapping); out: - if (!(buf->flags & PIPE_BUF_FLAG_STOLEN)) + if (!(buf->flags & PIPE_BUF_FLAG_STOLEN)) { page_cache_release(page); - - unlock_page(page); + unlock_page(page); + } out_nomem: buf->ops->unmap(info, buf); return ret; @@ -731,26 +687,22 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, ssize_t ret; ret = move_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); - if (ret > 0) { - struct inode *inode = mapping->host; - - *ppos += ret; - /* - * If file or inode is SYNC and we actually wrote some data, - * sync it. - */ - if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { - int err; + /* + * If file or inode is SYNC and we actually wrote some data, sync it. + */ + if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(mapping->host)) + && ret > 0) { + struct inode *inode = mapping->host; + int err; - mutex_lock(&inode->i_mutex); - err = generic_osync_inode(inode, mapping, - OSYNC_METADATA|OSYNC_DATA); - mutex_unlock(&inode->i_mutex); + mutex_lock(&inode->i_mutex); + err = generic_osync_inode(mapping->host, mapping, + OSYNC_METADATA|OSYNC_DATA); + mutex_unlock(&inode->i_mutex); - if (err) - ret = err; - } + if (err) + ret = err; } return ret; @@ -952,7 +904,6 @@ static long do_splice(struct file *in, loff_t __user *off_in, { struct pipe_inode_info *pipe; loff_t offset, *off; - long ret; pipe = in->f_dentry->d_inode->i_pipe; if (pipe) { @@ -967,12 +918,7 @@ static long do_splice(struct file *in, loff_t __user *off_in, } else off = &out->f_pos; - ret = do_splice_from(pipe, out, off, len, flags); - - if (off_out && copy_to_user(off_out, off, sizeof(loff_t))) - ret = -EFAULT; - - return ret; + return do_splice_from(pipe, out, off, len, flags); } pipe = out->f_dentry->d_inode->i_pipe; @@ -988,12 +934,7 @@ static long do_splice(struct file *in, loff_t __user *off_in, } else off = &in->f_pos; - ret = do_splice_to(in, off, pipe, len, flags); - - if (off_in && copy_to_user(off_in, off, sizeof(loff_t))) - ret = -EFAULT; - - return ret; + return do_splice_to(in, off, pipe, len, flags); } return -EINVAL; @@ -1038,9 +979,7 @@ static int link_pipe(struct pipe_inode_info *ipipe, size_t len, unsigned int flags) { struct pipe_buffer *ibuf, *obuf; - int ret, do_wakeup, i, ipipe_first; - - ret = do_wakeup = ipipe_first = 0; + int ret = 0, do_wakeup = 0, i; /* * Potential ABBA deadlock, work around it by ordering lock @@ -1048,7 +987,6 @@ static int link_pipe(struct pipe_inode_info *ipipe, * could deadlock (one doing tee from A -> B, the other from B -> A). */ if (ipipe->inode < opipe->inode) { - ipipe_first = 1; mutex_lock(&ipipe->inode->i_mutex); mutex_lock(&opipe->inode->i_mutex); } else { @@ -1097,11 +1035,9 @@ static int link_pipe(struct pipe_inode_info *ipipe, /* * We have input available, but no output room. - * If we already copied data, return that. If we - * need to drop the opipe lock, it must be ordered - * last to avoid deadlocks. + * If we already copied data, return that. */ - if ((flags & SPLICE_F_NONBLOCK) || !ipipe_first) { + if (flags & SPLICE_F_NONBLOCK) { if (!ret) ret = -EAGAIN; break; @@ -1135,12 +1071,7 @@ static int link_pipe(struct pipe_inode_info *ipipe, if (ret) break; } - /* - * pipe_wait() drops the ipipe mutex. To avoid deadlocks - * with another process, we can only safely do that if - * the ipipe lock is ordered last. - */ - if ((flags & SPLICE_F_NONBLOCK) || ipipe_first) { + if (flags & SPLICE_F_NONBLOCK) { if (!ret) ret = -EAGAIN; break; diff --git a/trunk/include/asm-i386/atomic.h b/trunk/include/asm-i386/atomic.h index 4ddce5296a78..22d80ece95cb 100644 --- a/trunk/include/asm-i386/atomic.h +++ b/trunk/include/asm-i386/atomic.h @@ -183,7 +183,6 @@ static __inline__ int atomic_add_return(int i, atomic_t *v) { int __i; #ifdef CONFIG_M386 - unsigned long flags; if(unlikely(boot_cpu_data.x86==3)) goto no_xadd; #endif @@ -197,10 +196,10 @@ static __inline__ int atomic_add_return(int i, atomic_t *v) #ifdef CONFIG_M386 no_xadd: /* Legacy 386 processor */ - local_irq_save(flags); + local_irq_disable(); __i = atomic_read(v); atomic_set(v, i + __i); - local_irq_restore(flags); + local_irq_enable(); return i + __i; #endif } diff --git a/trunk/include/asm-m32r/assembler.h b/trunk/include/asm-m32r/assembler.h index 1a1aa17edd33..b7f4d8aaeb46 100644 --- a/trunk/include/asm-m32r/assembler.h +++ b/trunk/include/asm-m32r/assembler.h @@ -109,9 +109,6 @@ push r13 mvfachi r13 push r13 - ldi r13, #0 - push r13 ; dummy push acc1h - push r13 ; dummy push acc1l #else #error unknown isa configuration #endif @@ -159,8 +156,6 @@ pop r13 mvtaclo r13, a1 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) - pop r13 ; dummy pop acc1h - pop r13 ; dummy pop acc1l pop r13 mvtachi r13 pop r13 diff --git a/trunk/include/asm-m32r/mappi3/mappi3_pld.h b/trunk/include/asm-m32r/mappi3/mappi3_pld.h index 031369a7afc8..1d3c25d61bcb 100644 --- a/trunk/include/asm-m32r/mappi3/mappi3_pld.h +++ b/trunk/include/asm-m32r/mappi3/mappi3_pld.h @@ -53,14 +53,16 @@ /* Power Control of MMC and CF */ #define PLD_CPCR __reg16(PLD_BASE + 0x14000) -/* ICU */ -#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ -#define M32R_IRQ_I2C (28) /* I2C-BUS */ -#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */ -#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert & Eject */ -#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */ -#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ -#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ + +/*==== ICU ====*/ +#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ +#define M32R_IRQ_I2C (28) /* I2C-BUS */ +#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */ +#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert */ +#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */ +#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ +#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ + #if 0 /* LED Control @@ -95,6 +97,7 @@ #define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) #define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) + #if 0 /* RTC */ #define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) @@ -137,7 +140,4 @@ #endif -/* Reset Control */ -#define PLD_REBOOT __reg16(PLD_BASE + 0x38000) - #endif /* _MAPPI3_PLD.H */ diff --git a/trunk/include/asm-m32r/ptrace.h b/trunk/include/asm-m32r/ptrace.h index 53c792452dfc..0d058b2d844e 100644 --- a/trunk/include/asm-m32r/ptrace.h +++ b/trunk/include/asm-m32r/ptrace.h @@ -43,14 +43,6 @@ #define PT_ACC1L 18 #define PT_ACCH PT_ACC0H #define PT_ACCL PT_ACC0L -#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) -#define PT_ACCH 15 -#define PT_ACCL 16 -#define PT_DUMMY_ACC1H 17 -#define PT_DUMMY_ACC1L 18 -#else -#error unknown isa conifiguration -#endif #define PT_PSW 19 #define PT_BPC 20 #define PT_BBPSW 21 @@ -60,6 +52,21 @@ #define PT_LR 25 #define PT_SPI 26 #define PT_ORIGR0 27 +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) +#define PT_ACCH 15 +#define PT_ACCL 16 +#define PT_PSW 17 +#define PT_BPC 18 +#define PT_BBPSW 19 +#define PT_BBPC 20 +#define PT_SPU 21 +#define PT_FP 22 +#define PT_LR 23 +#define PT_SPI 24 +#define PT_ORIGR0 25 +#else +#error unknown isa conifiguration +#endif /* virtual pt_reg entry for gdb */ #define PT_PC 30 @@ -114,8 +121,6 @@ struct pt_regs { #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) unsigned long acch; unsigned long accl; - unsigned long dummy_acc1h; - unsigned long dummy_acc1l; #else #error unknown isa configuration #endif diff --git a/trunk/include/asm-m32r/semaphore.h b/trunk/include/asm-m32r/semaphore.h index 81750edc8916..bf447c52a0a1 100644 --- a/trunk/include/asm-m32r/semaphore.h +++ b/trunk/include/asm-m32r/semaphore.h @@ -9,7 +9,7 @@ * SMP- and interrupt-safe semaphores.. * * Copyright (C) 1996 Linus Torvalds - * Copyright (C) 2004, 2006 Hirokazu Takata + * Copyright (C) 2004 Hirokazu Takata */ #include @@ -77,8 +77,27 @@ asmlinkage void __up(struct semaphore * sem); */ static inline void down(struct semaphore * sem) { + unsigned long flags; + long count; + might_sleep(); - if (unlikely(atomic_dec_return(&sem->count) < 0)) + local_irq_save(flags); + __asm__ __volatile__ ( + "# down \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + M32R_LOCK" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + M32R_UNLOCK" %0, @%1; \n\t" + : "=&r" (count) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (unlikely(count < 0)) __down(sem); } @@ -88,10 +107,28 @@ static inline void down(struct semaphore * sem) */ static inline int down_interruptible(struct semaphore * sem) { + unsigned long flags; + long count; int result = 0; might_sleep(); - if (unlikely(atomic_dec_return(&sem->count) < 0)) + local_irq_save(flags); + __asm__ __volatile__ ( + "# down_interruptible \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + M32R_LOCK" %0, @%1; \n\t" + "addi %0, #-1; \n\t" + M32R_UNLOCK" %0, @%1; \n\t" + : "=&r" (count) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (unlikely(count < 0)) result = __down_interruptible(sem); return result; @@ -137,7 +174,26 @@ static inline int down_trylock(struct semaphore * sem) */ static inline void up(struct semaphore * sem) { - if (unlikely(atomic_inc_return(&sem->count) <= 0)) + unsigned long flags; + long count; + + local_irq_save(flags); + __asm__ __volatile__ ( + "# up \n\t" + DCACHE_CLEAR("%0", "r4", "%1") + M32R_LOCK" %0, @%1; \n\t" + "addi %0, #1; \n\t" + M32R_UNLOCK" %0, @%1; \n\t" + : "=&r" (count) + : "r" (&sem->count) + : "memory" +#ifdef CONFIG_CHIP_M32700_TS1 + , "r4" +#endif /* CONFIG_CHIP_M32700_TS1 */ + ); + local_irq_restore(flags); + + if (unlikely(count <= 0)) __up(sem); } diff --git a/trunk/include/asm-m32r/sigcontext.h b/trunk/include/asm-m32r/sigcontext.h index 942b8a30937d..c233e2def2a3 100644 --- a/trunk/include/asm-m32r/sigcontext.h +++ b/trunk/include/asm-m32r/sigcontext.h @@ -32,8 +32,6 @@ struct sigcontext { #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) unsigned long sc_acch; unsigned long sc_accl; - unsigned long sc_dummy_acc1h; - unsigned long sc_dummy_acc1l; #else #error unknown isa configuration #endif diff --git a/trunk/include/asm-m32r/system.h b/trunk/include/asm-m32r/system.h index e55013f378e5..c5ab5da56d21 100644 --- a/trunk/include/asm-m32r/system.h +++ b/trunk/include/asm-m32r/system.h @@ -6,8 +6,8 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto - * Copyright (C) 2004, 2006 Hirokazu Takata + * Copyright (C) 2001 by Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto + * Copyright (C) 2004 Hirokazu Takata */ #include @@ -19,28 +19,49 @@ * switch_to(prev, next) should switch from task `prev' to `next' * `prev' will never be the same as `next'. * - * `next' and `prev' should be task_t, but it isn't always defined + * `next' and `prev' should be struct task_struct, but it isn't always defined */ #define switch_to(prev, next, last) do { \ + register unsigned long arg0 __asm__ ("r0") = (unsigned long)prev; \ + register unsigned long arg1 __asm__ ("r1") = (unsigned long)next; \ + register unsigned long *oldsp __asm__ ("r2") = &(prev->thread.sp); \ + register unsigned long *newsp __asm__ ("r3") = &(next->thread.sp); \ + register unsigned long *oldlr __asm__ ("r4") = &(prev->thread.lr); \ + register unsigned long *newlr __asm__ ("r5") = &(next->thread.lr); \ + register struct task_struct *__last __asm__ ("r6"); \ __asm__ __volatile__ ( \ - " seth lr, #high(1f) \n" \ - " or3 lr, lr, #low(1f) \n" \ - " st lr, @%4 ; store old LR \n" \ - " ld lr, @%5 ; load new LR \n" \ - " st sp, @%2 ; store old SP \n" \ - " ld sp, @%3 ; load new SP \n" \ - " push %1 ; store `prev' on new stack \n" \ - " jmp lr \n" \ - " .fillinsn \n" \ - "1: \n" \ - " pop %0 ; restore `__last' from new stack \n" \ - : "=r" (last) \ - : "0" (prev), \ - "r" (&(prev->thread.sp)), "r" (&(next->thread.sp)), \ - "r" (&(prev->thread.lr)), "r" (&(next->thread.lr)) \ - : "memory", "lr" \ + "st r8, @-r15 \n\t" \ + "st r9, @-r15 \n\t" \ + "st r10, @-r15 \n\t" \ + "st r11, @-r15 \n\t" \ + "st r12, @-r15 \n\t" \ + "st r13, @-r15 \n\t" \ + "st r14, @-r15 \n\t" \ + "seth r14, #high(1f) \n\t" \ + "or3 r14, r14, #low(1f) \n\t" \ + "st r14, @r4 ; store old LR \n\t" \ + "st r15, @r2 ; store old SP \n\t" \ + "ld r15, @r3 ; load new SP \n\t" \ + "st r0, @-r15 ; store 'prev' onto new stack \n\t" \ + "ld r14, @r5 ; load new LR \n\t" \ + "jmp r14 \n\t" \ + ".fillinsn \n " \ + "1: \n\t" \ + "ld r6, @r15+ ; load 'prev' from new stack \n\t" \ + "ld r14, @r15+ \n\t" \ + "ld r13, @r15+ \n\t" \ + "ld r12, @r15+ \n\t" \ + "ld r11, @r15+ \n\t" \ + "ld r10, @r15+ \n\t" \ + "ld r9, @r15+ \n\t" \ + "ld r8, @r15+ \n\t" \ + : "=&r" (__last) \ + : "r" (arg0), "r" (arg1), "r" (oldsp), "r" (newsp), \ + "r" (oldlr), "r" (newlr) \ + : "memory" \ ); \ + last = __last; \ } while(0) /* @@ -146,8 +167,8 @@ extern void __xchg_called_with_bad_pointer(void); #define DCACHE_CLEAR(reg0, reg1, addr) #endif /* CONFIG_CHIP_M32700_TS1 */ -static inline unsigned long -__xchg(unsigned long x, volatile void * ptr, int size) +static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr, + int size) { unsigned long flags; unsigned long tmp = 0; @@ -199,7 +220,7 @@ __xchg(unsigned long x, volatile void * ptr, int size) #define __HAVE_ARCH_CMPXCHG 1 -static inline unsigned long +static __inline__ unsigned long __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new) { unsigned long flags; @@ -233,7 +254,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new) if something tries to do an invalid cmpxchg(). */ extern void __cmpxchg_called_with_bad_pointer(void); -static inline unsigned long +static __inline__ unsigned long __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) { switch (size) { diff --git a/trunk/include/asm-x86_64/percpu.h b/trunk/include/asm-x86_64/percpu.h index 7f33aaf9f7b1..4405b4adeaba 100644 --- a/trunk/include/asm-x86_64/percpu.h +++ b/trunk/include/asm-x86_64/percpu.h @@ -26,7 +26,7 @@ #define percpu_modcopy(pcpudst, src, size) \ do { \ unsigned int __i; \ - for_each_possible_cpu(__i) \ + for_each_cpu(__i) \ memcpy((pcpudst)+__per_cpu_offset(__i), \ (src), (size)); \ } while (0) diff --git a/trunk/include/linux/ide.h b/trunk/include/linux/ide.h index a8bef1d1371c..8d2db412ba9c 100644 --- a/trunk/include/linux/ide.h +++ b/trunk/include/linux/ide.h @@ -1220,6 +1220,7 @@ typedef struct ide_pci_enablebit_s { enum { /* Uses ISA control ports not PCI ones. */ IDEPCI_FLAG_ISA_PORTS = (1 << 0), + IDEPCI_FLAG_FORCE_PDC = (1 << 1), }; typedef struct ide_pci_device_s { diff --git a/trunk/include/linux/pci_ids.h b/trunk/include/linux/pci_ids.h index d6fe048376ab..8d03e10212f5 100644 --- a/trunk/include/linux/pci_ids.h +++ b/trunk/include/linux/pci_ids.h @@ -356,10 +356,6 @@ #define PCI_DEVICE_ID_ATI_IXP300_SATA 0x436e #define PCI_DEVICE_ID_ATI_IXP400_IDE 0x4376 #define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379 -#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a -#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380 -#define PCI_DEVICE_ID_ATI_IXP600_SRAID 0x4381 -#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c #define PCI_VENDOR_ID_VLSI 0x1004 #define PCI_DEVICE_ID_VLSI_82C592 0x0005 diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index 29b7d4f87d20..b7d31e2e1729 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -1192,7 +1192,8 @@ extern void wait_task_inactive(task_t * p); #define remove_parent(p) list_del_init(&(p)->sibling) #define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) -#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) +#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) +#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) #define for_each_process(p) \ for (p = &init_task ; (p = next_task(p)) != &init_task ; ) diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index f86434d7b3d1..1a9787ac6173 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -56,7 +56,7 @@ static void __unhash_process(struct task_struct *p) detach_pid(p, PIDTYPE_PGID); detach_pid(p, PIDTYPE_SID); - list_del_rcu(&p->tasks); + list_del_init(&p->tasks); __get_cpu_var(process_counts)--; } list_del_rcu(&p->thread_group); diff --git a/trunk/kernel/fork.c b/trunk/kernel/fork.c index 34515772611e..54b15f8cda53 100644 --- a/trunk/kernel/fork.c +++ b/trunk/kernel/fork.c @@ -1204,7 +1204,7 @@ static task_t *copy_process(unsigned long clone_flags, attach_pid(p, PIDTYPE_PGID, process_group(p)); attach_pid(p, PIDTYPE_SID, p->signal->session); - list_add_tail_rcu(&p->tasks, &init_task.tasks); + list_add_tail(&p->tasks, &init_task.tasks); __get_cpu_var(process_counts)++; } attach_pid(p, PIDTYPE_PID, p->pid); diff --git a/trunk/kernel/power/snapshot.c b/trunk/kernel/power/snapshot.c index 3eeedbb13b78..c5863d02c89e 100644 --- a/trunk/kernel/power/snapshot.c +++ b/trunk/kernel/power/snapshot.c @@ -240,15 +240,14 @@ static void copy_data_pages(struct pbe *pblist) * free_pagedir - free pages allocated with alloc_pagedir() */ -static void free_pagedir(struct pbe *pblist, int clear_nosave_free) +static void free_pagedir(struct pbe *pblist) { struct pbe *pbe; while (pblist) { pbe = (pblist + PB_PAGE_SKIP)->next; ClearPageNosave(virt_to_page(pblist)); - if (clear_nosave_free) - ClearPageNosaveFree(virt_to_page(pblist)); + ClearPageNosaveFree(virt_to_page(pblist)); free_page((unsigned long)pblist); pblist = pbe; } @@ -390,7 +389,7 @@ struct pbe *alloc_pagedir(unsigned int nr_pages, gfp_t gfp_mask, int safe_needed pbe->next = alloc_image_page(gfp_mask, safe_needed); } if (!pbe) { /* get_zeroed_page() failed */ - free_pagedir(pblist, 1); + free_pagedir(pblist); pblist = NULL; } else create_pbe_list(pblist, nr_pages); @@ -737,7 +736,7 @@ static int create_image(struct snapshot_handle *handle) pblist = alloc_pagedir(nr_copy_pages, GFP_ATOMIC, 1); if (pblist) copy_page_backup_list(pblist, p); - free_pagedir(p, 0); + free_pagedir(p); if (!pblist) error = -ENOMEM; } diff --git a/trunk/lib/Kconfig.debug b/trunk/lib/Kconfig.debug index 6ecc180beb71..d57fd9181b18 100644 --- a/trunk/lib/Kconfig.debug +++ b/trunk/lib/Kconfig.debug @@ -101,7 +101,7 @@ config DEBUG_PREEMPT config DEBUG_MUTEXES bool "Mutex debugging, deadlock detection" - default n + default y depends on DEBUG_KERNEL help This allows mutex semantics violations and mutex related deadlocks diff --git a/trunk/mm/oom_kill.c b/trunk/mm/oom_kill.c index 042e6436c3ee..78747afad6b0 100644 --- a/trunk/mm/oom_kill.c +++ b/trunk/mm/oom_kill.c @@ -46,25 +46,15 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) { unsigned long points, cpu_time, run_time, s; - struct mm_struct *mm; - struct task_struct *child; + struct list_head *tsk; - task_lock(p); - mm = p->mm; - if (!mm) { - task_unlock(p); + if (!p->mm) return 0; - } /* * The memory size of the process is the basis for the badness. */ - points = mm->total_vm; - - /* - * After this unlock we can no longer dereference local variable `mm' - */ - task_unlock(p); + points = p->mm->total_vm; /* * Processes which fork a lot of child processes are likely @@ -74,11 +64,11 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) * child is eating the vast majority of memory, adding only half * to the parents will make the child our kill candidate of choice. */ - list_for_each_entry(child, &p->children, sibling) { - task_lock(child); - if (child->mm != mm && child->mm) - points += child->mm->total_vm/2 + 1; - task_unlock(child); + list_for_each(tsk, &p->children) { + struct task_struct *chld; + chld = list_entry(tsk, struct task_struct, sibling); + if (chld->mm != p->mm && chld->mm) + points += chld->mm->total_vm/2 + 1; } /* @@ -254,24 +244,17 @@ static void __oom_kill_task(task_t *p, const char *message) force_sig(SIGKILL, p); } -static int oom_kill_task(task_t *p, const char *message) +static struct mm_struct *oom_kill_task(task_t *p, const char *message) { - struct mm_struct *mm; + struct mm_struct *mm = get_task_mm(p); task_t * g, * q; - mm = p->mm; - - /* WARNING: mm may not be dereferenced since we did not obtain its - * value from get_task_mm(p). This is OK since all we need to do is - * compare mm to q->mm below. - * - * Furthermore, even if mm contains a non-NULL value, p->mm may - * change to NULL at any time since we do not hold task_lock(p). - * However, this is of no concern to us. - */ - - if (mm == NULL || mm == &init_mm) - return 1; + if (!mm) + return NULL; + if (mm == &init_mm) { + mmput(mm); + return NULL; + } __oom_kill_task(p, message); /* @@ -283,12 +266,13 @@ static int oom_kill_task(task_t *p, const char *message) __oom_kill_task(q, message); while_each_thread(g, q); - return 0; + return mm; } -static int oom_kill_process(struct task_struct *p, unsigned long points, - const char *message) +static struct mm_struct *oom_kill_process(struct task_struct *p, + unsigned long points, const char *message) { + struct mm_struct *mm; struct task_struct *c; struct list_head *tsk; @@ -299,8 +283,9 @@ static int oom_kill_process(struct task_struct *p, unsigned long points, c = list_entry(tsk, struct task_struct, sibling); if (c->mm == p->mm) continue; - if (!oom_kill_task(c, message)) - return 0; + mm = oom_kill_task(c, message); + if (mm) + return mm; } return oom_kill_task(p, message); } @@ -315,6 +300,7 @@ static int oom_kill_process(struct task_struct *p, unsigned long points, */ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) { + struct mm_struct *mm = NULL; task_t *p; unsigned long points = 0; @@ -334,12 +320,12 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) */ switch (constrained_alloc(zonelist, gfp_mask)) { case CONSTRAINT_MEMORY_POLICY: - oom_kill_process(current, points, + mm = oom_kill_process(current, points, "No available memory (MPOL_BIND)"); break; case CONSTRAINT_CPUSET: - oom_kill_process(current, points, + mm = oom_kill_process(current, points, "No available memory in cpuset"); break; @@ -361,7 +347,8 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) panic("Out of memory and no killable processes...\n"); } - if (oom_kill_process(p, points, "Out of memory")) + mm = oom_kill_process(p, points, "Out of memory"); + if (!mm) goto retry; break; @@ -370,6 +357,8 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) out: read_unlock(&tasklist_lock); cpuset_unlock(); + if (mm) + mmput(mm); /* * Give "p" a good chance of killing itself before we diff --git a/trunk/mm/page_alloc.c b/trunk/mm/page_alloc.c index 123c60586740..97d6827c7d66 100644 --- a/trunk/mm/page_alloc.c +++ b/trunk/mm/page_alloc.c @@ -232,13 +232,11 @@ static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags) * zone->lock is already acquired when we use these. * So, we don't need atomic page->flags operations here. */ -static inline unsigned long page_order(struct page *page) -{ +static inline unsigned long page_order(struct page *page) { return page_private(page); } -static inline void set_page_order(struct page *page, int order) -{ +static inline void set_page_order(struct page *page, int order) { set_page_private(page, order); __SetPageBuddy(page); } @@ -301,9 +299,9 @@ static inline int page_is_buddy(struct page *page, int order) if (PageBuddy(page) && page_order(page) == order) { BUG_ON(page_count(page) != 0); - return 1; + return 1; } - return 0; + return 0; } /* diff --git a/trunk/mm/slob.c b/trunk/mm/slob.c index a68255ba4553..9bcc7e2cabfd 100644 --- a/trunk/mm/slob.c +++ b/trunk/mm/slob.c @@ -354,7 +354,9 @@ void *__alloc_percpu(size_t size) if (!pdata) return NULL; - for_each_possible_cpu(i) { + for (i = 0; i < NR_CPUS; i++) { + if (!cpu_possible(i)) + continue; pdata->ptrs[i] = kmalloc(size, GFP_KERNEL); if (!pdata->ptrs[i]) goto unwind_oom; @@ -381,9 +383,11 @@ free_percpu(const void *objp) int i; struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp); - for_each_possible_cpu(i) + for (i = 0; i < NR_CPUS; i++) { + if (!cpu_possible(i)) + continue; kfree(p->ptrs[i]); - + } kfree(p); } EXPORT_SYMBOL(free_percpu); diff --git a/trunk/net/sunrpc/auth_gss/gss_krb5_crypto.c b/trunk/net/sunrpc/auth_gss/gss_krb5_crypto.c index 97c981fa6b8e..76b969e6904f 100644 --- a/trunk/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/trunk/net/sunrpc/auth_gss/gss_krb5_crypto.c @@ -212,7 +212,6 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, char *cksumname; struct crypto_tfm *tfm = NULL; /* XXX add to ctx? */ struct scatterlist sg[1]; - u32 code = GSS_S_FAILURE; switch (cksumtype) { case CKSUMTYPE_RSA_MD5: @@ -221,13 +220,11 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, default: dprintk("RPC: krb5_make_checksum:" " unsupported checksum %d", cksumtype); - goto out; + return GSS_S_FAILURE; } if (!(tfm = crypto_alloc_tfm(cksumname, CRYPTO_TFM_REQ_MAY_SLEEP))) - goto out; + return GSS_S_FAILURE; cksum->len = crypto_tfm_alg_digestsize(tfm); - if ((cksum->data = kmalloc(cksum->len, GFP_KERNEL)) == NULL) - goto out; crypto_digest_init(tfm); sg_set_buf(sg, header, hdrlen); @@ -235,10 +232,8 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, process_xdr_buf(body, body_offset, body->len - body_offset, checksummer, tfm); crypto_digest_final(tfm, cksum->data); - code = 0; -out: crypto_free_tfm(tfm); - return code; + return 0; } EXPORT_SYMBOL(make_checksum); diff --git a/trunk/scripts/kconfig/conf.c b/trunk/scripts/kconfig/conf.c index 8012d1076876..ae5ab981bb1d 100644 --- a/trunk/scripts/kconfig/conf.c +++ b/trunk/scripts/kconfig/conf.c @@ -5,7 +5,6 @@ #include #include -#include #include #include #include @@ -532,7 +531,7 @@ int main(int ac, char **av) break; case 'h': case '?': - fprintf(stderr, "See README for usage info\n"); + printf("%s [-o|-s] config\n", av[0]); exit(0); } } diff --git a/trunk/security/selinux/ss/mls.c b/trunk/security/selinux/ss/mls.c index 84047f69f9c1..640d0bfdbc68 100644 --- a/trunk/security/selinux/ss/mls.c +++ b/trunk/security/selinux/ss/mls.c @@ -264,7 +264,7 @@ int mls_context_to_sid(char oldc, if (!selinux_mls_enabled) { if (def_sid != SECSID_NULL && oldc) - *scontext += strlen(*scontext)+1; + *scontext += strlen(*scontext); return 0; } diff --git a/trunk/usr/gen_init_cpio.c b/trunk/usr/gen_init_cpio.c index 83acd6cc0b3c..33dbcbf77c5b 100644 --- a/trunk/usr/gen_init_cpio.c +++ b/trunk/usr/gen_init_cpio.c @@ -471,7 +471,6 @@ int main (int argc, char *argv[]) "ERROR: incorrect format, could not locate file type line %d: '%s'\n", line_nr, line); ec = -1; - break; } if ('\n' == *type) { @@ -507,8 +506,7 @@ int main (int argc, char *argv[]) line_nr, line); } } - if (ec == 0) - cpio_trailer(); + cpio_trailer(); exit(ec); }