From 0f8cf7a09ac4b62e3374e35fb558f0bac3216b62 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 4 Aug 2005 07:05:37 -0700 Subject: [PATCH] --- yaml --- r: 5666 b: refs/heads/master c: 3873658be7b3896e88648664e480a44d12083ad8 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/kprobes.txt | 588 ------------------ trunk/Documentation/usb/usbmon.txt | 2 +- .../video4linux/bttv/Insmod-options | 3 - trunk/arch/alpha/kernel/pci.c | 16 - trunk/arch/arm/kernel/bios32.c | 17 - trunk/arch/arm/mach-sa1100/jornada720.c | 1 - trunk/arch/arm/mm/fault.c | 6 +- trunk/arch/arm/oprofile/backtrace.c | 2 +- trunk/arch/arm26/mm/fault.c | 17 +- trunk/arch/cris/mm/fault.c | 6 +- trunk/arch/frv/mm/fault.c | 6 +- trunk/arch/i386/Kconfig | 3 +- trunk/arch/m68k/mm/fault.c | 6 +- trunk/arch/parisc/mm/fault.c | 12 +- trunk/arch/ppc/kernel/pci.c | 15 - trunk/arch/ppc64/kernel/head.S | 2 +- trunk/arch/ppc64/kernel/machine_kexec.c | 12 +- trunk/arch/ppc64/kernel/mpic.c | 4 +- trunk/arch/ppc64/kernel/mpic.h | 2 +- trunk/arch/ppc64/kernel/pci.c | 20 - trunk/arch/ppc64/kernel/xics.c | 31 +- trunk/arch/sh64/mm/fault.c | 6 +- trunk/arch/sparc64/kernel/pci.c | 6 - trunk/arch/x86_64/ia32/ptrace32.c | 8 +- trunk/arch/x86_64/mm/fault.c | 6 +- trunk/drivers/acpi/dispatcher/dswload.c | 6 + trunk/drivers/acpi/osl.c | 6 +- trunk/drivers/acpi/pci_link.c | 7 - trunk/drivers/char/rtc.c | 7 +- trunk/drivers/fc4/fc.c | 2 +- trunk/drivers/ide/ide-probe.c | 16 +- trunk/drivers/infiniband/include/ib_cm.h | 3 +- .../drivers/infiniband/ulp/ipoib/ipoib_main.c | 5 +- trunk/drivers/md/bitmap.c | 75 +-- trunk/drivers/md/dm-raid1.c | 2 +- trunk/drivers/md/md.c | 4 +- trunk/drivers/md/raid1.c | 29 +- trunk/drivers/media/video/bttv-cards.c | 8 +- trunk/drivers/media/video/bttv-driver.c | 28 +- trunk/drivers/pci/pci.c | 59 +- trunk/drivers/pci/setup-res.c | 2 +- trunk/drivers/pcmcia/yenta_socket.c | 15 +- trunk/drivers/sbus/char/vfc.h | 2 - trunk/drivers/sbus/char/vfc_dev.c | 1 - trunk/drivers/sbus/char/vfc_i2c.c | 19 +- trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c | 24 +- trunk/drivers/scsi/ibmvscsi/srp.h | 2 +- trunk/drivers/scsi/ips.c | 8 +- trunk/drivers/scsi/ips.h | 39 +- trunk/drivers/scsi/st.c | 8 +- trunk/drivers/usb/host/ehci-dbg.c | 2 +- trunk/drivers/usb/host/ehci-q.c | 5 +- trunk/drivers/usb/host/ehci-sched.c | 13 +- trunk/drivers/usb/host/ehci.h | 5 - trunk/drivers/usb/host/isp116x-hcd.c | 4 +- trunk/drivers/usb/mon/Kconfig | 9 +- trunk/drivers/usb/mon/Makefile | 1 - trunk/fs/Kconfig | 11 +- trunk/fs/namei.c | 5 +- trunk/include/asm-alpha/pci.h | 3 - trunk/include/asm-arm/pci.h | 4 - trunk/include/asm-generic/pci.h | 8 - trunk/include/asm-parisc/pci.h | 4 - trunk/include/asm-ppc/pci.h | 4 - trunk/include/asm-ppc64/machdep.h | 2 +- trunk/include/asm-ppc64/pci.h | 4 - trunk/include/asm-ppc64/xics.h | 2 +- trunk/include/linux/fsnotify.h | 4 +- trunk/include/linux/pci.h | 3 - trunk/include/linux/raid/bitmap.h | 1 - trunk/kernel/exit.c | 4 +- trunk/kernel/posix-timers.c | 1 + trunk/kernel/sys.c | 2 + trunk/mm/mmap.c | 6 +- trunk/mm/mremap.c | 2 +- trunk/mm/nommu.c | 6 +- trunk/net/ipv4/tcp_output.c | 86 +-- trunk/security/keys/keyctl.c | 11 +- trunk/security/keys/keyring.c | 6 +- trunk/security/keys/process_keys.c | 2 +- trunk/security/keys/request_key.c | 2 +- 82 files changed, 281 insertions(+), 1117 deletions(-) delete mode 100644 trunk/Documentation/kprobes.txt diff --git a/[refs] b/[refs] index d8f5a430214f..8de80bca7bbd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 403fe5ae57c831968c3dbbaba291ae825a1c5aaa +refs/heads/master: 3873658be7b3896e88648664e480a44d12083ad8 diff --git a/trunk/Documentation/kprobes.txt b/trunk/Documentation/kprobes.txt deleted file mode 100644 index 0541fe1de704..000000000000 --- a/trunk/Documentation/kprobes.txt +++ /dev/null @@ -1,588 +0,0 @@ -Title : Kernel Probes (Kprobes) -Authors : Jim Keniston - : Prasanna S Panchamukhi - -CONTENTS - -1. Concepts: Kprobes, Jprobes, Return Probes -2. Architectures Supported -3. Configuring Kprobes -4. API Reference -5. Kprobes Features and Limitations -6. Probe Overhead -7. TODO -8. Kprobes Example -9. Jprobes Example -10. Kretprobes Example - -1. Concepts: Kprobes, Jprobes, Return Probes - -Kprobes enables you to dynamically break into any kernel routine and -collect debugging and performance information non-disruptively. You -can trap at almost any kernel code address, specifying a handler -routine to be invoked when the breakpoint is hit. - -There are currently three types of probes: kprobes, jprobes, and -kretprobes (also called return probes). A kprobe can be inserted -on virtually any instruction in the kernel. A jprobe is inserted at -the entry to a kernel function, and provides convenient access to the -function's arguments. A return probe fires when a specified function -returns. - -In the typical case, Kprobes-based instrumentation is packaged as -a kernel module. The module's init function installs ("registers") -one or more probes, and the exit function unregisters them. A -registration function such as register_kprobe() specifies where -the probe is to be inserted and what handler is to be called when -the probe is hit. - -The next three subsections explain how the different types of -probes work. They explain certain things that you'll need to -know in order to make the best use of Kprobes -- e.g., the -difference between a pre_handler and a post_handler, and how -to use the maxactive and nmissed fields of a kretprobe. But -if you're in a hurry to start using Kprobes, you can skip ahead -to section 2. - -1.1 How Does a Kprobe Work? - -When a kprobe is registered, Kprobes makes a copy of the probed -instruction and replaces the first byte(s) of the probed instruction -with a breakpoint instruction (e.g., int3 on i386 and x86_64). - -When a CPU hits the breakpoint instruction, a trap occurs, the CPU's -registers are saved, and control passes to Kprobes via the -notifier_call_chain mechanism. Kprobes executes the "pre_handler" -associated with the kprobe, passing the handler the addresses of the -kprobe struct and the saved registers. - -Next, Kprobes single-steps its copy of the probed instruction. -(It would be simpler to single-step the actual instruction in place, -but then Kprobes would have to temporarily remove the breakpoint -instruction. This would open a small time window when another CPU -could sail right past the probepoint.) - -After the instruction is single-stepped, Kprobes executes the -"post_handler," if any, that is associated with the kprobe. -Execution then continues with the instruction following the probepoint. - -1.2 How Does a Jprobe Work? - -A jprobe is implemented using a kprobe that is placed on a function's -entry point. It employs a simple mirroring principle to allow -seamless access to the probed function's arguments. The jprobe -handler routine should have the same signature (arg list and return -type) as the function being probed, and must always end by calling -the Kprobes function jprobe_return(). - -Here's how it works. When the probe is hit, Kprobes makes a copy of -the saved registers and a generous portion of the stack (see below). -Kprobes then points the saved instruction pointer at the jprobe's -handler routine, and returns from the trap. As a result, control -passes to the handler, which is presented with the same register and -stack contents as the probed function. When it is done, the handler -calls jprobe_return(), which traps again to restore the original stack -contents and processor state and switch to the probed function. - -By convention, the callee owns its arguments, so gcc may produce code -that unexpectedly modifies that portion of the stack. This is why -Kprobes saves a copy of the stack and restores it after the jprobe -handler has run. Up to MAX_STACK_SIZE bytes are copied -- e.g., -64 bytes on i386. - -Note that the probed function's args may be passed on the stack -or in registers (e.g., for x86_64 or for an i386 fastcall function). -The jprobe will work in either case, so long as the handler's -prototype matches that of the probed function. - -1.3 How Does a Return Probe Work? - -When you call register_kretprobe(), Kprobes establishes a kprobe at -the entry to the function. When the probed function is called and this -probe is hit, Kprobes saves a copy of the return address, and replaces -the return address with the address of a "trampoline." The trampoline -is an arbitrary piece of code -- typically just a nop instruction. -At boot time, Kprobes registers a kprobe at the trampoline. - -When the probed function executes its return instruction, control -passes to the trampoline and that probe is hit. Kprobes' trampoline -handler calls the user-specified handler associated with the kretprobe, -then sets the saved instruction pointer to the saved return address, -and that's where execution resumes upon return from the trap. - -While the probed function is executing, its return address is -stored in an object of type kretprobe_instance. Before calling -register_kretprobe(), the user sets the maxactive field of the -kretprobe struct to specify how many instances of the specified -function can be probed simultaneously. register_kretprobe() -pre-allocates the indicated number of kretprobe_instance objects. - -For example, if the function is non-recursive and is called with a -spinlock held, maxactive = 1 should be enough. If the function is -non-recursive and can never relinquish the CPU (e.g., via a semaphore -or preemption), NR_CPUS should be enough. If maxactive <= 0, it is -set to a default value. If CONFIG_PREEMPT is enabled, the default -is max(10, 2*NR_CPUS). Otherwise, the default is NR_CPUS. - -It's not a disaster if you set maxactive too low; you'll just miss -some probes. In the kretprobe struct, the nmissed field is set to -zero when the return probe is registered, and is incremented every -time the probed function is entered but there is no kretprobe_instance -object available for establishing the return probe. - -2. Architectures Supported - -Kprobes, jprobes, and return probes are implemented on the following -architectures: - -- i386 -- x86_64 (AMD-64, E64MT) -- ppc64 -- ia64 (Support for probes on certain instruction types is still in progress.) -- sparc64 (Return probes not yet implemented.) - -3. Configuring Kprobes - -When configuring the kernel using make menuconfig/xconfig/oldconfig, -ensure that CONFIG_KPROBES is set to "y". Under "Kernel hacking", -look for "Kprobes". You may have to enable "Kernel debugging" -(CONFIG_DEBUG_KERNEL) before you can enable Kprobes. - -You may also want to ensure that CONFIG_KALLSYMS and perhaps even -CONFIG_KALLSYMS_ALL are set to "y", since kallsyms_lookup_name() -is a handy, version-independent way to find a function's address. - -If you need to insert a probe in the middle of a function, you may find -it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO), -so you can use "objdump -d -l vmlinux" to see the source-to-object -code mapping. - -4. API Reference - -The Kprobes API includes a "register" function and an "unregister" -function for each type of probe. Here are terse, mini-man-page -specifications for these functions and the associated probe handlers -that you'll write. See the latter half of this document for examples. - -4.1 register_kprobe - -#include -int register_kprobe(struct kprobe *kp); - -Sets a breakpoint at the address kp->addr. When the breakpoint is -hit, Kprobes calls kp->pre_handler. After the probed instruction -is single-stepped, Kprobe calls kp->post_handler. If a fault -occurs during execution of kp->pre_handler or kp->post_handler, -or during single-stepping of the probed instruction, Kprobes calls -kp->fault_handler. Any or all handlers can be NULL. - -register_kprobe() returns 0 on success, or a negative errno otherwise. - -User's pre-handler (kp->pre_handler): -#include -#include -int pre_handler(struct kprobe *p, struct pt_regs *regs); - -Called with p pointing to the kprobe associated with the breakpoint, -and regs pointing to the struct containing the registers saved when -the breakpoint was hit. Return 0 here unless you're a Kprobes geek. - -User's post-handler (kp->post_handler): -#include -#include -void post_handler(struct kprobe *p, struct pt_regs *regs, - unsigned long flags); - -p and regs are as described for the pre_handler. flags always seems -to be zero. - -User's fault-handler (kp->fault_handler): -#include -#include -int fault_handler(struct kprobe *p, struct pt_regs *regs, int trapnr); - -p and regs are as described for the pre_handler. trapnr is the -architecture-specific trap number associated with the fault (e.g., -on i386, 13 for a general protection fault or 14 for a page fault). -Returns 1 if it successfully handled the exception. - -4.2 register_jprobe - -#include -int register_jprobe(struct jprobe *jp) - -Sets a breakpoint at the address jp->kp.addr, which must be the address -of the first instruction of a function. When the breakpoint is hit, -Kprobes runs the handler whose address is jp->entry. - -The handler should have the same arg list and return type as the probed -function; and just before it returns, it must call jprobe_return(). -(The handler never actually returns, since jprobe_return() returns -control to Kprobes.) If the probed function is declared asmlinkage, -fastcall, or anything else that affects how args are passed, the -handler's declaration must match. - -register_jprobe() returns 0 on success, or a negative errno otherwise. - -4.3 register_kretprobe - -#include -int register_kretprobe(struct kretprobe *rp); - -Establishes a return probe for the function whose address is -rp->kp.addr. When that function returns, Kprobes calls rp->handler. -You must set rp->maxactive appropriately before you call -register_kretprobe(); see "How Does a Return Probe Work?" for details. - -register_kretprobe() returns 0 on success, or a negative errno -otherwise. - -User's return-probe handler (rp->handler): -#include -#include -int kretprobe_handler(struct kretprobe_instance *ri, struct pt_regs *regs); - -regs is as described for kprobe.pre_handler. ri points to the -kretprobe_instance object, of which the following fields may be -of interest: -- ret_addr: the return address -- rp: points to the corresponding kretprobe object -- task: points to the corresponding task struct -The handler's return value is currently ignored. - -4.4 unregister_*probe - -#include -void unregister_kprobe(struct kprobe *kp); -void unregister_jprobe(struct jprobe *jp); -void unregister_kretprobe(struct kretprobe *rp); - -Removes the specified probe. The unregister function can be called -at any time after the probe has been registered. - -5. Kprobes Features and Limitations - -As of Linux v2.6.12, Kprobes allows multiple probes at the same -address. Currently, however, there cannot be multiple jprobes on -the same function at the same time. - -In general, you can install a probe anywhere in the kernel. -In particular, you can probe interrupt handlers. Known exceptions -are discussed in this section. - -For obvious reasons, it's a bad idea to install a probe in -the code that implements Kprobes (mostly kernel/kprobes.c and -arch/*/kernel/kprobes.c). A patch in the v2.6.13 timeframe instructs -Kprobes to reject such requests. - -If you install a probe in an inline-able function, Kprobes makes -no attempt to chase down all inline instances of the function and -install probes there. gcc may inline a function without being asked, -so keep this in mind if you're not seeing the probe hits you expect. - -A probe handler can modify the environment of the probed function --- e.g., by modifying kernel data structures, or by modifying the -contents of the pt_regs struct (which are restored to the registers -upon return from the breakpoint). So Kprobes can be used, for example, -to install a bug fix or to inject faults for testing. Kprobes, of -course, has no way to distinguish the deliberately injected faults -from the accidental ones. Don't drink and probe. - -Kprobes makes no attempt to prevent probe handlers from stepping on -each other -- e.g., probing printk() and then calling printk() from a -probe handler. As of Linux v2.6.12, if a probe handler hits a probe, -that second probe's handlers won't be run in that instance. - -In Linux v2.6.12 and previous versions, Kprobes' data structures are -protected by a single lock that is held during probe registration and -unregistration and while handlers are run. Thus, no two handlers -can run simultaneously. To improve scalability on SMP systems, -this restriction will probably be removed soon, in which case -multiple handlers (or multiple instances of the same handler) may -run concurrently on different CPUs. Code your handlers accordingly. - -Kprobes does not use semaphores or allocate memory except during -registration and unregistration. - -Probe handlers are run with preemption disabled. Depending on the -architecture, handlers may also run with interrupts disabled. In any -case, your handler should not yield the CPU (e.g., by attempting to -acquire a semaphore). - -Since a return probe is implemented by replacing the return -address with the trampoline's address, stack backtraces and calls -to __builtin_return_address() will typically yield the trampoline's -address instead of the real return address for kretprobed functions. -(As far as we can tell, __builtin_return_address() is used only -for instrumentation and error reporting.) - -If the number of times a function is called does not match the -number of times it returns, registering a return probe on that -function may produce undesirable results. We have the do_exit() -and do_execve() cases covered. do_fork() is not an issue. We're -unaware of other specific cases where this could be a problem. - -6. Probe Overhead - -On a typical CPU in use in 2005, a kprobe hit takes 0.5 to 1.0 -microseconds to process. Specifically, a benchmark that hits the same -probepoint repeatedly, firing a simple handler each time, reports 1-2 -million hits per second, depending on the architecture. A jprobe or -return-probe hit typically takes 50-75% longer than a kprobe hit. -When you have a return probe set on a function, adding a kprobe at -the entry to that function adds essentially no overhead. - -Here are sample overhead figures (in usec) for different architectures. -k = kprobe; j = jprobe; r = return probe; kr = kprobe + return probe -on same function; jr = jprobe + return probe on same function - -i386: Intel Pentium M, 1495 MHz, 2957.31 bogomips -k = 0.57 usec; j = 1.00; r = 0.92; kr = 0.99; jr = 1.40 - -x86_64: AMD Opteron 246, 1994 MHz, 3971.48 bogomips -k = 0.49 usec; j = 0.76; r = 0.80; kr = 0.82; jr = 1.07 - -ppc64: POWER5 (gr), 1656 MHz (SMT disabled, 1 virtual CPU per physical CPU) -k = 0.77 usec; j = 1.31; r = 1.26; kr = 1.45; jr = 1.99 - -7. TODO - -a. SystemTap (http://sourceware.org/systemtap): Work in progress -to provide a simplified programming interface for probe-based -instrumentation. -b. Improved SMP scalability: Currently, work is in progress to handle -multiple kprobes in parallel. -c. Kernel return probes for sparc64. -d. Support for other architectures. -e. User-space probes. - -8. Kprobes Example - -Here's a sample kernel module showing the use of kprobes to dump a -stack trace and selected i386 registers when do_fork() is called. ------ cut here ----- -/*kprobe_example.c*/ -#include -#include -#include -#include -#include - -/*For each probe you need to allocate a kprobe structure*/ -static struct kprobe kp; - -/*kprobe pre_handler: called just before the probed instruction is executed*/ -int handler_pre(struct kprobe *p, struct pt_regs *regs) -{ - printk("pre_handler: p->addr=0x%p, eip=%lx, eflags=0x%lx\n", - p->addr, regs->eip, regs->eflags); - dump_stack(); - return 0; -} - -/*kprobe post_handler: called after the probed instruction is executed*/ -void handler_post(struct kprobe *p, struct pt_regs *regs, unsigned long flags) -{ - printk("post_handler: p->addr=0x%p, eflags=0x%lx\n", - p->addr, regs->eflags); -} - -/* fault_handler: this is called if an exception is generated for any - * instruction within the pre- or post-handler, or when Kprobes - * single-steps the probed instruction. - */ -int handler_fault(struct kprobe *p, struct pt_regs *regs, int trapnr) -{ - printk("fault_handler: p->addr=0x%p, trap #%dn", - p->addr, trapnr); - /* Return 0 because we don't handle the fault. */ - return 0; -} - -int init_module(void) -{ - int ret; - kp.pre_handler = handler_pre; - kp.post_handler = handler_post; - kp.fault_handler = handler_fault; - kp.addr = (kprobe_opcode_t*) kallsyms_lookup_name("do_fork"); - /* register the kprobe now */ - if (!kp.addr) { - printk("Couldn't find %s to plant kprobe\n", "do_fork"); - return -1; - } - if ((ret = register_kprobe(&kp) < 0)) { - printk("register_kprobe failed, returned %d\n", ret); - return -1; - } - printk("kprobe registered\n"); - return 0; -} - -void cleanup_module(void) -{ - unregister_kprobe(&kp); - printk("kprobe unregistered\n"); -} - -MODULE_LICENSE("GPL"); ------ cut here ----- - -You can build the kernel module, kprobe-example.ko, using the following -Makefile: ------ cut here ----- -obj-m := kprobe-example.o -KDIR := /lib/modules/$(shell uname -r)/build -PWD := $(shell pwd) -default: - $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules -clean: - rm -f *.mod.c *.ko *.o ------ cut here ----- - -$ make -$ su - -... -# insmod kprobe-example.ko - -You will see the trace data in /var/log/messages and on the console -whenever do_fork() is invoked to create a new process. - -9. Jprobes Example - -Here's a sample kernel module showing the use of jprobes to dump -the arguments of do_fork(). ------ cut here ----- -/*jprobe-example.c */ -#include -#include -#include -#include -#include -#include - -/* - * Jumper probe for do_fork. - * Mirror principle enables access to arguments of the probed routine - * from the probe handler. - */ - -/* Proxy routine having the same arguments as actual do_fork() routine */ -long jdo_fork(unsigned long clone_flags, unsigned long stack_start, - struct pt_regs *regs, unsigned long stack_size, - int __user * parent_tidptr, int __user * child_tidptr) -{ - printk("jprobe: clone_flags=0x%lx, stack_size=0x%lx, regs=0x%p\n", - clone_flags, stack_size, regs); - /* Always end with a call to jprobe_return(). */ - jprobe_return(); - /*NOTREACHED*/ - return 0; -} - -static struct jprobe my_jprobe = { - .entry = (kprobe_opcode_t *) jdo_fork -}; - -int init_module(void) -{ - int ret; - my_jprobe.kp.addr = (kprobe_opcode_t *) kallsyms_lookup_name("do_fork"); - if (!my_jprobe.kp.addr) { - printk("Couldn't find %s to plant jprobe\n", "do_fork"); - return -1; - } - - if ((ret = register_jprobe(&my_jprobe)) <0) { - printk("register_jprobe failed, returned %d\n", ret); - return -1; - } - printk("Planted jprobe at %p, handler addr %p\n", - my_jprobe.kp.addr, my_jprobe.entry); - return 0; -} - -void cleanup_module(void) -{ - unregister_jprobe(&my_jprobe); - printk("jprobe unregistered\n"); -} - -MODULE_LICENSE("GPL"); ------ cut here ----- - -Build and insert the kernel module as shown in the above kprobe -example. You will see the trace data in /var/log/messages and on -the console whenever do_fork() is invoked to create a new process. -(Some messages may be suppressed if syslogd is configured to -eliminate duplicate messages.) - -10. Kretprobes Example - -Here's a sample kernel module showing the use of return probes to -report failed calls to sys_open(). ------ cut here ----- -/*kretprobe-example.c*/ -#include -#include -#include -#include - -static const char *probed_func = "sys_open"; - -/* Return-probe handler: If the probed function fails, log the return value. */ -static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs) -{ - // Substitute the appropriate register name for your architecture -- - // e.g., regs->rax for x86_64, regs->gpr[3] for ppc64. - int retval = (int) regs->eax; - if (retval < 0) { - printk("%s returns %d\n", probed_func, retval); - } - return 0; -} - -static struct kretprobe my_kretprobe = { - .handler = ret_handler, - /* Probe up to 20 instances concurrently. */ - .maxactive = 20 -}; - -int init_module(void) -{ - int ret; - my_kretprobe.kp.addr = - (kprobe_opcode_t *) kallsyms_lookup_name(probed_func); - if (!my_kretprobe.kp.addr) { - printk("Couldn't find %s to plant return probe\n", probed_func); - return -1; - } - if ((ret = register_kretprobe(&my_kretprobe)) < 0) { - printk("register_kretprobe failed, returned %d\n", ret); - return -1; - } - printk("Planted return probe at %p\n", my_kretprobe.kp.addr); - return 0; -} - -void cleanup_module(void) -{ - unregister_kretprobe(&my_kretprobe); - printk("kretprobe unregistered\n"); - /* nmissed > 0 suggests that maxactive was set too low. */ - printk("Missed probing %d instances of %s\n", - my_kretprobe.nmissed, probed_func); -} - -MODULE_LICENSE("GPL"); ------ cut here ----- - -Build and insert the kernel module as shown in the above kprobe -example. You will see the trace data in /var/log/messages and on the -console whenever sys_open() returns a negative value. (Some messages -may be suppressed if syslogd is configured to eliminate duplicate -messages.) - -For additional information on Kprobes, refer to the following URLs: -http://www-106.ibm.com/developerworks/library/l-kprobes.html?ca=dgr-lnxw42Kprobe -http://www.redhat.com/magazine/005mar05/features/kprobes/ diff --git a/trunk/Documentation/usb/usbmon.txt b/trunk/Documentation/usb/usbmon.txt index 63cb7edd177e..f1896ee3bb2a 100644 --- a/trunk/Documentation/usb/usbmon.txt +++ b/trunk/Documentation/usb/usbmon.txt @@ -102,7 +102,7 @@ Here is the list of words, from left to right: - URB Status. This field makes no sense for submissions, but is present to help scripts with parsing. In error case, it contains the error code. In case of a setup packet, it contains a Setup Tag. If scripts read a number - in this field, they proceed to read Data Length. Otherwise, they read + in this field, the proceed to read Data Length. Otherwise, they read the setup packet before reading the Data Length. - Setup packet, if present, consists of 5 words: one of each for bmRequestType, bRequest, wValue, wIndex, wLength, as specified by the USB Specification 2.0. diff --git a/trunk/Documentation/video4linux/bttv/Insmod-options b/trunk/Documentation/video4linux/bttv/Insmod-options index fc94ff235ffa..7bb5a50b0779 100644 --- a/trunk/Documentation/video4linux/bttv/Insmod-options +++ b/trunk/Documentation/video4linux/bttv/Insmod-options @@ -44,9 +44,6 @@ bttv.o push used by bttv. bttv will disable overlay by default on this hardware to avoid crashes. With this insmod option you can override this. - no_overlay=1 Disable overlay. It should be used by broken - hardware that doesn't support PCI2PCI direct - transfers. automute=0/1 Automatically mutes the sound if there is no TV signal, on by default. You might try to disable this if you have bad input signal diff --git a/trunk/arch/alpha/kernel/pci.c b/trunk/arch/alpha/kernel/pci.c index 2a8b364c822e..1f36bbd0ed5d 100644 --- a/trunk/arch/alpha/kernel/pci.c +++ b/trunk/arch/alpha/kernel/pci.c @@ -350,24 +350,8 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, region->end = res->end - offset; } -void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region) -{ - struct pci_controller *hose = (struct pci_controller *)dev->sysdata; - unsigned long offset = 0; - - if (res->flags & IORESOURCE_IO) - offset = hose->io_space->start; - else if (res->flags & IORESOURCE_MEM) - offset = hose->mem_space->start; - - res->start = region->start + offset; - res->end = region->end + offset; -} - #ifdef CONFIG_HOTPLUG EXPORT_SYMBOL(pcibios_resource_to_bus); -EXPORT_SYMBOL(pcibios_bus_to_resource); #endif int diff --git a/trunk/arch/arm/kernel/bios32.c b/trunk/arch/arm/kernel/bios32.c index c4923fac8dff..ad26e98f1e62 100644 --- a/trunk/arch/arm/kernel/bios32.c +++ b/trunk/arch/arm/kernel/bios32.c @@ -447,26 +447,9 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, region->end = res->end - offset; } -void __devinit -pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region) -{ - struct pci_sys_data *root = dev->sysdata; - unsigned long offset = 0; - - if (res->flags & IORESOURCE_IO) - offset = root->io_offset; - if (res->flags & IORESOURCE_MEM) - offset = root->mem_offset; - - res->start = region->start + offset; - res->end = region->end + offset; -} - #ifdef CONFIG_HOTPLUG EXPORT_SYMBOL(pcibios_fixup_bus); EXPORT_SYMBOL(pcibios_resource_to_bus); -EXPORT_SYMBOL(pcibios_bus_to_resource); #endif /* diff --git a/trunk/arch/arm/mach-sa1100/jornada720.c b/trunk/arch/arm/mach-sa1100/jornada720.c index 2f497112c96a..eee3cbc5ec4f 100644 --- a/trunk/arch/arm/mach-sa1100/jornada720.c +++ b/trunk/arch/arm/mach-sa1100/jornada720.c @@ -97,7 +97,6 @@ static void __init jornada720_map_io(void) } MACHINE_START(JORNADA720, "HP Jornada 720") - /* Maintainer: Michael Gernoth */ .phys_ram = 0xc0000000, .phys_io = 0x80000000, .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, diff --git a/trunk/arch/arm/mm/fault.c b/trunk/arch/arm/mm/fault.c index 0b6c4db44e08..65bfe84b6d67 100644 --- a/trunk/arch/arm/mm/fault.c +++ b/trunk/arch/arm/mm/fault.c @@ -238,9 +238,9 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) up_read(&mm->mmap_sem); /* - * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR + * Handle the "normal" case first */ - if (fault >= VM_FAULT_MINOR) + if (fault > 0) return 0; /* @@ -261,7 +261,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) do_exit(SIGKILL); return 0; - case VM_FAULT_SIGBUS: + case 0: /* * We had some memory, but were unable to * successfully fix up this page fault. diff --git a/trunk/arch/arm/oprofile/backtrace.c b/trunk/arch/arm/oprofile/backtrace.c index df35c452a8bf..ec58d3e2eb8b 100644 --- a/trunk/arch/arm/oprofile/backtrace.c +++ b/trunk/arch/arm/oprofile/backtrace.c @@ -115,7 +115,7 @@ static int valid_kernel_stack(struct frame_tail *tail, struct pt_regs *regs) return (tailaddr > stack) && (tailaddr < stack_base); } -void arm_backtrace(struct pt_regs * const regs, unsigned int depth) +void arm_backtrace(struct pt_regs const *regs, unsigned int depth) { struct frame_tail *tail; unsigned long last_address = 0; diff --git a/trunk/arch/arm26/mm/fault.c b/trunk/arch/arm26/mm/fault.c index bd6f2db608b7..dacca8bb7744 100644 --- a/trunk/arch/arm26/mm/fault.c +++ b/trunk/arch/arm26/mm/fault.c @@ -176,12 +176,12 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, * Handle the "normal" cases first - successful and sigbus */ switch (fault) { - case VM_FAULT_MAJOR: + case 2: tsk->maj_flt++; return fault; - case VM_FAULT_MINOR: + case 1: tsk->min_flt++; - case VM_FAULT_SIGBUS: + case 0: return fault; } @@ -226,11 +226,14 @@ int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) /* * Handle the "normal" case first */ - switch (fault) { - case VM_FAULT_MINOR: - case VM_FAULT_MAJOR: + if (fault > 0) return 0; - case VM_FAULT_SIGBUS: + + /* + * We had some memory, but were unable to + * successfully fix up this page fault. + */ + if (fault == 0){ goto do_sigbus; } diff --git a/trunk/arch/cris/mm/fault.c b/trunk/arch/cris/mm/fault.c index 934c51078cce..fe1cc36b5aca 100644 --- a/trunk/arch/cris/mm/fault.c +++ b/trunk/arch/cris/mm/fault.c @@ -284,13 +284,13 @@ do_page_fault(unsigned long address, struct pt_regs *regs, */ switch (handle_mm_fault(mm, vma, address, writeaccess & 1)) { - case VM_FAULT_MINOR: + case 1: tsk->min_flt++; break; - case VM_FAULT_MAJOR: + case 2: tsk->maj_flt++; break; - case VM_FAULT_SIGBUS: + case 0: goto do_sigbus; default: goto out_of_memory; diff --git a/trunk/arch/frv/mm/fault.c b/trunk/arch/frv/mm/fault.c index 8b3eb50c5105..41d02ac48233 100644 --- a/trunk/arch/frv/mm/fault.c +++ b/trunk/arch/frv/mm/fault.c @@ -163,13 +163,13 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear * the fault. */ switch (handle_mm_fault(mm, vma, ear0, write)) { - case VM_FAULT_MINOR: + case 1: current->min_flt++; break; - case VM_FAULT_MAJOR: + case 2: current->maj_flt++; break; - case VM_FAULT_SIGBUS: + case 0: goto do_sigbus; default: goto out_of_memory; diff --git a/trunk/arch/i386/Kconfig b/trunk/arch/i386/Kconfig index 619d843ba231..a801d9d48606 100644 --- a/trunk/arch/i386/Kconfig +++ b/trunk/arch/i386/Kconfig @@ -454,9 +454,8 @@ config HPET_TIMER Choose N to continue using the legacy 8254 timer. config HPET_EMULATE_RTC - bool + bool "Provide RTC interrupt" depends on HPET_TIMER && RTC=y - default y config SMP bool "Symmetric multi-processing support" diff --git a/trunk/arch/m68k/mm/fault.c b/trunk/arch/m68k/mm/fault.c index aec15270d334..ac48b6d2aff6 100644 --- a/trunk/arch/m68k/mm/fault.c +++ b/trunk/arch/m68k/mm/fault.c @@ -160,13 +160,13 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, printk("handle_mm_fault returns %d\n",fault); #endif switch (fault) { - case VM_FAULT_MINOR: + case 1: current->min_flt++; break; - case VM_FAULT_MAJOR: + case 2: current->maj_flt++; break; - case VM_FAULT_SIGBUS: + case 0: goto bus_err; default: goto out_of_memory; diff --git a/trunk/arch/parisc/mm/fault.c b/trunk/arch/parisc/mm/fault.c index 0ad945d4c0a4..eaa701479f5f 100644 --- a/trunk/arch/parisc/mm/fault.c +++ b/trunk/arch/parisc/mm/fault.c @@ -178,17 +178,17 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, */ switch (handle_mm_fault(mm, vma, address, (acc_type & VM_WRITE) != 0)) { - case VM_FAULT_MINOR: + case 1: ++current->min_flt; break; - case VM_FAULT_MAJOR: + case 2: ++current->maj_flt; break; - case VM_FAULT_SIGBUS: + case 0: /* - * We hit a hared mapping outside of the file, or some - * other thing happened to us that made us unable to - * handle the page fault gracefully. + * We ran out of memory, or some other thing happened + * to us that made us unable to handle the page fault + * gracefully. */ goto bad_area; default: diff --git a/trunk/arch/ppc/kernel/pci.c b/trunk/arch/ppc/kernel/pci.c index 7b3586a3bf30..70cfb6ffd877 100644 --- a/trunk/arch/ppc/kernel/pci.c +++ b/trunk/arch/ppc/kernel/pci.c @@ -160,21 +160,6 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, } EXPORT_SYMBOL(pcibios_resource_to_bus); -void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region) -{ - unsigned long offset = 0; - struct pci_controller *hose = dev->sysdata; - - if (hose && res->flags & IORESOURCE_IO) - offset = (unsigned long)hose->io_base_virt - isa_io_base; - else if (hose && res->flags & IORESOURCE_MEM) - offset = hose->pci_mem_offset; - res->start = region->start + offset; - res->end = region->end + offset; -} -EXPORT_SYMBOL(pcibios_bus_to_resource); - /* * We need to avoid collisions with `mirrored' VGA ports * and other strange ISA hardware, so we always want the diff --git a/trunk/arch/ppc64/kernel/head.S b/trunk/arch/ppc64/kernel/head.S index 784f56d4684c..74fc3bc68604 100644 --- a/trunk/arch/ppc64/kernel/head.S +++ b/trunk/arch/ppc64/kernel/head.S @@ -2071,7 +2071,7 @@ _GLOBAL(hmt_start_secondary) blr #endif -#if defined(CONFIG_KEXEC) || (defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES)) +#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES) _GLOBAL(smp_release_cpus) /* All secondary cpus are spinning on a common * spinloop, release them all now so they can start diff --git a/trunk/arch/ppc64/kernel/machine_kexec.c b/trunk/arch/ppc64/kernel/machine_kexec.c index 4775f12a013c..fdb2fc649d72 100644 --- a/trunk/arch/ppc64/kernel/machine_kexec.c +++ b/trunk/arch/ppc64/kernel/machine_kexec.c @@ -185,7 +185,7 @@ void kexec_copy_flush(struct kimage *image) void kexec_smp_down(void *arg) { if (ppc_md.cpu_irq_down) - ppc_md.cpu_irq_down(1); + ppc_md.cpu_irq_down(); local_irq_disable(); kexec_smp_wait(); @@ -232,7 +232,7 @@ static void kexec_prepare_cpus(void) /* after we tell the others to go down */ if (ppc_md.cpu_irq_down) - ppc_md.cpu_irq_down(0); + ppc_md.cpu_irq_down(); put_cpu(); @@ -243,19 +243,15 @@ static void kexec_prepare_cpus(void) static void kexec_prepare_cpus(void) { - extern void smp_release_cpus(void); /* * move the secondarys to us so that we can copy * the new kernel 0-0x100 safely * * do this if kexec in setup.c ? - * - * We need to release the cpus if we are ever going from an - * UP to an SMP kernel. */ - smp_release_cpus(); + smp_relase_cpus(); if (ppc_md.cpu_irq_down) - ppc_md.cpu_irq_down(0); + ppc_md.cpu_irq_down(); local_irq_disable(); } diff --git a/trunk/arch/ppc64/kernel/mpic.c b/trunk/arch/ppc64/kernel/mpic.c index cc262a05ddb4..e8fbab1df37f 100644 --- a/trunk/arch/ppc64/kernel/mpic.c +++ b/trunk/arch/ppc64/kernel/mpic.c @@ -794,10 +794,10 @@ void mpic_setup_this_cpu(void) /* * XXX: someone who knows mpic should check this. - * do we need to eoi the ipi including for kexec cpu here (see xics comments)? + * do we need to eoi the ipi here (see xics comments)? * or can we reset the mpic in the new kernel? */ -void mpic_teardown_this_cpu(int secondary) +void mpic_teardown_this_cpu(void) { struct mpic *mpic = mpic_primary; unsigned long flags; diff --git a/trunk/arch/ppc64/kernel/mpic.h b/trunk/arch/ppc64/kernel/mpic.h index ca78a7f10528..99fbbc9a084c 100644 --- a/trunk/arch/ppc64/kernel/mpic.h +++ b/trunk/arch/ppc64/kernel/mpic.h @@ -256,7 +256,7 @@ extern unsigned int mpic_irq_get_priority(unsigned int irq); extern void mpic_setup_this_cpu(void); /* Clean up for kexec (or cpu offline or ...) */ -extern void mpic_teardown_this_cpu(int secondary); +extern void mpic_teardown_this_cpu(void); /* Request IPIs on primary mpic */ extern void mpic_request_ipis(void); diff --git a/trunk/arch/ppc64/kernel/pci.c b/trunk/arch/ppc64/kernel/pci.c index d0d55c7908ef..ae6f579d3fa0 100644 --- a/trunk/arch/ppc64/kernel/pci.c +++ b/trunk/arch/ppc64/kernel/pci.c @@ -108,28 +108,8 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region region->end = res->end - offset; } -void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region) -{ - unsigned long offset = 0; - struct pci_controller *hose = pci_bus_to_host(dev->bus); - - if (!hose) - return; - - if (res->flags & IORESOURCE_IO) - offset = (unsigned long)hose->io_base_virt - pci_io_base; - - if (res->flags & IORESOURCE_MEM) - offset = hose->pci_mem_offset; - - res->start = region->start + offset; - res->end = region->end + offset; -} - #ifdef CONFIG_HOTPLUG EXPORT_SYMBOL(pcibios_resource_to_bus); -EXPORT_SYMBOL(pcibios_bus_to_resource); #endif /* diff --git a/trunk/arch/ppc64/kernel/xics.c b/trunk/arch/ppc64/kernel/xics.c index d9dc6f28d050..677c4450984a 100644 --- a/trunk/arch/ppc64/kernel/xics.c +++ b/trunk/arch/ppc64/kernel/xics.c @@ -647,30 +647,29 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) } } -void xics_teardown_cpu(int secondary) +void xics_teardown_cpu(void) { int cpu = smp_processor_id(); + int status; ops->cppr_info(cpu, 0x00); iosync(); /* - * Some machines need to have at least one cpu in the GIQ, - * so leave the master cpu in the group. + * we need to EOI the IPI if we got here from kexec down IPI + * + * xics doesn't care if we duplicate an EOI as long as we + * don't EOI and raise priority. + * + * probably need to check all the other interrupts too + * should we be flagging idle loop instead? + * or creating some task to be scheduled? */ - if (secondary) { - /* - * we need to EOI the IPI if we got here from kexec down IPI - * - * probably need to check all the other interrupts too - * should we be flagging idle loop instead? - * or creating some task to be scheduled? - */ - ops->xirr_info_set(cpu, XICS_IPI); - rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, - (1UL << interrupt_server_size) - 1 - - default_distrib_server, 0); - } + ops->xirr_info_set(cpu, XICS_IPI); + + status = rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, + (1UL << interrupt_server_size) - 1 - default_distrib_server, 0); + WARN_ON(status != 0); } #ifdef CONFIG_HOTPLUG_CPU diff --git a/trunk/arch/sh64/mm/fault.c b/trunk/arch/sh64/mm/fault.c index f08d0eaf6497..a24932881dbb 100644 --- a/trunk/arch/sh64/mm/fault.c +++ b/trunk/arch/sh64/mm/fault.c @@ -223,13 +223,13 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess, */ survive: switch (handle_mm_fault(mm, vma, address, writeaccess)) { - case VM_FAULT_MINOR: + case 1: tsk->min_flt++; break; - case VM_FAULT_MAJOR: + case 2: tsk->maj_flt++; break; - case VM_FAULT_SIGBUS: + case 0: goto do_sigbus; default: goto out_of_memory; diff --git a/trunk/arch/sparc64/kernel/pci.c b/trunk/arch/sparc64/kernel/pci.c index 914e125d3971..bba140d98b1b 100644 --- a/trunk/arch/sparc64/kernel/pci.c +++ b/trunk/arch/sparc64/kernel/pci.c @@ -413,12 +413,6 @@ static int pci_assign_bus_resource(const struct pci_bus *bus, return -EBUSY; } -void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) -{ - /* Not implemented for sparc64... */ - BUG(); -} - int pci_assign_resource(struct pci_dev *pdev, int resource) { struct pcidev_cookie *pcp = pdev->sysdata; diff --git a/trunk/arch/x86_64/ia32/ptrace32.c b/trunk/arch/x86_64/ia32/ptrace32.c index 2a925e2af390..b98b6d2462f6 100644 --- a/trunk/arch/x86_64/ia32/ptrace32.c +++ b/trunk/arch/x86_64/ia32/ptrace32.c @@ -43,11 +43,11 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 val) switch (regno) { case offsetof(struct user32, regs.fs): if (val && (val & 3) != 3) return -EIO; - child->thread.fsindex = val & 0xffff; + child->thread.fs = val & 0xffff; break; case offsetof(struct user32, regs.gs): if (val && (val & 3) != 3) return -EIO; - child->thread.gsindex = val & 0xffff; + child->thread.gs = val & 0xffff; break; case offsetof(struct user32, regs.ds): if (val && (val & 3) != 3) return -EIO; @@ -138,10 +138,10 @@ static int getreg32(struct task_struct *child, unsigned regno, u32 *val) switch (regno) { case offsetof(struct user32, regs.fs): - *val = child->thread.fsindex; + *val = child->thread.fs; break; case offsetof(struct user32, regs.gs): - *val = child->thread.gsindex; + *val = child->thread.gs; break; case offsetof(struct user32, regs.ds): *val = child->thread.ds; diff --git a/trunk/arch/x86_64/mm/fault.c b/trunk/arch/x86_64/mm/fault.c index 493819e543a5..13792721037e 100644 --- a/trunk/arch/x86_64/mm/fault.c +++ b/trunk/arch/x86_64/mm/fault.c @@ -439,13 +439,13 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code) * the fault. */ switch (handle_mm_fault(mm, vma, address, write)) { - case VM_FAULT_MINOR: + case 1: tsk->min_flt++; break; - case VM_FAULT_MAJOR: + case 2: tsk->maj_flt++; break; - case VM_FAULT_SIGBUS: + case 0: goto do_sigbus; default: goto out_of_memory; diff --git a/trunk/drivers/acpi/dispatcher/dswload.c b/trunk/drivers/acpi/dispatcher/dswload.c index d11620018421..1ac197ccfc80 100644 --- a/trunk/drivers/acpi/dispatcher/dswload.c +++ b/trunk/drivers/acpi/dispatcher/dswload.c @@ -491,6 +491,12 @@ acpi_ds_load2_begin_op ( if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) || (!(walk_state->op_info->flags & AML_NAMED))) { + if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || + (walk_state->op_info->class == AML_CLASS_CONTROL)) { + ACPI_REPORT_WARNING (( + "Encountered executable code at module level, [%s]\n", + acpi_ps_get_opcode_name (walk_state->opcode))); + } return_ACPI_STATUS (AE_OK); } diff --git a/trunk/drivers/acpi/osl.c b/trunk/drivers/acpi/osl.c index 7289da3c4db6..bdd9f37f8101 100644 --- a/trunk/drivers/acpi/osl.c +++ b/trunk/drivers/acpi/osl.c @@ -145,14 +145,10 @@ acpi_os_vprintf(const char *fmt, va_list args) #endif } -extern int acpi_in_resume; void * acpi_os_allocate(acpi_size size) { - if (acpi_in_resume) - return kmalloc(size, GFP_ATOMIC); - else - return kmalloc(size, GFP_KERNEL); + return kmalloc(size, GFP_KERNEL); } void diff --git a/trunk/drivers/acpi/pci_link.c b/trunk/drivers/acpi/pci_link.c index 834c2ceff1aa..65cea07abbc3 100644 --- a/trunk/drivers/acpi/pci_link.c +++ b/trunk/drivers/acpi/pci_link.c @@ -798,11 +798,6 @@ acpi_pci_link_resume( return_VALUE(0); } -/* - * FIXME: this is a workaround to avoid nasty warning. It will be removed - * after every device calls pci_disable_device in .resume. - */ -int acpi_in_resume; static int irqrouter_resume( struct sys_device *dev) @@ -812,7 +807,6 @@ irqrouter_resume( ACPI_FUNCTION_TRACE("irqrouter_resume"); - acpi_in_resume = 1; list_for_each(node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node); if (!link) { @@ -822,7 +816,6 @@ irqrouter_resume( } acpi_pci_link_resume(link); } - acpi_in_resume = 0; return_VALUE(0); } diff --git a/trunk/drivers/char/rtc.c b/trunk/drivers/char/rtc.c index cd4fe8b1709f..d8f9e94ae475 100644 --- a/trunk/drivers/char/rtc.c +++ b/trunk/drivers/char/rtc.c @@ -1209,7 +1209,6 @@ static int rtc_proc_open(struct inode *inode, struct file *file) void rtc_get_rtc_time(struct rtc_time *rtc_tm) { - unsigned long uip_watchdog = jiffies; unsigned char ctrl; #ifdef CONFIG_MACH_DECSTATION unsigned int real_year; @@ -1225,10 +1224,8 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) * Once the read clears, read the RTC time (again via ioctl). Easy. */ - while (rtc_is_updating() != 0 && jiffies - uip_watchdog < 2*HZ/100) { - barrier(); - cpu_relax(); - } + if (rtc_is_updating() != 0) + msleep(20); /* * Only the values that we read from the RTC are set. We leave diff --git a/trunk/drivers/fc4/fc.c b/trunk/drivers/fc4/fc.c index e4710d1d1f9d..5d961f5e0ca0 100644 --- a/trunk/drivers/fc4/fc.c +++ b/trunk/drivers/fc4/fc.c @@ -1004,8 +1004,8 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt) return FAILED; } fc->rst_pkt->eh_state = SCSI_STATE_UNUSED; -#endif return SUCCESS; +#endif } static int __fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) diff --git a/trunk/drivers/ide/ide-probe.c b/trunk/drivers/ide/ide-probe.c index 94daf40ae323..7df85af75371 100644 --- a/trunk/drivers/ide/ide-probe.c +++ b/trunk/drivers/ide/ide-probe.c @@ -960,15 +960,6 @@ static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match) } #endif /* MAX_HWIFS > 1 */ -static inline int hwif_to_node(ide_hwif_t *hwif) -{ - if (hwif->pci_dev) - return pcibus_to_node(hwif->pci_dev->bus); - else - /* Add ways to determine the node of other busses here */ - return -1; -} - /* * init request queue */ @@ -987,7 +978,8 @@ static int ide_init_queue(ide_drive_t *drive) * do not. */ - q = blk_init_queue_node(do_ide_request, &ide_lock, hwif_to_node(hwif)); + q = blk_init_queue_node(do_ide_request, &ide_lock, + pcibus_to_node(drive->hwif->pci_dev->bus)); if (!q) return 1; @@ -1056,8 +1048,6 @@ static int init_irq (ide_hwif_t *hwif) BUG_ON(in_interrupt()); BUG_ON(irqs_disabled()); - BUG_ON(hwif == NULL); - down(&ide_cfg_sem); hwif->hwgroup = NULL; #if MAX_HWIFS > 1 @@ -1107,7 +1097,7 @@ static int init_irq (ide_hwif_t *hwif) spin_unlock_irq(&ide_lock); } else { hwgroup = kmalloc_node(sizeof(ide_hwgroup_t), GFP_KERNEL, - hwif_to_node(hwif->drives[0].hwif)); + pcibus_to_node(hwif->drives[0].hwif->pci_dev->bus)); if (!hwgroup) goto out_up; diff --git a/trunk/drivers/infiniband/include/ib_cm.h b/trunk/drivers/infiniband/include/ib_cm.h index da650115e79a..e5d74a730a70 100644 --- a/trunk/drivers/infiniband/include/ib_cm.h +++ b/trunk/drivers/infiniband/include/ib_cm.h @@ -169,8 +169,7 @@ enum ib_cm_rej_reason { IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS = __constant_htons(21), IB_CM_REJ_INVALID_ALT_HOP_LIMIT = __constant_htons(22), IB_CM_REJ_INVALID_ALT_PACKET_RATE = __constant_htons(23), - IB_CM_REJ_PORT_CM_REDIRECT = __constant_htons(24), - IB_CM_REJ_PORT_REDIRECT = __constant_htons(25), + IB_CM_REJ_PORT_REDIRECT = __constant_htons(24), IB_CM_REJ_INVALID_MTU = __constant_htons(26), IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES = __constant_htons(27), IB_CM_REJ_CONSUMER_DEFINED = __constant_htons(28), diff --git a/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c b/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c index fa00816a3cf7..6f60abbaebd5 100644 --- a/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -600,10 +600,9 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) ipoib_mcast_send(dev, (union ib_gid *) (phdr->hwaddr + 4), skb); } else { - /* unicast GID -- should be ARP or RARP reply */ + /* unicast GID -- should be ARP reply */ - if ((be16_to_cpup((__be16 *) skb->data) != ETH_P_ARP) && - (be16_to_cpup((__be16 *) skb->data) != ETH_P_RARP)) { + if (be16_to_cpup((u16 *) skb->data) != ETH_P_ARP) { ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x " IPOIB_GID_FMT "\n", skb->dst ? "neigh" : "dst", diff --git a/trunk/drivers/md/bitmap.c b/trunk/drivers/md/bitmap.c index 41df4cda66e2..70bca955e0de 100644 --- a/trunk/drivers/md/bitmap.c +++ b/trunk/drivers/md/bitmap.c @@ -818,7 +818,8 @@ int bitmap_unplug(struct bitmap *bitmap) return 0; } -static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset); +static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, + unsigned long sectors, int in_sync); /* * bitmap_init_from_disk -- called at bitmap_create time to initialize * the in-memory bitmap from the on-disk bitmap -- also, sets up the * memory mapping of the bitmap file @@ -827,7 +828,7 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset); * previously kicked from the array, we mark all the bits as * 1's in order to cause a full resync. */ -static int bitmap_init_from_disk(struct bitmap *bitmap) +static int bitmap_init_from_disk(struct bitmap *bitmap, int in_sync) { unsigned long i, chunks, index, oldindex, bit; struct page *page = NULL, *oldpage = NULL; @@ -928,7 +929,8 @@ static int bitmap_init_from_disk(struct bitmap *bitmap) } if (test_bit(bit, page_address(page))) { /* if the disk bit is set, set the memory bit */ - bitmap_set_memory_bits(bitmap, i << CHUNK_BLOCK_SHIFT(bitmap)); + bitmap_set_memory_bits(bitmap, + i << CHUNK_BLOCK_SHIFT(bitmap), 1, in_sync); bit_cnt++; } } @@ -1424,53 +1426,35 @@ void bitmap_close_sync(struct bitmap *bitmap) } } -static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset) +static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, + unsigned long sectors, int in_sync) { /* For each chunk covered by any of these sectors, set the - * counter to 1 and set resync_needed. They should all + * counter to 1 and set resync_needed unless in_sync. They should all * be 0 at this point */ - - int secs; - bitmap_counter_t *bmc; - spin_lock_irq(&bitmap->lock); - bmc = bitmap_get_counter(bitmap, offset, &secs, 1); - if (!bmc) { + while (sectors) { + int secs; + bitmap_counter_t *bmc; + spin_lock_irq(&bitmap->lock); + bmc = bitmap_get_counter(bitmap, offset, &secs, 1); + if (!bmc) { + spin_unlock_irq(&bitmap->lock); + return; + } + if (! *bmc) { + struct page *page; + *bmc = 1 | (in_sync? 0 : NEEDED_MASK); + bitmap_count_page(bitmap, offset, 1); + page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)); + set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); + } spin_unlock_irq(&bitmap->lock); - return; - } - if (! *bmc) { - struct page *page; - *bmc = 1 | NEEDED_MASK; - bitmap_count_page(bitmap, offset, 1); - page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)); - set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); + if (sectors > secs) + sectors -= secs; + else + sectors = 0; } - spin_unlock_irq(&bitmap->lock); - -} - -/* - * flush out any pending updates - */ -void bitmap_flush(mddev_t *mddev) -{ - struct bitmap *bitmap = mddev->bitmap; - int sleep; - - if (!bitmap) /* there was no bitmap */ - return; - - /* run the daemon_work three time to ensure everything is flushed - * that can be - */ - sleep = bitmap->daemon_sleep; - bitmap->daemon_sleep = 0; - bitmap_daemon_work(bitmap); - bitmap_daemon_work(bitmap); - bitmap_daemon_work(bitmap); - bitmap->daemon_sleep = sleep; - bitmap_update_sb(bitmap); } /* @@ -1581,8 +1565,7 @@ int bitmap_create(mddev_t *mddev) /* now that we have some pages available, initialize the in-memory * bitmap from the on-disk bitmap */ - err = bitmap_init_from_disk(bitmap); - + err = bitmap_init_from_disk(bitmap, mddev->recovery_cp == MaxSector); if (err) return err; diff --git a/trunk/drivers/md/dm-raid1.c b/trunk/drivers/md/dm-raid1.c index b08df8b9b2ca..12031c9d3f1e 100644 --- a/trunk/drivers/md/dm-raid1.c +++ b/trunk/drivers/md/dm-raid1.c @@ -1230,7 +1230,7 @@ static int __init dm_mirror_init(void) if (r) return r; - _kmirrord_wq = create_singlethread_workqueue("kmirrord"); + _kmirrord_wq = create_workqueue("kmirrord"); if (!_kmirrord_wq) { DMERR("couldn't start kmirrord"); dm_dirty_log_exit(); diff --git a/trunk/drivers/md/md.c b/trunk/drivers/md/md.c index 480f658db6f2..6580e0fa4a47 100644 --- a/trunk/drivers/md/md.c +++ b/trunk/drivers/md/md.c @@ -1798,8 +1798,6 @@ static int do_md_stop(mddev_t * mddev, int ro) goto out; mddev->ro = 1; } else { - bitmap_flush(mddev); - wait_event(mddev->sb_wait, atomic_read(&mddev->pending_writes)==0); if (mddev->ro) set_disk_ro(disk, 0); blk_queue_make_request(mddev->queue, md_fail_request); @@ -3486,6 +3484,7 @@ static void md_do_sync(mddev_t *mddev) goto skip; } ITERATE_MDDEV(mddev2,tmp) { + printk("."); if (mddev2 == mddev) continue; if (mddev2->curr_resync && @@ -4008,4 +4007,3 @@ EXPORT_SYMBOL(md_wakeup_thread); EXPORT_SYMBOL(md_print_devices); EXPORT_SYMBOL(md_check_recovery); MODULE_LICENSE("GPL"); -MODULE_ALIAS("md"); diff --git a/trunk/drivers/md/raid1.c b/trunk/drivers/md/raid1.c index 51d9645ed09c..d3a64a04a6d8 100644 --- a/trunk/drivers/md/raid1.c +++ b/trunk/drivers/md/raid1.c @@ -893,6 +893,7 @@ static int end_sync_read(struct bio *bio, unsigned int bytes_done, int error) if (!uptodate) { md_error(r1_bio->mddev, conf->mirrors[r1_bio->read_disk].rdev); + set_bit(R1BIO_Degraded, &r1_bio->state); } else set_bit(R1BIO_Uptodate, &r1_bio->state); rdev_dec_pending(conf->mirrors[r1_bio->read_disk].rdev, conf->mddev); @@ -917,9 +918,10 @@ static int end_sync_write(struct bio *bio, unsigned int bytes_done, int error) mirror = i; break; } - if (!uptodate) + if (!uptodate) { md_error(mddev, conf->mirrors[mirror].rdev); - + set_bit(R1BIO_Degraded, &r1_bio->state); + } update_head_pos(mirror, r1_bio); if (atomic_dec_and_test(&r1_bio->remaining)) { @@ -1107,7 +1109,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i int i; int write_targets = 0; int sync_blocks; - int still_degraded = 0; if (!conf->r1buf_pool) { @@ -1136,10 +1137,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i return 0; } - /* before building a request, check if we can skip these blocks.. - * This call the bitmap_start_sync doesn't actually record anything - */ - if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 1) && + if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, mddev->degraded) && !conf->fullsync) { /* We can skip this block, and probably several more */ *skipped = 1; @@ -1205,23 +1203,24 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i if (i == disk) { bio->bi_rw = READ; bio->bi_end_io = end_sync_read; - } else if (conf->mirrors[i].rdev == NULL || - conf->mirrors[i].rdev->faulty) { - still_degraded = 1; - continue; - } else if (!conf->mirrors[i].rdev->in_sync || - sector_nr + RESYNC_SECTORS > mddev->recovery_cp) { + } else if (conf->mirrors[i].rdev && + !conf->mirrors[i].rdev->faulty && + (!conf->mirrors[i].rdev->in_sync || + sector_nr + RESYNC_SECTORS > mddev->recovery_cp)) { bio->bi_rw = WRITE; bio->bi_end_io = end_sync_write; write_targets ++; } else - /* no need to read or write here */ continue; bio->bi_sector = sector_nr + conf->mirrors[i].rdev->data_offset; bio->bi_bdev = conf->mirrors[i].rdev->bdev; bio->bi_private = r1_bio; } + if (write_targets + 1 < conf->raid_disks) + /* array degraded, can't clear bitmap */ + set_bit(R1BIO_Degraded, &r1_bio->state); + if (write_targets == 0) { /* There is nowhere to write, so all non-sync * drives must be failed - so we are finished @@ -1244,7 +1243,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i break; if (sync_blocks == 0) { if (!bitmap_start_sync(mddev->bitmap, sector_nr, - &sync_blocks, still_degraded) && + &sync_blocks, mddev->degraded) && !conf->fullsync) break; if (sync_blocks < (PAGE_SIZE>>9)) diff --git a/trunk/drivers/media/video/bttv-cards.c b/trunk/drivers/media/video/bttv-cards.c index a97b9b958ed6..6c52fd0bb7df 100644 --- a/trunk/drivers/media/video/bttv-cards.c +++ b/trunk/drivers/media/video/bttv-cards.c @@ -95,7 +95,7 @@ static int __devinit pvr_boot(struct bttv *btv); static unsigned int triton1=0; static unsigned int vsfx=0; static unsigned int latency = UNSET; -int no_overlay=-1; +static unsigned int no_overlay=-1; static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; @@ -4296,11 +4296,9 @@ void __devinit bttv_check_chipset(void) printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n"); if (pcipci_fail) { printk(KERN_WARNING "bttv: BT848 and your chipset may not work together.\n"); - if (!no_overlay) { - printk(KERN_WARNING "bttv: overlay will be disabled.\n"); + if (UNSET == no_overlay) { + printk(KERN_WARNING "bttv: going to disable overlay.\n"); no_overlay = 1; - } else { - printk(KERN_WARNING "bttv: overlay forced. Use this option at your own risk.\n"); } } if (UNSET != latency) diff --git a/trunk/drivers/media/video/bttv-driver.c b/trunk/drivers/media/video/bttv-driver.c index eee9322ce21b..67f331eeeb19 100644 --- a/trunk/drivers/media/video/bttv-driver.c +++ b/trunk/drivers/media/video/bttv-driver.c @@ -1,5 +1,5 @@ /* - $Id: bttv-driver.c,v 1.52 2005/08/04 00:55:16 mchehab Exp $ + $Id: bttv-driver.c,v 1.45 2005/07/20 19:43:24 mkrufky Exp $ bttv - Bt848 frame grabber driver @@ -80,7 +80,6 @@ static unsigned int irq_iswitch = 0; static unsigned int uv_ratio = 50; static unsigned int full_luma_range = 0; static unsigned int coring = 0; -extern int no_overlay; /* API features (turn on/off stuff for testing) */ static unsigned int v4l2 = 1; @@ -2152,10 +2151,6 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv, return 0; } case V4L2_BUF_TYPE_VIDEO_OVERLAY: - if (no_overlay > 0) { - printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n"); - return -EINVAL; - } return setup_window(fh, btv, &f->fmt.win, 1); case V4L2_BUF_TYPE_VBI_CAPTURE: retval = bttv_switch_type(fh,f->type); @@ -2229,11 +2224,9 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, /* others */ cap->type = VID_TYPE_CAPTURE| VID_TYPE_TUNER| + VID_TYPE_OVERLAY| VID_TYPE_CLIPPING| VID_TYPE_SCALES; - if (no_overlay <= 0) - cap->type |= VID_TYPE_OVERLAY; - cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth; cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight; cap->minwidth = 48; @@ -2309,11 +2302,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, struct video_window *win = arg; struct v4l2_window w2; - if (no_overlay > 0) { - printk ("VIDIOCSWIN: no_overlay\n"); - return -EINVAL; - } - w2.field = V4L2_FIELD_ANY; w2.w.left = win->x; w2.w.top = win->y; @@ -2589,12 +2577,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, cap->version = BTTV_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | + V4L2_CAP_VIDEO_OVERLAY | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; - if (no_overlay <= 0) - cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY; - if (bttv_tvcards[btv->c.type].tuner != UNSET && bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT) cap->capabilities |= V4L2_CAP_TUNER; @@ -3090,7 +3076,7 @@ static struct file_operations bttv_fops = static struct video_device bttv_video_template = { .name = "UNSET", - .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER| + .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_OVERLAY| VID_TYPE_CLIPPING|VID_TYPE_SCALES, .hardware = VID_HARDWARE_BT848, .fops = &bttv_fops, @@ -3770,12 +3756,6 @@ static void bttv_unregister_video(struct bttv *btv) /* register video4linux devices */ static int __devinit bttv_register_video(struct bttv *btv) { - if (no_overlay <= 0) { - bttv_video_template.type |= VID_TYPE_OVERLAY; - } else { - printk("bttv: Overlay support disabled.\n"); - } - /* video */ btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); if (NULL == btv->video_dev) diff --git a/trunk/drivers/pci/pci.c b/trunk/drivers/pci/pci.c index 65ea7d25f691..1b34fc56067e 100644 --- a/trunk/drivers/pci/pci.c +++ b/trunk/drivers/pci/pci.c @@ -221,37 +221,6 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) return best; } -/** - * pci_restore_bars - restore a devices BAR values (e.g. after wake-up) - * @dev: PCI device to have its BARs restored - * - * Restore the BAR values for a given device, so as to make it - * accessible by its driver. - */ -void -pci_restore_bars(struct pci_dev *dev) -{ - int i, numres; - - switch (dev->hdr_type) { - case PCI_HEADER_TYPE_NORMAL: - numres = 6; - break; - case PCI_HEADER_TYPE_BRIDGE: - numres = 2; - break; - case PCI_HEADER_TYPE_CARDBUS: - numres = 1; - break; - default: - /* Should never get here, but just in case... */ - return; - } - - for (i = 0; i < numres; i ++) - pci_update_resource(dev, &dev->resource[i], i); -} - /** * pci_set_power_state - Set the power state of a PCI device * @dev: PCI device to be suspended @@ -270,7 +239,7 @@ int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t t); int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { - int pm, need_restore = 0; + int pm; u16 pmcsr, pmc; /* bound the state we're entering */ @@ -309,17 +278,14 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) return -EIO; } - pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr); - /* If we're in D3, force entire word to 0. * This doesn't affect PME_Status, disables PME_En, and * sets PowerState to 0. */ - if (dev->current_state >= PCI_D3hot) { - if (!(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET)) - need_restore = 1; + if (dev->current_state >= PCI_D3hot) pmcsr = 0; - } else { + else { + pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr); pmcsr &= ~PCI_PM_CTRL_STATE_MASK; pmcsr |= state; } @@ -342,22 +308,6 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) platform_pci_set_power_state(dev, state); dev->current_state = state; - - /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT - * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning - * from D3hot to D0 _may_ perform an internal reset, thereby - * going to "D0 Uninitialized" rather than "D0 Initialized". - * For example, at least some versions of the 3c905B and the - * 3c556B exhibit this behaviour. - * - * At least some laptop BIOSen (e.g. the Thinkpad T21) leave - * devices in a D3hot state at boot. Consequently, we need to - * restore at least the BARs so that the device will be - * accessible to its driver. - */ - if (need_restore) - pci_restore_bars(dev); - return 0; } @@ -855,7 +805,6 @@ struct pci_dev *isa_bridge; EXPORT_SYMBOL(isa_bridge); #endif -EXPORT_SYMBOL_GPL(pci_restore_bars); EXPORT_SYMBOL(pci_enable_device_bars); EXPORT_SYMBOL(pci_enable_device); EXPORT_SYMBOL(pci_disable_device); diff --git a/trunk/drivers/pci/setup-res.c b/trunk/drivers/pci/setup-res.c index 878fd0a65c02..1ca21d2ba11c 100644 --- a/trunk/drivers/pci/setup-res.c +++ b/trunk/drivers/pci/setup-res.c @@ -26,7 +26,7 @@ #include "pci.h" -void +static void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) { struct pci_bus_region region; diff --git a/trunk/drivers/pcmcia/yenta_socket.c b/trunk/drivers/pcmcia/yenta_socket.c index 62fd705203fb..91e7457d5b04 100644 --- a/trunk/drivers/pcmcia/yenta_socket.c +++ b/trunk/drivers/pcmcia/yenta_socket.c @@ -605,8 +605,9 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res, static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) { + struct pci_bus *bus; struct resource *root, *res; - struct pci_bus_region region; + u32 start, end; unsigned mask; res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; @@ -619,13 +620,15 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ if (type & IORESOURCE_IO) mask = ~3; - res->name = socket->dev->subordinate->name; + bus = socket->dev->subordinate; + res->name = bus->name; res->flags = type; - region.start = config_readl(socket, addr_start) & mask; - region.end = config_readl(socket, addr_end) | ~mask; - if (region.start && region.end > region.start && !override_bios) { - pcibios_bus_to_resource(socket->dev, res, ®ion); + start = config_readl(socket, addr_start) & mask; + end = config_readl(socket, addr_end) | ~mask; + if (start && end > start && !override_bios) { + res->start = start; + res->end = end; root = pci_find_parent_resource(socket->dev, res); if (root && (request_resource(root, res) == 0)) return; diff --git a/trunk/drivers/sbus/char/vfc.h b/trunk/drivers/sbus/char/vfc.h index e56a43af0f62..a7782e7da42e 100644 --- a/trunk/drivers/sbus/char/vfc.h +++ b/trunk/drivers/sbus/char/vfc.h @@ -129,8 +129,6 @@ struct vfc_dev { struct vfc_regs *phys_regs; unsigned int control_reg; struct semaphore device_lock_sem; - struct timer_list poll_timer; - wait_queue_head_t poll_wait; int instance; int busy; unsigned long which_io; diff --git a/trunk/drivers/sbus/char/vfc_dev.c b/trunk/drivers/sbus/char/vfc_dev.c index 86ce54130954..7a103698fa3c 100644 --- a/trunk/drivers/sbus/char/vfc_dev.c +++ b/trunk/drivers/sbus/char/vfc_dev.c @@ -137,7 +137,6 @@ int init_vfc_devstruct(struct vfc_dev *dev, int instance) dev->instance=instance; init_MUTEX(&dev->device_lock_sem); dev->control_reg=0; - init_waitqueue_head(&dev->poll_wait); dev->busy=0; return 0; } diff --git a/trunk/drivers/sbus/char/vfc_i2c.c b/trunk/drivers/sbus/char/vfc_i2c.c index 1faf1e75f71f..739cad9b19a1 100644 --- a/trunk/drivers/sbus/char/vfc_i2c.c +++ b/trunk/drivers/sbus/char/vfc_i2c.c @@ -79,25 +79,10 @@ int vfc_pcf8584_init(struct vfc_dev *dev) return 0; } -void vfc_i2c_delay_wakeup(struct vfc_dev *dev) -{ - /* Used to profile code and eliminate too many delays */ - VFC_I2C_DEBUG_PRINTK(("vfc%d: Delaying\n", dev->instance)); - wake_up(&dev->poll_wait); -} - void vfc_i2c_delay_no_busy(struct vfc_dev *dev, unsigned long usecs) { - DEFINE_WAIT(wait); - init_timer(&dev->poll_timer); - dev->poll_timer.expires = jiffies + usecs_to_jiffies(usecs); - dev->poll_timer.data=(unsigned long)dev; - dev->poll_timer.function=(void *)(unsigned long)vfc_i2c_delay_wakeup; - add_timer(&dev->poll_timer); - prepare_to_wait(&dev->poll_wait, &wait, TASK_UNINTERRUPTIBLE); - schedule(); - del_timer(&dev->poll_timer); - finish_wait(&dev->poll_wait, &wait); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(usecs_to_jiffies(usecs)); } void inline vfc_i2c_delay(struct vfc_dev *dev) diff --git a/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c b/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c index 687f19e9cf03..116d0f51ca2c 100644 --- a/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -1264,12 +1264,14 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, } switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { case AHC_DEV_Q_BASIC: - scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); - scsi_activate_tcq(sdev, dev->openings + dev->active); + scsi_adjust_queue_depth(sdev, + MSG_SIMPLE_TASK, + dev->openings + dev->active); break; case AHC_DEV_Q_TAGGED: - scsi_set_tag_type(sdev, MSG_ORDERED_TAG); - scsi_activate_tcq(sdev, dev->openings + dev->active); + scsi_adjust_queue_depth(sdev, + MSG_ORDERED_TASK, + dev->openings + dev->active); break; default: /* @@ -1278,7 +1280,9 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, * serially on the controller/device. This should * remove some latency. */ - scsi_deactivate_tcq(sdev, 2); + scsi_adjust_queue_depth(sdev, + /*NON-TAGGED*/0, + /*queue depth*/2); break; } } @@ -1631,9 +1635,9 @@ ahc_send_async(struct ahc_softc *ahc, char channel, spi_period(starget) = tinfo->curr.period; spi_width(starget) = tinfo->curr.width; spi_offset(starget) = tinfo->curr.offset; - spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0; - spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0; - spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0; + spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ; + spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ; + spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ; spi_display_xfer_agreement(starget); break; } @@ -2425,14 +2429,12 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt) unsigned int ppr_options = tinfo->goal.ppr_options & ~MSG_EXT_PPR_DT_REQ; unsigned int period = tinfo->goal.period; - unsigned int width = tinfo->goal.width; unsigned long flags; struct ahc_syncrate *syncrate; if (dt) { + period = 9; /* 12.5ns is the only period valid for DT */ ppr_options |= MSG_EXT_PPR_DT_REQ; - if (!width) - ahc_linux_set_width(starget, 1); } else if (period == 9) period = 10; /* if resetting DT, period must be >= 25ns */ diff --git a/trunk/drivers/scsi/ibmvscsi/srp.h b/trunk/drivers/scsi/ibmvscsi/srp.h index 7d8e4c4accb9..2ae5154fd89c 100644 --- a/trunk/drivers/scsi/ibmvscsi/srp.h +++ b/trunk/drivers/scsi/ibmvscsi/srp.h @@ -35,7 +35,7 @@ enum srp_types { SRP_LOGIN_REQ_TYPE = 0x00, SRP_LOGIN_RSP_TYPE = 0xC0, - SRP_LOGIN_REJ_TYPE = 0xC2, + SRP_LOGIN_REJ_TYPE = 0x80, SRP_I_LOGOUT_TYPE = 0x03, SRP_T_LOGOUT_TYPE = 0x80, SRP_TSK_MGMT_TYPE = 0x01, diff --git a/trunk/drivers/scsi/ips.c b/trunk/drivers/scsi/ips.c index 4cdd891781b1..6dfcb4fbccdd 100644 --- a/trunk/drivers/scsi/ips.c +++ b/trunk/drivers/scsi/ips.c @@ -133,12 +133,10 @@ /* 6.10.00 - Remove 1G Addressing Limitations */ /* 6.11.xx - Get VersionInfo buffer off the stack ! DDTS 60401 */ /* 6.11.xx - Make Logical Drive Info structure safe for DMA DDTS 60639 */ -/* 7.10.18 - Add highmem_io flag in SCSI Templete for 2.4 kernels */ +/* 7.10.xx - Add highmem_io flag in SCSI Templete for 2.4 kernels */ /* - Fix path/name for scsi_hosts.h include for 2.6 kernels */ /* - Fix sort order of 7k */ /* - Remove 3 unused "inline" functions */ -/* 7.12.xx - Use STATIC functions whereever possible */ -/* - Clean up deprecated MODULE_PARM calls */ /*****************************************************************************/ /* @@ -209,8 +207,8 @@ module_param(ips, charp, 0); /* * DRIVER_VER */ -#define IPS_VERSION_HIGH "7.12" -#define IPS_VERSION_LOW ".02 " +#define IPS_VERSION_HIGH "7.10" +#define IPS_VERSION_LOW ".18 " #if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__) #warning "This driver has only been tested on the x86/ia64/x86_64 platforms" diff --git a/trunk/drivers/scsi/ips.h b/trunk/drivers/scsi/ips.h index 505e967013de..480e06f4d6ae 100644 --- a/trunk/drivers/scsi/ips.h +++ b/trunk/drivers/scsi/ips.h @@ -87,14 +87,15 @@ #define scsi_set_pci_device(sh,dev) (0) #endif - #ifndef IRQ_NONE - typedef void irqreturn_t; + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + + #ifndef irqreturn_t + typedef void irqreturn_t; + #endif + #define IRQ_NONE #define IRQ_HANDLED #define IRQ_RETVAL(x) - #endif - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #define IPS_REGISTER_HOSTS(SHT) scsi_register_module(MODULE_SCSI_HA,SHT) #define IPS_UNREGISTER_HOSTS(SHT) scsi_unregister_module(MODULE_SCSI_HA,SHT) #define IPS_ADD_HOST(shost,device) @@ -122,10 +123,6 @@ #ifndef min #define min(x,y) ((x) < (y) ? x : y) #endif - - #ifndef __iomem /* For clean compiles in earlier kernels without __iomem annotations */ - #define __iomem - #endif #define pci_dma_hi32(a) ((a >> 16) >> 16) #define pci_dma_lo32(a) (a & 0xffffffff) @@ -1209,13 +1206,13 @@ typedef struct { #define IPS_VER_MAJOR 7 #define IPS_VER_MAJOR_STRING "7" -#define IPS_VER_MINOR 12 -#define IPS_VER_MINOR_STRING "12" -#define IPS_VER_BUILD 02 -#define IPS_VER_BUILD_STRING "02" -#define IPS_VER_STRING "7.12.02" +#define IPS_VER_MINOR 10 +#define IPS_VER_MINOR_STRING "10" +#define IPS_VER_BUILD 18 +#define IPS_VER_BUILD_STRING "18" +#define IPS_VER_STRING "7.10.18" #define IPS_RELEASE_ID 0x00020000 -#define IPS_BUILD_IDENT 761 +#define IPS_BUILD_IDENT 731 #define IPS_LEGALCOPYRIGHT_STRING "(C) Copyright IBM Corp. 1994, 2002. All Rights Reserved." #define IPS_ADAPTECCOPYRIGHT_STRING "(c) Copyright Adaptec, Inc. 2002 to 2004. All Rights Reserved." #define IPS_DELLCOPYRIGHT_STRING "(c) Copyright Dell 2004. All Rights Reserved." @@ -1226,12 +1223,12 @@ typedef struct { #define IPS_VER_SERVERAID2 "2.88.13" #define IPS_VER_NAVAJO "2.88.13" #define IPS_VER_SERVERAID3 "6.10.24" -#define IPS_VER_SERVERAID4H "7.12.02" -#define IPS_VER_SERVERAID4MLx "7.12.02" -#define IPS_VER_SARASOTA "7.12.02" -#define IPS_VER_MARCO "7.12.02" -#define IPS_VER_SEBRING "7.12.02" -#define IPS_VER_KEYWEST "7.12.02" +#define IPS_VER_SERVERAID4H "7.10.11" +#define IPS_VER_SERVERAID4MLx "7.10.18" +#define IPS_VER_SARASOTA "7.10.18" +#define IPS_VER_MARCO "7.10.18" +#define IPS_VER_SEBRING "7.10.18" +#define IPS_VER_KEYWEST "7.10.18" /* Compatability IDs for various adapters */ #define IPS_COMPAT_UNKNOWN "" diff --git a/trunk/drivers/scsi/st.c b/trunk/drivers/scsi/st.c index 0a7839db5752..0291a8fb654d 100644 --- a/trunk/drivers/scsi/st.c +++ b/trunk/drivers/scsi/st.c @@ -4149,10 +4149,12 @@ static int __init init_st(void) do_create_driverfs_files(); return 0; } + if (st_sysfs_class) + class_destroy(st_sysfs_class); unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), + ST_MAX_TAPE_ENTRIES); } - class_destroy(st_sysfs_class); printk(KERN_ERR "Unable to get major %d for SCSI tapes\n", SCSI_TAPE_MAJOR); return 1; @@ -4160,11 +4162,13 @@ static int __init init_st(void) static void __exit exit_st(void) { + if (st_sysfs_class) + class_destroy(st_sysfs_class); + st_sysfs_class = NULL; do_remove_driverfs_files(); scsi_unregister_driver(&st_template.gendrv); unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), ST_MAX_TAPE_ENTRIES); - class_destroy(st_sysfs_class); kfree(scsi_tapes); printk(KERN_INFO "st: Unloaded.\n"); } diff --git a/trunk/drivers/usb/host/ehci-dbg.c b/trunk/drivers/usb/host/ehci-dbg.c index b01efb6b36f6..50cb01831075 100644 --- a/trunk/drivers/usb/host/ehci-dbg.c +++ b/trunk/drivers/usb/host/ehci-dbg.c @@ -527,7 +527,7 @@ show_periodic (struct class_device *class_dev, char *buf) p.qh->period, le32_to_cpup (&p.qh->hw_info2) /* uframe masks */ - & (QH_CMASK | QH_SMASK), + & 0xffff, p.qh); size -= temp; next += temp; diff --git a/trunk/drivers/usb/host/ehci-q.c b/trunk/drivers/usb/host/ehci-q.c index 20df01a79b2e..4f97a4ad1ed3 100644 --- a/trunk/drivers/usb/host/ehci-q.c +++ b/trunk/drivers/usb/host/ehci-q.c @@ -222,7 +222,7 @@ __acquires(ehci->lock) struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv; /* S-mask in a QH means it's an interrupt urb */ - if ((qh->hw_info2 & __constant_cpu_to_le32 (QH_SMASK)) != 0) { + if ((qh->hw_info2 & __constant_cpu_to_le32 (0x00ff)) != 0) { /* ... update hc-wide periodic stats (for usbfs) */ ehci_to_hcd(ehci)->self.bandwidth_int_reqs--; @@ -428,8 +428,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs) /* should be rare for periodic transfers, * except maybe high bandwidth ... */ - if ((__constant_cpu_to_le32 (QH_SMASK) - & qh->hw_info2) != 0) { + if (qh->period) { intr_deschedule (ehci, qh); (void) qh_schedule (ehci, qh); } else diff --git a/trunk/drivers/usb/host/ehci-sched.c b/trunk/drivers/usb/host/ehci-sched.c index b56f25864ed6..9af4f64532a9 100644 --- a/trunk/drivers/usb/host/ehci-sched.c +++ b/trunk/drivers/usb/host/ehci-sched.c @@ -301,7 +301,7 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) dev_dbg (&qh->dev->dev, "link qh%d-%04x/%p start %d [%d/%d us]\n", - period, le32_to_cpup (&qh->hw_info2) & (QH_CMASK | QH_SMASK), + period, le32_to_cpup (&qh->hw_info2) & 0xffff, qh, qh->start, qh->usecs, qh->c_usecs); /* high bandwidth, or otherwise every microframe */ @@ -385,8 +385,7 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) dev_dbg (&qh->dev->dev, "unlink qh%d-%04x/%p start %d [%d/%d us]\n", - qh->period, - le32_to_cpup (&qh->hw_info2) & (QH_CMASK | QH_SMASK), + qh->period, le32_to_cpup (&qh->hw_info2) & 0xffff, qh, qh->start, qh->usecs, qh->c_usecs); /* qh->qh_next still "live" to HC */ @@ -412,7 +411,7 @@ static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh) * active high speed queues may need bigger delays... */ if (list_empty (&qh->qtd_list) - || (__constant_cpu_to_le32 (QH_CMASK) + || (__constant_cpu_to_le32 (0x0ff << 8) & qh->hw_info2) != 0) wait = 2; else @@ -534,7 +533,7 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh) /* reuse the previous schedule slots, if we can */ if (frame < qh->period) { - uframe = ffs (le32_to_cpup (&qh->hw_info2) & QH_SMASK); + uframe = ffs (le32_to_cpup (&qh->hw_info2) & 0x00ff); status = check_intr_schedule (ehci, frame, --uframe, qh, &c_mask); } else { @@ -570,10 +569,10 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh) qh->start = frame; /* reset S-frame and (maybe) C-frame masks */ - qh->hw_info2 &= __constant_cpu_to_le32(~(QH_CMASK | QH_SMASK)); + qh->hw_info2 &= __constant_cpu_to_le32 (~0xffff); qh->hw_info2 |= qh->period ? cpu_to_le32 (1 << uframe) - : __constant_cpu_to_le32 (QH_SMASK); + : __constant_cpu_to_le32 (0xff); qh->hw_info2 |= c_mask; } else ehci_dbg (ehci, "reused qh %p schedule\n", qh); diff --git a/trunk/drivers/usb/host/ehci.h b/trunk/drivers/usb/host/ehci.h index a7542157534c..4df498231752 100644 --- a/trunk/drivers/usb/host/ehci.h +++ b/trunk/drivers/usb/host/ehci.h @@ -385,11 +385,6 @@ struct ehci_qh { __le32 hw_info1; /* see EHCI 3.6.2 */ #define QH_HEAD 0x00008000 __le32 hw_info2; /* see EHCI 3.6.2 */ -#define QH_SMASK 0x000000ff -#define QH_CMASK 0x0000ff00 -#define QH_HUBADDR 0x007f0000 -#define QH_HUBPORT 0x3f800000 -#define QH_MULT 0xc0000000 __le32 hw_current; /* qtd list - see EHCI 3.6.4 */ /* qtd overlay (hardware parts of a struct ehci_qtd) */ diff --git a/trunk/drivers/usb/host/isp116x-hcd.c b/trunk/drivers/usb/host/isp116x-hcd.c index 76cb496c5836..50b1970fe6b6 100644 --- a/trunk/drivers/usb/host/isp116x-hcd.c +++ b/trunk/drivers/usb/host/isp116x-hcd.c @@ -229,11 +229,9 @@ static void preproc_atl_queue(struct isp116x *isp116x) struct isp116x_ep *ep; struct urb *urb; struct ptd *ptd; - u16 len; + u16 toggle = 0, dir = PTD_DIR_SETUP, len; for (ep = isp116x->atl_active; ep; ep = ep->active) { - u16 toggle = 0, dir = PTD_DIR_SETUP; - BUG_ON(list_empty(&ep->hep->urb_list)); urb = container_of(ep->hep->urb_list.next, struct urb, urb_list); diff --git a/trunk/drivers/usb/mon/Kconfig b/trunk/drivers/usb/mon/Kconfig index deb9ddffa402..777642e26b9a 100644 --- a/trunk/drivers/usb/mon/Kconfig +++ b/trunk/drivers/usb/mon/Kconfig @@ -9,8 +9,9 @@ config USB_MON help If you say Y here, a component which captures the USB traffic between peripheral-specific drivers and HC drivers will be built. - For more information, see . + The USB_MON is similar in spirit and may be compatible with Dave + Harding's USBMon. - This is somewhat experimental at this time, but it should be safe. - - If unsure, say Y. + This is somewhat experimental at this time, but it should be safe, + as long as you aren't using modular USB and try to remove this + module. diff --git a/trunk/drivers/usb/mon/Makefile b/trunk/drivers/usb/mon/Makefile index b0015b8a1d1f..f18d10ce91f9 100644 --- a/trunk/drivers/usb/mon/Makefile +++ b/trunk/drivers/usb/mon/Makefile @@ -4,5 +4,4 @@ usbmon-objs := mon_main.o mon_stat.o mon_text.o -# This does not use CONFIG_USB_MON because we want this to use a tristate. obj-$(CONFIG_USB) += usbmon.o diff --git a/trunk/fs/Kconfig b/trunk/fs/Kconfig index e54be7058359..5d0c4be43dba 100644 --- a/trunk/fs/Kconfig +++ b/trunk/fs/Kconfig @@ -363,15 +363,12 @@ config INOTIFY bool "Inotify file change notification support" default y ---help--- - Say Y here to enable inotify support and the associated system - calls. Inotify is a file change notification system and a + Say Y here to enable inotify support and the /dev/inotify character + device. Inotify is a file change notification system and a replacement for dnotify. Inotify fixes numerous shortcomings in dnotify and introduces several new features. It allows monitoring - of both files and directories via a single open fd. Other features - include multiple file events, one-shot support, and unmount - notification. - - For more information, see Documentation/filesystems/inotify.txt + of both files and directories via a single open fd. Multiple file + events are supported. If unsure, say Y. diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 32accb6a672f..4a27eb798118 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -1801,8 +1801,8 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) } up(&dentry->d_inode->i_sem); if (!error) { - d_delete(dentry); fsnotify_rmdir(dentry, dentry->d_inode, dir); + d_delete(dentry); } dput(dentry); @@ -1874,9 +1874,8 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) /* We don't d_delete() NFS sillyrenamed files--they still exist. */ if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { - struct inode *inode = dentry->d_inode; + fsnotify_unlink(dentry, dir); d_delete(dentry); - fsnotify_unlink(dentry, inode, dir); } return error; diff --git a/trunk/include/asm-alpha/pci.h b/trunk/include/asm-alpha/pci.h index f681e675b823..28957697e59c 100644 --- a/trunk/include/asm-alpha/pci.h +++ b/trunk/include/asm-alpha/pci.h @@ -251,9 +251,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *, struct resource *); -extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region); - #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index static inline int pci_proc_domain(struct pci_bus *bus) diff --git a/trunk/include/asm-arm/pci.h b/trunk/include/asm-arm/pci.h index 38ea5899a580..b28f1c95dd62 100644 --- a/trunk/include/asm-arm/pci.h +++ b/trunk/include/asm-arm/pci.h @@ -60,10 +60,6 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res); -extern void -pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region); - static inline void pcibios_add_platform_entries(struct pci_dev *dev) { } diff --git a/trunk/include/asm-generic/pci.h b/trunk/include/asm-generic/pci.h index ee1d8b5d8168..9d4cc47bde39 100644 --- a/trunk/include/asm-generic/pci.h +++ b/trunk/include/asm-generic/pci.h @@ -22,14 +22,6 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, region->end = res->end; } -static inline void -pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region) -{ - res->start = region->start; - res->end = region->end; -} - #define pcibios_scan_all_fns(a, b) 0 #ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ diff --git a/trunk/include/asm-parisc/pci.h b/trunk/include/asm-parisc/pci.h index 98d79a3d54fa..ee741c150176 100644 --- a/trunk/include/asm-parisc/pci.h +++ b/trunk/include/asm-parisc/pci.h @@ -253,10 +253,6 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res); -extern void -pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region); - static inline void pcibios_add_platform_entries(struct pci_dev *dev) { } diff --git a/trunk/include/asm-ppc/pci.h b/trunk/include/asm-ppc/pci.h index a811e440c978..a13d55870e62 100644 --- a/trunk/include/asm-ppc/pci.h +++ b/trunk/include/asm-ppc/pci.h @@ -105,10 +105,6 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res); -extern void -pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region); - extern void pcibios_add_platform_entries(struct pci_dev *dev); struct file; diff --git a/trunk/include/asm-ppc64/machdep.h b/trunk/include/asm-ppc64/machdep.h index f0ef06375947..f0c1d2d92672 100644 --- a/trunk/include/asm-ppc64/machdep.h +++ b/trunk/include/asm-ppc64/machdep.h @@ -84,7 +84,7 @@ struct machdep_calls { void (*init_IRQ)(void); int (*get_irq)(struct pt_regs *); - void (*cpu_irq_down)(int secondary); + void (*cpu_irq_down)(void); /* PCI stuff */ void (*pcibios_fixup)(void); diff --git a/trunk/include/asm-ppc64/pci.h b/trunk/include/asm-ppc64/pci.h index 4d057452f59b..faa772223075 100644 --- a/trunk/include/asm-ppc64/pci.h +++ b/trunk/include/asm-ppc64/pci.h @@ -134,10 +134,6 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res); -extern void -pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, - struct pci_bus_region *region); - extern int unmap_bus_range(struct pci_bus *bus); diff --git a/trunk/include/asm-ppc64/xics.h b/trunk/include/asm-ppc64/xics.h index 1092af55d707..0c45e14e26ca 100644 --- a/trunk/include/asm-ppc64/xics.h +++ b/trunk/include/asm-ppc64/xics.h @@ -17,7 +17,7 @@ void xics_init_IRQ(void); int xics_get_irq(struct pt_regs *); void xics_setup_cpu(void); -void xics_teardown_cpu(int secondary); +void xics_teardown_cpu(void); void xics_cause_IPI(int cpu); void xics_request_IPIs(void); void xics_migrate_irqs_away(void); diff --git a/trunk/include/linux/fsnotify.h b/trunk/include/linux/fsnotify.h index 1cb4935348d8..e96a4306ab3b 100644 --- a/trunk/include/linux/fsnotify.h +++ b/trunk/include/linux/fsnotify.h @@ -46,8 +46,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, /* * fsnotify_unlink - file was unlinked */ -static inline void fsnotify_unlink(struct dentry *dentry, struct inode *inode, struct inode *dir) +static inline void fsnotify_unlink(struct dentry *dentry, struct inode *dir) { + struct inode *inode = dentry->d_inode; + inode_dir_notify(dir, DN_DELETE); inotify_inode_queue_event(dir, IN_DELETE, 0, dentry->d_name.name); inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL); diff --git a/trunk/include/linux/pci.h b/trunk/include/linux/pci.h index 98bdd95fcee9..8621cf42b46f 100644 --- a/trunk/include/linux/pci.h +++ b/trunk/include/linux/pci.h @@ -225,7 +225,6 @@ #define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ #define PCI_PM_CTRL 4 /* PM control and status register */ #define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ -#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ #define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ @@ -817,9 +816,7 @@ int pci_set_mwi(struct pci_dev *dev); void pci_clear_mwi(struct pci_dev *dev); int pci_set_dma_mask(struct pci_dev *dev, u64 mask); int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); -void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); int pci_assign_resource(struct pci_dev *dev, int i); -void pci_restore_bars(struct pci_dev *dev); /* ROM control related routines */ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size); diff --git a/trunk/include/linux/raid/bitmap.h b/trunk/include/linux/raid/bitmap.h index 4bf1659f8aa8..6213e976eade 100644 --- a/trunk/include/linux/raid/bitmap.h +++ b/trunk/include/linux/raid/bitmap.h @@ -248,7 +248,6 @@ struct bitmap { /* these are used only by md/bitmap */ int bitmap_create(mddev_t *mddev); -void bitmap_flush(mddev_t *mddev); void bitmap_destroy(mddev_t *mddev); int bitmap_active(struct bitmap *bitmap); diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index 5b0fb9f09f21..9d1b10ed0135 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -829,10 +829,8 @@ fastcall NORET_TYPE void do_exit(long code) acct_update_integrals(tsk); update_mem_hiwater(tsk); group_dead = atomic_dec_and_test(&tsk->signal->live); - if (group_dead) { - del_timer_sync(&tsk->signal->real_timer); + if (group_dead) acct_process(code); - } exit_mm(tsk); exit_sem(tsk); diff --git a/trunk/kernel/posix-timers.c b/trunk/kernel/posix-timers.c index 38798a2ff994..10b2ad749d14 100644 --- a/trunk/kernel/posix-timers.c +++ b/trunk/kernel/posix-timers.c @@ -1166,6 +1166,7 @@ void exit_itimers(struct signal_struct *sig) tmr = list_entry(sig->posix_timers.next, struct k_itimer, list); itimer_delete(tmr); } + del_timer_sync(&sig->real_timer); } /* diff --git a/trunk/kernel/sys.c b/trunk/kernel/sys.c index 0bcaed6560ac..000e81ad2c1d 100644 --- a/trunk/kernel/sys.c +++ b/trunk/kernel/sys.c @@ -404,6 +404,7 @@ void kernel_halt(void) { notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL); system_state = SYSTEM_HALT; + device_suspend(PMSG_SUSPEND); device_shutdown(); printk(KERN_EMERG "System halted.\n"); machine_halt(); @@ -414,6 +415,7 @@ void kernel_power_off(void) { notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL); system_state = SYSTEM_POWER_OFF; + device_suspend(PMSG_SUSPEND); device_shutdown(); printk(KERN_EMERG "Power down.\n"); machine_power_off(); diff --git a/trunk/mm/mmap.c b/trunk/mm/mmap.c index 404319477e71..da3fa90a0aae 100644 --- a/trunk/mm/mmap.c +++ b/trunk/mm/mmap.c @@ -143,11 +143,7 @@ int __vm_enough_memory(long pages, int cap_sys_admin) leave 3% of the size of this process for other processes */ allowed -= current->mm->total_vm / 32; - /* - * cast `allowed' as a signed long because vm_committed_space - * sometimes has a negative value - */ - if (atomic_read(&vm_committed_space) < (long)allowed) + if (atomic_read(&vm_committed_space) < allowed) return 0; vm_unacct_memory(pages); diff --git a/trunk/mm/mremap.c b/trunk/mm/mremap.c index fc45dc9a617b..ec7238a78f36 100644 --- a/trunk/mm/mremap.c +++ b/trunk/mm/mremap.c @@ -229,7 +229,6 @@ static unsigned long move_vma(struct vm_area_struct *vma, * since do_munmap() will decrement it by old_len == new_len */ mm->total_vm += new_len >> PAGE_SHIFT; - __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT); if (do_munmap(mm, old_addr, old_len) < 0) { /* OOM: unable to split vma, just get accounts right */ @@ -244,6 +243,7 @@ static unsigned long move_vma(struct vm_area_struct *vma, vma->vm_next->vm_flags |= VM_ACCOUNT; } + __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT); if (vm_flags & VM_LOCKED) { mm->locked_vm += new_len >> PAGE_SHIFT; if (new_len > old_len) diff --git a/trunk/mm/nommu.c b/trunk/mm/nommu.c index fd4e8df0f02d..ce74452c02d9 100644 --- a/trunk/mm/nommu.c +++ b/trunk/mm/nommu.c @@ -1167,11 +1167,7 @@ int __vm_enough_memory(long pages, int cap_sys_admin) leave 3% of the size of this process for other processes */ allowed -= current->mm->total_vm / 32; - /* - * cast `allowed' as a signed long because vm_committed_space - * sometimes has a negative value - */ - if (atomic_read(&vm_committed_space) < (long)allowed) + if (atomic_read(&vm_committed_space) < allowed) return 0; vm_unacct_memory(pages); diff --git a/trunk/net/ipv4/tcp_output.c b/trunk/net/ipv4/tcp_output.c index 7d076f0db100..e3f8ea1bfa9c 100644 --- a/trunk/net/ipv4/tcp_output.c +++ b/trunk/net/ipv4/tcp_output.c @@ -403,9 +403,11 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb) sk->sk_send_head = skb; } -static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now) +static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb) { - if (skb->len <= mss_now || + struct tcp_sock *tp = tcp_sk(sk); + + if (skb->len <= tp->mss_cache || !(sk->sk_route_caps & NETIF_F_TSO)) { /* Avoid the costly divide in the normal * non-TSO case. @@ -415,10 +417,10 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned } else { unsigned int factor; - factor = skb->len + (mss_now - 1); - factor /= mss_now; + factor = skb->len + (tp->mss_cache - 1); + factor /= tp->mss_cache; skb_shinfo(skb)->tso_segs = factor; - skb_shinfo(skb)->tso_size = mss_now; + skb_shinfo(skb)->tso_size = tp->mss_cache; } } @@ -427,7 +429,7 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned * packet to the list. This won't be called frequently, I hope. * Remember, these are still headerless SKBs at this point. */ -static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss_now) +static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len) { struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *buff; @@ -490,8 +492,8 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned } /* Fix up tso_factor for both original and new SKB. */ - tcp_set_skb_tso_segs(sk, skb, mss_now); - tcp_set_skb_tso_segs(sk, buff, mss_now); + tcp_set_skb_tso_segs(sk, skb); + tcp_set_skb_tso_segs(sk, buff); if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) { tp->lost_out += tcp_skb_pcount(skb); @@ -567,7 +569,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) * factor and mss. */ if (tcp_skb_pcount(skb) > 1) - tcp_set_skb_tso_segs(sk, skb, tcp_current_mss(sk, 1)); + tcp_set_skb_tso_segs(sk, skb); return 0; } @@ -732,14 +734,12 @@ static inline unsigned int tcp_cwnd_test(struct tcp_sock *tp, struct sk_buff *sk /* This must be invoked the first time we consider transmitting * SKB onto the wire. */ -static inline int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now) +static inline int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb) { int tso_segs = tcp_skb_pcount(skb); - if (!tso_segs || - (tso_segs > 1 && - skb_shinfo(skb)->tso_size != mss_now)) { - tcp_set_skb_tso_segs(sk, skb, mss_now); + if (!tso_segs) { + tcp_set_skb_tso_segs(sk, skb); tso_segs = tcp_skb_pcount(skb); } return tso_segs; @@ -817,7 +817,7 @@ static unsigned int tcp_snd_test(struct sock *sk, struct sk_buff *skb, struct tcp_sock *tp = tcp_sk(sk); unsigned int cwnd_quota; - tcp_init_tso_segs(sk, skb, cur_mss); + tcp_init_tso_segs(sk, skb); if (!tcp_nagle_test(tp, skb, cur_mss, nonagle)) return 0; @@ -854,7 +854,7 @@ int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp) * know that all the data is in scatter-gather pages, and that the * packet has never been sent out before (and thus is not cloned). */ -static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, unsigned int mss_now) +static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len) { struct sk_buff *buff; int nlen = skb->len - len; @@ -887,8 +887,8 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, skb_split(skb, buff, len); /* Fix up tso_factor for both original and new SKB. */ - tcp_set_skb_tso_segs(sk, skb, mss_now); - tcp_set_skb_tso_segs(sk, buff, mss_now); + tcp_set_skb_tso_segs(sk, skb); + tcp_set_skb_tso_segs(sk, buff); /* Link BUFF into the send queue. */ skb_header_release(buff); @@ -972,17 +972,18 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) if (unlikely(sk->sk_state == TCP_CLOSE)) return 0; - sent_pkts = 0; - while ((skb = sk->sk_send_head)) { - tso_segs = tcp_init_tso_segs(sk, skb, mss_now); - BUG_ON(!tso_segs); + skb = sk->sk_send_head; + if (unlikely(!skb)) + return 0; - cwnd_quota = tcp_cwnd_test(tp, skb); - if (!cwnd_quota) - break; + tso_segs = tcp_init_tso_segs(sk, skb); + cwnd_quota = tcp_cwnd_test(tp, skb); + if (unlikely(!cwnd_quota)) + goto out; - if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now))) - break; + sent_pkts = 0; + while (likely(tcp_snd_wnd_test(tp, skb, mss_now))) { + BUG_ON(!tso_segs); if (tso_segs == 1) { if (unlikely(!tcp_nagle_test(tp, skb, mss_now, @@ -1005,11 +1006,11 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) limit = skb->len - trim; } if (skb->len > limit) { - if (tso_fragment(sk, skb, limit, mss_now)) + if (tso_fragment(sk, skb, limit)) break; } } else if (unlikely(skb->len > mss_now)) { - if (unlikely(tcp_fragment(sk, skb, mss_now, mss_now))) + if (unlikely(tcp_fragment(sk, skb, mss_now))) break; } @@ -1025,12 +1026,27 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) tcp_minshall_update(tp, mss_now, skb); sent_pkts++; + + /* Do not optimize this to use tso_segs. If we chopped up + * the packet above, tso_segs will no longer be valid. + */ + cwnd_quota -= tcp_skb_pcount(skb); + + BUG_ON(cwnd_quota < 0); + if (!cwnd_quota) + break; + + skb = sk->sk_send_head; + if (!skb) + break; + tso_segs = tcp_init_tso_segs(sk, skb); } if (likely(sent_pkts)) { tcp_cwnd_validate(sk, tp); return 0; } +out: return !tp->packets_out && sk->sk_send_head; } @@ -1060,7 +1076,7 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now) BUG_ON(!skb || skb->len < mss_now); - tso_segs = tcp_init_tso_segs(sk, skb, mss_now); + tso_segs = tcp_init_tso_segs(sk, skb); cwnd_quota = tcp_snd_test(sk, skb, mss_now, TCP_NAGLE_PUSH); if (likely(cwnd_quota)) { @@ -1077,11 +1093,11 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now) limit = skb->len - trim; } if (skb->len > limit) { - if (unlikely(tso_fragment(sk, skb, limit, mss_now))) + if (unlikely(tso_fragment(sk, skb, limit))) return; } } else if (unlikely(skb->len > mss_now)) { - if (unlikely(tcp_fragment(sk, skb, mss_now, mss_now))) + if (unlikely(tcp_fragment(sk, skb, mss_now))) return; } @@ -1372,7 +1388,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) int old_factor = tcp_skb_pcount(skb); int new_factor; - if (tcp_fragment(sk, skb, cur_mss, cur_mss)) + if (tcp_fragment(sk, skb, cur_mss)) return -ENOMEM; /* We'll try again later. */ /* New SKB created, account for it. */ @@ -1975,7 +1991,7 @@ int tcp_write_wakeup(struct sock *sk) skb->len > mss) { seg_size = min(seg_size, mss); TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; - if (tcp_fragment(sk, skb, seg_size, mss)) + if (tcp_fragment(sk, skb, seg_size)) return -1; /* SWS override triggered forced fragmentation. * Disable TSO, the connection is too sick. */ @@ -1984,7 +2000,7 @@ int tcp_write_wakeup(struct sock *sk) sk->sk_route_caps &= ~NETIF_F_TSO; } } else if (!tcp_skb_pcount(skb)) - tcp_set_skb_tso_segs(sk, skb, mss); + tcp_set_skb_tso_segs(sk, skb); TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; TCP_SKB_CB(skb)->when = tcp_time_stamp; diff --git a/trunk/security/keys/keyctl.c b/trunk/security/keys/keyctl.c index a6516a64b297..fea262860ea0 100644 --- a/trunk/security/keys/keyctl.c +++ b/trunk/security/keys/keyctl.c @@ -49,6 +49,9 @@ asmlinkage long sys_add_key(const char __user *_type, goto error; type[31] = '\0'; + if (!type[0]) + goto error; + ret = -EPERM; if (type[0] == '.') goto error; @@ -141,10 +144,6 @@ asmlinkage long sys_request_key(const char __user *_type, goto error; type[31] = '\0'; - ret = -EPERM; - if (type[0] == '.') - goto error; - /* pull the description into kernel space */ ret = -EFAULT; dlen = strnlen_user(_description, PAGE_SIZE - 1); @@ -363,7 +362,7 @@ long keyctl_revoke_key(key_serial_t id) key_put(key); error: - return ret; + return 0; } /* end keyctl_revoke_key() */ @@ -686,8 +685,6 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) goto can_read_key2; ret = PTR_ERR(skey); - if (ret == -EAGAIN) - ret = -EACCES; goto error2; } diff --git a/trunk/security/keys/keyring.c b/trunk/security/keys/keyring.c index 9c208c756df8..a1f6bac647a1 100644 --- a/trunk/security/keys/keyring.c +++ b/trunk/security/keys/keyring.c @@ -201,11 +201,7 @@ static void keyring_destroy(struct key *keyring) if (keyring->description) { write_lock(&keyring_name_lock); - - if (keyring->type_data.link.next != NULL && - !list_empty(&keyring->type_data.link)) - list_del(&keyring->type_data.link); - + list_del(&keyring->type_data.link); write_unlock(&keyring_name_lock); } diff --git a/trunk/security/keys/process_keys.c b/trunk/security/keys/process_keys.c index c089f78fb94e..9b0369c5a223 100644 --- a/trunk/security/keys/process_keys.c +++ b/trunk/security/keys/process_keys.c @@ -678,7 +678,7 @@ long join_session_keyring(const char *name) keyring = keyring_alloc(name, tsk->uid, tsk->gid, 0, NULL); if (IS_ERR(keyring)) { ret = PTR_ERR(keyring); - goto error2; + goto error; } } else if (IS_ERR(keyring)) { diff --git a/trunk/security/keys/request_key.c b/trunk/security/keys/request_key.c index 90c1506d007c..dfcd983af1fd 100644 --- a/trunk/security/keys/request_key.c +++ b/trunk/security/keys/request_key.c @@ -405,7 +405,7 @@ struct key *request_key_and_link(struct key_type *type, key_user_put(user); /* link the new key into the appropriate keyring */ - if (!IS_ERR(key)) + if (!PTR_ERR(key)) request_key_link(key, dest_keyring); }