From f38a24566727ce303331cde26047356b1570b9e7 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:15:13 -0500 Subject: [PATCH] Import 2.1.96 --- CREDITS | 6 +- arch/arm/kernel/bios32.c | 1 - arch/i386/kernel/ldt.c | 28 +++++++--- arch/i386/kernel/process.c | 69 ++++++++++++----------- arch/i386/lib/checksum.c | 13 +++-- arch/i386/math-emu/fpu_system.h | 2 +- drivers/block/ll_rw_blk.c | 9 --- drivers/char/bttv.c | 1 - drivers/char/pc_keyb.h | 2 +- drivers/char/serial.c | 1 + drivers/misc/parport_pc.c | 4 +- drivers/scsi/AM53C974.c | 2 +- drivers/scsi/advansys.c | 5 +- drivers/scsi/aic7xxx.c | 74 +++++++++++++------------ drivers/scsi/aic7xxx.h | 2 +- drivers/scsi/ncr53c8xx.c | 5 +- drivers/scsi/sg.c | 5 -- drivers/scsi/sr.c | 1 - drivers/scsi/st.c | 8 +++ drivers/sound/vidc.c | 2 - drivers/sound/vidc_audio.c | 4 +- drivers/sound/vidc_mixer.c | 2 - drivers/sound/vidc_synth.c | 3 +- include/asm-alpha/processor.h | 3 + include/asm-arm/arch-arc/system.h | 2 + include/asm-arm/arch-ebsa285/keyboard.h | 1 + include/asm-i386/processor.h | 7 +++ include/linux/kernel.h | 8 +-- include/linux/sched.h | 10 ++-- init/main.c | 8 +-- kernel/fork.c | 6 +- kernel/kmod.c | 7 ++- kernel/printk.c | 3 +- kernel/signal.c | 1 + net/netsyms.c | 3 + 35 files changed, 173 insertions(+), 135 deletions(-) diff --git a/CREDITS b/CREDITS index fd6f99e2f3de..a27bb46356cc 100644 --- a/CREDITS +++ b/CREDITS @@ -647,11 +647,11 @@ S: Atlanta, Georgia 30332 S: USA N: Angelo Haritsis -E: ah@doc.ic.ac.uk +E: ah@computer.org D: kernel patches (serial, watchdog) D: xringd, vuzkern, greekXfonts -S: 58 Henfield Close -S: London N19 3UL +S: 77 Clarence Mews +S: London SE16 1GD S: United Kingdom N: Kai Harrekilde-Petersen diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index fb5b2e561002..4400dda42e8d 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -3,7 +3,6 @@ * * Copyright (C) 1998 Russell King */ -#include #include #include #include diff --git a/arch/i386/kernel/ldt.c b/arch/i386/kernel/ldt.c index 65c743195ff4..046d5cab8423 100644 --- a/arch/i386/kernel/ldt.c +++ b/arch/i386/kernel/ldt.c @@ -18,7 +18,7 @@ static int read_ldt(void * ptr, unsigned long bytecount) { - void * address = current->ldt; + void * address = current->mm->segments; unsigned long size; if (!ptr) @@ -37,6 +37,7 @@ static int write_ldt(void * ptr, unsigned long bytecount, int oldmode) { struct modify_ldt_ldt_s ldt_info; unsigned long *lp; + struct mm_struct * mm; int error, i; if (bytecount != sizeof(ldt_info)) @@ -48,19 +49,32 @@ static int write_ldt(void * ptr, unsigned long bytecount, int oldmode) if ((ldt_info.contents == 3 && (oldmode || ldt_info.seg_not_present == 0)) || ldt_info.entry_number >= LDT_ENTRIES) return -EINVAL; - if (!current->ldt) { + mm = current->mm; + + /* + * Horrible dependencies! Try to get rid of this. This is wrong, + * as it only reloads the ldt for the first process with this + * mm. The implications are that you should really make sure that + * you have a ldt before you do the first clone(), otherwise + * you get strange behaviour (the kernel is safe, it's just user + * space strangeness). + * + * For no good reason except historical, the GDT index of the LDT + * is chosen to follow the index number in the task[] array. + */ + if (!mm->segments) { for (i=1 ; ildt = (struct desc_struct*) vmalloc(LDT_ENTRIES*LDT_ENTRY_SIZE))) + if (task[i]->mm == mm) { + if (!(mm->segments = (void *) vmalloc(LDT_ENTRIES*LDT_ENTRY_SIZE))) return -ENOMEM; - memset(current->ldt, 0, LDT_ENTRIES*LDT_ENTRY_SIZE); - set_ldt_desc(gdt+(i<<1)+FIRST_LDT_ENTRY, current->ldt, LDT_ENTRIES); + memset(mm->segments, 0, LDT_ENTRIES*LDT_ENTRY_SIZE); + set_ldt_desc(gdt+(i<<1)+FIRST_LDT_ENTRY, mm->segments, LDT_ENTRIES); load_ldt(i); } } } - lp = (unsigned long *) ¤t->ldt[ldt_info.entry_number]; + lp = (unsigned long *) (LDT_ENTRY_SIZE * ldt_info.entry_number + (unsigned long) mm->segments); /* Allow LDTs to be cleared by the user. */ if (ldt_info.base_addr == 0 && ldt_info.limit == 0 && (oldmode || diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 741453c38b2b..3fa241db4fb4 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -418,43 +418,37 @@ void show_regs(struct pt_regs * regs) 0xffff & regs->xds,0xffff & regs->xes); } -/* - * Free current thread data structures etc.. - */ - -void exit_thread(void) +void release_segments(struct mm_struct *mm) { - /* forget lazy i387 state */ - if (last_task_used_math == current) - last_task_used_math = NULL; + void * ldt; + /* forget local segments */ __asm__ __volatile__("movl %w0,%%fs ; movl %w0,%%gs ; lldt %w0" : /* no outputs */ : "r" (0)); current->tss.ldt = 0; - if (current->ldt) { - void * ldt = current->ldt; - current->ldt = NULL; + + ldt = mm->segments; + if (ldt) { + mm->segments = NULL; vfree(ldt); } } +/* + * Free current thread data structures etc.. + */ +void exit_thread(void) +{ + /* forget lazy i387 state */ + if (last_task_used_math == current) + last_task_used_math = NULL; +} + void flush_thread(void) { int i; - if (current->ldt) { - free_page((unsigned long) current->ldt); - current->ldt = NULL; - for (i=1 ; idebugreg[i] = 0; @@ -479,13 +473,30 @@ void release_thread(struct task_struct *dead_task) { } +void copy_segments(int nr, struct task_struct *p, struct mm_struct *new_mm) +{ + int ldt_size = 1; + void * ldt = &default_ldt; + struct mm_struct * old_mm = current->mm; + + p->tss.ldt = _LDT(nr); + if (old_mm->segments) { + new_mm->segments = vmalloc(LDT_ENTRIES*LDT_ENTRY_SIZE); + if (new_mm->segments) { + ldt = new_mm->segments; + ldt_size = LDT_ENTRIES; + memcpy(ldt, old_mm->segments, LDT_ENTRIES*LDT_ENTRY_SIZE); + } + } + set_ldt_desc(gdt+(nr<<1)+FIRST_LDT_ENTRY, ldt, LDT_ENTRIES); +} + int copy_thread(int nr, unsigned long clone_flags, unsigned long esp, struct task_struct * p, struct pt_regs * regs) { struct pt_regs * childregs; p->tss.tr = _TSS(nr); - p->tss.ldt = _LDT(nr); p->tss.es = __KERNEL_DS; p->tss.cs = __KERNEL_CS; p->tss.ss = __KERNEL_DS; @@ -508,16 +519,8 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp, childregs->eax = 0; childregs->esp = esp; p->tss.back_link = 0; - if (p->ldt) { - p->ldt = (struct desc_struct*) vmalloc(LDT_ENTRIES*LDT_ENTRY_SIZE); - if (p->ldt != NULL) - memcpy(p->ldt, current->ldt, LDT_ENTRIES*LDT_ENTRY_SIZE); - } set_tss_desc(gdt+(nr<<1)+FIRST_TSS_ENTRY,&(p->tss)); - if (p->ldt) - set_ldt_desc(gdt+(nr<<1)+FIRST_LDT_ENTRY,p->ldt, 512); - else - set_ldt_desc(gdt+(nr<<1)+FIRST_LDT_ENTRY,&default_ldt, 1); + /* * a bitmap offset pointing outside of the TSS limit causes a nicely * controllable SIGSEGV. The first sys_ioperm() call sets up the diff --git a/arch/i386/lib/checksum.c b/arch/i386/lib/checksum.c index 88f250d62dee..c246421a9506 100644 --- a/arch/i386/lib/checksum.c +++ b/arch/i386/lib/checksum.c @@ -123,6 +123,8 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) unsigned int csum_partial_copy_generic (const char *src, char *dst, int len, int sum, int *src_err_ptr, int *dst_err_ptr) { + __u32 tmp_var; + __asm__ __volatile__ ( " testl $2, %%edi # Check alignment. jz 2f # Jump if alignment is ok. @@ -137,7 +139,7 @@ unsigned int csum_partial_copy_generic (const char *src, char *dst, addw %%bx, %%ax adcl $0, %%eax 2: - pushl %%ecx + movl %%ecx, %8 shrl $5, %%ecx jz 2f testl %%esi, %%esi @@ -174,7 +176,7 @@ unsigned int csum_partial_copy_generic (const char *src, char *dst, dec %%ecx jne 1b adcl $0, %%eax - 2: popl %%edx + 2: movl %8, %%edx movl %%edx, %%ecx andl $0x1c, %%edx je 4f @@ -231,9 +233,10 @@ unsigned int csum_partial_copy_generic (const char *src, char *dst, ################################################ " - : "=a" (sum), "=m" (src_err_ptr), "=m" (dst_err_ptr) - : "0" (sum), "c" (len), "S" (src), "D" (dst), - "i" (-EFAULT) + : "=a" (sum) + : "m" (src_err_ptr), "m" (dst_err_ptr), + "0" (sum), "c" (len), "S" (src), "D" (dst), + "i" (-EFAULT), "m"(tmp_var) : "bx", "cx", "dx", "si", "di" ); return(sum); diff --git a/arch/i386/math-emu/fpu_system.h b/arch/i386/math-emu/fpu_system.h index 42303f6795e8..d98a0aa54602 100644 --- a/arch/i386/math-emu/fpu_system.h +++ b/arch/i386/math-emu/fpu_system.h @@ -20,7 +20,7 @@ of the stack frame of math_emulate() */ #define SETUP_DATA_AREA(arg) FPU_info = (struct info *) &arg -#define LDT_DESCRIPTOR(s) (current->ldt[(s) >> 3]) +#define LDT_DESCRIPTOR(s) (((struct ldt_struct *)current->mm->segments)[(s) >> 3]) #define SEG_D_SIZE(x) ((x).b & (3 << 21)) #define SEG_G_BIT(x) ((x).b & (1 << 23)) #define SEG_GRANULARITY(x) (((x).b & (1 << 23)) ? 4096 : 1) diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 76cbe3150df4..dd2f83fb752a 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -149,11 +149,6 @@ void unplug_device(void * data) } } if (queue_new_request) - /* - * request functions are smart enough to notice a change - * in the request queue, calling them without the spinlock - * is OK, i think. <-- FIXME: [is this true? --mingo] - */ (dev->request_fn)(); spin_unlock_irqrestore(&io_request_lock,flags); @@ -348,10 +343,6 @@ void add_request(struct blk_dev_struct * dev, struct request * req) if (scsi_blk_major(MAJOR(req->rq_dev))) queue_new_request = 1; out: - /* - * request_fn() is usually a quite complex and slow function, - * we want to call it with no spinlocks held - */ if (queue_new_request) (dev->request_fn)(); spin_unlock_irqrestore(&io_request_lock,flags); diff --git a/drivers/char/bttv.c b/drivers/char/bttv.c index e61d6361c9b3..ec66585cfe1b 100644 --- a/drivers/char/bttv.c +++ b/drivers/char/bttv.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include diff --git a/drivers/char/pc_keyb.h b/drivers/char/pc_keyb.h index 19429557608e..1bd7ab8b24f8 100644 --- a/drivers/char/pc_keyb.h +++ b/drivers/char/pc_keyb.h @@ -17,7 +17,7 @@ #define KBD_INIT_TIMEOUT HZ /* Timeout in jiffies for initializing the keyboard */ #define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */ -#define KBD_TIMEOUT 250 /* Timeout in ms for keyboard command acknowledge */ +#define KBD_TIMEOUT 1000 /* Timeout in ms for keyboard command acknowledge */ /* * Internal variables of the driver diff --git a/drivers/char/serial.c b/drivers/char/serial.c index f5d5895a2002..eeb865dd3a51 100644 --- a/drivers/char/serial.c +++ b/drivers/char/serial.c @@ -3613,6 +3613,7 @@ __initfunc(static int serial_console_setup(struct console *co, char *options)) * Disable UART interrupts, set DTR and RTS high * and set speed. */ + outb(cval, ser->port + UART_LCR); /* don't assume that DLAB is clear */ outb(0, ser->port + UART_IER); outb(UART_MCR_DTR | UART_MCR_RTS, ser->port + UART_MCR); outb(cval | UART_LCR_DLAB, ser->port + UART_LCR); /* set DLAB */ diff --git a/drivers/misc/parport_pc.c b/drivers/misc/parport_pc.c index 0926262d94af..7ecc021703dc 100644 --- a/drivers/misc/parport_pc.c +++ b/drivers/misc/parport_pc.c @@ -162,9 +162,9 @@ void parport_pc_release_resources(struct parport *p) int parport_pc_claim_resources(struct parport *p) { - /* FIXME check that resources are free */ + int err; if (p->irq != PARPORT_IRQ_NONE) - request_irq(p->irq, parport_pc_null_intr_func, 0, p->name, NULL); + if ((err = request_irq(p->irq, parport_pc_null_intr_func, 0, p->name, NULL)) != 0) return err; request_region(p->base, p->size, p->name); if (p->modes & PARPORT_MODE_PCECR) request_region(p->base+0x400, 3, p->name); diff --git a/drivers/scsi/AM53C974.c b/drivers/scsi/AM53C974.c index 06c60edfbfce..2f5fb197d868 100644 --- a/drivers/scsi/AM53C974.c +++ b/drivers/scsi/AM53C974.c @@ -6,11 +6,11 @@ #include #include #include -#incldue #include #include #include +#include #include "scsi.h" #include "hosts.h" diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 37af86d358fe..9c951b966ef6 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -3844,8 +3844,11 @@ STATIC int asc_proc_copy(off_t, off_t, char *, int , char *, int); #endif /* version >= v1.3.0 */ #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(1,3,70) STATIC void advansys_interrupt(int, struct pt_regs *); -#else /* version >= v1.3.70 */ +#elif LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,1,95) +STATIC void advansys_interrupt(int, void *, struct pt_regs *); +#else /* version >= 2.1.95 */ STATIC void advansys_interrupt(int, void *, struct pt_regs *); +STATIC void do_advansys_interrupt(int, void *, struct pt_regs *); #endif /* version >= v1.3.70 */ #if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(1,3,89) STATIC void advansys_select_queue_depths(struct Scsi_Host *, diff --git a/drivers/scsi/aic7xxx.c b/drivers/scsi/aic7xxx.c index 09eb26bd57ef..cc265ecb7a48 100644 --- a/drivers/scsi/aic7xxx.c +++ b/drivers/scsi/aic7xxx.c @@ -209,7 +209,7 @@ struct proc_dir_entry proc_scsi_aic7xxx = { 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; -#define AIC7XXX_C_VERSION "5.0.12" +#define AIC7XXX_C_VERSION "5.0.13" #define NUMBER(arr) (sizeof(arr) / sizeof(arr[0])) #define MIN(a,b) (((a) < (b)) ? (a) : (b)) @@ -270,18 +270,24 @@ struct proc_dir_entry proc_scsi_aic7xxx = { # include # include # define cpuid smp_processor_id() -# define DRIVER_LOCK_INIT \ - spin_lock_init(&p->spin_lock); -# define DRIVER_LOCK \ +# if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) +# define DRIVER_LOCK_INIT \ + spin_lock_init(&p->spin_lock); +# define DRIVER_LOCK \ if(!p->cpu_lock_count[cpuid]) { \ spin_lock_irqsave(&p->spin_lock, cpu_flags); \ p->cpu_lock_count[cpuid]++; \ } else { \ p->cpu_lock_count[cpuid]++; \ } -# define DRIVER_UNLOCK \ - if(--p->cpu_lock_count[cpuid] == 0) \ - spin_unlock_irqrestore(&p->spin_lock, cpu_flags); +# define DRIVER_UNLOCK \ + if(--p->cpu_lock_count[cpuid] == 0) \ + spin_unlock_irqrestore(&p->spin_lock, cpu_flags); +# else +# define DRIVER_LOCK_INIT +# define DRIVER_LOCK +# define DRIVER_UNLOCK +# endif #else # define cpuid 0 # define DRIVER_LOCK_INIT @@ -2159,7 +2165,9 @@ static inline void aic7xxx_done_cmds_complete(struct aic7xxx_host *p) { Scsi_Cmnd *cmd; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) unsigned int cpu_flags = 0; +#endif DRIVER_LOCK while (p->completeq.head != NULL) @@ -3193,7 +3201,9 @@ aic7xxx_run_waiting_queues(struct aic7xxx_host *p) struct aic7xxx_scb *scb; int tindex; int sent; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) unsigned long cpu_flags = 0; +#endif if (p->waiting_scbs.head == NULL) @@ -3261,8 +3271,12 @@ aic7xxx_timer(struct aic7xxx_host *p) int i; unsigned long cpu_flags = 0; struct aic7xxx_scb *scb; - + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) DRIVER_LOCK +#else + spin_lock_irqsave(&io_request_lock, cpu_flags); +#endif for(i=0; idev_timer[i].expires) && @@ -3282,7 +3296,11 @@ aic7xxx_timer(struct aic7xxx_host *p) } } aic7xxx_run_waiting_queues(p); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) DRIVER_UNLOCK +#else + spin_unlock_irqrestore(&io_request_lock, cpu_flags); +#endif } /*+F************************************************************************* @@ -4893,7 +4911,6 @@ aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs) { struct aic7xxx_host *p; unsigned char intstat; - unsigned long cpu_flags = 0; p = (struct aic7xxx_host *)dev_id; @@ -4924,6 +4941,7 @@ aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs) p->spurious_int++; } #endif + return; } else if (p->flags & AHC_IN_ISR) { @@ -4934,7 +4952,6 @@ aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs) * Handle all the interrupt sources - especially for SCSI * interrupts, we won't get a second chance at them. */ - DRIVER_LOCK intstat = aic_inb(p, INTSTAT); p->spurious_int = 0; @@ -4943,24 +4960,6 @@ aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs) */ p->isr_count++; p->flags |= AHC_IN_ISR; - if (!(p->flags & AHC_A_SCANNED) && (p->isr_count == 1)) - { - /* - * We must only have one card at this IRQ and it must have been - * added to the board data before the spurious interrupt occurred. - * It is sufficient that we check isr_count and not the spurious - * interrupt count. - */ - if (intstat) - { - /* Try clearing all interrupts. */ - aic_outb(p, CLRBRKADRINT | CLRSCSIINT | CLRCMDINT | CLRSEQINT, CLRINT); - unpause_sequencer(p, TRUE); - } - DRIVER_UNLOCK - printk("scsi%d: Encountered spurious interrupt.\n", p->host_no); - return; - } /* * Indicate that we're in the interrupt handler. @@ -5069,7 +5068,6 @@ aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs) { aic7xxx_handle_scsiint(p, intstat); } - DRIVER_UNLOCK if(!(p->flags & (AHC_IN_ABORT | AHC_IN_RESET))) { aic7xxx_done_cmds_complete(p); @@ -5080,7 +5078,7 @@ aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs) /*+F************************************************************************* * Function: - * aic7xxx_isr + * do_aic7xxx_isr * * Description: * This is a gross hack to solve a problem in linux kernels 2.1.85 and @@ -5090,14 +5088,16 @@ aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs) static void do_aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,93) - unsigned long flags; + unsigned long cpu_flags; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,95) - spin_lock_irqsave(&io_request_lock, flags); + spin_lock_irqsave(&io_request_lock, cpu_flags); aic7xxx_isr(irq, dev_id, regs); - spin_unlock_irqrestore(&io_request_lock, flags); + spin_unlock_irqrestore(&io_request_lock, cpu_flags); #else + DRIVER_LOCK aic7xxx_isr(irq, dev_id, regs); + DRIVER_UNLOCK #endif } @@ -8007,7 +8007,9 @@ aic7xxx_queue(Scsi_Cmnd *cmd, void (*fn)(Scsi_Cmnd *)) struct aic7xxx_host *p; struct aic7xxx_scb *scb; int tindex = TARGET_INDEX(cmd); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) unsigned long cpu_flags = 0; +#endif p = (struct aic7xxx_host *) cmd->host->hostdata; /* @@ -8327,7 +8329,9 @@ aic7xxx_abort(Scsi_Cmnd *cmd) struct aic7xxx_host *p; int result, found=0; unsigned char tmp_char, saved_hscbptr, next_hscbptr, prev_hscbptr; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) unsigned long cpu_flags = 0; +#endif Scsi_Cmnd *cmd_next, *cmd_prev; p = (struct aic7xxx_host *) cmd->host->hostdata; @@ -8646,7 +8650,9 @@ aic7xxx_reset(Scsi_Cmnd *cmd, unsigned int flags) struct aic7xxx_host *p; int tindex; int result = -1; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) unsigned long cpu_flags = 0; +#endif #define DEVICE_RESET 0x01 #define BUS_RESET 0x02 #define HOST_RESET 0x04 diff --git a/drivers/scsi/aic7xxx.h b/drivers/scsi/aic7xxx.h index 0fa8744b9c47..8da5edba0a22 100644 --- a/drivers/scsi/aic7xxx.h +++ b/drivers/scsi/aic7xxx.h @@ -25,7 +25,7 @@ #define AIC7XXX_H_VERSION "3.2.4" -#ifndef LINUX_KERNEL_VERSION +#ifndef LINUX_VERSION_CODE #include #endif diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index 004d0a2c8d77..1f6f6865d6f5 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c @@ -9789,18 +9789,15 @@ printk("ncr53c8xx : command successfully queued\n"); #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,70) static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs) { - unsigned long flags; - #ifdef DEBUG_NCR53C8XX printk("ncr53c8xx : interrupt received\n"); #endif if (DEBUG_FLAGS & DEBUG_TINY) printf ("["); - spin_lock_irqsave(&io_request_lock, flags); ncr_exception((ncb_p) dev_id); - spin_unlock_irqrestore(&io_request_lock, flags); if (DEBUG_FLAGS & DEBUG_TINY) printf ("]\n"); } + static void do_ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs *regs) { unsigned long flags; diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 782de8fc0f6f..f50cc96c2b90 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -228,7 +228,6 @@ static ssize_t sg_read(struct file *filp, char *buf, struct inode *inode = filp->f_dentry->d_inode; int dev=MINOR(inode->i_rdev); int i; - unsigned long flags; struct scsi_generic *device=&scsi_generics[dev]; /* @@ -252,22 +251,18 @@ static ssize_t sg_read(struct file *filp, char *buf, /* * Wait until the command is actually done. */ - spin_lock_irqsave(&io_request_lock, flags); while(!device->pending || !device->complete) { if (filp->f_flags & O_NONBLOCK) { - spin_unlock_irqrestore(&io_request_lock, flags); return -EAGAIN; } interruptible_sleep_on(&device->read_wait); if (signal_pending(current)) { - spin_unlock_irqrestore(&io_request_lock, flags); return -ERESTARTSYS; } } - spin_unlock_irqrestore(&io_request_lock, flags); /* * Now copy the result back to the user buffer. diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index c273b49de816..bbbffbd84169 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -427,7 +427,6 @@ static void do_sr_request (void) Scsi_Cmnd * SCpnt = NULL; struct request * req = NULL; Scsi_Device * SDev; - unsigned long flags; int flag = 0; while (1==1){ diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 809dc93a6629..35af3e391718 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -30,6 +30,7 @@ #include #include #include +#include /* The driver prints some debugging information on the console if DEBUG is defined and non-zero. */ @@ -250,6 +251,9 @@ st_sleep_done (Scsi_Cmnd * SCpnt) st_do_scsi(Scsi_Cmnd *SCpnt, Scsi_Tape *STp, unsigned char *cmd, int bytes, int timeout, int retries) { + unsigned long flags; + + spin_lock_irqsave(&io_request_lock, flags); if (SCpnt == NULL) if ((SCpnt = scsi_allocate_device(NULL, STp->device, 1)) == NULL) { printk(KERN_ERR "st%d: Can't get SCSI request.\n", TAPE_NR(STp->devt)); @@ -264,6 +268,7 @@ st_do_scsi(Scsi_Cmnd *SCpnt, Scsi_Tape *STp, unsigned char *cmd, int bytes, scsi_do_cmd(SCpnt, (void *)cmd, (STp->buffer)->b_data, bytes, st_sleep_done, timeout, retries); + spin_unlock_irqrestore(&io_request_lock, flags); down(SCpnt->request.sem); @@ -976,6 +981,7 @@ st_write(struct file * filp, const char * buf, size_t count, loff_t *ppos) ST_mode * STm; ST_partstat * STps; int dev = TAPE_NR(inode->i_rdev); + unsigned long flags; STp = &(scsi_tapes[dev]); @@ -1271,10 +1277,12 @@ st_write(struct file * filp, const char * buf, size_t count, loff_t *ppos) STp->write_pending = 1; #endif + spin_lock_irqsave(&io_request_lock, flags); scsi_do_cmd (SCpnt, (void *) cmd, (STp->buffer)->b_data, (STp->buffer)->writing, st_sleep_done, STp->timeout, MAX_WRITE_RETRIES); + spin_unlock_irqrestore(&io_request_lock, flags); } else if (SCpnt != NULL) { diff --git a/drivers/sound/vidc.c b/drivers/sound/vidc.c index 8966959ee1c9..c33ed9beb7c9 100644 --- a/drivers/sound/vidc.c +++ b/drivers/sound/vidc.c @@ -6,11 +6,9 @@ * Copyright (C) 1997 by Russell King */ -#include #include #include #include "sound_config.h" - #include "vidc.h" int vidc_busy; diff --git a/drivers/sound/vidc_audio.c b/drivers/sound/vidc_audio.c index 59ea01be676a..a59a077f386b 100644 --- a/drivers/sound/vidc_audio.c +++ b/drivers/sound/vidc_audio.c @@ -6,11 +6,9 @@ * Copyright (C) 1997 Russell King */ -#include -#include "sound_config.h" #include #include - +#include "sound_config.h" #include "vidc.h" /* diff --git a/drivers/sound/vidc_mixer.c b/drivers/sound/vidc_mixer.c index b9c8b4cb6b6f..1bdb1e88e588 100644 --- a/drivers/sound/vidc_mixer.c +++ b/drivers/sound/vidc_mixer.c @@ -6,9 +6,7 @@ * Copyright (C) 1997 Russell King */ -#include #include "sound_config.h" - #include "vidc.h" int vidc_volume; diff --git a/drivers/sound/vidc_synth.c b/drivers/sound/vidc_synth.c index 556af8456b4a..7e6797e8ee3c 100644 --- a/drivers/sound/vidc_synth.c +++ b/drivers/sound/vidc_synth.c @@ -5,9 +5,8 @@ * * Copyright (C) 1997 Russell King */ -#include -#include "sound_config.h" +#include "sound_config.h" #include "vidc.h" static struct synth_info vidc_info = diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h index 2a09c61d8de6..0e3c600029af 100644 --- a/include/asm-alpha/processor.h +++ b/include/asm-alpha/processor.h @@ -92,6 +92,9 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); +#define copy_segments(nr, tsk, mm) do { } while (0) +#define release_segments(mm) do { } while (0) + /* NOTE: The task struct and the stack go together! */ #define alloc_task_struct() \ ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) diff --git a/include/asm-arm/arch-arc/system.h b/include/asm-arm/arch-arc/system.h index a76c25845e42..3becc7b2f81f 100644 --- a/include/asm-arm/arch-arc/system.h +++ b/include/asm-arm/arch-arc/system.h @@ -6,6 +6,8 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H +#include + #ifdef CONFIG_ARCH_ARC #define cliIF() \ diff --git a/include/asm-arm/arch-ebsa285/keyboard.h b/include/asm-arm/arch-ebsa285/keyboard.h index 92b29e39c649..4620ff16588c 100644 --- a/include/asm-arm/arch-ebsa285/keyboard.h +++ b/include/asm-arm/arch-ebsa285/keyboard.h @@ -6,6 +6,7 @@ * (C) 1998 Russell King */ +#include #include #define NR_SCANCODES 128 diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index c19558162bfe..8e4b694e1530 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -189,9 +189,16 @@ struct thread_struct { regs->esp = new_esp; \ } while (0) +/* Forward declaration, a strange C thing */ +struct mm_struct; + /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); +/* Copy and release all segment info associated with a VM */ +extern void copy_segments(int nr, struct task_struct *p, struct mm_struct * mm); +extern void release_segments(struct mm_struct * mm); + /* * Return saved PC of a blocked thread. */ diff --git a/include/linux/kernel.h b/include/linux/kernel.h index a5e6544f6169..20fe4fa689ed 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -69,10 +69,10 @@ asmlinkage int printk(const char * fmt, ...) */ #define NIPQUAD(addr) \ - (((addr) >> 0) & 0xff), \ - (((addr) >> 8) & 0xff), \ - (((addr) >> 16) & 0xff), \ - (((addr) >> 24) & 0xff) + (int)(((addr) >> 0) & 0xff), \ + (int)(((addr) >> 8) & 0xff), \ + (int)(((addr) >> 16) & 0xff), \ + (int)(((addr) >> 24) & 0xff) #endif /* __KERNEL__ */ diff --git a/include/linux/sched.h b/include/linux/sched.h index ca8016313012..ceeea5d427cb 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -168,6 +168,11 @@ struct mm_struct { unsigned long rss, total_vm, locked_vm; unsigned long def_flags; unsigned long cpu_vm_mask; + /* + * This is an architecture-specific pointer: the portable + * part of Linux does not know about any segments. + */ + void * segments; }; #define INIT_MM { \ @@ -178,7 +183,7 @@ struct mm_struct { 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, \ - 0, 0 } + 0, 0, NULL } struct signal_struct { atomic_t count; @@ -267,8 +272,6 @@ struct task_struct { /* ipc stuff */ struct sem_undo *semundo; struct sem_queue *semsleeping; -/* ldt for this task - used by Wine. If NULL, default_ldt is used */ - struct desc_struct *ldt; /* tss for this task */ struct thread_struct tss; /* filesystem information */ @@ -357,7 +360,6 @@ struct task_struct { /* comm */ "swapper", \ /* fs info */ 0,NULL, \ /* ipc */ NULL, NULL, \ -/* ldt */ NULL, \ /* tss */ INIT_TSS, \ /* fs */ &init_fs, \ /* files */ &init_files, \ diff --git a/init/main.c b/init/main.c index a54b51783114..de8dae6df10b 100644 --- a/init/main.c +++ b/init/main.c @@ -1093,7 +1093,7 @@ __initfunc(asmlinkage void start_kernel(void)) * Like idlers init is an unlocked kernel thread, which will * make syscalls (and thus be locked). */ - kernel_thread(init, NULL, 0); + kernel_thread(init, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); /* * task[0] is meant to be used as an "idle" task: it may not sleep, but * it might do some general things like count free pages or it could be @@ -1132,16 +1132,16 @@ static int init(void * unused) #endif /* Launch bdflush from here, instead of the old syscall way. */ - kernel_thread(bdflush, NULL, 0); + kernel_thread(bdflush, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); /* Start the background pageout daemon. */ kswapd_setup(); - kernel_thread(kswapd, NULL, 0); + kernel_thread(kswapd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); #if CONFIG_AP1000 /* Start the async paging daemon. */ { extern int asyncd(void *); - kernel_thread(asyncd, NULL, 0); + kernel_thread(asyncd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); } #endif diff --git a/kernel/fork.c b/kernel/fork.c index d419727a31b4..88199cae1536 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -300,13 +300,14 @@ struct mm_struct * mm_alloc(void) void mmput(struct mm_struct *mm) { if (!--mm->count) { + release_segments(mm); exit_mmap(mm); free_page_tables(mm); kmem_cache_free(mm_cachep, mm); } } -static inline int copy_mm(unsigned long clone_flags, struct task_struct * tsk) +static inline int copy_mm(int nr, unsigned long clone_flags, struct task_struct * tsk) { struct mm_struct * mm; int retval; @@ -326,6 +327,7 @@ static inline int copy_mm(unsigned long clone_flags, struct task_struct * tsk) tsk->min_flt = tsk->maj_flt = 0; tsk->cmin_flt = tsk->cmaj_flt = 0; tsk->nswap = tsk->cnswap = 0; + copy_segments(nr, tsk, mm); retval = new_page_tables(tsk); if (retval) goto free_mm; @@ -542,7 +544,7 @@ int do_fork(unsigned long clone_flags, unsigned long usp, struct pt_regs *regs) goto bad_fork_cleanup_files; if (copy_sighand(clone_flags, p)) goto bad_fork_cleanup_fs; - if (copy_mm(clone_flags, p)) + if (copy_mm(nr, clone_flags, p)) goto bad_fork_cleanup_sighand; error = copy_thread(nr, clone_flags, usp, p, regs); if (error) diff --git a/kernel/kmod.c b/kernel/kmod.c index 5a5602c6f844..8dc555b64ddc 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -108,7 +108,12 @@ int kmod_init(void) { printk("Starting kmod\n"); - kernel_thread(kmod_thread, NULL, 0); + /* + * CLONE_FS means that our "cwd" will follow that of init. + * CLONE_FILES just saves some space (we don't need any + * new file descriptors). Ditto for CLONE_SIGHAND. + */ + kernel_thread(kmod_thread, NULL, CLONE_FILES | CLONE_FS | CLONE_SIGHAND); kmod_unload_timer.next = NULL; kmod_unload_timer.prev = NULL; diff --git a/kernel/printk.c b/kernel/printk.c index d8242a428c79..48922d7795e4 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -358,7 +358,8 @@ void register_console(struct console * console) if (console->index >= 0 && console->index != console_cmdline[i].index) continue; - if (console->index < 0) console->index = 0; + if (console->index < 0) + console->index = console_cmdline[i].index; if (console->setup && console->setup(console, console_cmdline[i].options) != 0) break; diff --git a/kernel/signal.c b/kernel/signal.c index 1695860eeb46..eccb06614d30 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -788,6 +788,7 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact) if (act) { *k = *act; + sigdelsetmask(&k->sa.sa_mask, sigmask(SIGKILL) | sigmask(SIGSTOP)); /* * POSIX 3.3.1.3: diff --git a/net/netsyms.c b/net/netsyms.c index abb56a4a0ba8..f4fbfdeffe9e 100644 --- a/net/netsyms.c +++ b/net/netsyms.c @@ -64,6 +64,9 @@ extern struct datalink_proto *make_EII_client(void); extern struct datalink_proto *make_8023_client(void); extern void destroy_EII_client(struct datalink_proto *); extern void destroy_8023_client(struct datalink_proto *); +#endif + +#ifdef CONFIG_IPV6_MODULE #ifdef CONFIG_SYSCTL extern int sysctl_max_syn_backlog; #endif -- 2.39.5