]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Pull fix-cpu-possible-map into release branch
authorTony Luck <tony.luck@intel.com>
Wed, 15 Feb 2006 23:17:57 +0000 (15:17 -0800)
committerTony Luck <tony.luck@intel.com>
Wed, 15 Feb 2006 23:17:57 +0000 (15:17 -0800)
124 files changed:
Documentation/fujitsu/frv/kernel-ABI.txt [new file with mode: 0644]
Documentation/kprobes.txt
Documentation/mips/AU1xxx_IDE.README
arch/frv/Kconfig
arch/frv/Makefile
arch/frv/kernel/break.S
arch/frv/kernel/entry-table.S
arch/frv/kernel/entry.S
arch/frv/kernel/head.S
arch/frv/kernel/irq.c
arch/frv/mm/kmap.c
arch/h8300/Kconfig
arch/h8300/Kconfig.cpu
arch/i386/boot/.gitignore [new file with mode: 0644]
arch/i386/boot/tools/.gitignore [new file with mode: 0644]
arch/i386/kernel/.gitignore [new file with mode: 0644]
arch/i386/kernel/vsyscall-sysenter.S
arch/ia64/kernel/ia64_ksyms.c
arch/ia64/kernel/time.c
arch/ia64/kernel/traps.c
arch/ia64/sn/kernel/io_init.c
arch/ia64/sn/kernel/setup.c
arch/ia64/sn/kernel/sn2/prominfo_proc.c
arch/ia64/sn/kernel/sn2/sn2_smp.c
arch/ia64/sn/kernel/sn2/sn_proc_fs.c
arch/ia64/sn/kernel/sn2/timer.c
arch/ia64/sn/kernel/sn2/timer_interrupt.c
arch/ia64/sn/kernel/tiocx.c
arch/ia64/sn/kernel/xpc_channel.c
arch/ia64/sn/kernel/xpc_main.c
arch/ia64/sn/pci/pci_dma.c
arch/ia64/sn/pci/pcibr/pcibr_ate.c
arch/ia64/sn/pci/pcibr/pcibr_dma.c
arch/ia64/sn/pci/pcibr/pcibr_provider.c
arch/m68k/Kconfig
arch/m68knommu/Kconfig
arch/mips/Makefile
arch/mips/kernel/process.c
arch/mips/kernel/signal-common.h
arch/mips/kernel/signal32.c
arch/mips/kernel/signal_n32.c
arch/mips/kernel/smp_mt.c
arch/mips/mm/c-r4k.c
arch/mips/mm/c-tx39.c
arch/parisc/Kconfig
arch/s390/lib/delay.c
arch/v850/Kconfig
drivers/block/pktcdvd.c
drivers/char/esp.c
drivers/char/hpet.c
drivers/char/tty_io.c
drivers/ide/pci/sgiioc4.c
drivers/infiniband/core/mad.c
drivers/infiniband/hw/mthca/mthca_cmd.c
drivers/infiniband/hw/mthca/mthca_dev.h
drivers/infiniband/ulp/ipoib/ipoib.h
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
drivers/isdn/i4l/isdn_tty.c
drivers/video/neofb.c
fs/cifs/file.c
fs/exec.c
fs/jbd/checkpoint.c
fs/jbd/commit.c
fs/lockd/clntlock.c
fs/lockd/svc4proc.c
fs/lockd/svcproc.c
include/asm-alpha/mman.h
include/asm-arm/mman.h
include/asm-arm26/mman.h
include/asm-cris/mman.h
include/asm-frv/atomic.h
include/asm-frv/cacheflush.h
include/asm-frv/io.h
include/asm-frv/mman.h
include/asm-frv/spr-regs.h
include/asm-frv/system.h
include/asm-frv/uaccess.h
include/asm-frv/unistd.h
include/asm-h8300/mman.h
include/asm-i386/mman.h
include/asm-i386/topology.h
include/asm-ia64/machvec_sn2.h
include/asm-ia64/mman.h
include/asm-ia64/sn/arch.h
include/asm-ia64/sn/bte.h
include/asm-ia64/sn/pcibr_provider.h
include/asm-ia64/sn/sn_feature_sets.h
include/asm-ia64/sn/xpc.h
include/asm-ia64/timex.h
include/asm-m32r/mman.h
include/asm-m68k/mman.h
include/asm-mips/cpu.h
include/asm-mips/gcc/sgidefs.h [deleted file]
include/asm-mips/mach-generic/timex.h
include/asm-mips/mach-rm200/timex.h [new file with mode: 0644]
include/asm-mips/mman.h
include/asm-mips/r4kcache.h
include/asm-mips/uaccess.h
include/asm-mips/unistd.h
include/asm-parisc/mman.h
include/asm-powerpc/mman.h
include/asm-s390/mman.h
include/asm-sh/mman.h
include/asm-sparc/mman.h
include/asm-sparc64/mman.h
include/asm-v850/mman.h
include/asm-x86_64/mman.h
include/asm-xtensa/mman.h
include/linux/jbd.h
include/linux/lockd/lockd.h
include/linux/netfilter_ipv4.h
include/linux/ptrace.h
include/linux/sched.h
kernel/fork.c
kernel/hrtimer.c
kernel/ptrace.c
kernel/sched.c
mm/hugetlb.c
mm/madvise.c
mm/page_alloc.c
mm/swap.c
net/bridge/br_stp_if.c
net/ipv4/netfilter.c
net/ipv4/netfilter/ip_nat_standalone.c

diff --git a/Documentation/fujitsu/frv/kernel-ABI.txt b/Documentation/fujitsu/frv/kernel-ABI.txt
new file mode 100644 (file)
index 0000000..0ed9b0a
--- /dev/null
@@ -0,0 +1,234 @@
+                                =================================
+                                INTERNAL KERNEL ABI FOR FR-V ARCH
+                                =================================
+
+The internal FRV kernel ABI is not quite the same as the userspace ABI. A number of the registers
+are used for special purposed, and the ABI is not consistent between modules vs core, and MMU vs
+no-MMU.
+
+This partly stems from the fact that FRV CPUs do not have a separate supervisor stack pointer, and
+most of them do not have any scratch registers, thus requiring at least one general purpose
+register to be clobbered in such an event. Also, within the kernel core, it is possible to simply
+jump or call directly between functions using a relative offset. This cannot be extended to modules
+for the displacement is likely to be too far. Thus in modules the address of a function to call
+must be calculated in a register and then used, requiring two extra instructions.
+
+This document has the following sections:
+
+ (*) System call register ABI
+ (*) CPU operating modes
+ (*) Internal kernel-mode register ABI
+ (*) Internal debug-mode register ABI
+ (*) Virtual interrupt handling
+
+
+========================
+SYSTEM CALL REGISTER ABI
+========================
+
+When a system call is made, the following registers are effective:
+
+       REGISTERS       CALL                    RETURN
+       =============== ======================= =======================
+       GR7             System call number      Preserved
+       GR8             Syscall arg #1          Return value
+       GR9-GR13        Syscall arg #2-6        Preserved
+
+
+===================
+CPU OPERATING MODES
+===================
+
+The FR-V CPU has three basic operating modes. In order of increasing capability:
+
+  (1) User mode.
+
+      Basic userspace running mode.
+
+  (2) Kernel mode.
+
+      Normal kernel mode. There are many additional control registers available that may be
+      accessed in this mode, in addition to all the stuff available to user mode. This has two
+      submodes:
+
+      (a) Exceptions enabled (PSR.T == 1).
+
+         Exceptions will invoke the appropriate normal kernel mode handler. On entry to the
+         handler, the PSR.T bit will be cleared.
+
+      (b) Exceptions disabled (PSR.T == 0).
+
+         No exceptions or interrupts may happen. Any mandatory exceptions will cause the CPU to
+         halt unless the CPU is told to jump into debug mode instead.
+
+  (3) Debug mode.
+
+      No exceptions may happen in this mode. Memory protection and management exceptions will be
+      flagged for later consideration, but the exception handler won't be invoked. Debugging traps
+      such as hardware breakpoints and watchpoints will be ignored. This mode is entered only by
+      debugging events obtained from the other two modes.
+
+      All kernel mode registers may be accessed, plus a few extra debugging specific registers.
+
+
+=================================
+INTERNAL KERNEL-MODE REGISTER ABI
+=================================
+
+There are a number of permanent register assignments that are set up by entry.S in the exception
+prologue. Note that there is a complete set of exception prologues for each of user->kernel
+transition and kernel->kernel transition. There are also user->debug and kernel->debug mode
+transition prologues.
+
+
+       REGISTER        FLAVOUR USE
+       =============== ======= ====================================================
+       GR1                     Supervisor stack pointer
+       GR15                    Current thread info pointer
+       GR16                    GP-Rel base register for small data
+       GR28                    Current exception frame pointer (__frame)
+       GR29                    Current task pointer (current)
+       GR30                    Destroyed by kernel mode entry
+       GR31            NOMMU   Destroyed by debug mode entry
+       GR31            MMU     Destroyed by TLB miss kernel mode entry
+       CCR.ICC2                Virtual interrupt disablement tracking
+       CCCR.CC3                Cleared by exception prologue (atomic op emulation)
+       SCR0            MMU     See mmu-layout.txt.
+       SCR1            MMU     See mmu-layout.txt.
+       SCR2            MMU     Save for EAR0 (destroyed by icache insns in debug mode)
+       SCR3            MMU     Save for GR31 during debug exceptions
+       DAMR/IAMR       NOMMU   Fixed memory protection layout.
+       DAMR/IAMR       MMU     See mmu-layout.txt.
+
+
+Certain registers are also used or modified across function calls:
+
+       REGISTER        CALL                            RETURN
+       =============== =============================== ===============================
+       GR0             Fixed Zero                      -
+       GR2             Function call frame pointer
+       GR3             Special                         Preserved
+       GR3-GR7         -                               Clobbered
+       GR8             Function call arg #1            Return value (or clobbered)
+       GR9             Function call arg #2            Return value MSW (or clobbered)
+       GR10-GR13       Function call arg #3-#6         Clobbered
+       GR14            -                               Clobbered
+       GR15-GR16       Special                         Preserved
+       GR17-GR27       -                               Preserved
+       GR28-GR31       Special                         Only accessed explicitly
+       LR              Return address after CALL       Clobbered
+       CCR/CCCR        -                               Mostly Clobbered
+
+
+================================
+INTERNAL DEBUG-MODE REGISTER ABI
+================================
+
+This is the same as the kernel-mode register ABI for functions calls. The difference is that in
+debug-mode there's a different stack and a different exception frame. Almost all the global
+registers from kernel-mode (including the stack pointer) may be changed.
+
+       REGISTER        FLAVOUR USE
+       =============== ======= ====================================================
+       GR1                     Debug stack pointer
+       GR16                    GP-Rel base register for small data
+       GR31                    Current debug exception frame pointer (__debug_frame)
+       SCR3            MMU     Saved value of GR31
+
+
+Note that debug mode is able to interfere with the kernel's emulated atomic ops, so it must be
+exceedingly careful not to do any that would interact with the main kernel in this regard. Hence
+the debug mode code (gdbstub) is almost completely self-contained. The only external code used is
+the sprintf family of functions.
+
+Futhermore, break.S is so complicated because single-step mode does not switch off on entry to an
+exception. That means unless manually disabled, single-stepping will blithely go on stepping into
+things like interrupts. See gdbstub.txt for more information.
+
+
+==========================
+VIRTUAL INTERRUPT HANDLING
+==========================
+
+Because accesses to the PSR is so slow, and to disable interrupts we have to access it twice (once
+to read and once to write), we don't actually disable interrupts at all if we don't have to. What
+we do instead is use the ICC2 condition code flags to note virtual disablement, such that if we
+then do take an interrupt, we note the flag, really disable interrupts, set another flag and resume
+execution at the point the interrupt happened. Setting condition flags as a side effect of an
+arithmetic or logical instruction is really fast. This use of the ICC2 only occurs within the
+kernel - it does not affect userspace.
+
+The flags we use are:
+
+ (*) CCR.ICC2.Z [Zero flag]
+
+     Set to virtually disable interrupts, clear when interrupts are virtually enabled. Can be
+     modified by logical instructions without affecting the Carry flag.
+
+ (*) CCR.ICC2.C [Carry flag]
+
+     Clear to indicate hardware interrupts are really disabled, set otherwise.
+
+
+What happens is this:
+
+ (1) Normal kernel-mode operation.
+
+       ICC2.Z is 0, ICC2.C is 1.
+
+ (2) An interrupt occurs. The exception prologue examines ICC2.Z and determines that nothing needs
+     doing. This is done simply with an unlikely BEQ instruction.
+
+ (3) The interrupts are disabled (local_irq_disable)
+
+       ICC2.Z is set to 1.
+
+ (4) If interrupts were then re-enabled (local_irq_enable):
+
+       ICC2.Z would be set to 0.
+
+     A TIHI #2 instruction (trap #2 if condition HI - Z==0 && C==0) would be used to trap if
+     interrupts were now virtually enabled, but physically disabled - which they're not, so the
+     trap isn't taken. The kernel would then be back to state (1).
+
+ (5) An interrupt occurs. The exception prologue examines ICC2.Z and determines that the interrupt
+     shouldn't actually have happened. It jumps aside, and there disabled interrupts by setting
+     PSR.PIL to 14 and then it clears ICC2.C.
+
+ (6) If interrupts were then saved and disabled again (local_irq_save):
+
+       ICC2.Z would be shifted into the save variable and masked off (giving a 1).
+
+       ICC2.Z would then be set to 1 (thus unchanged), and ICC2.C would be unaffected (ie: 0).
+
+ (7) If interrupts were then restored from state (6) (local_irq_restore):
+
+       ICC2.Z would be set to indicate the result of XOR'ing the saved value (ie: 1) with 1, which
+       gives a result of 0 - thus leaving ICC2.Z set.
+
+       ICC2.C would remain unaffected (ie: 0).
+
+     A TIHI #2 instruction would be used to again assay the current state, but this would do
+     nothing as Z==1.
+
+ (8) If interrupts were then enabled (local_irq_enable):
+
+       ICC2.Z would be cleared. ICC2.C would be left unaffected. Both flags would now be 0.
+
+     A TIHI #2 instruction again issued to assay the current state would then trap as both Z==0
+     [interrupts virtually enabled] and C==0 [interrupts really disabled] would then be true.
+
+ (9) The trap #2 handler would simply enable hardware interrupts (set PSR.PIL to 0), set ICC2.C to
+     1 and return.
+
+(10) Immediately upon returning, the pending interrupt would be taken.
+
+(11) The interrupt handler would take the path of actually processing the interrupt (ICC2.Z is
+     clear, BEQ fails as per step (2)).
+
+(12) The interrupt handler would then set ICC2.C to 1 since hardware interrupts are definitely
+     enabled - or else the kernel wouldn't be here.
+
+(13) On return from the interrupt handler, things would be back to state (1).
+
+This trap (#2) is only available in kernel mode. In user mode it will result in SIGILL.
index 0ea5a0c6e8277f9691f21aed46edfa923d30adf4..2c3b1eae42801ae38fe9fe4eb2174f15b44c89f3 100644 (file)
@@ -136,17 +136,20 @@ Kprobes, jprobes, and return probes are implemented on the following
 architectures:
 
 - i386
-- x86_64 (AMD-64, E64MT)
+- x86_64 (AMD-64, EM64T)
 - ppc64
-- ia64 (Support for probes on certain instruction types is still in progress.)
+- ia64 (Does not support probes on instruction slot1.)
 - 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.
+ensure that CONFIG_KPROBES is set to "y".  Under "Instrumentation
+Support", look for "Kprobes".
+
+So that you can load and unload Kprobes-based instrumentation modules,
+make sure "Loadable module support" (CONFIG_MODULES) and "Module
+unloading" (CONFIG_MODULE_UNLOAD) are set to "y".
 
 You may also want to ensure that CONFIG_KALLSYMS and perhaps even
 CONFIG_KALLSYMS_ALL are set to "y", since kallsyms_lookup_name()
@@ -262,18 +265,18 @@ 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.
+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.
+The register_*probe functions will return -EINVAL if you attempt
+to install a probe in the code that implements Kprobes (mostly
+kernel/kprobes.c and arch/*/kernel/kprobes.c, but also functions such
+as do_page_fault and notifier_call_chain).
 
 If you install a probe in an inline-able function, Kprobes makes
 no attempt to chase down all inline instances of the function and
@@ -290,18 +293,14 @@ 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
+probe handler.  If a probe handler hits a probe, that second probe's
+handlers won't be run in that instance, and the kprobe.nmissed member
+of the second probe will be incremented.
+
+As of Linux v2.6.15-rc1, multiple handlers (or multiple instances of
+the same handler) may run concurrently on different CPUs.
+
+Kprobes does not use mutexes or allocate memory except during
 registration and unregistration.
 
 Probe handlers are run with preemption disabled.  Depending on the
@@ -316,11 +315,18 @@ 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.
+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() case covered.
+do_execve() and do_fork() are not an issue.  We're unaware of other
+specific cases where this could be a problem.
+
+If, upon entry to or exit from a function, the CPU is running on
+a stack other than that of the current task, registering a return
+probe on that function may produce undesirable results.  For this
+reason, Kprobes doesn't support return probes (or kprobes or jprobes)
+on the x86_64 version of __switch_to(); the registration functions
+return -EINVAL.
 
 6. Probe Overhead
 
@@ -347,14 +353,12 @@ 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.
+a. SystemTap (http://sourceware.org/systemtap): Provides a simplified
+programming interface for probe-based instrumentation.  Try it out.
+b. Kernel return probes for sparc64.
+c. Support for other architectures.
+d. User-space probes.
+e. Watchpoint probes (which fire on data references).
 
 8. Kprobes Example
 
@@ -411,8 +415,7 @@ int init_module(void)
                printk("Couldn't find %s to plant kprobe\n", "do_fork");
                return -1;
        }
-       ret = register_kprobe(&kp);
-       if (ret < 0) {
+       if ((ret = register_kprobe(&kp) < 0)) {
                printk("register_kprobe failed, returned %d\n", ret);
                return -1;
        }
index a7e4c4ea3560faf6dfc2a4f48eeb79ed3950c970..afb31c141d9d281a3a5b406cffb29220961d02cc 100644 (file)
@@ -95,11 +95,13 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
 CONFIG_IDEDMA_PCI_AUTO=y
 CONFIG_BLK_DEV_IDE_AU1XXX=y
 CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y
-CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON=y
 CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
 CONFIG_BLK_DEV_IDEDMA=y
 CONFIG_IDEDMA_AUTO=y
 
+Also define 'IDE_AU1XXX_BURSTMODE' in 'drivers/ide/mips/au1xxx-ide.c' to enable
+the burst support on DBDMA controller.
+
 If the used system need the USB support enable the following kernel configs for
 high IDE to USB throughput.
 
@@ -115,6 +117,8 @@ CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
 CONFIG_BLK_DEV_IDEDMA=y
 CONFIG_IDEDMA_AUTO=y
 
+Also undefine 'IDE_AU1XXX_BURSTMODE' in 'drivers/ide/mips/au1xxx-ide.c' to
+disable the burst support on DBDMA controller.
 
 ADD NEW HARD DISC TO WHITE OR BLACK LIST
 ----------------------------------------
index 60a617aff8ba465d83b38f09ebf9cbdc1dbe684c..e0838371237093e3f4800d5c12ccc604d363526f 100644 (file)
@@ -25,6 +25,10 @@ config GENERIC_HARDIRQS
        bool
        default n
 
+config TIME_LOW_RES
+       bool
+       default y
+
 mainmenu "Fujitsu FR-V Kernel Configuration"
 
 source "init/Kconfig"
index 90c0fb8d9dc3de577f3bbc011a4911821881a5fc..d163747d17c0e5a45f4be201007b498fbf84cc22 100644 (file)
@@ -81,7 +81,7 @@ endif
 # - reserve CC3 for use with atomic ops
 # - all the extra registers are dealt with only at context switch time
 CFLAGS         += -mno-fdpic -mgpr-32 -msoft-float -mno-media
-CFLAGS         += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15
+CFLAGS         += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
 AFLAGS         += -mno-fdpic
 ASFLAGS                += -mno-fdpic
 
index 33233dc23e292602637b1e1752c8f86f687b1215..687c48d62dde73b8d67a8a6bc2cd76dfcb61d773 100644 (file)
@@ -200,12 +200,20 @@ __break_step:
        movsg           bpcsr,gr2
        sethi.p         %hi(__entry_kernel_external_interrupt),gr3
        setlo           %lo(__entry_kernel_external_interrupt),gr3
-       subcc           gr2,gr3,gr0,icc0
+       subcc.p         gr2,gr3,gr0,icc0
+       sethi           %hi(__entry_uspace_external_interrupt),gr3
+       setlo.p         %lo(__entry_uspace_external_interrupt),gr3
        beq             icc0,#2,__break_step_kernel_external_interrupt
-       sethi.p         %hi(__entry_uspace_external_interrupt),gr3
-       setlo           %lo(__entry_uspace_external_interrupt),gr3
-       subcc           gr2,gr3,gr0,icc0
+       subcc.p         gr2,gr3,gr0,icc0
+       sethi           %hi(__entry_kernel_external_interrupt_virtually_disabled),gr3
+       setlo.p         %lo(__entry_kernel_external_interrupt_virtually_disabled),gr3
        beq             icc0,#2,__break_step_uspace_external_interrupt
+       subcc.p         gr2,gr3,gr0,icc0
+       sethi           %hi(__entry_kernel_external_interrupt_virtual_reenable),gr3
+       setlo.p         %lo(__entry_kernel_external_interrupt_virtual_reenable),gr3
+       beq             icc0,#2,__break_step_kernel_external_interrupt_virtually_disabled
+       subcc           gr2,gr3,gr0,icc0
+       beq             icc0,#2,__break_step_kernel_external_interrupt_virtual_reenable
 
        LEDS            0x2007,gr2
 
@@ -254,6 +262,9 @@ __break_step_kernel_softprog_interrupt:
 # step through an external interrupt from kernel mode
        .globl          __break_step_kernel_external_interrupt
 __break_step_kernel_external_interrupt:
+       # deal with virtual interrupt disablement
+       beq             icc2,#0,__break_step_kernel_external_interrupt_virtually_disabled
+
        sethi.p         %hi(__entry_kernel_external_interrupt_reentry),gr3
        setlo           %lo(__entry_kernel_external_interrupt_reentry),gr3
 
@@ -294,6 +305,64 @@ __break_return_as_kernel_prologue:
 #endif
        rett            #1
 
+# we single-stepped into an interrupt handler whilst interrupts were merely virtually disabled
+# need to really disable interrupts, set flag, fix up and return
+__break_step_kernel_external_interrupt_virtually_disabled:
+       movsg           psr,gr2
+       andi            gr2,#~PSR_PIL,gr2
+       ori             gr2,#PSR_PIL_14,gr2     /* debugging interrupts only */
+       movgs           gr2,psr
+
+       ldi             @(gr31,#REG_CCR),gr3
+       movgs           gr3,ccr
+       subcc.p         gr0,gr0,gr0,icc2        /* leave Z set, clear C */
+
+       # exceptions must've been enabled and we must've been in supervisor mode
+       setlos          BPSR_BET|BPSR_BS,gr3
+       movgs           gr3,bpsr
+
+       # return to where the interrupt happened
+       movsg           pcsr,gr2
+       movgs           gr2,bpcsr
+
+       lddi.p          @(gr31,#REG_GR(2)),gr2
+
+       xor             gr31,gr31,gr31
+       movgs           gr0,brr
+#ifdef CONFIG_MMU
+       movsg           scr3,gr31
+#endif
+       rett            #1
+
+# we stepped through into the virtual interrupt reenablement trap
+#
+# we also want to single step anyway, but after fixing up so that we get an event on the
+# instruction after the broken-into exception returns
+       .globl          __break_step_kernel_external_interrupt_virtual_reenable
+__break_step_kernel_external_interrupt_virtual_reenable:
+       movsg           psr,gr2
+       andi            gr2,#~PSR_PIL,gr2
+       movgs           gr2,psr
+
+       ldi             @(gr31,#REG_CCR),gr3
+       movgs           gr3,ccr
+       subicc          gr0,#1,gr0,icc2         /* clear Z, set C */
+
+       # save the adjusted ICC2
+       movsg           ccr,gr3
+       sti             gr3,@(gr31,#REG_CCR)
+
+       # exceptions must've been enabled and we must've been in supervisor mode
+       setlos          BPSR_BET|BPSR_BS,gr3
+       movgs           gr3,bpsr
+
+       # return to where the trap happened
+       movsg           pcsr,gr2
+       movgs           gr2,bpcsr
+
+       # and then process the single step
+       bra             __break_continue
+
 # step through an internal exception from uspace mode
        .globl          __break_step_uspace_softprog_interrupt
 __break_step_uspace_softprog_interrupt:
index 9b9243e2103cd00b5f164a76ad6b270834ec8c4c..81568acea9cdb0fe1b31a4b39ac5a094e587fbbb 100644 (file)
@@ -116,6 +116,8 @@ __break_kerneltrap_fixup_table:
        .long           __break_step_uspace_external_interrupt
        .section .trap.kernel
        .org            \tbr_tt
+       # deal with virtual interrupt disablement
+       beq             icc2,#0,__entry_kernel_external_interrupt_virtually_disabled
        bra             __entry_kernel_external_interrupt
        .section .trap.fixup.kernel
        .org            \tbr_tt >> 2
@@ -259,25 +261,52 @@ __trap_fixup_kernel_data_tlb_miss:
        .org            TBR_TT_TRAP0
        .rept           127
        bra             __entry_uspace_softprog_interrupt
-       bra             __break_step_uspace_softprog_interrupt
-       .long           0,0
+       .long           0,0,0
        .endr
        .org            TBR_TT_BREAK
        bra             __entry_break
        .long           0,0,0
 
+       .section        .trap.fixup.user
+       .org            TBR_TT_TRAP0 >> 2
+       .rept           127
+       .long           __break_step_uspace_softprog_interrupt
+       .endr
+       .org            TBR_TT_BREAK >> 2
+       .long           0
+
        # miscellaneous kernel mode entry points
        .section        .trap.kernel
        .org            TBR_TT_TRAP0
-       .rept           127
        bra             __entry_kernel_softprog_interrupt
-       bra             __break_step_kernel_softprog_interrupt
-       .long           0,0
+       .org            TBR_TT_TRAP1
+       bra             __entry_kernel_softprog_interrupt
+
+       # trap #2 in kernel - reenable interrupts
+       .org            TBR_TT_TRAP2
+       bra             __entry_kernel_external_interrupt_virtual_reenable
+
+       # miscellaneous kernel traps
+       .org            TBR_TT_TRAP3
+       .rept           124
+       bra             __entry_kernel_softprog_interrupt
+       .long           0,0,0
        .endr
        .org            TBR_TT_BREAK
        bra             __entry_break
        .long           0,0,0
 
+       .section        .trap.fixup.kernel
+       .org            TBR_TT_TRAP0 >> 2
+       .long           __break_step_kernel_softprog_interrupt
+       .long           __break_step_kernel_softprog_interrupt
+       .long           __break_step_kernel_external_interrupt_virtual_reenable
+       .rept           124
+       .long           __break_step_kernel_softprog_interrupt
+       .endr
+       .org            TBR_TT_BREAK >> 2
+       .long           0
+
        # miscellaneous debug mode entry points
        .section        .trap.break
        .org            TBR_TT_BREAK
index 5f6548388b74a6d765a23f77e10aa6b793d9be22..1d21c8d34d8ab0b7770599f5ce95f67e28b20886 100644 (file)
@@ -141,7 +141,10 @@ __entry_uspace_external_interrupt_reentry:
 
        movsg           gner0,gr4
        movsg           gner1,gr5
-       stdi            gr4,@(gr28,#REG_GNER0)
+       stdi.p          gr4,@(gr28,#REG_GNER0)
+
+       # interrupts start off fully disabled in the interrupt handler
+       subcc           gr0,gr0,gr0,icc2                /* set Z and clear C */
 
        # set up kernel global registers
        sethi.p         %hi(__kernel_current_task),gr5
@@ -193,9 +196,8 @@ __entry_uspace_external_interrupt_reentry:
         .type          __entry_kernel_external_interrupt,@function
 __entry_kernel_external_interrupt:
        LEDS            0x6210
-
-       sub             sp,gr15,gr31
-       LEDS32
+//     sub             sp,gr15,gr31
+//     LEDS32
 
        # set up the stack pointer
        or.p            sp,gr0,gr30
@@ -231,7 +233,10 @@ __entry_kernel_external_interrupt_reentry:
        stdi            gr24,@(gr28,#REG_GR(24))
        stdi            gr26,@(gr28,#REG_GR(26))
        sti             gr29,@(gr28,#REG_GR(29))
-       stdi            gr30,@(gr28,#REG_GR(30))
+       stdi.p          gr30,@(gr28,#REG_GR(30))
+
+       # note virtual interrupts will be fully enabled upon return
+       subicc          gr0,#1,gr0,icc2                 /* clear Z, set C */
 
        movsg           tbr ,gr20
        movsg           psr ,gr22
@@ -267,7 +272,10 @@ __entry_kernel_external_interrupt_reentry:
 
        movsg           gner0,gr4
        movsg           gner1,gr5
-       stdi            gr4,@(gr28,#REG_GNER0)
+       stdi.p          gr4,@(gr28,#REG_GNER0)
+
+       # interrupts start off fully disabled in the interrupt handler
+       subcc           gr0,gr0,gr0,icc2                        /* set Z and clear C */
 
        # set the return address
        sethi.p         %hi(__entry_return_from_kernel_interrupt),gr4
@@ -291,6 +299,45 @@ __entry_kernel_external_interrupt_reentry:
 
        .size           __entry_kernel_external_interrupt,.-__entry_kernel_external_interrupt
 
+###############################################################################
+#
+# deal with interrupts that were actually virtually disabled
+# - we need to really disable them, flag the fact and return immediately
+# - if you change this, you must alter break.S also
+#
+###############################################################################
+       .balign         L1_CACHE_BYTES
+       .globl          __entry_kernel_external_interrupt_virtually_disabled
+       .type           __entry_kernel_external_interrupt_virtually_disabled,@function
+__entry_kernel_external_interrupt_virtually_disabled:
+       movsg           psr,gr30
+       andi            gr30,#~PSR_PIL,gr30
+       ori             gr30,#PSR_PIL_14,gr30           ; debugging interrupts only
+       movgs           gr30,psr
+       subcc           gr0,gr0,gr0,icc2                ; leave Z set, clear C
+       rett            #0
+
+       .size           __entry_kernel_external_interrupt_virtually_disabled,.-__entry_kernel_external_interrupt_virtually_disabled
+
+###############################################################################
+#
+# deal with re-enablement of interrupts that were pending when virtually re-enabled
+# - set ICC2.C, re-enable the real interrupts and return
+# - we can clear ICC2.Z because we shouldn't be here if it's not 0 [due to TIHI]
+# - if you change this, you must alter break.S also
+#
+###############################################################################
+       .balign         L1_CACHE_BYTES
+       .globl          __entry_kernel_external_interrupt_virtual_reenable
+       .type           __entry_kernel_external_interrupt_virtual_reenable,@function
+__entry_kernel_external_interrupt_virtual_reenable:
+       movsg           psr,gr30
+       andi            gr30,#~PSR_PIL,gr30             ; re-enable interrupts
+       movgs           gr30,psr
+       subicc          gr0,#1,gr0,icc2                 ; clear Z, set C
+       rett            #0
+
+       .size           __entry_kernel_external_interrupt_virtual_reenable,.-__entry_kernel_external_interrupt_virtual_reenable
 
 ###############################################################################
 #
@@ -335,6 +382,7 @@ __entry_uspace_softprog_interrupt_reentry:
 
        sethi.p         %hi(__entry_return_from_user_exception),gr23
        setlo           %lo(__entry_return_from_user_exception),gr23
+
        bra             __entry_common
 
        .size           __entry_uspace_softprog_interrupt,.-__entry_uspace_softprog_interrupt
@@ -495,7 +543,10 @@ __entry_common:
 
        movsg           gner0,gr4
        movsg           gner1,gr5
-       stdi            gr4,@(gr28,#REG_GNER0)
+       stdi.p          gr4,@(gr28,#REG_GNER0)
+
+       # set up virtual interrupt disablement
+       subicc          gr0,#1,gr0,icc2                 /* clear Z flag, set C flag */
 
        # set up kernel global registers
        sethi.p         %hi(__kernel_current_task),gr5
@@ -1418,11 +1469,27 @@ sys_call_table:
        .long sys_add_key
        .long sys_request_key
        .long sys_keyctl
-       .long sys_ni_syscall // sys_vperfctr_open
-       .long sys_ni_syscall // sys_vperfctr_control    /* 290 */
-       .long sys_ni_syscall // sys_vperfctr_unlink
-       .long sys_ni_syscall // sys_vperfctr_iresume
-       .long sys_ni_syscall // sys_vperfctr_read
+       .long sys_ioprio_set
+       .long sys_ioprio_get            /* 290 */
+       .long sys_inotify_init
+       .long sys_inotify_add_watch
+       .long sys_inotify_rm_watch
+       .long sys_migrate_pages
+       .long sys_openat                /* 295 */
+       .long sys_mkdirat
+       .long sys_mknodat
+       .long sys_fchownat
+       .long sys_futimesat
+       .long sys_newfstatat            /* 300 */
+       .long sys_unlinkat
+       .long sys_renameat
+       .long sys_linkat
+       .long sys_symlinkat
+       .long sys_readlinkat            /* 305 */
+       .long sys_fchmodat
+       .long sys_faccessat
+       .long sys_pselect6
+       .long sys_ppoll
 
 
 syscall_table_size = (. - sys_call_table)
index c73b4fe9f6ca4be6f20121b931ab32d9ec93ce15..29a5265489b7ec2333bc7ede45332c18ccb0b971 100644 (file)
@@ -513,6 +513,9 @@ __head_mmu_enabled:
        movgs           gr0,ccr
        movgs           gr0,cccr
 
+       # initialise the virtual interrupt handling
+       subcc           gr0,gr0,gr0,icc2                /* set Z, clear C */
+
 #ifdef CONFIG_MMU
        movgs           gr3,scr2
        movgs           gr3,scr3
index 59580c59c62ca899c0a150b59b41f16161d47e6e..27ab4c30aac677396a6cd975e8fb1d99f904e6e5 100644 (file)
@@ -287,18 +287,11 @@ asmlinkage void do_IRQ(void)
        struct irq_source *source;
        int level, cpu;
 
+       irq_enter();
+
        level = (__frame->tbr >> 4) & 0xf;
        cpu = smp_processor_id();
 
-#if 0
-       {
-               static u32 irqcount;
-               *(volatile u32 *) 0xe1200004 = ~((irqcount++ << 8) | level);
-               *(volatile u16 *) 0xffc00100 = (u16) ~0x9999;
-               mb();
-       }
-#endif
-
        if ((unsigned long) __frame - (unsigned long) (current + 1) < 512)
                BUG();
 
@@ -308,40 +301,12 @@ asmlinkage void do_IRQ(void)
 
        kstat_this_cpu.irqs[level]++;
 
-       irq_enter();
-
        for (source = frv_irq_levels[level].sources; source; source = source->next)
                source->doirq(source);
 
-       irq_exit();
-
        __clr_MASK(level);
 
-       /* only process softirqs if we didn't interrupt another interrupt handler */
-       if ((__frame->psr & PSR_PIL) == PSR_PIL_0)
-               if (local_softirq_pending())
-                       do_softirq();
-
-#ifdef CONFIG_PREEMPT
-       local_irq_disable();
-       while (--current->preempt_count == 0) {
-               if (!(__frame->psr & PSR_S) ||
-                   current->need_resched == 0 ||
-                   in_interrupt())
-                       break;
-               current->preempt_count++;
-               local_irq_enable();
-               preempt_schedule();
-               local_irq_disable();
-       }
-#endif
-
-#if 0
-       {
-               *(volatile u16 *) 0xffc00100 = (u16) ~0x6666;
-               mb();
-       }
-#endif
+       irq_exit();
 
 } /* end do_IRQ() */
 
index 539f45e6d15ee1bd78aa549b7470bedc2983dd11..c54f18e65ea6e31873dd3a16a3f1216c5f261478 100644 (file)
@@ -43,15 +43,6 @@ void iounmap(void *addr)
 {
 }
 
-/*
- * __iounmap unmaps nearly everything, so be careful
- * it doesn't free currently pointer/page tables anymore but it
- * wans't used anyway and might be added later.
- */
-void __iounmap(void *addr, unsigned long size)
-{
-}
-
 /*
  * Set new cache mode for some kernel address space.
  * The caller must push data for that range itself, if such data may already
index 80940d712acf76b6bea39df0cc27a618d0f632b1..98308b018a3514c3456b7bee5677e315083bc6ed 100644 (file)
@@ -33,6 +33,10 @@ config GENERIC_CALIBRATE_DELAY
        bool
        default y
 
+config TIME_LOW_RES
+       bool
+       default y
+
 config ISA
        bool
        default y
index a380167a13cf6f661fb294704c6b7d6d67f65988..582797db9603f1fa19b3a0d2fae692bf1510efb2 100644 (file)
@@ -169,7 +169,7 @@ endif
 
 config CPU_H8300H
        bool
-       depends on (H8002 || H83007 || H83048 || H83068)
+       depends on (H83002 || H83007 || H83048 || H83068)
        default y
 
 config CPU_H8S
diff --git a/arch/i386/boot/.gitignore b/arch/i386/boot/.gitignore
new file mode 100644 (file)
index 0000000..495f20c
--- /dev/null
@@ -0,0 +1,3 @@
+bootsect
+bzImage
+setup
diff --git a/arch/i386/boot/tools/.gitignore b/arch/i386/boot/tools/.gitignore
new file mode 100644 (file)
index 0000000..378eac2
--- /dev/null
@@ -0,0 +1 @@
+build
diff --git a/arch/i386/kernel/.gitignore b/arch/i386/kernel/.gitignore
new file mode 100644 (file)
index 0000000..40836ad
--- /dev/null
@@ -0,0 +1 @@
+vsyscall.lds
index 4daefb2ec1b281fb5e9169e2440f54cb840d2354..76b728159403376456b118b7615ae5ef5a5ae3fb 100644 (file)
@@ -7,6 +7,21 @@
  *    for details.
  */
 
+/*
+ * The caller puts arg2 in %ecx, which gets pushed. The kernel will use
+ * %ecx itself for arg2. The pushing is because the sysexit instruction
+ * (found in entry.S) requires that we clobber %ecx with the desired %esp.
+ * User code might expect that %ecx is unclobbered though, as it would be
+ * for returning via the iret instruction, so we must push and pop.
+ *
+ * The caller puts arg3 in %edx, which the sysexit instruction requires
+ * for %eip. Thus, exactly as for arg2, we must push and pop.
+ *
+ * Arg6 is different. The caller puts arg6 in %ebp. Since the sysenter
+ * instruction clobbers %esp, the user's %esp won't even survive entry
+ * into the kernel. We store %esp in %ebp. Code in entry.S must fetch
+ * arg6 from the stack.
+ */
        .text
        .globl __kernel_vsyscall
        .type __kernel_vsyscall,@function
index e72de580ebbf8b9a41801c08b7e09da4d9d33a7c..bbcfd08378a6c37d1389433f6d92c5d54a33e893 100644 (file)
 
 #include <linux/string.h>
 EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memchr);
-EXPORT_SYMBOL(memcmp);
 EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(memscan);
-EXPORT_SYMBOL(strcat);
-EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strcmp);
-EXPORT_SYMBOL(strcpy);
 EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strncat);
-EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(strncpy);
-EXPORT_SYMBOL(strnlen);
-EXPORT_SYMBOL(strrchr);
-EXPORT_SYMBOL(strstr);
-EXPORT_SYMBOL(strpbrk);
 
 #include <asm/checksum.h>
 EXPORT_SYMBOL(ip_fast_csum);           /* hand-coded assembly */
index a094ec49ccfab6fe8822771f9335def7a51cacf8..307d01e15b2ea359c043d11c5e19a0bc57bd1002 100644 (file)
@@ -250,32 +250,27 @@ time_init (void)
        set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
 }
 
-#define SMALLUSECS 100
-
-void
-udelay (unsigned long usecs)
+/*
+ * Generic udelay assumes that if preemption is allowed and the thread
+ * migrates to another CPU, that the ITC values are synchronized across
+ * all CPUs.
+ */
+static void
+ia64_itc_udelay (unsigned long usecs)
 {
-       unsigned long start;
-       unsigned long cycles;
-       unsigned long smallusecs;
+       unsigned long start = ia64_get_itc();
+       unsigned long end = start + usecs*local_cpu_data->cyc_per_usec;
 
-       /*
-        * Execute the non-preemptible delay loop (because the ITC might
-        * not be synchronized between CPUS) in relatively short time
-        * chunks, allowing preemption between the chunks.
-        */
-       while (usecs > 0) {
-               smallusecs = (usecs > SMALLUSECS) ? SMALLUSECS : usecs;
-               preempt_disable();
-               cycles = smallusecs*local_cpu_data->cyc_per_usec;
-               start = ia64_get_itc();
+       while (time_before(ia64_get_itc(), end))
+               cpu_relax();
+}
 
-               while (ia64_get_itc() - start < cycles)
-                       cpu_relax();
+void (*ia64_udelay)(unsigned long usecs) = &ia64_itc_udelay;
 
-               preempt_enable();
-               usecs -= smallusecs;
-       }
+void
+udelay (unsigned long usecs)
+{
+       (*ia64_udelay)(usecs);
 }
 EXPORT_SYMBOL(udelay);
 
index 55391901b0137f17184a7e8203d5087581ecd14e..dabd6c32641ecc412d81d35f423813c3c72aa4b3 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/module.h>       /* for EXPORT_SYMBOL */
 #include <linux/hardirq.h>
 #include <linux/kprobes.h>
+#include <linux/delay.h>               /* for ssleep() */
 
 #include <asm/fpswa.h>
 #include <asm/ia32.h>
@@ -116,6 +117,13 @@ die (const char *str, struct pt_regs *regs, long err)
        bust_spinlocks(0);
        die.lock_owner = -1;
        spin_unlock_irq(&die.lock);
+
+       if (panic_on_oops) {
+               printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n");
+               ssleep(5);
+               panic("Fatal exception");
+       }
+
        do_exit(SIGSEGV);
 }
 
index 3437c2390429daff50c60e1700dde33e66645198..3edef0d32f8653559bec1a09a6df96ff57bd7e1e 100644 (file)
 #include "xtalk/hubdev.h"
 #include "xtalk/xwidgetdev.h"
 
+
+extern void sn_init_cpei_timer(void);
+extern void register_sn_procfs(void);
+
 static struct list_head sn_sysdata_list;
 
 /* sysdata list struct */
@@ -40,12 +44,12 @@ struct brick {
        struct slab_info slab_info[MAX_SLABS + 1];
 };
 
-int sn_ioif_inited = 0;                /* SN I/O infrastructure initialized? */
+int sn_ioif_inited;            /* SN I/O infrastructure initialized? */
 
 struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES];      /* indexed by asic type */
 
-static int max_segment_number = 0; /* Default highest segment number */
-static int max_pcibus_number = 255; /* Default highest pci bus number */
+static int max_segment_number;          /* Default highest segment number */
+static int max_pcibus_number = 255;    /* Default highest pci bus number */
 
 /*
  * Hooks and struct for unsupported pci providers
@@ -84,7 +88,6 @@ static inline u64
 sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
                             u64 address)
 {
-
        struct ia64_sal_retval ret_stuff;
        ret_stuff.status = 0;
        ret_stuff.v0 = 0;
@@ -94,7 +97,6 @@ sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
                        (u64) nasid, (u64) widget_num,
                        (u64) device_num, (u64) address, 0, 0, 0);
        return ret_stuff.status;
-
 }
 
 /*
@@ -102,7 +104,6 @@ sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
  */
 static inline u64 sal_get_hubdev_info(u64 handle, u64 address)
 {
-
        struct ia64_sal_retval ret_stuff;
        ret_stuff.status = 0;
        ret_stuff.v0 = 0;
@@ -118,7 +119,6 @@ static inline u64 sal_get_hubdev_info(u64 handle, u64 address)
  */
 static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
 {
-
        struct ia64_sal_retval ret_stuff;
        ret_stuff.status = 0;
        ret_stuff.v0 = 0;
@@ -215,7 +215,7 @@ static void __init sn_fixup_ionodes(void)
        struct hubdev_info *hubdev;
        u64 status;
        u64 nasid;
-       int i, widget, device;
+       int i, widget, device, size;
 
        /*
         * Get SGI Specific HUB chipset information.
@@ -251,48 +251,37 @@ static void __init sn_fixup_ionodes(void)
                if (!hubdev->hdi_flush_nasid_list.widget_p)
                        continue;
 
+               size = (HUB_WIDGET_ID_MAX + 1) *
+                       sizeof(struct sn_flush_device_kernel *);
                hubdev->hdi_flush_nasid_list.widget_p =
-                   kmalloc((HUB_WIDGET_ID_MAX + 1) *
-                           sizeof(struct sn_flush_device_kernel *),
-                           GFP_KERNEL);
-               memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0,
-                      (HUB_WIDGET_ID_MAX + 1) *
-                      sizeof(struct sn_flush_device_kernel *));
+                       kzalloc(size, GFP_KERNEL);
+               if (!hubdev->hdi_flush_nasid_list.widget_p)
+                       BUG();
 
                for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
-                       sn_flush_device_kernel = kmalloc(DEV_PER_WIDGET *
-                                                        sizeof(struct
-                                                       sn_flush_device_kernel),
-                                                       GFP_KERNEL);
+                       size = DEV_PER_WIDGET *
+                               sizeof(struct sn_flush_device_kernel);
+                       sn_flush_device_kernel = kzalloc(size, GFP_KERNEL);
                        if (!sn_flush_device_kernel)
                                BUG();
-                       memset(sn_flush_device_kernel, 0x0,
-                              DEV_PER_WIDGET *
-                              sizeof(struct sn_flush_device_kernel));
 
                        dev_entry = sn_flush_device_kernel;
                        for (device = 0; device < DEV_PER_WIDGET;
                             device++,dev_entry++) {
-                               dev_entry->common = kmalloc(sizeof(struct
-                                                       sn_flush_device_common),
-                                                           GFP_KERNEL);
+                               size = sizeof(struct sn_flush_device_common);
+                               dev_entry->common = kzalloc(size, GFP_KERNEL);
                                if (!dev_entry->common)
                                        BUG();
-                               memset(dev_entry->common, 0x0, sizeof(struct
-                                                      sn_flush_device_common));
 
                                if (sn_prom_feature_available(
                                                       PRF_DEVICE_FLUSH_LIST))
                                        status = sal_get_device_dmaflush_list(
-                                                                         nasid,
-                                                                        widget,
-                                                                        device,
-                                                     (u64)(dev_entry->common));
+                                                    nasid, widget, device,
+                                                    (u64)(dev_entry->common));
                                else
                                        status = sn_device_fixup_war(nasid,
-                                                                    widget,
-                                                                    device,
-                                                            dev_entry->common);
+                                                    widget, device,
+                                                    dev_entry->common);
                                if (status != SALRET_OK)
                                        panic("SAL call failed: %s\n",
                                              ia64_sal_strerror(status));
@@ -383,13 +372,12 @@ void sn_pci_fixup_slot(struct pci_dev *dev)
 
        pci_dev_get(dev); /* for the sysdata pointer */
        pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
-       if (pcidev_info <= 0)
+       if (!pcidev_info)
                BUG();          /* Cannot afford to run out of memory */
 
-       sn_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
-       if (sn_irq_info <= 0)
+       sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
+       if (!sn_irq_info)
                BUG();          /* Cannot afford to run out of memory */
-       memset(sn_irq_info, 0, sizeof(struct sn_irq_info));
 
        /* Call to retrieve pci device information needed by kernel. */
        status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number, 
@@ -482,13 +470,13 @@ void sn_pci_fixup_slot(struct pci_dev *dev)
  */
 void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 {
-       int status = 0;
+       int status;
        int nasid, cnode;
        struct pci_controller *controller;
        struct sn_pci_controller *sn_controller;
        struct pcibus_bussoft *prom_bussoft_ptr;
        struct hubdev_info *hubdev_info;
-       void *provider_soft = NULL;
+       void *provider_soft;
        struct sn_pcibus_provider *provider;
 
        status = sal_get_pcibus_info((u64) segment, (u64) busnum,
@@ -535,6 +523,8 @@ void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
        bus->sysdata = controller;
        if (provider->bus_fixup)
                provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller);
+       else
+               provider_soft = NULL;
 
        if (provider_soft == NULL) {
                /* fixup failed or not applicable */
@@ -638,13 +628,8 @@ void sn_bus_free_sysdata(void)
 
 static int __init sn_pci_init(void)
 {
-       int i = 0;
-       int j = 0;
+       int i, j;
        struct pci_dev *pci_dev = NULL;
-       extern void sn_init_cpei_timer(void);
-#ifdef CONFIG_PROC_FS
-       extern void register_sn_procfs(void);
-#endif
 
        if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM())
                return 0;
@@ -700,32 +685,29 @@ static int __init sn_pci_init(void)
  */
 void hubdev_init_node(nodepda_t * npda, cnodeid_t node)
 {
-
        struct hubdev_info *hubdev_info;
+       int size;
+       pg_data_t *pg;
+
+       size = sizeof(struct hubdev_info);
 
        if (node >= num_online_nodes()) /* Headless/memless IO nodes */
-               hubdev_info =
-                   (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(0),
-                                                            sizeof(struct
-                                                                   hubdev_info));
+               pg = NODE_DATA(0);
        else
-               hubdev_info =
-                   (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(node),
-                                                            sizeof(struct
-                                                                   hubdev_info));
-       npda->pdinfo = (void *)hubdev_info;
+               pg = NODE_DATA(node);
 
+       hubdev_info = (struct hubdev_info *)alloc_bootmem_node(pg, size);
+
+       npda->pdinfo = (void *)hubdev_info;
 }
 
 geoid_t
 cnodeid_get_geoid(cnodeid_t cnode)
 {
-
        struct hubdev_info *hubdev;
 
        hubdev = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
        return hubdev->hdi_geoid;
-
 }
 
 subsys_initcall(sn_pci_init);
@@ -734,3 +716,4 @@ EXPORT_SYMBOL(sn_pci_unfixup_slot);
 EXPORT_SYMBOL(sn_pci_controller_fixup);
 EXPORT_SYMBOL(sn_bus_store_sysdata);
 EXPORT_SYMBOL(sn_bus_free_sysdata);
+EXPORT_SYMBOL(sn_pcidev_info_get);
index 48645ac120fc3d0b8b7855de1f0d965b5694a2d4..5b84836c2171b1a53c3dddc0cc060055c1433a15 100644 (file)
@@ -75,7 +75,7 @@ EXPORT_SYMBOL(sn_rtc_cycles_per_second);
 DEFINE_PER_CPU(struct sn_hub_info_s, __sn_hub_info);
 EXPORT_PER_CPU_SYMBOL(__sn_hub_info);
 
-DEFINE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_NUMNODES]);
+DEFINE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_COMPACT_NODES]);
 EXPORT_PER_CPU_SYMBOL(__sn_cnodeid_to_nasid);
 
 DEFINE_PER_CPU(struct nodepda_s *, __sn_nodepda);
@@ -317,6 +317,7 @@ struct pcdp_vga_device {
 #define PCDP_PCI_TRANS_IOPORT  0x02
 #define PCDP_PCI_TRANS_MMIO    0x01
 
+#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
 static void
 sn_scan_pcdp(void)
 {
@@ -358,6 +359,7 @@ sn_scan_pcdp(void)
                break; /* once we find the primary, we're done */
        }
 }
+#endif
 
 static unsigned long sn2_rtc_initial;
 
index 81c63b2f8ae99b525f9f82168a4e7073494d711b..6ae276d5d50c858d213c25513d4c0748599151b8 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 1999,2001-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (C) 1999,2001-2004, 2006 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * Module to export the system's Firmware Interface Tables, including
  * PROM revision numbers and banners, in /proc
@@ -190,7 +190,7 @@ static int
 read_version_entry(char *page, char **start, off_t off, int count, int *eof,
                   void *data)
 {
-       int len = 0;
+       int len;
 
        /* data holds the NASID of the node */
        len = dump_version(page, (unsigned long)data);
@@ -202,7 +202,7 @@ static int
 read_fit_entry(char *page, char **start, off_t off, int count, int *eof,
               void *data)
 {
-       int len = 0;
+       int len;
 
        /* data holds the NASID of the node */
        len = dump_fit(page, (unsigned long)data);
@@ -229,13 +229,16 @@ int __init prominfo_init(void)
        struct proc_dir_entry *p;
        cnodeid_t cnodeid;
        unsigned long nasid;
+       int size;
        char name[NODE_NAME_LEN];
 
        if (!ia64_platform_is("sn2"))
                return 0;
 
-       proc_entries = kmalloc(num_online_nodes() * sizeof(struct proc_dir_entry *),
-                              GFP_KERNEL);
+       size = num_online_nodes() * sizeof(struct proc_dir_entry *);
+       proc_entries = kzalloc(size, GFP_KERNEL);
+       if (!proc_entries)
+               return -ENOMEM;
 
        sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL);
 
@@ -244,14 +247,12 @@ int __init prominfo_init(void)
                sprintf(name, "node%d", cnodeid);
                *entp = proc_mkdir(name, sgi_prominfo_entry);
                nasid = cnodeid_to_nasid(cnodeid);
-               p = create_proc_read_entry(
-                       "fit", 0, *entp, read_fit_entry,
-                       (void *)nasid);
+               p = create_proc_read_entry("fit", 0, *entp, read_fit_entry,
+                                          (void *)nasid);
                if (p)
                        p->owner = THIS_MODULE;
-               p = create_proc_read_entry(
-                       "version", 0, *entp, read_version_entry,
-                       (void *)nasid);
+               p = create_proc_read_entry("version", 0, *entp,
+                                          read_version_entry, (void *)nasid);
                if (p)
                        p->owner = THIS_MODULE;
                entp++;
@@ -263,7 +264,7 @@ int __init prominfo_init(void)
 void __exit prominfo_exit(void)
 {
        struct proc_dir_entry **entp;
-       unsigned cnodeid;
+       unsigned int cnodeid;
        char name[NODE_NAME_LEN];
 
        entp = proc_entries;
index f153a4c35c70b206cbcbb450de72feb943d3be16..24eefb2fc55ffd56360209316e6c9b6a1f421e2a 100644 (file)
@@ -46,8 +46,14 @@ DECLARE_PER_CPU(struct ptc_stats, ptcstats);
 
 static  __cacheline_aligned DEFINE_SPINLOCK(sn2_global_ptc_lock);
 
-void sn2_ptc_deadlock_recovery(short *, short, short, int, volatile unsigned long *, unsigned long,
-       volatile unsigned long *, unsigned long);
+extern unsigned long
+sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long,
+                              volatile unsigned long *, unsigned long,
+                              volatile unsigned long *, unsigned long);
+void
+sn2_ptc_deadlock_recovery(short *, short, short, int,
+                         volatile unsigned long *, unsigned long,
+                         volatile unsigned long *, unsigned long);
 
 /*
  * Note: some is the following is captured here to make degugging easier
@@ -59,16 +65,6 @@ void sn2_ptc_deadlock_recovery(short *, short, short, int, volatile unsigned lon
 #define reset_max_active_on_deadlock() 1
 #define PTC_LOCK(sh1)                  ((sh1) ? &sn2_global_ptc_lock : &sn_nodepda->ptc_lock)
 
-static inline void ptc_lock(int sh1, unsigned long *flagp)
-{
-       spin_lock_irqsave(PTC_LOCK(sh1), *flagp);
-}
-
-static inline void ptc_unlock(int sh1, unsigned long flags)
-{
-       spin_unlock_irqrestore(PTC_LOCK(sh1), flags);
-}
-
 struct ptc_stats {
        unsigned long ptc_l;
        unsigned long change_rid;
@@ -82,6 +78,8 @@ struct ptc_stats {
        unsigned long shub_ptc_flushes_not_my_mm;
 };
 
+#define sn2_ptctest    0
+
 static inline unsigned long wait_piowc(void)
 {
        volatile unsigned long *piows;
@@ -200,7 +198,7 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
        max_active = max_active_pio(shub1);
 
        itc = ia64_get_itc();
-       ptc_lock(shub1, &flags);
+       spin_lock_irqsave(PTC_LOCK(shub1), flags);
        itc2 = ia64_get_itc();
 
        __get_cpu_var(ptcstats).lock_itc_clocks += itc2 - itc;
@@ -258,7 +256,7 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
                ia64_srlz_d();
        }
 
-       ptc_unlock(shub1, flags);
+       spin_unlock_irqrestore(PTC_LOCK(shub1), flags);
 
        preempt_enable();
 }
@@ -270,11 +268,12 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
  * TLB flush transaction.  The recovery sequence is somewhat tricky & is
  * coded in assembly language.
  */
-void sn2_ptc_deadlock_recovery(short *nasids, short ib, short ie, int mynasid, volatile unsigned long *ptc0, unsigned long data0,
-       volatile unsigned long *ptc1, unsigned long data1)
+
+void
+sn2_ptc_deadlock_recovery(short *nasids, short ib, short ie, int mynasid,
+                         volatile unsigned long *ptc0, unsigned long data0,
+                         volatile unsigned long *ptc1, unsigned long data1)
 {
-       extern unsigned long sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long,
-               volatile unsigned long *, unsigned long, volatile unsigned long *, unsigned long);
        short nasid, i;
        unsigned long *piows, zeroval, n;
 
index a06719d752a03112e697b0a060864ec99267e012..c686d9c12f7b1dc3c66b49f72acbd128466339bb 100644 (file)
@@ -6,11 +6,11 @@
  * Copyright (C) 2000-2005 Silicon Graphics, Inc. All rights reserved.
  */
 #include <linux/config.h>
-#include <asm/uaccess.h>
 
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <asm/uaccess.h>
 #include <asm/sn/sn_sal.h>
 
 static int partition_id_show(struct seq_file *s, void *p)
@@ -90,10 +90,10 @@ static int coherence_id_open(struct inode *inode, struct file *file)
        return single_open(file, coherence_id_show, NULL);
 }
 
-static struct proc_dir_entry *sn_procfs_create_entry(
-       const char *name, struct proc_dir_entry *parent,
-       int (*openfunc)(struct inode *, struct file *),
-       int (*releasefunc)(struct inode *, struct file *))
+static struct proc_dir_entry
+*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent,
+                       int (*openfunc)(struct inode *, struct file *),
+                       int (*releasefunc)(struct inode *, struct file *))
 {
        struct proc_dir_entry *e = create_proc_entry(name, 0444, parent);
 
@@ -126,24 +126,24 @@ void register_sn_procfs(void)
                return;
 
        sn_procfs_create_entry("partition_id", sgi_proc_dir,
-               partition_id_open, single_release);
+                              partition_id_open, single_release);
 
        sn_procfs_create_entry("system_serial_number", sgi_proc_dir,
-               system_serial_number_open, single_release);
+                              system_serial_number_open, single_release);
 
        sn_procfs_create_entry("licenseID", sgi_proc_dir, 
-               licenseID_open, single_release);
+                              licenseID_open, single_release);
 
        e = sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, 
-               sn_force_interrupt_open, single_release);
+                                  sn_force_interrupt_open, single_release);
        if (e) 
                e->proc_fops->write = sn_force_interrupt_write_proc;
 
        sn_procfs_create_entry("coherence_id", sgi_proc_dir, 
-               coherence_id_open, single_release);
+                              coherence_id_open, single_release);
        
        sn_procfs_create_entry("sn_topology", sgi_proc_dir,
-               sn_topology_open, sn_topology_release);
+                              sn_topology_open, sn_topology_release);
 }
 
 #endif /* CONFIG_PROC_FS */
index deb9baf4d4735f8562f16726a2d49b0075aff293..56a88b6df4b41fbca0df635ab5fc23988b0298b4 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <asm/hw_irq.h>
 #include <asm/system.h>
+#include <asm/timex.h>
 
 #include <asm/sn/leds.h>
 #include <asm/sn/shub_mmr.h>
@@ -28,9 +29,27 @@ static struct time_interpolator sn2_interpolator = {
        .source = TIME_SOURCE_MMIO64
 };
 
+/*
+ * sn udelay uses the RTC instead of the ITC because the ITC is not
+ * synchronized across all CPUs, and the thread may migrate to another CPU
+ * if preemption is enabled.
+ */
+static void
+ia64_sn_udelay (unsigned long usecs)
+{
+       unsigned long start = rtc_time();
+       unsigned long end = start +
+                       usecs * sn_rtc_cycles_per_second / 1000000;
+
+       while (time_before((unsigned long)rtc_time(), end))
+               cpu_relax();
+}
+
 void __init sn_timer_init(void)
 {
        sn2_interpolator.frequency = sn_rtc_cycles_per_second;
        sn2_interpolator.addr = RTC_COUNTER_ADDR;
        register_time_interpolator(&sn2_interpolator);
+
+       ia64_udelay = &ia64_sn_udelay;
 }
index adf5db2e2afeb4e2742457b40c062e0546e42972..fa7f69945917dd4b80ae5a5d6dc9897b19d1a9b8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *
  *
- * Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2005, 2006 Silicon Graphics, Inc.  All Rights Reserved.
  * 
  * This program is free software; you can redistribute it and/or modify it 
  * under the terms of version 2 of the GNU General Public License 
  * License along with this program; if not, write the Free Software 
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  * 
- * Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 
- * Mountain View, CA  94043, or:
- * 
- * http://www.sgi.com 
- * 
  * For further information regarding this notice, see: 
  * 
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan
index d263d3e8fbb91b7067ec3e137a9a2c085d048b05..8a56f8b5ffa2243d633f06dae80f7d0e53056e55 100644 (file)
@@ -284,12 +284,10 @@ struct sn_irq_info *tiocx_irq_alloc(nasid_t nasid, int widget, int irq,
        if ((nasid & 1) == 0)
                return NULL;
 
-       sn_irq_info = kmalloc(sn_irq_size, GFP_KERNEL);
+       sn_irq_info = kzalloc(sn_irq_size, GFP_KERNEL);
        if (sn_irq_info == NULL)
                return NULL;
 
-       memset(sn_irq_info, 0x0, sn_irq_size);
-
        status = tiocx_intr_alloc(nasid, widget, __pa(sn_irq_info), irq,
                                  req_nasid, slice);
        if (status) {
index 36e5437a0fb6bdc281e104340b4b9ec8f4358a3a..cdf6856ce089c07c4344f6150439e1bd4ef29523 100644 (file)
@@ -738,7 +738,9 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
 
        /* make sure all activity has settled down first */
 
-       if (atomic_read(&ch->references) > 0) {
+       if (atomic_read(&ch->references) > 0 ||
+                       ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
+                       !(ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE))) {
                return;
        }
        DBUG_ON(atomic_read(&ch->kthreads_assigned) != 0);
@@ -775,7 +777,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
 
        /* both sides are disconnected now */
 
-       if (ch->flags & XPC_C_CONNECTCALLOUT) {
+       if (ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE) {
                spin_unlock_irqrestore(&ch->lock, *irq_flags);
                xpc_disconnect_callout(ch, xpcDisconnected);
                spin_lock_irqsave(&ch->lock, *irq_flags);
@@ -1300,7 +1302,7 @@ xpc_process_msg_IPI(struct xpc_partition *part, int ch_number)
                                "delivered=%d, partid=%d, channel=%d\n",
                                nmsgs_sent, ch->partid, ch->number);
 
-                       if (ch->flags & XPC_C_CONNECTCALLOUT) {
+                       if (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) {
                                xpc_activate_kthreads(ch, nmsgs_sent);
                        }
                }
index 9cd460dfe27ef71b0e0a1517114b54812b490c54..8cbf164325703048ecd277ebf141efb432e8b075 100644 (file)
@@ -750,12 +750,16 @@ xpc_daemonize_kthread(void *args)
                /* let registerer know that connection has been established */
 
                spin_lock_irqsave(&ch->lock, irq_flags);
-               if (!(ch->flags & XPC_C_CONNECTCALLOUT)) {
-                       ch->flags |= XPC_C_CONNECTCALLOUT;
+               if (!(ch->flags & XPC_C_CONNECTEDCALLOUT)) {
+                       ch->flags |= XPC_C_CONNECTEDCALLOUT;
                        spin_unlock_irqrestore(&ch->lock, irq_flags);
 
                        xpc_connected_callout(ch);
 
+                       spin_lock_irqsave(&ch->lock, irq_flags);
+                       ch->flags |= XPC_C_CONNECTEDCALLOUT_MADE;
+                       spin_unlock_irqrestore(&ch->lock, irq_flags);
+
                        /*
                         * It is possible that while the callout was being
                         * made that the remote partition sent some messages.
@@ -777,15 +781,17 @@ xpc_daemonize_kthread(void *args)
 
        if (atomic_dec_return(&ch->kthreads_assigned) == 0) {
                spin_lock_irqsave(&ch->lock, irq_flags);
-               if ((ch->flags & XPC_C_CONNECTCALLOUT) &&
-                               !(ch->flags & XPC_C_DISCONNECTCALLOUT)) {
-                       ch->flags |= XPC_C_DISCONNECTCALLOUT;
+               if ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
+                               !(ch->flags & XPC_C_DISCONNECTINGCALLOUT)) {
+                       ch->flags |= XPC_C_DISCONNECTINGCALLOUT;
                        spin_unlock_irqrestore(&ch->lock, irq_flags);
 
                        xpc_disconnect_callout(ch, xpcDisconnecting);
-               } else {
-                       spin_unlock_irqrestore(&ch->lock, irq_flags);
+
+                       spin_lock_irqsave(&ch->lock, irq_flags);
+                       ch->flags |= XPC_C_DISCONNECTINGCALLOUT_MADE;
                }
+               spin_unlock_irqrestore(&ch->lock, irq_flags);
                if (atomic_dec_return(&part->nchannels_engaged) == 0) {
                        xpc_mark_partition_disengaged(part);
                        xpc_IPI_send_disengage(part);
index 5a36292388eb79d420db590c0ab0655bd9649afa..b4b84c269210b134495b864ecd8a40c5a22573ab 100644 (file)
@@ -335,10 +335,10 @@ int sn_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size)
         */
 
        SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE,
-               pci_domain_nr(bus), bus->number,
-               0, /* io */
-               0, /* read */
-               port, size, __pa(val));
+                pci_domain_nr(bus), bus->number,
+                0, /* io */
+                0, /* read */
+                port, size, __pa(val));
 
        if (isrv.status == 0)
                return size;
@@ -381,10 +381,10 @@ int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size)
         */
 
        SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE,
-               pci_domain_nr(bus), bus->number,
-               0, /* io */
-               1, /* write */
-               port, size, __pa(&val));
+                pci_domain_nr(bus), bus->number,
+                0, /* io */
+                1, /* write */
+                port, size, __pa(&val));
 
        if (isrv.status == 0)
                return size;
index aa3fa5152a32c52f36704477adf9519fb9c4045c..1f0253bfe0a0473f1a8b83046a4ca317204d0bf4 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001-2004 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 2001-2006 Silicon Graphics, Inc. All rights reserved.
  */
 
 #include <linux/types.h>
@@ -12,7 +12,7 @@
 #include <asm/sn/pcibus_provider_defs.h>
 #include <asm/sn/pcidev.h>
 
-int pcibr_invalidate_ate = 0;  /* by default don't invalidate ATE on free */
+int pcibr_invalidate_ate;      /* by default don't invalidate ATE on free */
 
 /*
  * mark_ate: Mark the ate as either free or inuse.
@@ -20,14 +20,12 @@ int pcibr_invalidate_ate = 0;       /* by default don't invalidate ATE on free */
 static void mark_ate(struct ate_resource *ate_resource, int start, int number,
                     u64 value)
 {
-
        u64 *ate = ate_resource->ate;
        int index;
        int length = 0;
 
        for (index = start; length < number; index++, length++)
                ate[index] = value;
-
 }
 
 /*
@@ -37,7 +35,6 @@ static void mark_ate(struct ate_resource *ate_resource, int start, int number,
 static int find_free_ate(struct ate_resource *ate_resource, int start,
                         int count)
 {
-
        u64 *ate = ate_resource->ate;
        int index;
        int start_free;
@@ -70,12 +67,10 @@ static int find_free_ate(struct ate_resource *ate_resource, int start,
 static inline void free_ate_resource(struct ate_resource *ate_resource,
                                     int start)
 {
-
        mark_ate(ate_resource, start, ate_resource->ate[start], 0);
        if ((ate_resource->lowest_free_index > start) ||
            (ate_resource->lowest_free_index < 0))
                ate_resource->lowest_free_index = start;
-
 }
 
 /*
@@ -84,7 +79,6 @@ static inline void free_ate_resource(struct ate_resource *ate_resource,
 static inline int alloc_ate_resource(struct ate_resource *ate_resource,
                                     int ate_needed)
 {
-
        int start_index;
 
        /*
@@ -118,19 +112,12 @@ static inline int alloc_ate_resource(struct ate_resource *ate_resource,
  */
 int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
 {
-       int status = 0;
-       u64 flag;
+       int status;
+       unsigned long flags;
 
-       flag = pcibr_lock(pcibus_info);
+       spin_lock_irqsave(&pcibus_info->pbi_lock, flags);
        status = alloc_ate_resource(&pcibus_info->pbi_int_ate_resource, count);
-
-       if (status < 0) {
-               /* Failed to allocate */
-               pcibr_unlock(pcibus_info, flag);
-               return -1;
-       }
-
-       pcibr_unlock(pcibus_info, flag);
+       spin_unlock_irqrestore(&pcibus_info->pbi_lock, flags);
 
        return status;
 }
@@ -182,7 +169,7 @@ void pcibr_ate_free(struct pcibus_info *pcibus_info, int index)
                ate_write(pcibus_info, index, count, (ate & ~PCI32_ATE_V));
        }
 
-       flags = pcibr_lock(pcibus_info);
+       spin_lock_irqsave(&pcibus_info->pbi_lock, flags);
        free_ate_resource(&pcibus_info->pbi_int_ate_resource, index);
-       pcibr_unlock(pcibus_info, flags);
+       spin_unlock_irqrestore(&pcibus_info->pbi_lock, flags);
 }
index 54ce5b7ceed27e3ec0b29254b3e4f00f02edd83e..9f86bb6519aa6bbfc4511e63959d2530bfbcc867 100644 (file)
@@ -137,14 +137,12 @@ pcibr_dmatrans_direct64(struct pcidev_info * info, u64 paddr,
                pci_addr |= PCI64_ATTR_VIRTUAL;
 
        return pci_addr;
-
 }
 
 static dma_addr_t
 pcibr_dmatrans_direct32(struct pcidev_info * info,
                        u64 paddr, size_t req_size, u64 flags)
 {
-
        struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info;
        struct pcibus_info *pcibus_info = (struct pcibus_info *)pcidev_info->
            pdi_pcibus_info;
@@ -171,7 +169,6 @@ pcibr_dmatrans_direct32(struct pcidev_info * info,
        }
 
        return PCI32_DIRECT_BASE | offset;
-
 }
 
 /*
@@ -218,9 +215,8 @@ void sn_dma_flush(u64 addr)
        u64 flags;
        u64 itte;
        struct hubdev_info *hubinfo;
-       volatile struct sn_flush_device_kernel *p;
-       volatile struct sn_flush_device_common *common;
-
+       struct sn_flush_device_kernel *p;
+       struct sn_flush_device_common *common;
        struct sn_flush_nasid_entry *flush_nasid_list;
 
        if (!sn_ioif_inited)
@@ -310,8 +306,7 @@ void sn_dma_flush(u64 addr)
                                             (common->sfdl_slot - 1));
                }
        } else {
-               spin_lock_irqsave((spinlock_t *)&p->sfdl_flush_lock,
-                                 flags);
+               spin_lock_irqsave(&p->sfdl_flush_lock, flags);
                *common->sfdl_flush_addr = 0;
 
                /* force an interrupt. */
@@ -322,8 +317,7 @@ void sn_dma_flush(u64 addr)
                        cpu_relax();
 
                /* okay, everything is synched up. */
-               spin_unlock_irqrestore((spinlock_t *)&p->sfdl_flush_lock,
-                                      flags);
+               spin_unlock_irqrestore(&p->sfdl_flush_lock, flags);
        }
        return;
 }
index 2fac27049bf62eda7323fee737217db830250fc8..98f716bd92f0ce414d414f8c1c6cf68523d01f7f 100644 (file)
@@ -163,9 +163,12 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
        /* Setup the PMU ATE map */
        soft->pbi_int_ate_resource.lowest_free_index = 0;
        soft->pbi_int_ate_resource.ate =
-           kmalloc(soft->pbi_int_ate_size * sizeof(u64), GFP_KERNEL);
-       memset(soft->pbi_int_ate_resource.ate, 0,
-              (soft->pbi_int_ate_size * sizeof(u64)));
+           kzalloc(soft->pbi_int_ate_size * sizeof(u64), GFP_KERNEL);
+
+       if (!soft->pbi_int_ate_resource.ate) {
+               kfree(soft);
+               return NULL;
+       }
 
        if (prom_bussoft->bs_asic_type == PCIIO_ASIC_TYPE_TIOCP) {
                /* TIO PCI Bridge: find nearest node with CPUs */
index 96b91982805316769128ac8e5a00791b5b4cf8bf..8849439e88dd35f997238d0fbee9e4eea3c342ed 100644 (file)
@@ -21,6 +21,10 @@ config GENERIC_CALIBRATE_DELAY
        bool
        default y
 
+config TIME_LOW_RES
+       bool
+       default y
+
 config ARCH_MAY_HAVE_PC_FDC
        bool
        depends on Q40 || (BROKEN && SUN3X)
index e2a6e864896080a42b2cd76e98e43b63d67dc92e..e50858dbc23777ba6ef85b08bb9c70bef6dd211c 100644 (file)
@@ -29,6 +29,10 @@ config GENERIC_CALIBRATE_DELAY
        bool
        default y
 
+config TIME_LOW_RES
+       bool
+       default y
+
 source "init/Kconfig"
 
 menu "Processor type and features"
index 6a57407df1bcd1627c86e22de5f3228ad488c9d9..38c0f3360d517aa05794879a8a2a342ca1d86f18 100644 (file)
@@ -94,7 +94,6 @@ endif
 # machines may also.  Since BFD is incredibly buggy with respect to
 # crossformat linking we rely on the elf2ecoff tool for format conversion.
 #
-cflags-y                       += -I $(TOPDIR)/include/asm/gcc
 cflags-y                       += -G 0 -mno-abicalls -fno-pic -pipe
 LDFLAGS_vmlinux                        += -G 0 -static -n -nostdlib
 MODFLAGS                       += -mlong-calls
index 5232fc752935385a7346c7d9702eebd425106c85..092679c2dca9b83bd3e66503d83413daf29853d7 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/a.out.h>
 #include <linux/init.h>
 #include <linux/completion.h>
+#include <linux/kallsyms.h>
 
 #include <asm/abi.h>
 #include <asm/bootinfo.h>
@@ -272,46 +273,19 @@ long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
 
 static struct mips_frame_info {
        void *func;
-       int omit_fp;    /* compiled without fno-omit-frame-pointer */
-       int frame_offset;
+       unsigned long func_size;
+       int frame_size;
        int pc_offset;
-} schedule_frame, mfinfo[] = {
-       { schedule, 0 },        /* must be first */
-       /* arch/mips/kernel/semaphore.c */
-       { __down, 1 },
-       { __down_interruptible, 1 },
-       /* kernel/sched.c */
-#ifdef CONFIG_PREEMPT
-       { preempt_schedule, 0 },
-#endif
-       { wait_for_completion, 0 },
-       { interruptible_sleep_on, 0 },
-       { interruptible_sleep_on_timeout, 0 },
-       { sleep_on, 0 },
-       { sleep_on_timeout, 0 },
-       { yield, 0 },
-       { io_schedule, 0 },
-       { io_schedule_timeout, 0 },
-#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT)
-       { __preempt_spin_lock, 0 },
-       { __preempt_write_lock, 0 },
-#endif
-       /* kernel/timer.c */
-       { schedule_timeout, 1 },
-/*     { nanosleep_restart, 1 }, */
-       /* lib/rwsem-spinlock.c */
-       { __down_read, 1 },
-       { __down_write, 1 },
-};
+} *schedule_frame, mfinfo[64];
+static int mfinfo_num;
 
-static int mips_frame_info_initialized;
 static int __init get_frame_info(struct mips_frame_info *info)
 {
        int i;
        void *func = info->func;
        union mips_instruction *ip = (union mips_instruction *)func;
        info->pc_offset = -1;
-       info->frame_offset = info->omit_fp ? 0 : -1;
+       info->frame_size = 0;
        for (i = 0; i < 128; i++, ip++) {
                /* if jal, jalr, jr, stop. */
                if (ip->j_format.opcode == jal_op ||
@@ -320,6 +294,23 @@ static int __init get_frame_info(struct mips_frame_info *info)
                      ip->r_format.func == jr_op)))
                        break;
 
+               if (info->func_size && i >= info->func_size / 4)
+                       break;
+               if (
+#ifdef CONFIG_32BIT
+                   ip->i_format.opcode == addiu_op &&
+#endif
+#ifdef CONFIG_64BIT
+                   ip->i_format.opcode == daddiu_op &&
+#endif
+                   ip->i_format.rs == 29 &&
+                   ip->i_format.rt == 29) {
+                       /* addiu/daddiu sp,sp,-imm */
+                       if (info->frame_size)
+                               continue;
+                       info->frame_size = - ip->i_format.simmediate;
+               }
+
                if (
 #ifdef CONFIG_32BIT
                    ip->i_format.opcode == sw_op &&
@@ -327,31 +318,20 @@ static int __init get_frame_info(struct mips_frame_info *info)
 #ifdef CONFIG_64BIT
                    ip->i_format.opcode == sd_op &&
 #endif
-                   ip->i_format.rs == 29)
-               {
+                   ip->i_format.rs == 29 &&
+                   ip->i_format.rt == 31) {
                        /* sw / sd $ra, offset($sp) */
-                       if (ip->i_format.rt == 31) {
-                               if (info->pc_offset != -1)
-                                       continue;
-                               info->pc_offset =
-                                       ip->i_format.simmediate / sizeof(long);
-                       }
-                       /* sw / sd $s8, offset($sp) */
-                       if (ip->i_format.rt == 30) {
-//#if 0        /* gcc 3.4 does aggressive optimization... */
-                               if (info->frame_offset != -1)
-                                       continue;
-//#endif
-                               info->frame_offset =
-                                       ip->i_format.simmediate / sizeof(long);
-                       }
+                       if (info->pc_offset != -1)
+                               continue;
+                       info->pc_offset =
+                               ip->i_format.simmediate / sizeof(long);
                }
        }
-       if (info->pc_offset == -1 || info->frame_offset == -1) {
-               printk("Can't analyze prologue code at %p\n", func);
+       if (info->pc_offset == -1 || info->frame_size == 0) {
+               if (func == schedule)
+                       printk("Can't analyze prologue code at %p\n", func);
                info->pc_offset = -1;
-               info->frame_offset = -1;
-               return -1;
+               info->frame_size = 0;
        }
 
        return 0;
@@ -359,25 +339,36 @@ static int __init get_frame_info(struct mips_frame_info *info)
 
 static int __init frame_info_init(void)
 {
-       int i, found;
-       for (i = 0; i < ARRAY_SIZE(mfinfo); i++)
-               if (get_frame_info(&mfinfo[i]))
-                       return -1;
-       schedule_frame = mfinfo[0];
-       /* bubble sort */
-       do {
-               struct mips_frame_info tmp;
-               found = 0;
-               for (i = 1; i < ARRAY_SIZE(mfinfo); i++) {
-                       if (mfinfo[i-1].func > mfinfo[i].func) {
-                               tmp = mfinfo[i];
-                               mfinfo[i] = mfinfo[i-1];
-                               mfinfo[i-1] = tmp;
-                               found = 1;
-                       }
-               }
-       } while (found);
-       mips_frame_info_initialized = 1;
+       int i;
+#ifdef CONFIG_KALLSYMS
+       char *modname;
+       char namebuf[KSYM_NAME_LEN + 1];
+       unsigned long start, size, ofs;
+       extern char __sched_text_start[], __sched_text_end[];
+       extern char __lock_text_start[], __lock_text_end[];
+
+       start = (unsigned long)__sched_text_start;
+       for (i = 0; i < ARRAY_SIZE(mfinfo); i++) {
+               if (start == (unsigned long)schedule)
+                       schedule_frame = &mfinfo[i];
+               if (!kallsyms_lookup(start, &size, &ofs, &modname, namebuf))
+                       break;
+               mfinfo[i].func = (void *)(start + ofs);
+               mfinfo[i].func_size = size;
+               start += size - ofs;
+               if (start >= (unsigned long)__lock_text_end)
+                       break;
+               if (start == (unsigned long)__sched_text_end)
+                       start = (unsigned long)__lock_text_start;
+       }
+#else
+       mfinfo[0].func = schedule;
+       schedule_frame = &mfinfo[0];
+#endif
+       for (i = 0; i < ARRAY_SIZE(mfinfo) && mfinfo[i].func; i++)
+               get_frame_info(&mfinfo[i]);
+
+       mfinfo_num = i;
        return 0;
 }
 
@@ -394,47 +385,52 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
        if (t->reg31 == (unsigned long) ret_from_fork)
                return t->reg31;
 
-       if (schedule_frame.pc_offset < 0)
+       if (!schedule_frame || schedule_frame->pc_offset < 0)
                return 0;
-       return ((unsigned long *)t->reg29)[schedule_frame.pc_offset];
+       return ((unsigned long *)t->reg29)[schedule_frame->pc_offset];
 }
 
 /* get_wchan - a maintenance nightmare^W^Wpain in the ass ...  */
 unsigned long get_wchan(struct task_struct *p)
 {
        unsigned long stack_page;
-       unsigned long frame, pc;
+       unsigned long pc;
+#ifdef CONFIG_KALLSYMS
+       unsigned long frame;
+#endif
 
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;
 
        stack_page = (unsigned long)task_stack_page(p);
-       if (!stack_page || !mips_frame_info_initialized)
+       if (!stack_page || !mfinfo_num)
                return 0;
 
        pc = thread_saved_pc(p);
+#ifdef CONFIG_KALLSYMS
        if (!in_sched_functions(pc))
                return pc;
 
-       frame = ((unsigned long *)p->thread.reg30)[schedule_frame.frame_offset];
+       frame = p->thread.reg29 + schedule_frame->frame_size;
        do {
                int i;
 
                if (frame < stack_page || frame > stack_page + THREAD_SIZE - 32)
                        return 0;
 
-               for (i = ARRAY_SIZE(mfinfo) - 1; i >= 0; i--) {
+               for (i = mfinfo_num - 1; i >= 0; i--) {
                        if (pc >= (unsigned long) mfinfo[i].func)
                                break;
                }
                if (i < 0)
                        break;
 
-               if (mfinfo[i].omit_fp)
-                       break;
                pc = ((unsigned long *)frame)[mfinfo[i].pc_offset];
-               frame = ((unsigned long *)frame)[mfinfo[i].frame_offset];
+               if (!mfinfo[i].frame_size)
+                       break;
+               frame += mfinfo[i].frame_size;
        } while (in_sched_functions(pc));
+#endif
 
        return pc;
 }
index 0fbc492d24b4a50f97bf2249e2e0905f171ab4e3..36bfc2588aa351cb1776edfe14a9663f11f972ba 100644 (file)
@@ -176,7 +176,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
        if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
                sp = current->sas_ss_sp + current->sas_ss_size;
 
-       return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK));
+       return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? ~(cpu_icache_line_size()-1) : ALMASK));
 }
 
 static inline int install_sigtramp(unsigned int __user *tramp,
index da3271e1fdac096e9cab303cddd6ece3d9f50f5f..8a8b8dd90417a242f49e295a01db11672655652f 100644 (file)
@@ -537,7 +537,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
        /* The ucontext contains a stack32_t, so we must convert!  */
        if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
                goto badframe;
-       st.ss_size = (long) sp;
+       st.ss_sp = (void *)(long) sp;
        if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
                goto badframe;
        if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
index 384fc4a639a49653d785c4fd817fff429569b2bb..5a3776096f074f794ffe2647c7e4d0ac9bd3f38e 100644 (file)
@@ -108,7 +108,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
        /* The ucontext contains a stack32_t, so we must convert!  */
        if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
                goto badframe;
-       st.ss_size = (long) sp;
+       st.ss_sp = (void *)(long) sp;
        if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
                goto badframe;
        if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
index 794a1c3de2a493b62ac2f60f38c3665d30763489..c930364830d0661defb72b56f6729e7c6af17179 100644 (file)
@@ -68,6 +68,8 @@ void __init sanitize_tlb_entries(void)
 
        set_c0_mvpcontrol(MVPCONTROL_VPC);
 
+       back_to_back_c0_hazard();
+
        /* Disable TLB sharing */
        clear_c0_mvpcontrol(MVPCONTROL_STLB);
 
@@ -102,35 +104,6 @@ void __init sanitize_tlb_entries(void)
        clear_c0_mvpcontrol(MVPCONTROL_VPC);
 }
 
-#if 0
-/*
- * Use c0_MVPConf0 to find out how many CPUs are available, setting up
- * phys_cpu_present_map and the logical/physical mappings.
- */
-void __init prom_build_cpu_map(void)
-{
-       int i, num, ncpus;
-
-       cpus_clear(phys_cpu_present_map);
-
-       /* assume we boot on cpu 0.... */
-       cpu_set(0, phys_cpu_present_map);
-       __cpu_number_map[0] = 0;
-       __cpu_logical_map[0] = 0;
-
-       if (cpu_has_mipsmt) {
-               ncpus = ((read_c0_mvpconf0() & (MVPCONF0_PVPE)) >> MVPCONF0_PVPE_SHIFT) + 1;
-               for (i=1, num=0; i< NR_CPUS && i<ncpus; i++) {
-                       cpu_set(i, phys_cpu_present_map);
-                       __cpu_number_map[i] = ++num;
-                       __cpu_logical_map[num] = i;
-               }
-
-               printk(KERN_INFO "%i available secondary CPU(s)\n", num);
-       }
-}
-#endif
-
 static void ipi_resched_dispatch (struct pt_regs *regs)
 {
        do_IRQ(MIPS_CPU_IPI_RESCHED_IRQ, regs);
@@ -222,6 +195,9 @@ void prom_prepare_cpus(unsigned int max_cpus)
 
                                /* set config to be the same as vpe0, particularly kseg0 coherency alg */
                                write_vpe_c0_config( read_c0_config());
+
+                               /* Propagate Config7 */
+                               write_vpe_c0_config7(read_c0_config7());
                        }
 
                }
index e51c38cef88e82465493e425c8d5dc9c7d57cbdb..1b71d91e82689f9f0effd43b5bbafdff5c96a565 100644 (file)
@@ -471,61 +471,29 @@ struct flush_icache_range_args {
 static inline void local_r4k_flush_icache_range(void *args)
 {
        struct flush_icache_range_args *fir_args = args;
-       unsigned long dc_lsize = cpu_dcache_line_size();
-       unsigned long ic_lsize = cpu_icache_line_size();
-       unsigned long sc_lsize = cpu_scache_line_size();
        unsigned long start = fir_args->start;
        unsigned long end = fir_args->end;
-       unsigned long addr, aend;
 
        if (!cpu_has_ic_fills_f_dc) {
                if (end - start > dcache_size) {
                        r4k_blast_dcache();
                } else {
                        R4600_HIT_CACHEOP_WAR_IMPL;
-                       addr = start & ~(dc_lsize - 1);
-                       aend = (end - 1) & ~(dc_lsize - 1);
-
-                       while (1) {
-                               /* Hit_Writeback_Inv_D */
-                               protected_writeback_dcache_line(addr);
-                               if (addr == aend)
-                                       break;
-                               addr += dc_lsize;
-                       }
+                       protected_blast_dcache_range(start, end);
                }
 
                if (!cpu_icache_snoops_remote_store) {
-                       if (end - start > scache_size) {
+                       if (end - start > scache_size)
                                r4k_blast_scache();
-                       } else {
-                               addr = start & ~(sc_lsize - 1);
-                               aend = (end - 1) & ~(sc_lsize - 1);
-
-                               while (1) {
-                                       /* Hit_Writeback_Inv_SD */
-                                       protected_writeback_scache_line(addr);
-                                       if (addr == aend)
-                                               break;
-                                       addr += sc_lsize;
-                               }
-                       }
+                       else
+                               protected_blast_scache_range(start, end);
                }
        }
 
        if (end - start > icache_size)
                r4k_blast_icache();
-       else {
-               addr = start & ~(ic_lsize - 1);
-               aend = (end - 1) & ~(ic_lsize - 1);
-               while (1) {
-                       /* Hit_Invalidate_I */
-                       protected_flush_icache_line(addr);
-                       if (addr == aend)
-                               break;
-                       addr += ic_lsize;
-               }
-       }
+       else
+               protected_blast_icache_range(start, end);
 }
 
 static void r4k_flush_icache_range(unsigned long start, unsigned long end)
@@ -619,27 +587,14 @@ static void r4k_flush_icache_page(struct vm_area_struct *vma,
 
 static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
 {
-       unsigned long end, a;
-
        /* Catch bad driver code */
        BUG_ON(size == 0);
 
        if (cpu_has_subset_pcaches) {
-               unsigned long sc_lsize = cpu_scache_line_size();
-
-               if (size >= scache_size) {
+               if (size >= scache_size)
                        r4k_blast_scache();
-                       return;
-               }
-
-               a = addr & ~(sc_lsize - 1);
-               end = (addr + size - 1) & ~(sc_lsize - 1);
-               while (1) {
-                       flush_scache_line(a);   /* Hit_Writeback_Inv_SD */
-                       if (a == end)
-                               break;
-                       a += sc_lsize;
-               }
+               else
+                       blast_scache_range(addr, addr + size);
                return;
        }
 
@@ -651,17 +606,8 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
        if (size >= dcache_size) {
                r4k_blast_dcache();
        } else {
-               unsigned long dc_lsize = cpu_dcache_line_size();
-
                R4600_HIT_CACHEOP_WAR_IMPL;
-               a = addr & ~(dc_lsize - 1);
-               end = (addr + size - 1) & ~(dc_lsize - 1);
-               while (1) {
-                       flush_dcache_line(a);   /* Hit_Writeback_Inv_D */
-                       if (a == end)
-                               break;
-                       a += dc_lsize;
-               }
+               blast_dcache_range(addr, addr + size);
        }
 
        bc_wback_inv(addr, size);
@@ -669,44 +615,22 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
 
 static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
 {
-       unsigned long end, a;
-
        /* Catch bad driver code */
        BUG_ON(size == 0);
 
        if (cpu_has_subset_pcaches) {
-               unsigned long sc_lsize = cpu_scache_line_size();
-
-               if (size >= scache_size) {
+               if (size >= scache_size)
                        r4k_blast_scache();
-                       return;
-               }
-
-               a = addr & ~(sc_lsize - 1);
-               end = (addr + size - 1) & ~(sc_lsize - 1);
-               while (1) {
-                       flush_scache_line(a);   /* Hit_Writeback_Inv_SD */
-                       if (a == end)
-                               break;
-                       a += sc_lsize;
-               }
+               else
+                       blast_scache_range(addr, addr + size);
                return;
        }
 
        if (size >= dcache_size) {
                r4k_blast_dcache();
        } else {
-               unsigned long dc_lsize = cpu_dcache_line_size();
-
                R4600_HIT_CACHEOP_WAR_IMPL;
-               a = addr & ~(dc_lsize - 1);
-               end = (addr + size - 1) & ~(dc_lsize - 1);
-               while (1) {
-                       flush_dcache_line(a);   /* Hit_Writeback_Inv_D */
-                       if (a == end)
-                               break;
-                       a += dc_lsize;
-               }
+               blast_dcache_range(addr, addr + size);
        }
 
        bc_inv(addr, size);
index 0a97a9434ebacf0f45ded71f676f280a2cf58694..7c572bea4a986b8e95d46d37262b933cd16c38c4 100644 (file)
@@ -44,8 +44,6 @@ __asm__ __volatile__( \
 /* TX39H-style cache flush routines. */
 static void tx39h_flush_icache_all(void)
 {
-       unsigned long start = KSEG0;
-       unsigned long end = (start + icache_size);
        unsigned long flags, config;
 
        /* disable icache (set ICE#) */
@@ -53,33 +51,18 @@ static void tx39h_flush_icache_all(void)
        config = read_c0_conf();
        write_c0_conf(config & ~TX39_CONF_ICE);
        TX39_STOP_STREAMING();
-
-       /* invalidate icache */
-       while (start < end) {
-               cache16_unroll32(start, Index_Invalidate_I);
-               start += 0x200;
-       }
-
+       blast_icache16();
        write_c0_conf(config);
        local_irq_restore(flags);
 }
 
 static void tx39h_dma_cache_wback_inv(unsigned long addr, unsigned long size)
 {
-       unsigned long end, a;
-       unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-
        /* Catch bad driver code */
        BUG_ON(size == 0);
 
        iob();
-       a = addr & ~(dc_lsize - 1);
-       end = (addr + size - 1) & ~(dc_lsize - 1);
-       while (1) {
-               invalidate_dcache_line(a); /* Hit_Invalidate_D */
-               if (a == end) break;
-               a += dc_lsize;
-       }
+       blast_inv_dcache_range(addr, addr + size);
 }
 
 
@@ -241,42 +224,21 @@ static void tx39_flush_data_cache_page(unsigned long addr)
 
 static void tx39_flush_icache_range(unsigned long start, unsigned long end)
 {
-       unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-       unsigned long addr, aend;
-
        if (end - start > dcache_size)
                tx39_blast_dcache();
-       else {
-               addr = start & ~(dc_lsize - 1);
-               aend = (end - 1) & ~(dc_lsize - 1);
-
-               while (1) {
-                       /* Hit_Writeback_Inv_D */
-                       protected_writeback_dcache_line(addr);
-                       if (addr == aend)
-                               break;
-                       addr += dc_lsize;
-               }
-       }
+       else
+               protected_blast_dcache_range(start, end);
 
        if (end - start > icache_size)
                tx39_blast_icache();
        else {
                unsigned long flags, config;
-               addr = start & ~(dc_lsize - 1);
-               aend = (end - 1) & ~(dc_lsize - 1);
                /* disable icache (set ICE#) */
                local_irq_save(flags);
                config = read_c0_conf();
                write_c0_conf(config & ~TX39_CONF_ICE);
                TX39_STOP_STREAMING();
-               while (1) {
-                       /* Hit_Invalidate_I */
-                       protected_flush_icache_line(addr);
-                       if (addr == aend)
-                               break;
-                       addr += dc_lsize;
-               }
+               protected_blast_icache_range(start, end);
                write_c0_conf(config);
                local_irq_restore(flags);
        }
@@ -311,7 +273,7 @@ static void tx39_flush_icache_page(struct vm_area_struct *vma, struct page *page
 
 static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size)
 {
-       unsigned long end, a;
+       unsigned long end;
 
        if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
                end = addr + size;
@@ -322,20 +284,13 @@ static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size)
        } else if (size > dcache_size) {
                tx39_blast_dcache();
        } else {
-               unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-               a = addr & ~(dc_lsize - 1);
-               end = (addr + size - 1) & ~(dc_lsize - 1);
-               while (1) {
-                       flush_dcache_line(a); /* Hit_Writeback_Inv_D */
-                       if (a == end) break;
-                       a += dc_lsize;
-               }
+               blast_dcache_range(addr, addr + size);
        }
 }
 
 static void tx39_dma_cache_inv(unsigned long addr, unsigned long size)
 {
-       unsigned long end, a;
+       unsigned long end;
 
        if (((size | addr) & (PAGE_SIZE - 1)) == 0) {
                end = addr + size;
@@ -346,14 +301,7 @@ static void tx39_dma_cache_inv(unsigned long addr, unsigned long size)
        } else if (size > dcache_size) {
                tx39_blast_dcache();
        } else {
-               unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-               a = addr & ~(dc_lsize - 1);
-               end = (addr + size - 1) & ~(dc_lsize - 1);
-               while (1) {
-                       invalidate_dcache_line(a); /* Hit_Invalidate_D */
-                       if (a == end) break;
-                       a += dc_lsize;
-               }
+               blast_inv_dcache_range(addr, addr + size);
        }
 }
 
index 7c914a4c67c3e928b20f44a1acc6ffa90e05a95d..eca33cfa8a4c5dab12d927acf389b703a4f87528 100644 (file)
@@ -29,6 +29,11 @@ config GENERIC_CALIBRATE_DELAY
        bool
        default y
 
+config TIME_LOW_RES
+       bool
+       depends on SMP
+       default y
+
 config GENERIC_ISA_DMA
        bool
 
index e96c35bddac778030a7de4c184e4d781248a0fe4..71f0a2fb30786674b601391b3d4ffca1d604256b 100644 (file)
@@ -30,7 +30,7 @@ void __delay(unsigned long loops)
          */
         __asm__ __volatile__(
                 "0: brct %0,0b"
-                : /* no outputs */ : "r" (loops/2) );
+                : /* no outputs */ : "r" ((loops/2) + 1));
 }
 
 /*
index 04494638b96387203fefc91aebab3be1045bf681..e7fc3e500342edc9384b458e8b7d89e156a194d1 100644 (file)
@@ -28,6 +28,10 @@ config GENERIC_IRQ_PROBE
        bool
        default y
 
+config TIME_LOW_RES
+       bool
+       default y
+
 # Turn off some random 386 crap that can affect device config
 config ISA
        bool
index 4e7dbcc425ff69d7f1f3c851e47d7ed5c60351b6..93e44d0292ab7aa56c04c4552ef2607bb6add19b 100644 (file)
@@ -645,7 +645,7 @@ static void pkt_copy_bio_data(struct bio *src_bio, int seg, int offs, struct pag
  * b) The data can be used as cache to avoid read requests if we receive a
  *    new write request for the same zone.
  */
-static void pkt_make_local_copy(struct packet_data *pkt, struct page **pages, int *offsets)
+static void pkt_make_local_copy(struct packet_data *pkt, struct bio_vec *bvec)
 {
        int f, p, offs;
 
@@ -653,15 +653,15 @@ static void pkt_make_local_copy(struct packet_data *pkt, struct page **pages, in
        p = 0;
        offs = 0;
        for (f = 0; f < pkt->frames; f++) {
-               if (pages[f] != pkt->pages[p]) {
-                       void *vfrom = kmap_atomic(pages[f], KM_USER0) + offsets[f];
+               if (bvec[f].bv_page != pkt->pages[p]) {
+                       void *vfrom = kmap_atomic(bvec[f].bv_page, KM_USER0) + bvec[f].bv_offset;
                        void *vto = page_address(pkt->pages[p]) + offs;
                        memcpy(vto, vfrom, CD_FRAMESIZE);
                        kunmap_atomic(vfrom, KM_USER0);
-                       pages[f] = pkt->pages[p];
-                       offsets[f] = offs;
+                       bvec[f].bv_page = pkt->pages[p];
+                       bvec[f].bv_offset = offs;
                } else {
-                       BUG_ON(offsets[f] != offs);
+                       BUG_ON(bvec[f].bv_offset != offs);
                }
                offs += CD_FRAMESIZE;
                if (offs >= PAGE_SIZE) {
@@ -991,18 +991,17 @@ try_next_bio:
 static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
 {
        struct bio *bio;
-       struct page *pages[PACKET_MAX_SIZE];
-       int offsets[PACKET_MAX_SIZE];
        int f;
        int frames_write;
+       struct bio_vec *bvec = pkt->w_bio->bi_io_vec;
 
        for (f = 0; f < pkt->frames; f++) {
-               pages[f] = pkt->pages[(f * CD_FRAMESIZE) / PAGE_SIZE];
-               offsets[f] = (f * CD_FRAMESIZE) % PAGE_SIZE;
+               bvec[f].bv_page = pkt->pages[(f * CD_FRAMESIZE) / PAGE_SIZE];
+               bvec[f].bv_offset = (f * CD_FRAMESIZE) % PAGE_SIZE;
        }
 
        /*
-        * Fill-in pages[] and offsets[] with data from orig_bios.
+        * Fill-in bvec with data from orig_bios.
         */
        frames_write = 0;
        spin_lock(&pkt->lock);
@@ -1024,11 +1023,11 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
                        }
 
                        if (src_bvl->bv_len - src_offs >= CD_FRAMESIZE) {
-                               pages[f] = src_bvl->bv_page;
-                               offsets[f] = src_bvl->bv_offset + src_offs;
+                               bvec[f].bv_page = src_bvl->bv_page;
+                               bvec[f].bv_offset = src_bvl->bv_offset + src_offs;
                        } else {
                                pkt_copy_bio_data(bio, segment, src_offs,
-                                                 pages[f], offsets[f]);
+                                                 bvec[f].bv_page, bvec[f].bv_offset);
                        }
                        src_offs += CD_FRAMESIZE;
                        frames_write++;
@@ -1042,7 +1041,7 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
        BUG_ON(frames_write != pkt->write_size);
 
        if (test_bit(PACKET_MERGE_SEGS, &pd->flags) || (pkt->write_size < pkt->frames)) {
-               pkt_make_local_copy(pkt, pages, offsets);
+               pkt_make_local_copy(pkt, bvec);
                pkt->cache_valid = 1;
        } else {
                pkt->cache_valid = 0;
@@ -1055,17 +1054,9 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
        pkt->w_bio->bi_bdev = pd->bdev;
        pkt->w_bio->bi_end_io = pkt_end_io_packet_write;
        pkt->w_bio->bi_private = pkt;
-       for (f = 0; f < pkt->frames; f++) {
-               if ((f + 1 < pkt->frames) && (pages[f + 1] == pages[f]) &&
-                   (offsets[f + 1] = offsets[f] + CD_FRAMESIZE)) {
-                       if (!bio_add_page(pkt->w_bio, pages[f], CD_FRAMESIZE * 2, offsets[f]))
-                               BUG();
-                       f++;
-               } else {
-                       if (!bio_add_page(pkt->w_bio, pages[f], CD_FRAMESIZE, offsets[f]))
-                               BUG();
-               }
-       }
+       for (f = 0; f < pkt->frames; f++)
+               if (!bio_add_page(pkt->w_bio, bvec[f].bv_page, CD_FRAMESIZE, bvec[f].bv_offset))
+                       BUG();
        VPRINTK("pktcdvd: vcnt=%d\n", pkt->w_bio->bi_vcnt);
 
        atomic_set(&pkt->io_wait, 1);
@@ -1548,7 +1539,7 @@ static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di)
                case 0x12: /* DVD-RAM */
                        return 0;
                default:
-                       printk("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile);
+                       VPRINTK("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile);
                        return 1;
        }
 
@@ -1894,8 +1885,8 @@ static int pkt_open_write(struct pktcdvd_device *pd)
        unsigned int write_speed, media_write_speed, read_speed;
 
        if ((ret = pkt_probe_settings(pd))) {
-               DPRINTK("pktcdvd: %s failed probe\n", pd->name);
-               return -EIO;
+               VPRINTK("pktcdvd: %s failed probe\n", pd->name);
+               return -EROFS;
        }
 
        if ((ret = pkt_set_write_settings(pd))) {
@@ -2053,10 +2044,9 @@ static int pkt_open(struct inode *inode, struct file *file)
                        goto out_dec;
                }
        } else {
-               if (pkt_open_dev(pd, file->f_mode & FMODE_WRITE)) {
-                       ret = -EIO;
+               ret = pkt_open_dev(pd, file->f_mode & FMODE_WRITE);
+               if (ret)
                        goto out_dec;
-               }
                /*
                 * needed here as well, since ext2 (among others) may change
                 * the blocksize at mount time
@@ -2436,11 +2426,12 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
                 * The door gets locked when the device is opened, so we
                 * have to unlock it or else the eject command fails.
                 */
-               pkt_lock_door(pd, 0);
+               if (pd->refcnt == 1)
+                       pkt_lock_door(pd, 0);
                return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg);
 
        default:
-               printk("pktcdvd: Unknown ioctl for %s (%x)\n", pd->name, cmd);
+               VPRINTK("pktcdvd: Unknown ioctl for %s (%x)\n", pd->name, cmd);
                return -ENOTTY;
        }
 
index 57539d8f9f7c861770c21843fbe38b1b7097151f..09dc4b01232c018e95733b303a86ee8c2f9ed1ba 100644 (file)
@@ -150,17 +150,6 @@ static void rs_wait_until_sent(struct tty_struct *, int);
 /* Standard COM flags (except for COM4, because of the 8514 problem) */
 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
 
-/*
- * tmp_buf is used as a temporary buffer by serial_write.  We need to
- * lock it in case the memcpy_fromfs blocks while swapping in a page,
- * and some other program tries to do a serial write at the same time.
- * Since the lock will only come under contention when the system is
- * swapping and available memory is low, it makes sense to share one
- * buffer across all the serial ports, since it significantly saves
- * memory if large numbers of serial ports are open.
- */
-static unsigned char *tmp_buf;
-
 static inline int serial_paranoia_check(struct esp_struct *info,
                                        char *name, const char *routine)
 {
@@ -1267,7 +1256,7 @@ static int rs_write(struct tty_struct * tty,
        if (serial_paranoia_check(info, tty->name, "rs_write"))
                return 0;
 
-       if (!tty || !info->xmit_buf || !tmp_buf)
+       if (!tty || !info->xmit_buf)
                return 0;
            
        while (1) {
@@ -2291,11 +2280,7 @@ static int esp_open(struct tty_struct *tty, struct file * filp)
        tty->driver_data = info;
        info->tty = tty;
 
-       if (!tmp_buf) {
-               tmp_buf = (unsigned char *) get_zeroed_page(GFP_KERNEL);
-               if (!tmp_buf)
-                       return -ENOMEM;
-       }
+       spin_unlock_irqrestore(&info->lock, flags);
        
        /*
         * Start up serial port
@@ -2602,9 +2587,6 @@ static void __exit espserial_exit(void)
                free_pages((unsigned long)dma_buffer,
                        get_order(DMA_BUFFER_SZ));
 
-       if (tmp_buf)
-               free_page((unsigned long)tmp_buf);
-
        while (free_pio_buf) {
                pio_buf = free_pio_buf->next;
                kfree(free_pio_buf);
index 66a2fee06eb9151607ac97fb617962f8563b0e8c..ef140ebde117339ab7c99120df2837f9499aadf7 100644 (file)
@@ -956,22 +956,18 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
                }
        } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) {
                struct acpi_resource_extended_irq *irqp;
-               int i;
+               int i, irq;
 
                irqp = &res->data.extended_irq;
 
-               if (irqp->interrupt_count > 0) {
-                       hdp->hd_nirqs = irqp->interrupt_count;
-
-                       for (i = 0; i < hdp->hd_nirqs; i++) {
-                               int rc =
-                                   acpi_register_gsi(irqp->interrupts[i],
-                                                     irqp->triggering,
-                                                     irqp->polarity);
-                               if (rc < 0)
-                                       return AE_ERROR;
-                               hdp->hd_irq[i] = rc;
-                       }
+               for (i = 0; i < irqp->interrupt_count; i++) {
+                       irq = acpi_register_gsi(irqp->interrupts[i],
+                                     irqp->triggering, irqp->polarity);
+                       if (irq < 0)
+                               return AE_ERROR;
+
+                       hdp->hd_irq[hdp->hd_nirqs] = irq;
+                       hdp->hd_nirqs++;
                }
        }
 
index a23816d3e9a1684794c8e5a8f1cc0cce26fb61d8..e9bba94fc898388ff09bd8a9e2116442e07ca104 100644 (file)
@@ -1841,7 +1841,6 @@ static void release_dev(struct file * filp)
                tty_closing = tty->count <= 1;
                o_tty_closing = o_tty &&
                        (o_tty->count <= (pty_master ? 1 : 0));
-               up(&tty_sem);
                do_sleep = 0;
 
                if (tty_closing) {
@@ -1869,6 +1868,7 @@ static void release_dev(struct file * filp)
 
                printk(KERN_WARNING "release_dev: %s: read/write wait queue "
                                    "active!\n", tty_name(tty, buf));
+               up(&tty_sem);
                schedule();
        }       
 
@@ -1877,8 +1877,6 @@ static void release_dev(struct file * filp)
         * both sides, and we've completed the last operation that could 
         * block, so it's safe to proceed with closing.
         */
-        
-       down(&tty_sem);
        if (pty_master) {
                if (--o_tty->count < 0) {
                        printk(KERN_WARNING "release_dev: bad pty slave count "
@@ -1892,7 +1890,6 @@ static void release_dev(struct file * filp)
                       tty->count, tty_name(tty, buf));
                tty->count = 0;
        }
-       up(&tty_sem);
        
        /*
         * We've decremented tty->count, so we need to remove this file
@@ -1937,6 +1934,8 @@ static void release_dev(struct file * filp)
                read_unlock(&tasklist_lock);
        }
 
+       up(&tty_sem);
+
        /* check whether both sides are closing ... */
        if (!tty_closing || (o_tty && !o_tty_closing))
                return;
index 2b286e8651632fcd1f4af7dead2fc67d7a5eefcf..43b96e298363ac9d441235206c33020ab133269a 100644 (file)
  * License along with this program; if not, write the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  *
- * Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
  * For further information regarding this notice, see:
  *
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan
index d393b504bf26b23ffafc069e92a07bf485ffd3f4..c82f47a66e48f8ee4d1f48bb80c9eec220bc37c8 100644 (file)
@@ -665,7 +665,15 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
        struct ib_wc mad_wc;
        struct ib_send_wr *send_wr = &mad_send_wr->send_wr;
 
-       if (!smi_handle_dr_smp_send(smp, device->node_type, port_num)) {
+       /*
+        * Directed route handling starts if the initial LID routed part of
+        * a request or the ending LID routed part of a response is empty.
+        * If we are at the start of the LID routed part, don't update the
+        * hop_ptr or hop_cnt.  See section 14.2.2, Vol 1 IB spec.
+        */
+       if ((ib_get_smp_direction(smp) ? smp->dr_dlid : smp->dr_slid) ==
+            IB_LID_PERMISSIVE &&
+           !smi_handle_dr_smp_send(smp, device->node_type, port_num)) {
                ret = -EINVAL;
                printk(KERN_ERR PFX "Invalid directed route\n");
                goto out;
index f9b9b93dc5016b9fcaa28ff1b7b9e33da28060c9..2825615ce81c3cd440247a500eedc7111e36871a 100644 (file)
@@ -1029,25 +1029,6 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
        MTHCA_GET(size, outbox, QUERY_DEV_LIM_UAR_ENTRY_SZ_OFFSET);
        dev_lim->uar_scratch_entry_sz = size;
 
-       mthca_dbg(dev, "Max QPs: %d, reserved QPs: %d, entry size: %d\n",
-                 dev_lim->max_qps, dev_lim->reserved_qps, dev_lim->qpc_entry_sz);
-       mthca_dbg(dev, "Max SRQs: %d, reserved SRQs: %d, entry size: %d\n",
-                 dev_lim->max_srqs, dev_lim->reserved_srqs, dev_lim->srq_entry_sz);
-       mthca_dbg(dev, "Max CQs: %d, reserved CQs: %d, entry size: %d\n",
-                 dev_lim->max_cqs, dev_lim->reserved_cqs, dev_lim->cqc_entry_sz);
-       mthca_dbg(dev, "Max EQs: %d, reserved EQs: %d, entry size: %d\n",
-                 dev_lim->max_eqs, dev_lim->reserved_eqs, dev_lim->eqc_entry_sz);
-       mthca_dbg(dev, "reserved MPTs: %d, reserved MTTs: %d\n",
-                 dev_lim->reserved_mrws, dev_lim->reserved_mtts);
-       mthca_dbg(dev, "Max PDs: %d, reserved PDs: %d, reserved UARs: %d\n",
-                 dev_lim->max_pds, dev_lim->reserved_pds, dev_lim->reserved_uars);
-       mthca_dbg(dev, "Max QP/MCG: %d, reserved MGMs: %d\n",
-                 dev_lim->max_pds, dev_lim->reserved_mgms);
-       mthca_dbg(dev, "Max CQEs: %d, max WQEs: %d, max SRQ WQEs: %d\n",
-                 dev_lim->max_cq_sz, dev_lim->max_qp_sz, dev_lim->max_srq_sz);
-
-       mthca_dbg(dev, "Flags: %08x\n", dev_lim->flags);
-
        if (mthca_is_memfree(dev)) {
                MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SRQ_SZ_OFFSET);
                dev_lim->max_srq_sz = 1 << field;
@@ -1093,6 +1074,25 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
                dev_lim->mpt_entry_sz = MTHCA_MPT_ENTRY_SIZE;
        }
 
+       mthca_dbg(dev, "Max QPs: %d, reserved QPs: %d, entry size: %d\n",
+                 dev_lim->max_qps, dev_lim->reserved_qps, dev_lim->qpc_entry_sz);
+       mthca_dbg(dev, "Max SRQs: %d, reserved SRQs: %d, entry size: %d\n",
+                 dev_lim->max_srqs, dev_lim->reserved_srqs, dev_lim->srq_entry_sz);
+       mthca_dbg(dev, "Max CQs: %d, reserved CQs: %d, entry size: %d\n",
+                 dev_lim->max_cqs, dev_lim->reserved_cqs, dev_lim->cqc_entry_sz);
+       mthca_dbg(dev, "Max EQs: %d, reserved EQs: %d, entry size: %d\n",
+                 dev_lim->max_eqs, dev_lim->reserved_eqs, dev_lim->eqc_entry_sz);
+       mthca_dbg(dev, "reserved MPTs: %d, reserved MTTs: %d\n",
+                 dev_lim->reserved_mrws, dev_lim->reserved_mtts);
+       mthca_dbg(dev, "Max PDs: %d, reserved PDs: %d, reserved UARs: %d\n",
+                 dev_lim->max_pds, dev_lim->reserved_pds, dev_lim->reserved_uars);
+       mthca_dbg(dev, "Max QP/MCG: %d, reserved MGMs: %d\n",
+                 dev_lim->max_pds, dev_lim->reserved_mgms);
+       mthca_dbg(dev, "Max CQEs: %d, max WQEs: %d, max SRQ WQEs: %d\n",
+                 dev_lim->max_cq_sz, dev_lim->max_qp_sz, dev_lim->max_srq_sz);
+
+       mthca_dbg(dev, "Flags: %08x\n", dev_lim->flags);
+
 out:
        mthca_free_mailbox(dev, mailbox);
        return err;
index 2a165fd06e57085a569f5787a0788f5401e5b237..e481037288d61cbb642890754f999a965f9db5be 100644 (file)
@@ -53,8 +53,8 @@
 
 #define DRV_NAME       "ib_mthca"
 #define PFX            DRV_NAME ": "
-#define DRV_VERSION    "0.06"
-#define DRV_RELDATE    "June 23, 2005"
+#define DRV_VERSION    "0.07"
+#define DRV_RELDATE    "February 13, 2006"
 
 enum {
        MTHCA_FLAG_DDR_HIDDEN = 1 << 1,
index e0a5412b7e68042f820a0c6c32261eba3f39d23c..2f85a9a831b1a6b5787b58326270cd7f45c3e570 100644 (file)
@@ -78,6 +78,7 @@ enum {
        IPOIB_FLAG_SUBINTERFACE   = 4,
        IPOIB_MCAST_RUN           = 5,
        IPOIB_STOP_REAPER         = 6,
+       IPOIB_MCAST_STARTED       = 7,
 
        IPOIB_MAX_BACKOFF_SECONDS = 16,
 
index ccaa0c387076e8b0a36dc90dbb830528b09b93da..a2408d7ec5986cb3e69b3988f9a6c5a35fbf118f 100644 (file)
@@ -533,8 +533,10 @@ void ipoib_mcast_join_task(void *dev_ptr)
        }
 
        if (!priv->broadcast) {
-               priv->broadcast = ipoib_mcast_alloc(dev, 1);
-               if (!priv->broadcast) {
+               struct ipoib_mcast *broadcast;
+
+               broadcast = ipoib_mcast_alloc(dev, 1);
+               if (!broadcast) {
                        ipoib_warn(priv, "failed to allocate broadcast group\n");
                        mutex_lock(&mcast_mutex);
                        if (test_bit(IPOIB_MCAST_RUN, &priv->flags))
@@ -544,10 +546,11 @@ void ipoib_mcast_join_task(void *dev_ptr)
                        return;
                }
 
-               memcpy(priv->broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
+               spin_lock_irq(&priv->lock);
+               memcpy(broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
                       sizeof (union ib_gid));
+               priv->broadcast = broadcast;
 
-               spin_lock_irq(&priv->lock);
                __ipoib_mcast_add(dev, priv->broadcast);
                spin_unlock_irq(&priv->lock);
        }
@@ -601,6 +604,10 @@ int ipoib_mcast_start_thread(struct net_device *dev)
                queue_work(ipoib_workqueue, &priv->mcast_task);
        mutex_unlock(&mcast_mutex);
 
+       spin_lock_irq(&priv->lock);
+       set_bit(IPOIB_MCAST_STARTED, &priv->flags);
+       spin_unlock_irq(&priv->lock);
+
        return 0;
 }
 
@@ -611,6 +618,10 @@ int ipoib_mcast_stop_thread(struct net_device *dev, int flush)
 
        ipoib_dbg_mcast(priv, "stopping multicast thread\n");
 
+       spin_lock_irq(&priv->lock);
+       clear_bit(IPOIB_MCAST_STARTED, &priv->flags);
+       spin_unlock_irq(&priv->lock);
+
        mutex_lock(&mcast_mutex);
        clear_bit(IPOIB_MCAST_RUN, &priv->flags);
        cancel_delayed_work(&priv->mcast_task);
@@ -693,6 +704,14 @@ void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid,
         */
        spin_lock(&priv->lock);
 
+       if (!test_bit(IPOIB_MCAST_STARTED, &priv->flags)        ||
+           !priv->broadcast                                    ||
+           !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) {
+               ++priv->stats.tx_dropped;
+               dev_kfree_skb_any(skb);
+               goto unlock;
+       }
+
        mcast = __ipoib_mcast_find(dev, mgid);
        if (!mcast) {
                /* Let's create a new send only group now */
@@ -754,6 +773,7 @@ out:
                ipoib_send(dev, skb, mcast->ah, IB_MULTICAST_QPN);
        }
 
+unlock:
        spin_unlock(&priv->lock);
 }
 
index f190a99604f0c3821c9e97e865819e4d89dfc144..393633681f49fa852ac549b2aeb48fc4d9ebf07d 100644 (file)
@@ -2359,8 +2359,8 @@ isdn_tty_at_cout(char *msg, modem_info * info)
 
        /* use queue instead of direct, if online and */
        /* data is in queue or buffer is full */
-       if ((info->online && tty_buffer_request_room(tty, l) < l) ||
-           (!skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) {
+       if (info->online && ((tty_buffer_request_room(tty, l) < l) ||
+           !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) {
                skb = alloc_skb(l, GFP_ATOMIC);
                if (!skb) {
                        spin_unlock_irqrestore(&info->readlock, flags);
index 747602aa56158976aa5b7ce67aed28d72e2aa1ee..b85e2b180a4488f9eeeb99d69d7dedf7c1c7f9b0 100644 (file)
@@ -1334,6 +1334,12 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
        struct neofb_par *par = info->par;
        int seqflags, lcdflags, dpmsflags, reg;
 
+       /*
+        * Reload the value stored in the register, might have been changed via
+        * FN keystroke
+        */
+       par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
+
        switch (blank_mode) {
        case FB_BLANK_POWERDOWN:        /* powerdown - both sync lines down */
                seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */
@@ -1366,7 +1372,7 @@ static int neofb_blank(int blank_mode, struct fb_info *info)
        case FB_BLANK_NORMAL:           /* just blank screen (backlight stays on) */
                seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */
                lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */
-               dpmsflags = 0;                  /* no hsync/vsync suppression */
+               dpmsflags = 0x00;       /* no hsync/vsync suppression */
                break;
        case FB_BLANK_UNBLANK:          /* unblank */
                seqflags = 0;                   /* Enable sequencer */
index d17c97d07c80e44895503e6d336b8328c0ffd348..675bd25682979fc8a87bdb082da0bc3ec37d0ce9 100644 (file)
@@ -1442,13 +1442,15 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
                                         &bytes_read, &smb_read_data,
                                         &buf_type);
                        pSMBr = (struct smb_com_read_rsp *)smb_read_data;
-                       if (copy_to_user(current_offset, 
-                                        smb_read_data + 4 /* RFC1001 hdr */
-                                        + le16_to_cpu(pSMBr->DataOffset), 
-                                        bytes_read)) {
-                               rc = -EFAULT;
-                       }
                        if (smb_read_data) {
+                               if (copy_to_user(current_offset,
+                                               smb_read_data +
+                                               4 /* RFC1001 length field */ +
+                                               le16_to_cpu(pSMBr->DataOffset),
+                                               bytes_read)) {
+                                       rc = -EFAULT;
+                               }
+
                                if(buf_type == CIFS_SMALL_BUFFER)
                                        cifs_small_buf_release(smb_read_data);
                                else if(buf_type == CIFS_LARGE_BUFFER)
index 055378d2513e87359b899cafc2b981e1bd392407..0e1c95074d4201b33bda839d1fe41566bb69e5ec 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1403,7 +1403,7 @@ static void zap_threads (struct mm_struct *mm)
                do_each_thread(g,p) {
                        if (mm == p->mm && p != tsk &&
                            p->ptrace && p->parent->mm == mm) {
-                               __ptrace_unlink(p);
+                               __ptrace_detach(p, 0);
                        }
                } while_each_thread(g,p);
                write_unlock_irq(&tasklist_lock);
index e6265a0b56b8de25e8bceccd9e6be1eff10159f7..543ed543d1e5d6fa41e77279074f2bd51b8b68af 100644 (file)
 #include <linux/slab.h>
 
 /*
- * Unlink a buffer from a transaction checkpoint list.
+ * Unlink a buffer from a transaction.
  *
  * Called with j_list_lock held.
  */
 
-static void __buffer_unlink_first(struct journal_head *jh)
+static inline void __buffer_unlink(struct journal_head *jh)
 {
        transaction_t *transaction;
 
        transaction = jh->b_cp_transaction;
+       jh->b_cp_transaction = NULL;
 
        jh->b_cpnext->b_cpprev = jh->b_cpprev;
        jh->b_cpprev->b_cpnext = jh->b_cpnext;
-       if (transaction->t_checkpoint_list == jh) {
+       if (transaction->t_checkpoint_list == jh)
                transaction->t_checkpoint_list = jh->b_cpnext;
-               if (transaction->t_checkpoint_list == jh)
-                       transaction->t_checkpoint_list = NULL;
-       }
-}
-
-/*
- * Unlink a buffer from a transaction checkpoint(io) list.
- *
- * Called with j_list_lock held.
- */
-
-static inline void __buffer_unlink(struct journal_head *jh)
-{
-       transaction_t *transaction;
-
-       transaction = jh->b_cp_transaction;
-
-       __buffer_unlink_first(jh);
-       if (transaction->t_checkpoint_io_list == jh) {
-               transaction->t_checkpoint_io_list = jh->b_cpnext;
-               if (transaction->t_checkpoint_io_list == jh)
-                       transaction->t_checkpoint_io_list = NULL;
-       }
-}
-
-/*
- * Move a buffer from the checkpoint list to the checkpoint io list
- *
- * Called with j_list_lock held
- */
-
-static inline void __buffer_relink_io(struct journal_head *jh)
-{
-       transaction_t *transaction;
-
-       transaction = jh->b_cp_transaction;
-       __buffer_unlink_first(jh);
-
-       if (!transaction->t_checkpoint_io_list) {
-               jh->b_cpnext = jh->b_cpprev = jh;
-       } else {
-               jh->b_cpnext = transaction->t_checkpoint_io_list;
-               jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev;
-               jh->b_cpprev->b_cpnext = jh;
-               jh->b_cpnext->b_cpprev = jh;
-       }
-       transaction->t_checkpoint_io_list = jh;
+       if (transaction->t_checkpoint_list == jh)
+               transaction->t_checkpoint_list = NULL;
 }
 
 /*
  * Try to release a checkpointed buffer from its transaction.
- * Returns 1 if we released it and 2 if we also released the
- * whole transaction.
- *
+ * Returns 1 if we released it.
  * Requires j_list_lock
  * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it
  */
@@ -103,11 +57,12 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
 
        if (jh->b_jlist == BJ_None && !buffer_locked(bh) && !buffer_dirty(bh)) {
                JBUFFER_TRACE(jh, "remove from checkpoint list");
-               ret = __journal_remove_checkpoint(jh) + 1;
+               __journal_remove_checkpoint(jh);
                jbd_unlock_bh_state(bh);
                journal_remove_journal_head(bh);
                BUFFER_TRACE(bh, "release");
                __brelse(bh);
+               ret = 1;
        } else {
                jbd_unlock_bh_state(bh);
        }
@@ -162,53 +117,83 @@ static void jbd_sync_bh(journal_t *journal, struct buffer_head *bh)
 }
 
 /*
- * Clean up transaction's list of buffers submitted for io.
- * We wait for any pending IO to complete and remove any clean
- * buffers. Note that we take the buffers in the opposite ordering
- * from the one in which they were submitted for IO.
+ * Clean up a transaction's checkpoint list.
+ *
+ * We wait for any pending IO to complete and make sure any clean
+ * buffers are removed from the transaction.
+ *
+ * Return 1 if we performed any actions which might have destroyed the
+ * checkpoint.  (journal_remove_checkpoint() deletes the transaction when
+ * the last checkpoint buffer is cleansed)
  *
  * Called with j_list_lock held.
  */
-
-static void __wait_cp_io(journal_t *journal, transaction_t *transaction)
+static int __cleanup_transaction(journal_t *journal, transaction_t *transaction)
 {
-       struct journal_head *jh;
+       struct journal_head *jh, *next_jh, *last_jh;
        struct buffer_head *bh;
-       tid_t this_tid;
-       int released = 0;
-
-       this_tid = transaction->t_tid;
-restart:
-       /* Didn't somebody clean up the transaction in the meanwhile */
-       if (journal->j_checkpoint_transactions != transaction ||
-               transaction->t_tid != this_tid)
-               return;
-       while (!released && transaction->t_checkpoint_io_list) {
-               jh = transaction->t_checkpoint_io_list;
+       int ret = 0;
+
+       assert_spin_locked(&journal->j_list_lock);
+       jh = transaction->t_checkpoint_list;
+       if (!jh)
+               return 0;
+
+       last_jh = jh->b_cpprev;
+       next_jh = jh;
+       do {
+               jh = next_jh;
                bh = jh2bh(jh);
-               if (!jbd_trylock_bh_state(bh)) {
-                       jbd_sync_bh(journal, bh);
-                       spin_lock(&journal->j_list_lock);
-                       goto restart;
-               }
                if (buffer_locked(bh)) {
                        atomic_inc(&bh->b_count);
                        spin_unlock(&journal->j_list_lock);
-                       jbd_unlock_bh_state(bh);
                        wait_on_buffer(bh);
                        /* the journal_head may have gone by now */
                        BUFFER_TRACE(bh, "brelse");
                        __brelse(bh);
-                       spin_lock(&journal->j_list_lock);
-                       goto restart;
+                       goto out_return_1;
                }
+
                /*
-                * Now in whatever state the buffer currently is, we know that
-                * it has been written out and so we can drop it from the list
+                * This is foul
                 */
-               released = __journal_remove_checkpoint(jh);
-               jbd_unlock_bh_state(bh);
-       }
+               if (!jbd_trylock_bh_state(bh)) {
+                       jbd_sync_bh(journal, bh);
+                       goto out_return_1;
+               }
+
+               if (jh->b_transaction != NULL) {
+                       transaction_t *t = jh->b_transaction;
+                       tid_t tid = t->t_tid;
+
+                       spin_unlock(&journal->j_list_lock);
+                       jbd_unlock_bh_state(bh);
+                       log_start_commit(journal, tid);
+                       log_wait_commit(journal, tid);
+                       goto out_return_1;
+               }
+
+               /*
+                * AKPM: I think the buffer_jbddirty test is redundant - it
+                * shouldn't have NULL b_transaction?
+                */
+               next_jh = jh->b_cpnext;
+               if (!buffer_dirty(bh) && !buffer_jbddirty(bh)) {
+                       BUFFER_TRACE(bh, "remove from checkpoint");
+                       __journal_remove_checkpoint(jh);
+                       jbd_unlock_bh_state(bh);
+                       journal_remove_journal_head(bh);
+                       __brelse(bh);
+                       ret = 1;
+               } else {
+                       jbd_unlock_bh_state(bh);
+               }
+       } while (jh != last_jh);
+
+       return ret;
+out_return_1:
+       spin_lock(&journal->j_list_lock);
+       return 1;
 }
 
 #define NR_BATCH       64
@@ -218,7 +203,9 @@ __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count)
 {
        int i;
 
+       spin_unlock(&journal->j_list_lock);
        ll_rw_block(SWRITE, *batch_count, bhs);
+       spin_lock(&journal->j_list_lock);
        for (i = 0; i < *batch_count; i++) {
                struct buffer_head *bh = bhs[i];
                clear_buffer_jwrite(bh);
@@ -234,46 +221,19 @@ __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count)
  * Return 1 if something happened which requires us to abort the current
  * scan of the checkpoint list.  
  *
- * Called with j_list_lock held and drops it if 1 is returned
+ * Called with j_list_lock held.
  * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it
  */
-static int __process_buffer(journal_t *journal, struct journal_head *jh,
-                       struct buffer_head **bhs, int *batch_count)
+static int __flush_buffer(journal_t *journal, struct journal_head *jh,
+                       struct buffer_head **bhs, int *batch_count,
+                       int *drop_count)
 {
        struct buffer_head *bh = jh2bh(jh);
        int ret = 0;
 
-       if (buffer_locked(bh)) {
-               get_bh(bh);
-               spin_unlock(&journal->j_list_lock);
-               jbd_unlock_bh_state(bh);
-               wait_on_buffer(bh);
-               /* the journal_head may have gone by now */
-               BUFFER_TRACE(bh, "brelse");
-               put_bh(bh);
-               ret = 1;
-       }
-       else if (jh->b_transaction != NULL) {
-               transaction_t *t = jh->b_transaction;
-               tid_t tid = t->t_tid;
+       if (buffer_dirty(bh) && !buffer_locked(bh) && jh->b_jlist == BJ_None) {
+               J_ASSERT_JH(jh, jh->b_transaction == NULL);
 
-               spin_unlock(&journal->j_list_lock);
-               jbd_unlock_bh_state(bh);
-               log_start_commit(journal, tid);
-               log_wait_commit(journal, tid);
-               ret = 1;
-       }
-       else if (!buffer_dirty(bh)) {
-               J_ASSERT_JH(jh, !buffer_jbddirty(bh));
-               BUFFER_TRACE(bh, "remove from checkpoint");
-               __journal_remove_checkpoint(jh);
-               spin_unlock(&journal->j_list_lock);
-               jbd_unlock_bh_state(bh);
-               journal_remove_journal_head(bh);
-               put_bh(bh);
-               ret = 1;
-       }
-       else {
                /*
                 * Important: we are about to write the buffer, and
                 * possibly block, while still holding the journal lock.
@@ -286,30 +246,45 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh,
                J_ASSERT_BH(bh, !buffer_jwrite(bh));
                set_buffer_jwrite(bh);
                bhs[*batch_count] = bh;
-               __buffer_relink_io(jh);
                jbd_unlock_bh_state(bh);
                (*batch_count)++;
                if (*batch_count == NR_BATCH) {
-                       spin_unlock(&journal->j_list_lock);
                        __flush_batch(journal, bhs, batch_count);
                        ret = 1;
                }
+       } else {
+               int last_buffer = 0;
+               if (jh->b_cpnext == jh) {
+                       /* We may be about to drop the transaction.  Tell the
+                        * caller that the lists have changed.
+                        */
+                       last_buffer = 1;
+               }
+               if (__try_to_free_cp_buf(jh)) {
+                       (*drop_count)++;
+                       ret = last_buffer;
+               }
        }
        return ret;
 }
 
 /*
- * Perform an actual checkpoint. We take the first transaction on the
- * list of transactions to be checkpointed and send all its buffers
- * to disk. We submit larger chunks of data at once.
+ * Perform an actual checkpoint.  We don't write out only enough to
+ * satisfy the current blocked requests: rather we submit a reasonably
+ * sized chunk of the outstanding data to disk at once for
+ * efficiency.  __log_wait_for_space() will retry if we didn't free enough.
  * 
+ * However, we _do_ take into account the amount requested so that once
+ * the IO has been queued, we can return as soon as enough of it has
+ * completed to disk.
+ *
  * The journal should be locked before calling this function.
  */
 int log_do_checkpoint(journal_t *journal)
 {
-       transaction_t *transaction;
-       tid_t this_tid;
        int result;
+       int batch_count = 0;
+       struct buffer_head *bhs[NR_BATCH];
 
        jbd_debug(1, "Start checkpoint\n");
 
@@ -324,70 +299,79 @@ int log_do_checkpoint(journal_t *journal)
                return result;
 
        /*
-        * OK, we need to start writing disk blocks.  Take one transaction
-        * and write it.
+        * OK, we need to start writing disk blocks.  Try to free up a
+        * quarter of the log in a single checkpoint if we can.
         */
-       spin_lock(&journal->j_list_lock);
-       if (!journal->j_checkpoint_transactions)
-               goto out;
-       transaction = journal->j_checkpoint_transactions;
-       this_tid = transaction->t_tid;
-restart:
        /*
-        * If someone cleaned up this transaction while we slept, we're
-        * done (maybe it's a new transaction, but it fell at the same
-        * address).
+        * AKPM: check this code.  I had a feeling a while back that it
+        * degenerates into a busy loop at unmount time.
         */
-       if (journal->j_checkpoint_transactions == transaction &&
-                       transaction->t_tid == this_tid) {
-               int batch_count = 0;
-               struct buffer_head *bhs[NR_BATCH];
-               struct journal_head *jh;
-               int retry = 0;
-
-               while (!retry && transaction->t_checkpoint_list) {
+       spin_lock(&journal->j_list_lock);
+       while (journal->j_checkpoint_transactions) {
+               transaction_t *transaction;
+               struct journal_head *jh, *last_jh, *next_jh;
+               int drop_count = 0;
+               int cleanup_ret, retry = 0;
+               tid_t this_tid;
+
+               transaction = journal->j_checkpoint_transactions;
+               this_tid = transaction->t_tid;
+               jh = transaction->t_checkpoint_list;
+               last_jh = jh->b_cpprev;
+               next_jh = jh;
+               do {
                        struct buffer_head *bh;
 
-                       jh = transaction->t_checkpoint_list;
+                       jh = next_jh;
+                       next_jh = jh->b_cpnext;
                        bh = jh2bh(jh);
                        if (!jbd_trylock_bh_state(bh)) {
                                jbd_sync_bh(journal, bh);
+                               spin_lock(&journal->j_list_lock);
                                retry = 1;
                                break;
                        }
-                       retry = __process_buffer(journal, jh, bhs,
-                                               &batch_count);
-                       if (!retry &&
-                           lock_need_resched(&journal->j_list_lock)) {
-                               spin_unlock(&journal->j_list_lock);
+                       retry = __flush_buffer(journal, jh, bhs, &batch_count, &drop_count);
+                       if (cond_resched_lock(&journal->j_list_lock)) {
                                retry = 1;
                                break;
                        }
-               }
+               } while (jh != last_jh && !retry);
 
                if (batch_count) {
-                       if (!retry) {
-                               spin_unlock(&journal->j_list_lock);
-                               retry = 1;
-                       }
                        __flush_batch(journal, bhs, &batch_count);
+                       retry = 1;
                }
 
-               if (retry) {
-                       spin_lock(&journal->j_list_lock);
-                       goto restart;
-               }
                /*
-                * Now we have cleaned up the first transaction's checkpoint
-                * list.  Let's clean up the second one.
+                * If someone cleaned up this transaction while we slept, we're
+                * done
+                */
+               if (journal->j_checkpoint_transactions != transaction)
+                       break;
+               if (retry)
+                       continue;
+               /*
+                * Maybe it's a new transaction, but it fell at the same
+                * address
                 */
-               __wait_cp_io(journal, transaction);
+               if (transaction->t_tid != this_tid)
+                       continue;
+               /*
+                * We have walked the whole transaction list without
+                * finding anything to write to disk.  We had better be
+                * able to make some progress or we are in trouble.
+                */
+               cleanup_ret = __cleanup_transaction(journal, transaction);
+               J_ASSERT(drop_count != 0 || cleanup_ret != 0);
+               if (journal->j_checkpoint_transactions != transaction)
+                       break;
        }
-out:
        spin_unlock(&journal->j_list_lock);
        result = cleanup_journal_tail(journal);
        if (result < 0)
                return result;
+
        return 0;
 }
 
@@ -471,53 +455,6 @@ int cleanup_journal_tail(journal_t *journal)
 
 /* Checkpoint list management */
 
-/*
- * journal_clean_one_cp_list
- *
- * Find all the written-back checkpoint buffers in the given list and release them.
- *
- * Called with the journal locked.
- * Called with j_list_lock held.
- * Returns number of bufers reaped (for debug)
- */
-
-static int journal_clean_one_cp_list(struct journal_head *jh, int *released)
-{
-       struct journal_head *last_jh;
-       struct journal_head *next_jh = jh;
-       int ret, freed = 0;
-
-       *released = 0;
-       if (!jh)
-               return 0;
-
-       last_jh = jh->b_cpprev;
-       do {
-               jh = next_jh;
-               next_jh = jh->b_cpnext;
-               /* Use trylock because of the ranking */
-               if (jbd_trylock_bh_state(jh2bh(jh))) {
-                       ret = __try_to_free_cp_buf(jh);
-                       if (ret) {
-                               freed++;
-                               if (ret == 2) {
-                                       *released = 1;
-                                       return freed;
-                               }
-                       }
-               }
-               /*
-                * This function only frees up some memory if possible so we
-                * dont have an obligation to finish processing. Bail out if
-                * preemption requested:
-                */
-               if (need_resched())
-                       return freed;
-       } while (jh != last_jh);
-
-       return freed;
-}
-
 /*
  * journal_clean_checkpoint_list
  *
@@ -525,38 +462,46 @@ static int journal_clean_one_cp_list(struct journal_head *jh, int *released)
  *
  * Called with the journal locked.
  * Called with j_list_lock held.
- * Returns number of buffers reaped (for debug)
+ * Returns number of bufers reaped (for debug)
  */
 
 int __journal_clean_checkpoint_list(journal_t *journal)
 {
        transaction_t *transaction, *last_transaction, *next_transaction;
-       int ret = 0, released;
+       int ret = 0;
 
        transaction = journal->j_checkpoint_transactions;
-       if (!transaction)
+       if (transaction == 0)
                goto out;
 
        last_transaction = transaction->t_cpprev;
        next_transaction = transaction;
        do {
+               struct journal_head *jh;
+
                transaction = next_transaction;
                next_transaction = transaction->t_cpnext;
-               ret += journal_clean_one_cp_list(transaction->
-                               t_checkpoint_list, &released);
-               if (need_resched())
-                       goto out;
-               if (released)
-                       continue;
-               /*
-                * It is essential that we are as careful as in the case of
-                * t_checkpoint_list with removing the buffer from the list as
-                * we can possibly see not yet submitted buffers on io_list
-                */
-               ret += journal_clean_one_cp_list(transaction->
-                               t_checkpoint_io_list, &released);
-               if (need_resched())
-                       goto out;
+               jh = transaction->t_checkpoint_list;
+               if (jh) {
+                       struct journal_head *last_jh = jh->b_cpprev;
+                       struct journal_head *next_jh = jh;
+
+                       do {
+                               jh = next_jh;
+                               next_jh = jh->b_cpnext;
+                               /* Use trylock because of the ranknig */
+                               if (jbd_trylock_bh_state(jh2bh(jh)))
+                                       ret += __try_to_free_cp_buf(jh);
+                               /*
+                                * This function only frees up some memory
+                                * if possible so we dont have an obligation
+                                * to finish processing. Bail out if preemption
+                                * requested:
+                                */
+                               if (need_resched())
+                                       goto out;
+                       } while (jh != last_jh);
+               }
        } while (transaction != last_transaction);
 out:
        return ret;
@@ -571,22 +516,18 @@ out:
  * buffer updates committed in that transaction have safely been stored
  * elsewhere on disk.  To achieve this, all of the buffers in a
  * transaction need to be maintained on the transaction's checkpoint
- * lists until they have been rewritten, at which point this function is
+ * list until they have been rewritten, at which point this function is
  * called to remove the buffer from the existing transaction's
- * checkpoint lists.
- *
- * The function returns 1 if it frees the transaction, 0 otherwise.
+ * checkpoint list.
  *
  * This function is called with the journal locked.
  * This function is called with j_list_lock held.
- * This function is called with jbd_lock_bh_state(jh2bh(jh))
  */
 
-int __journal_remove_checkpoint(struct journal_head *jh)
+void __journal_remove_checkpoint(struct journal_head *jh)
 {
        transaction_t *transaction;
        journal_t *journal;
-       int ret = 0;
 
        JBUFFER_TRACE(jh, "entry");
 
@@ -597,10 +538,8 @@ int __journal_remove_checkpoint(struct journal_head *jh)
        journal = transaction->t_journal;
 
        __buffer_unlink(jh);
-       jh->b_cp_transaction = NULL;
 
-       if (transaction->t_checkpoint_list != NULL ||
-           transaction->t_checkpoint_io_list != NULL)
+       if (transaction->t_checkpoint_list != NULL)
                goto out;
        JBUFFER_TRACE(jh, "transaction has no more buffers");
 
@@ -626,10 +565,8 @@ int __journal_remove_checkpoint(struct journal_head *jh)
        /* Just in case anybody was waiting for more transactions to be
            checkpointed... */
        wake_up(&journal->j_wait_logspace);
-       ret = 1;
 out:
        JBUFFER_TRACE(jh, "exit");
-       return ret;
 }
 
 /*
@@ -691,7 +628,6 @@ void __journal_drop_transaction(journal_t *journal, transaction_t *transaction)
        J_ASSERT(transaction->t_shadow_list == NULL);
        J_ASSERT(transaction->t_log_list == NULL);
        J_ASSERT(transaction->t_checkpoint_list == NULL);
-       J_ASSERT(transaction->t_checkpoint_io_list == NULL);
        J_ASSERT(transaction->t_updates == 0);
        J_ASSERT(journal->j_committing_transaction != transaction);
        J_ASSERT(journal->j_running_transaction != transaction);
index 29e62d98bae64b5f326fb94beb88e87a8c8f183a..002ad2bbc76992b6acda52def147799886147693 100644 (file)
@@ -829,8 +829,7 @@ restart_loop:
        journal->j_committing_transaction = NULL;
        spin_unlock(&journal->j_state_lock);
 
-       if (commit_transaction->t_checkpoint_list == NULL &&
-           commit_transaction->t_checkpoint_io_list == NULL) {
+       if (commit_transaction->t_checkpoint_list == NULL) {
                __journal_drop_transaction(journal, commit_transaction);
        } else {
                if (journal->j_checkpoint_transactions == NULL) {
index 3eaf6e70108781fec63c61a32141b435532faae3..da6354baa0b804b36d2778282b31bc5ae8e2d858 100644 (file)
@@ -111,9 +111,10 @@ long nlmclnt_block(struct nlm_rqst *req, long timeout)
 /*
  * The server lockd has called us back to tell us the lock was granted
  */
-u32
-nlmclnt_grant(struct nlm_lock *lock)
+u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock)
 {
+       const struct file_lock *fl = &lock->fl;
+       const struct nfs_fh *fh = &lock->fh;
        struct nlm_wait *block;
        u32 res = nlm_lck_denied;
 
@@ -122,14 +123,20 @@ nlmclnt_grant(struct nlm_lock *lock)
         * Warning: must not use cookie to match it!
         */
        list_for_each_entry(block, &nlm_blocked, b_list) {
-               if (nlm_compare_locks(block->b_lock, &lock->fl)) {
-                       /* Alright, we found a lock. Set the return status
-                        * and wake up the caller
-                        */
-                       block->b_status = NLM_LCK_GRANTED;
-                       wake_up(&block->b_wait);
-                       res = nlm_granted;
-               }
+               struct file_lock *fl_blocked = block->b_lock;
+
+               if (!nlm_compare_locks(fl_blocked, fl))
+                       continue;
+               if (!nlm_cmp_addr(&block->b_host->h_addr, addr))
+                       continue;
+               if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_dentry->d_inode) ,fh) != 0)
+                       continue;
+               /* Alright, we found a lock. Set the return status
+                * and wake up the caller
+                */
+               block->b_status = NLM_LCK_GRANTED;
+               wake_up(&block->b_wait);
+               res = nlm_granted;
        }
        return res;
 }
index 4063095d849e0280ceecbeb4d510a600810b7797..b10f913aa06ae44f7d797920ed9e981b610caa5d 100644 (file)
@@ -228,7 +228,7 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
        resp->cookie = argp->cookie;
 
        dprintk("lockd: GRANTED       called\n");
-       resp->status = nlmclnt_grant(&argp->lock);
+       resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock);
        dprintk("lockd: GRANTED       status %d\n", ntohl(resp->status));
        return rpc_success;
 }
index 3bc437e0cf5b6f0d6618c806fc9f835b084dbc52..35681d9cf1fcf52ca816249221a5b4c48b293c4e 100644 (file)
@@ -256,7 +256,7 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
        resp->cookie = argp->cookie;
 
        dprintk("lockd: GRANTED       called\n");
-       resp->status = nlmclnt_grant(&argp->lock);
+       resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock);
        dprintk("lockd: GRANTED       status %d\n", ntohl(resp->status));
        return rpc_success;
 }
index f6439532a262d45e2ff47655edfd87cb9fcf55fb..a21515c16a431b861ab37ce8e71df8b79d6d93b6 100644 (file)
@@ -43,6 +43,8 @@
 #define        MADV_SPACEAVAIL 5               /* ensure resources are available */
 #define MADV_DONTNEED  6               /* don't need these pages */
 #define MADV_REMOVE    7               /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index f0bebca2ac214a5b6b87dc8413c18b3cd9115ceb..693ed859e6324ff65fb26beea773291cedfd006a 100644 (file)
@@ -36,6 +36,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index 0ed7780541fa1b27abba46b8541bcb6cf583d1c6..2096c50df8880ed104975f366bfd1b81bbe3c8e7 100644 (file)
@@ -36,6 +36,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index 5a382b8bf3f738effedd851b6887f7ce4197817b..deddfb239ff55aa3af5d5e1f929fc6744c0fa1f1 100644 (file)
@@ -38,6 +38,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index a59f684b4f33e8ea747068561ec1ecfa65d60ce5..5d9f84bfdcad3300ddccb8b031c86433b472648d 100644 (file)
@@ -220,9 +220,9 @@ extern unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsig
        switch (sizeof(__xg_orig)) {                                            \
        case 4:                                                                 \
                asm volatile(                                                   \
-                       "swap%I0 %2,%M0"                                        \
-                       : "+m"(*__xg_ptr), "=&r"(__xg_orig)                     \
-                       : "r"(x)                                                \
+                       "swap%I0 %M0,%1"                                        \
+                       : "+m"(*__xg_ptr), "=r"(__xg_orig)                      \
+                       : "1"(x)                                                \
                        : "memory"                                              \
                        );                                                      \
                break;                                                          \
index 3007deccb4904256521eda65a7defdc91c555f37..eaa5826bc1c8f1627d890f4a7fcda630716c13fb 100644 (file)
@@ -87,5 +87,17 @@ static inline void flush_icache_page(struct vm_area_struct *vma, struct page *pa
        flush_icache_user_range(vma, page, page_to_phys(page), PAGE_SIZE);
 }
 
+/*
+ * permit ptrace to access another process's address space through the icache
+ * and the dcache
+ */
+#define copy_to_user_page(vma, page, vaddr, dst, src, len)     \
+do {                                                           \
+       memcpy((dst), (src), (len));                            \
+       flush_icache_user_range((vma), (page), (vaddr), (len)); \
+} while(0)
+
+#define copy_from_user_page(vma, page, vaddr, dst, src, len)   \
+       memcpy((dst), (src), (len))
 
 #endif /* _ASM_CACHEFLUSH_H */
index 075369b1a34baba46412a739b95b2fe66517111d..01247cb2bc39d88ba228d4bd1b82131754848f33 100644 (file)
@@ -251,7 +251,6 @@ static inline void writel(uint32_t datum, volatile void __iomem *addr)
 #define IOMAP_WRITETHROUGH             3
 
 extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag);
-extern void __iounmap(void __iomem *addr, unsigned long size);
 
 static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
 {
index 8af4a41c255e113b6bf38b37fb0eafb26e312f65..d3bca306da82b751fe56c149fdea61da459d5ad8 100644 (file)
@@ -36,6 +36,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index ef472f058d9c28bb5b67b38469bc919909ae8e58..c2a541ef828d88c87f73fed40dcd0f9b3e85dc99 100644 (file)
@@ -98,6 +98,7 @@
 #define TBR_TT_TRAP0           (0x80 << 4)
 #define TBR_TT_TRAP1           (0x81 << 4)
 #define TBR_TT_TRAP2           (0x82 << 4)
+#define TBR_TT_TRAP3           (0x83 << 4)
 #define TBR_TT_TRAP126         (0xfe << 4)
 #define TBR_TT_BREAK           (0xff << 4)
 
index d2aea70a5f64cc0ef37e55275394c06f1ad4b34b..f72ff0c4dc0b9050a580e0c4dba61b8a36b7b129 100644 (file)
@@ -40,8 +40,84 @@ do {                                                                 \
 
 /*
  * interrupt flag manipulation
+ * - use virtual interrupt management since touching the PSR is slow
+ *   - ICC2.Z: T if interrupts virtually disabled
+ *   - ICC2.C: F if interrupts really disabled
+ * - if Z==1 upon interrupt:
+ *   - C is set to 0
+ *   - interrupts are really disabled
+ *   - entry.S returns immediately
+ * - uses TIHI (TRAP if Z==0 && C==0) #2 to really reenable interrupts
+ *   - if taken, the trap:
+ *     - sets ICC2.C
+ *     - enables interrupts
  */
-#define local_irq_disable()                            \
+#define local_irq_disable()                                    \
+do {                                                           \
+       /* set Z flag, but don't change the C flag */           \
+       asm volatile("  andcc   gr0,gr0,gr0,icc2        \n"     \
+                    :                                          \
+                    :                                          \
+                    : "memory", "icc2"                         \
+                    );                                         \
+} while(0)
+
+#define local_irq_enable()                                     \
+do {                                                           \
+       /* clear Z flag and then test the C flag */             \
+       asm volatile("  oricc   gr0,#1,gr0,icc2         \n"     \
+                    "  tihi    icc2,gr0,#2             \n"     \
+                    :                                          \
+                    :                                          \
+                    : "memory", "icc2"                         \
+                    );                                         \
+} while(0)
+
+#define local_save_flags(flags)                                        \
+do {                                                           \
+       typecheck(unsigned long, flags);                        \
+       asm volatile("movsg ccr,%0"                             \
+                    : "=r"(flags)                              \
+                    :                                          \
+                    : "memory");                               \
+                                                               \
+       /* shift ICC2.Z to bit 0 */                             \
+       flags >>= 26;                                           \
+                                                               \
+       /* make flags 1 if interrupts disabled, 0 otherwise */  \
+       flags &= 1UL;                                           \
+} while(0)
+
+#define irqs_disabled() \
+       ({unsigned long flags; local_save_flags(flags); flags; })
+
+#define        local_irq_save(flags)                   \
+do {                                           \
+       typecheck(unsigned long, flags);        \
+       local_save_flags(flags);                \
+       local_irq_disable();                    \
+} while(0)
+
+#define        local_irq_restore(flags)                                        \
+do {                                                                   \
+       typecheck(unsigned long, flags);                                \
+                                                                       \
+       /* load the Z flag by turning 1 if disabled into 0 if disabled  \
+        * and thus setting the Z flag but not the C flag */            \
+       asm volatile("  xoricc  %0,#1,gr0,icc2          \n"             \
+                    /* then test Z=0 and C=0 */                        \
+                    "  tihi    icc2,gr0,#2             \n"             \
+                    :                                                  \
+                    : "r"(flags)                                       \
+                    : "memory", "icc2"                                 \
+                    );                                                 \
+                                                                       \
+} while(0)
+
+/*
+ * real interrupt flag manipulation
+ */
+#define __local_irq_disable()                          \
 do {                                                   \
        unsigned long psr;                              \
        asm volatile("  movsg   psr,%0          \n"     \
@@ -53,7 +129,7 @@ do {                                                 \
                     : "memory");                       \
 } while(0)
 
-#define local_irq_enable()                             \
+#define __local_irq_enable()                           \
 do {                                                   \
        unsigned long psr;                              \
        asm volatile("  movsg   psr,%0          \n"     \
@@ -64,7 +140,7 @@ do {                                                 \
                     : "memory");                       \
 } while(0)
 
-#define local_save_flags(flags)                        \
+#define __local_save_flags(flags)              \
 do {                                           \
        typecheck(unsigned long, flags);        \
        asm("movsg psr,%0"                      \
@@ -73,7 +149,7 @@ do {                                         \
            : "memory");                        \
 } while(0)
 
-#define        local_irq_save(flags)                           \
+#define        __local_irq_save(flags)                         \
 do {                                                   \
        unsigned long npsr;                             \
        typecheck(unsigned long, flags);                \
@@ -86,7 +162,7 @@ do {                                                 \
                     : "memory");                       \
 } while(0)
 
-#define        local_irq_restore(flags)                        \
+#define        __local_irq_restore(flags)                      \
 do {                                                   \
        typecheck(unsigned long, flags);                \
        asm volatile("  movgs   %0,psr          \n"     \
@@ -95,7 +171,7 @@ do {                                                 \
                     : "memory");                       \
 } while(0)
 
-#define irqs_disabled() \
+#define __irqs_disabled() \
        ((__get_PSR() & PSR_PIL) >= PSR_PIL_14)
 
 /*
index b6bcbe01f6ee43851e0f67570684010f529de01f..a1d140438863a957991f9cd765af3a2d1a2f6d10 100644 (file)
@@ -306,7 +306,4 @@ extern long strnlen_user(const char *src, long count);
 
 extern unsigned long search_exception_table(unsigned long addr);
 
-#define copy_to_user_page(vma, page, vaddr, dst, src, len)     memcpy(dst, src, len)
-#define copy_from_user_page(vma, page, vaddr, dst, src, len)   memcpy(dst, src, len)
-
 #endif /* _ASM_UACCESS_H */
index 4d994d2e99e30e50a7ed68da17914abfa939cefa..322531caa484f7697bcb48bd3fe2b824d0e3ed8b 100644 (file)
 #define __NR_add_key           286
 #define __NR_request_key       287
 #define __NR_keyctl            288
-#define __NR_vperfctr_open     289
-#define __NR_vperfctr_control  (__NR_perfctr_info+1)
-#define __NR_vperfctr_unlink   (__NR_perfctr_info+2)
-#define __NR_vperfctr_iresume  (__NR_perfctr_info+3)
-#define __NR_vperfctr_read     (__NR_perfctr_info+4)
+#define __NR_ioprio_set                289
+#define __NR_ioprio_get                290
+#define __NR_inotify_init      291
+#define __NR_inotify_add_watch 292
+#define __NR_inotify_rm_watch  293
+#define __NR_migrate_pages     294
+#define __NR_openat            295
+#define __NR_mkdirat           296
+#define __NR_mknodat           297
+#define __NR_fchownat          298
+#define __NR_futimesat         299
+#define __NR_newfstatat                300
+#define __NR_unlinkat          301
+#define __NR_renameat          302
+#define __NR_linkat            303
+#define __NR_symlinkat         304
+#define __NR_readlinkat                305
+#define __NR_fchmodat          306
+#define __NR_faccessat         307
+#define __NR_pselect6          308
+#define __NR_ppoll             309
 
-#define NR_syscalls 294
+#define NR_syscalls 310
 
 /*
  * process the return value of a syscall, consigning it to one of two possible fates
index 744a8fb485c230780ff6256abc483a58bab647b2..ac0346f7d11da1fbdde8b1c661b6fa24a7096fde 100644 (file)
@@ -36,6 +36,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index ba4941e6f643213f39bcff3379259cdadf8584d3..ab2339a1d807e670d24becedebed92c3e068f68f 100644 (file)
@@ -36,6 +36,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index af503a122b23592eb6e82836fffd30ead57de91a..aa958c6ee83e35898ad50ccecab748f18daf7d50 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef _ASM_I386_TOPOLOGY_H
 #define _ASM_I386_TOPOLOGY_H
 
-#ifdef CONFIG_SMP
+#ifdef CONFIG_X86_HT
 #define topology_physical_package_id(cpu)                              \
        (phys_proc_id[cpu] == BAD_APICID ? -1 : phys_proc_id[cpu])
 #define topology_core_id(cpu)                                          \
index e1b6cd63f49e637e2d6752ae4802963632d1c5c9..03d00faf03b5c414a473b8a28d4e793a9e63787b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2002-2003, 2006 Silicon Graphics, Inc.  All Rights Reserved.
  * 
  * This program is free software; you can redistribute it and/or modify it 
  * under the terms of version 2 of the GNU General Public License 
  * License along with this program; if not, write the Free Software 
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  * 
- * Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 
- * Mountain View, CA  94043, or:
- * 
- * http://www.sgi.com 
- * 
  * For further information regarding this notice, see: 
  * 
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan
index 828beb24a20ec7837fe7a00dde7c4b8b93bbe941..357ebb780cc0f7378a990751373a487e5c77b723 100644 (file)
@@ -44,6 +44,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index 1a3831c04af607fdcde43dc2a74909130459d34d..91c31be87b13d1734afd63176912b661e96f4f20 100644 (file)
@@ -70,7 +70,7 @@ DECLARE_PER_CPU(struct sn_hub_info_s, __sn_hub_info);
  * Compact node ID to nasid mappings kept in the per-cpu data areas of each
  * cpu.
  */
-DECLARE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_NUMNODES]);
+DECLARE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_COMPACT_NODES]);
 #define sn_cnodeid_to_nasid    (&__get_cpu_var(__sn_cnodeid_to_nasid[0]))
 
 
index 01e5b41032357a1c615c8326d7c7a7ea12df5882..5335d87ca5f8e080b756ec6dec7478822c87be1f 100644 (file)
@@ -46,7 +46,7 @@
 #define BTES_PER_NODE (is_shub2() ? 4 : 2)
 #define MAX_BTES_PER_NODE 4
 
-#define BTE2OFF_CTRL   (0)
+#define BTE2OFF_CTRL   0
 #define BTE2OFF_SRC    (SH2_BT_ENG_SRC_ADDR_0 - SH2_BT_ENG_CSR_0)
 #define BTE2OFF_DEST   (SH2_BT_ENG_DEST_ADDR_0 - SH2_BT_ENG_CSR_0)
 #define BTE2OFF_NOTIFY (SH2_BT_ENG_NOTIF_ADDR_0 - SH2_BT_ENG_CSR_0)
                : base + (BTEOFF_NOTIFY/8))
 
 /* Define hardware modes */
-#define BTE_NOTIFY (IBCT_NOTIFY)
+#define BTE_NOTIFY IBCT_NOTIFY
 #define BTE_NORMAL BTE_NOTIFY
 #define BTE_ZERO_FILL (BTE_NOTIFY | IBCT_ZFIL_MODE)
 /* Use a reserved bit to let the caller specify a wait for any BTE */
-#define BTE_WACQUIRE (0x4000)
+#define BTE_WACQUIRE 0x4000
 /* Use the BTE on the node with the destination memory */
 #define BTE_USE_DEST (BTE_WACQUIRE << 1)
 /* Use any available BTE interface on any node for the transfer */
index 9334078b089a0c46eab8bbdceae51e4b22c027e7..a601d3af39b6a47dacec545524bdf7dacf58478f 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 1992-1997,2000-2004 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 1992-1997,2000-2006 Silicon Graphics, Inc. All rights reserved.
  */
 #ifndef _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
 #define _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
@@ -115,18 +115,6 @@ struct pcibus_info {
        spinlock_t              pbi_lock;
 };
 
-/*
- * pcibus_info structure locking macros
- */
-inline static unsigned long
-pcibr_lock(struct pcibus_info *pcibus_info)
-{
-       unsigned long flag;
-       spin_lock_irqsave(&pcibus_info->pbi_lock, flag);
-       return(flag);
-}
-#define pcibr_unlock(pcibus_info, flag)  spin_unlock_irqrestore(&pcibus_info->pbi_lock, flag)
-
 extern int  pcibr_init_provider(void);
 extern void *pcibr_bus_fixup(struct pcibus_bussoft *, struct pci_controller *);
 extern dma_addr_t pcibr_dma_map(struct pci_dev *, unsigned long, size_t);
index 9ca642cad33878a0a3de28c74ae639998099ea86..ff33e3bd3f8e337a471e3e20fa57ccb04e8c715d 100644 (file)
@@ -12,9 +12,6 @@
  */
 
 
-#include <asm/types.h>
-#include <asm/bitops.h>
-
 /* --------------------- PROM Features -----------------------------*/
 extern int sn_prom_feature_available(int id);
 
index 0c36928ffd8b56c1e67ff1090124b8b902be126c..df7f5f4f3cde2d7e68f8360ca771554c0039227e 100644 (file)
@@ -508,19 +508,24 @@ struct xpc_channel {
 #define        XPC_C_OPENREQUEST       0x00000010 /* local open channel request */
 
 #define        XPC_C_SETUP             0x00000020 /* channel's msgqueues are alloc'd */
-#define        XPC_C_CONNECTCALLOUT    0x00000040 /* channel connected callout made */
-#define        XPC_C_CONNECTED         0x00000080 /* local channel is connected */
-#define        XPC_C_CONNECTING        0x00000100 /* channel is being connected */
-
-#define        XPC_C_RCLOSEREPLY       0x00000200 /* remote close channel reply */
-#define        XPC_C_CLOSEREPLY        0x00000400 /* local close channel reply */
-#define        XPC_C_RCLOSEREQUEST     0x00000800 /* remote close channel request */
-#define        XPC_C_CLOSEREQUEST      0x00001000 /* local close channel request */
-
-#define        XPC_C_DISCONNECTED      0x00002000 /* channel is disconnected */
-#define        XPC_C_DISCONNECTING     0x00004000 /* channel is being disconnected */
-#define        XPC_C_DISCONNECTCALLOUT 0x00008000 /* chan disconnected callout made */
-#define        XPC_C_WDISCONNECT       0x00010000 /* waiting for channel disconnect */
+#define        XPC_C_CONNECTEDCALLOUT  0x00000040 /* connected callout initiated */
+#define        XPC_C_CONNECTEDCALLOUT_MADE \
+                               0x00000080 /* connected callout completed */
+#define        XPC_C_CONNECTED         0x00000100 /* local channel is connected */
+#define        XPC_C_CONNECTING        0x00000200 /* channel is being connected */
+
+#define        XPC_C_RCLOSEREPLY       0x00000400 /* remote close channel reply */
+#define        XPC_C_CLOSEREPLY        0x00000800 /* local close channel reply */
+#define        XPC_C_RCLOSEREQUEST     0x00001000 /* remote close channel request */
+#define        XPC_C_CLOSEREQUEST      0x00002000 /* local close channel request */
+
+#define        XPC_C_DISCONNECTED      0x00004000 /* channel is disconnected */
+#define        XPC_C_DISCONNECTING     0x00008000 /* channel is being disconnected */
+#define        XPC_C_DISCONNECTINGCALLOUT \
+                               0x00010000 /* disconnecting callout initiated */
+#define        XPC_C_DISCONNECTINGCALLOUT_MADE \
+                               0x00020000 /* disconnecting callout completed */
+#define        XPC_C_WDISCONNECT       0x00040000 /* waiting for channel disconnect */
 
 
 
index 414aae06044093b474033f1824c4734c2bcc5008..05a6baf8a472a5daef978db6858c35a9a0e664bb 100644 (file)
@@ -15,6 +15,8 @@
 
 typedef unsigned long cycles_t;
 
+extern void (*ia64_udelay)(unsigned long usecs);
+
 /*
  * For performance reasons, we don't want to define CLOCK_TICK_TRATE as
  * local_cpu_data->itc_rate.  Fortunately, we don't have to, either: according to George
index 12e29747bc84a510163f6e948f3d6834047e0c7c..6b02fe3fcff299c7dbeacb22e99f32404606e662 100644 (file)
@@ -38,6 +38,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index ea262ab88b3bb547761227d0a039e7800674bc4c..efd12bc4ccb7e4119529a2d2ac96180fb7353bfd 100644 (file)
@@ -36,6 +36,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index 934e063e79f1752f0ca0a8368ced8a66c85c34ba..818b9a97e214280c0c6a93af52699028e32a95bb 100644 (file)
  */
 #define MIPS_CPU_ISA_I         0x00000001
 #define MIPS_CPU_ISA_II                0x00000002
-#define MIPS_CPU_ISA_III       0x00000003
-#define MIPS_CPU_ISA_IV                0x00000004
-#define MIPS_CPU_ISA_V         0x00000005
+#define MIPS_CPU_ISA_III       0x00000004
+#define MIPS_CPU_ISA_IV                0x00000008
+#define MIPS_CPU_ISA_V         0x00000010
 #define MIPS_CPU_ISA_M32R1     0x00000020
 #define MIPS_CPU_ISA_M32R2     0x00000040
 #define MIPS_CPU_ISA_M64R1     0x00000080
diff --git a/include/asm-mips/gcc/sgidefs.h b/include/asm-mips/gcc/sgidefs.h
deleted file mode 100644 (file)
index 0599437..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * include/sgidefs.h
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996 by Ralf Baechle
- *
- * This file is here to satisfy GCC's expectations.
- */
-#ifndef __SGIDEFS_H
-#define __SGIDEFS_H
-
-#include <asm/sgidefs.h>
-
-#endif /* __SGIDEFS_H */
index c6a2e5f0574a46051624b915e02047a2b11f3a87..48b4cfaa0d5003f6ecf070f254fad7faccc62df2 100644 (file)
@@ -3,20 +3,11 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2003 by Ralf Baechle
+ * Copyright (C) 2003, 2005 by Ralf Baechle
  */
 #ifndef __ASM_MACH_GENERIC_TIMEX_H
 #define __ASM_MACH_GENERIC_TIMEX_H
 
-#include <linux/config.h>
-
-/*
- * Last remaining user of the i8254 PIC, will be converted, too ...
- */
-#ifdef CONFIG_SNI_RM200_PCI
-#define CLOCK_TICK_RATE                1193182
-#else
 #define CLOCK_TICK_RATE                500000
-#endif
 
 #endif /* __ASM_MACH_GENERIC_TIMEX_H */
diff --git a/include/asm-mips/mach-rm200/timex.h b/include/asm-mips/mach-rm200/timex.h
new file mode 100644 (file)
index 0000000..11ff6cb
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2003, 2005 by Ralf Baechle
+ */
+#ifndef __ASM_MACH_RM200_TIMEX_H
+#define __ASM_MACH_RM200_TIMEX_H
+
+#define CLOCK_TICK_RATE                1193182
+
+#endif /* __ASM_MACH_RM200_TIMEX_H */
index dd17c8bd62a1cbc4450db3b21035f8de94826639..6d01e26830fa55391b7feffb9d66d8d27f6c0609 100644 (file)
@@ -66,6 +66,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index cc53196efa40a0623383c6df50b0adaed3553a0f..9632c27dad15045ad66b443cbfe026ad02966800 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <asm/asm.h>
 #include <asm/cacheops.h>
+#include <asm/cpu-features.h>
 
 /*
  * This macro return a properly sign-extended address suitable as base address
@@ -78,22 +79,25 @@ static inline void flush_scache_line(unsigned long addr)
        cache_op(Hit_Writeback_Inv_SD, addr);
 }
 
+#define protected_cache_op(op,addr)                            \
+       __asm__ __volatile__(                                   \
+       "       .set    push                    \n"             \
+       "       .set    noreorder               \n"             \
+       "       .set    mips3                   \n"             \
+       "1:     cache   %0, (%1)                \n"             \
+       "2:     .set    pop                     \n"             \
+       "       .section __ex_table,\"a\"       \n"             \
+       "       "STR(PTR)" 1b, 2b               \n"             \
+       "       .previous"                                      \
+       :                                                       \
+       : "i" (op), "r" (addr))
+
 /*
  * The next two are for badland addresses like signal trampolines.
  */
 static inline void protected_flush_icache_line(unsigned long addr)
 {
-       __asm__ __volatile__(
-               "       .set    push                    \n"
-               "       .set    noreorder               \n"
-               "       .set    mips3                   \n"
-               "1:     cache   %0, (%1)                \n"
-               "2:     .set    pop                     \n"
-               "       .section __ex_table,\"a\"       \n"
-               "       "STR(PTR)" 1b, 2b               \n"
-               "       .previous"
-               :
-               : "i" (Hit_Invalidate_I), "r" (addr));
+       protected_cache_op(Hit_Invalidate_I, addr);
 }
 
 /*
@@ -104,32 +108,12 @@ static inline void protected_flush_icache_line(unsigned long addr)
  */
 static inline void protected_writeback_dcache_line(unsigned long addr)
 {
-       __asm__ __volatile__(
-               "       .set    push                    \n"
-               "       .set    noreorder               \n"
-               "       .set    mips3                   \n"
-               "1:     cache   %0, (%1)                \n"
-               "2:     .set    pop                     \n"
-               "       .section __ex_table,\"a\"       \n"
-               "       "STR(PTR)" 1b, 2b               \n"
-               "       .previous"
-               :
-               : "i" (Hit_Writeback_Inv_D), "r" (addr));
+       protected_cache_op(Hit_Writeback_Inv_D, addr);
 }
 
 static inline void protected_writeback_scache_line(unsigned long addr)
 {
-       __asm__ __volatile__(
-               "       .set    push                    \n"
-               "       .set    noreorder               \n"
-               "       .set    mips3                   \n"
-               "1:     cache   %0, (%1)                \n"
-               "2:     .set    pop                     \n"
-               "       .section __ex_table,\"a\"       \n"
-               "       "STR(PTR)" 1b, 2b               \n"
-               "       .previous"
-               :
-               : "i" (Hit_Writeback_Inv_SD), "r" (addr));
+       protected_cache_op(Hit_Writeback_Inv_SD, addr);
 }
 
 /*
@@ -295,4 +279,28 @@ __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64)
 __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
 __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
 
+/* build blast_xxx_range, protected_blast_xxx_range */
+#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot) \
+static inline void prot##blast_##pfx##cache##_range(unsigned long start, \
+                                                   unsigned long end)  \
+{                                                                      \
+       unsigned long lsize = cpu_##desc##_line_size();                 \
+       unsigned long addr = start & ~(lsize - 1);                      \
+       unsigned long aend = (end - 1) & ~(lsize - 1);                  \
+       while (1) {                                                     \
+               prot##cache_op(hitop, addr);                            \
+               if (addr == aend)                                       \
+                       break;                                          \
+               addr += lsize;                                          \
+       }                                                               \
+}
+
+__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_)
+__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_)
+__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_)
+__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, )
+__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, )
+/* blast_inv_dcache_range */
+__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, )
+
 #endif /* _ASM_R4KCACHE_H */
index 91d813a37823e03a68690233818a754eac0b8f05..7a553e9d44d3299ad26363b2947a299e2fd76727 100644 (file)
@@ -266,6 +266,8 @@ do {                                                                        \
  */
 #define __get_user_asm_ll32(val, addr)                                 \
 {                                                                      \
+        unsigned long long __gu_tmp;                                   \
+                                                                       \
        __asm__ __volatile__(                                           \
        "1:     lw      %1, (%3)                                \n"     \
        "2:     lw      %D1, 4(%3)                              \n"     \
@@ -280,8 +282,9 @@ do {                                                                        \
        "       " __UA_ADDR "   1b, 4b                          \n"     \
        "       " __UA_ADDR "   2b, 4b                          \n"     \
        "       .previous                                       \n"     \
-       : "=r" (__gu_err), "=&r" (val)                                  \
+       : "=r" (__gu_err), "=&r" (__gu_tmp)                             \
        : "0" (0), "r" (addr), "i" (-EFAULT));                          \
+       (val) = __gu_tmp;                                               \
 }
 
 /*
index e7ff9b1877835c4911d02afe6c747ecae6b02ca2..769305d20108338d00b8775c80ea4d8727e067ea 100644 (file)
@@ -1184,10 +1184,8 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_RT_SIGACTION
-# ifndef __mips64
-#  define __ARCH_WANT_STAT64
-# endif
 # ifdef CONFIG_32BIT
+#  define __ARCH_WANT_STAT64
 #  define __ARCH_WANT_SYS_TIME
 # endif
 # ifdef CONFIG_MIPS32_O32
index 736b0abcac052b1ad468ff0362bfe8e3173c531a..a381cf5c8f555c9429e1177d4bc983fc42dc9107 100644 (file)
@@ -49,6 +49,8 @@
 #define MADV_4M_PAGES   22              /* Use 4 Megabyte pages */
 #define MADV_16M_PAGES  24              /* Use 16 Megabyte pages */
 #define MADV_64M_PAGES  26              /* Use 64 Megabyte pages */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index a2e34c21b44f8f09455dad99aef78285d166da1a..fcff25d13f139d93330c273534f137dd0f0a00d3 100644 (file)
@@ -45,6 +45,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index c8d5409b5d563c383e9fa4f8378504b41c992473..d41ca1477010b9691e7d2150a0e8872948a5d0f2 100644 (file)
@@ -44,6 +44,8 @@
 #define MADV_WILLNEED  0x3              /* pre-fault pages */
 #define MADV_DONTNEED  0x4              /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index 693bd55a37104f543a2c5e3a21878bbc5cd3d395..0e08d0573abcb5ed46ddea0b20b0f51d14d488c5 100644 (file)
@@ -36,6 +36,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index 98435ad8619e0b0b5f5cd9aa882de51d6ea89948..4a298b2be8591d253a293824ac67afa78b2f848b 100644 (file)
@@ -55,6 +55,8 @@
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_FREE      0x5             /* (Solaris) contents can be freed */
 #define MADV_REMOVE    0x6             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index cb4b6156194dbe12dc92adfba8c3247400ebd0f8..d705ec92da8b03fe9fe2445ace035e51de507eff 100644 (file)
@@ -55,6 +55,8 @@
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_FREE      0x5             /* (Solaris) contents can be freed */
 #define MADV_REMOVE    0x6             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index edc79965193aa589e6810b35903fb7262c404927..7b851c310e41de6ce3362f5c941e2b0a81ec4078 100644 (file)
@@ -33,6 +33,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index d0e97b74f73591d0e430719f0861dc00dda1d224..b699a38c1c3ce751f76a19a9a8171d2df80a3b66 100644 (file)
@@ -37,6 +37,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index 082a7504925ed5bebeda7b910b25de6bc58075c1..e2d7afb679c803bad52d4413d45980abc7504e49 100644 (file)
@@ -73,6 +73,8 @@
 #define MADV_WILLNEED  0x3             /* pre-fault pages */
 #define MADV_DONTNEED  0x4             /* discard these pages */
 #define MADV_REMOVE    0x5             /* remove these pages & resources */
+#define MADV_DONTFORK  0x30            /* dont inherit across fork */
+#define MADV_DOFORK    0x31            /* do inherit across fork */
 
 /* compatibility flags */
 #define MAP_ANON       MAP_ANONYMOUS
index 0fe4aa891ddc1f1086493b65218b656ef8d9b7e1..41ee79962bb26c7dfc26dd7027de7abf59de3736 100644 (file)
@@ -497,12 +497,6 @@ struct transaction_s
         */
        struct journal_head     *t_checkpoint_list;
 
-       /*
-        * Doubly-linked circular list of all buffers submitted for IO while
-        * checkpointing. [j_list_lock]
-        */
-       struct journal_head     *t_checkpoint_io_list;
-
        /*
         * Doubly-linked circular list of temporary buffers currently undergoing
         * IO in the log [j_list_lock]
@@ -852,7 +846,7 @@ extern void journal_commit_transaction(journal_t *);
 
 /* Checkpoint list management */
 int __journal_clean_checkpoint_list(journal_t *journal);
-int __journal_remove_checkpoint(struct journal_head *);
+void __journal_remove_checkpoint(struct journal_head *);
 void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
 
 /* Buffer IO */
index 920766cea79cbc15634411e4c9633c27f6c8fd61..ef21ed296039dc87527c3eb777992851e0774bcf 100644 (file)
@@ -149,7 +149,7 @@ struct nlm_rqst * nlmclnt_alloc_call(void);
 int              nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl);
 void             nlmclnt_finish_block(struct nlm_rqst *req);
 long             nlmclnt_block(struct nlm_rqst *req, long timeout);
-u32              nlmclnt_grant(struct nlm_lock *);
+u32              nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
 void             nlmclnt_recovery(struct nlm_host *, u32);
 int              nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
 int              nlmclnt_setgrantargs(struct nlm_rqst *, struct nlm_lock *);
@@ -204,7 +204,7 @@ nlmsvc_file_inode(struct nlm_file *file)
  * Compare two host addresses (needs modifying for ipv6)
  */
 static __inline__ int
-nlm_cmp_addr(struct sockaddr_in *sin1, struct sockaddr_in *sin2)
+nlm_cmp_addr(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
 {
        return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
 }
@@ -214,7 +214,7 @@ nlm_cmp_addr(struct sockaddr_in *sin1, struct sockaddr_in *sin2)
  * When the second lock is of type F_UNLCK, this acts like a wildcard.
  */
 static __inline__ int
-nlm_compare_locks(struct file_lock *fl1, struct file_lock *fl2)
+nlm_compare_locks(const struct file_lock *fl1, const struct file_lock *fl2)
 {
        return  fl1->fl_pid   == fl2->fl_pid
             && fl1->fl_start == fl2->fl_start
index fdc4a95273439edd826eb928e0207420db4ea373..43c09d790b838151aba69d891638801a57e1e9d0 100644 (file)
@@ -79,7 +79,7 @@ enum nf_ip_hook_priorities {
 
 #ifdef __KERNEL__
 extern int ip_route_me_harder(struct sk_buff **pskb);
-
+extern int ip_xfrm_me_harder(struct sk_buff **pskb);
 #endif /*__KERNEL__*/
 
 #endif /*__LINUX_IP_NETFILTER_H*/
index 9d5cd106b344bc7a316bfb712cbc9509a8920075..0d36750fc0f10954cad808cb863183cf5e0265cd 100644 (file)
@@ -84,6 +84,7 @@ extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __us
 extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
 extern int ptrace_attach(struct task_struct *tsk);
 extern int ptrace_detach(struct task_struct *, unsigned int);
+extern void __ptrace_detach(struct task_struct *, unsigned int);
 extern void ptrace_disable(struct task_struct *);
 extern int ptrace_check_attach(struct task_struct *task, int kill);
 extern int ptrace_request(struct task_struct *child, long request, long addr, long data);
index 9c1da0269a18586778ef1c57d14294667127956f..b6f51e3a38ecdf990b018f38344afefa0a0110cc 100644 (file)
@@ -697,11 +697,8 @@ struct task_struct {
 
        int lock_depth;         /* BKL lock depth */
 
-#if defined(CONFIG_SMP)
-       int last_waker_cpu;     /* CPU that last woke this task up */
-#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
+#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
        int oncpu;
-#endif
 #endif
        int prio, static_prio;
        struct list_head run_list;
index 8e88b374cee90b646234d7cfa64b108c8ab9bbe2..fbea12d7a94378105bfa728b4c9d6e98d07d2bf3 100644 (file)
@@ -1123,8 +1123,8 @@ static task_t *copy_process(unsigned long clone_flags,
                p->real_parent = current;
        p->parent = p->real_parent;
 
+       spin_lock(&current->sighand->siglock);
        if (clone_flags & CLONE_THREAD) {
-               spin_lock(&current->sighand->siglock);
                /*
                 * Important: if an exit-all has been started then
                 * do not create this new thread - the whole thread
@@ -1162,8 +1162,6 @@ static task_t *copy_process(unsigned long clone_flags,
                         */
                        p->it_prof_expires = jiffies_to_cputime(1);
                }
-
-               spin_unlock(&current->sighand->siglock);
        }
 
        /*
@@ -1175,8 +1173,6 @@ static task_t *copy_process(unsigned long clone_flags,
        if (unlikely(p->ptrace & PT_PTRACED))
                __ptrace_link(p, current->parent);
 
-       attach_pid(p, PIDTYPE_PID, p->pid);
-       attach_pid(p, PIDTYPE_TGID, p->tgid);
        if (thread_group_leader(p)) {
                p->signal->tty = current->signal->tty;
                p->signal->pgrp = process_group(current);
@@ -1186,9 +1182,12 @@ static task_t *copy_process(unsigned long clone_flags,
                if (p->pid)
                        __get_cpu_var(process_counts)++;
        }
+       attach_pid(p, PIDTYPE_TGID, p->tgid);
+       attach_pid(p, PIDTYPE_PID, p->pid);
 
        nr_threads++;
        total_forks++;
+       spin_unlock(&current->sighand->siglock);
        write_unlock_irq(&tasklist_lock);
        proc_fork_connector(p);
        return p;
index 2b6e1757aeddf118f43c31111f46224b00f5d25e..5ae51f1bc7c80347d091bd4da0df2e8840c0bae4 100644 (file)
@@ -418,8 +418,19 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
        /* Switch the timer base, if necessary: */
        new_base = switch_hrtimer_base(timer, base);
 
-       if (mode == HRTIMER_REL)
+       if (mode == HRTIMER_REL) {
                tim = ktime_add(tim, new_base->get_time());
+               /*
+                * CONFIG_TIME_LOW_RES is a temporary way for architectures
+                * to signal that they simply return xtime in
+                * do_gettimeoffset(). In this case we want to round up by
+                * resolution when starting a relative timer, to avoid short
+                * timeouts. This will go away with the GTOD framework.
+                */
+#ifdef CONFIG_TIME_LOW_RES
+               tim = ktime_add(tim, base->resolution);
+#endif
+       }
        timer->expires = tim;
 
        enqueue_hrtimer(timer, new_base);
index 5f33cdb6fff5f7e629842a8bee7865bb2607515c..d95a72c9279dc2e1110d31c0dadacc39b30b198f 100644 (file)
@@ -72,8 +72,8 @@ void ptrace_untrace(task_t *child)
  */
 void __ptrace_unlink(task_t *child)
 {
-       if (!child->ptrace)
-               BUG();
+       BUG_ON(!child->ptrace);
+
        child->ptrace = 0;
        if (!list_empty(&child->ptrace_list)) {
                list_del_init(&child->ptrace_list);
@@ -184,22 +184,27 @@ bad:
        return retval;
 }
 
+void __ptrace_detach(struct task_struct *child, unsigned int data)
+{
+       child->exit_code = data;
+       /* .. re-parent .. */
+       __ptrace_unlink(child);
+       /* .. and wake it up. */
+       if (child->exit_state != EXIT_ZOMBIE)
+               wake_up_process(child);
+}
+
 int ptrace_detach(struct task_struct *child, unsigned int data)
 {
        if (!valid_signal(data))
-               return  -EIO;
+               return -EIO;
 
        /* Architecture-specific hardware disable .. */
        ptrace_disable(child);
 
-       /* .. re-parent .. */
-       child->exit_code = data;
-
        write_lock_irq(&tasklist_lock);
-       __ptrace_unlink(child);
-       /* .. and wake it up. */
-       if (child->exit_state != EXIT_ZOMBIE)
-               wake_up_process(child);
+       if (child->ptrace)
+               __ptrace_detach(child, data);
        write_unlock_irq(&tasklist_lock);
 
        return 0;
@@ -242,8 +247,7 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
                if (write) {
                        copy_to_user_page(vma, page, addr,
                                          maddr + offset, buf, bytes);
-                       if (!PageCompound(page))
-                               set_page_dirty_lock(page);
+                       set_page_dirty_lock(page);
                } else {
                        copy_from_user_page(vma, page, addr,
                                            buf, maddr + offset, bytes);
index 87d93be336a111eb542dccfa652d7a5940451c33..66d957227de9c847953961224828eff723e71057 100644 (file)
@@ -1204,9 +1204,6 @@ static int try_to_wake_up(task_t *p, unsigned int state, int sync)
                }
        }
 
-       if (p->last_waker_cpu != this_cpu)
-               goto out_set_cpu;
-
        if (unlikely(!cpu_isset(this_cpu, p->cpus_allowed)))
                goto out_set_cpu;
 
@@ -1277,8 +1274,6 @@ out_set_cpu:
                cpu = task_cpu(p);
        }
 
-       p->last_waker_cpu = this_cpu;
-
 out_activate:
 #endif /* CONFIG_SMP */
        if (old_state == TASK_UNINTERRUPTIBLE) {
@@ -1360,12 +1355,9 @@ void fastcall sched_fork(task_t *p, int clone_flags)
 #ifdef CONFIG_SCHEDSTATS
        memset(&p->sched_info, 0, sizeof(p->sched_info));
 #endif
-#if defined(CONFIG_SMP)
-       p->last_waker_cpu = cpu;
-#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
+#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
        p->oncpu = 0;
 #endif
-#endif
 #ifdef CONFIG_PREEMPT
        /* Want to start with kernel preemption disabled. */
        task_thread_info(p)->preempt_count = 1;
index 67f29516662a4b9d3c2291731a2259808646f54c..508707704d2cb714968a779e128084d640afc439 100644 (file)
@@ -85,7 +85,7 @@ void free_huge_page(struct page *page)
        BUG_ON(page_count(page));
 
        INIT_LIST_HEAD(&page->lru);
-       page[1].mapping = NULL;
+       page[1].lru.next = NULL;                        /* reset dtor */
 
        spin_lock(&hugetlb_lock);
        enqueue_huge_page(page);
@@ -105,7 +105,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr)
        }
        spin_unlock(&hugetlb_lock);
        set_page_count(page, 1);
-       page[1].mapping = (void *)free_huge_page;
+       page[1].lru.next = (void *)free_huge_page;      /* set dtor */
        for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
                clear_user_highpage(&page[i], addr);
        return page;
index ae0ae3ea299a7a83b72939236ef4931eb5ac16d0..af3d573b014122f7fd2a99c3ee90c3826f70457f 100644 (file)
@@ -22,16 +22,23 @@ static long madvise_behavior(struct vm_area_struct * vma,
        struct mm_struct * mm = vma->vm_mm;
        int error = 0;
        pgoff_t pgoff;
-       int new_flags = vma->vm_flags & ~VM_READHINTMASK;
+       int new_flags = vma->vm_flags;
 
        switch (behavior) {
+       case MADV_NORMAL:
+               new_flags = new_flags & ~VM_RAND_READ & ~VM_SEQ_READ;
+               break;
        case MADV_SEQUENTIAL:
-               new_flags |= VM_SEQ_READ;
+               new_flags = (new_flags & ~VM_RAND_READ) | VM_SEQ_READ;
                break;
        case MADV_RANDOM:
-               new_flags |= VM_RAND_READ;
+               new_flags = (new_flags & ~VM_SEQ_READ) | VM_RAND_READ;
                break;
-       default:
+       case MADV_DONTFORK:
+               new_flags |= VM_DONTCOPY;
+               break;
+       case MADV_DOFORK:
+               new_flags &= ~VM_DONTCOPY;
                break;
        }
 
@@ -177,6 +184,12 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
        long error;
 
        switch (behavior) {
+       case MADV_DOFORK:
+               if (vma->vm_flags & VM_IO) {
+                       error = -EINVAL;
+                       break;
+               }
+       case MADV_DONTFORK:
        case MADV_NORMAL:
        case MADV_SEQUENTIAL:
        case MADV_RANDOM:
index dde04ff4be31873b88c38efbf94d30fd06ca5329..62c122528587d47063b7185917c9b61d27e6383e 100644 (file)
@@ -56,6 +56,7 @@ long nr_swap_pages;
 int percpu_pagelist_fraction;
 
 static void fastcall free_hot_cold_page(struct page *page, int cold);
+static void __free_pages_ok(struct page *page, unsigned int order);
 
 /*
  * results with 256, 32 in the lowmem_reserve sysctl:
@@ -169,20 +170,23 @@ static void bad_page(struct page *page)
  * All pages have PG_compound set.  All pages have their ->private pointing at
  * the head page (even the head page has this).
  *
- * The first tail page's ->mapping, if non-zero, holds the address of the
- * compound page's put_page() function.
- *
- * The order of the allocation is stored in the first tail page's ->index
- * This is only for debug at present.  This usage means that zero-order pages
- * may not be compound.
+ * The first tail page's ->lru.next holds the address of the compound page's
+ * put_page() function.  Its ->lru.prev holds the order of allocation.
+ * This usage means that zero-order pages may not be compound.
  */
+
+static void free_compound_page(struct page *page)
+{
+       __free_pages_ok(page, (unsigned long)page[1].lru.prev);
+}
+
 static void prep_compound_page(struct page *page, unsigned long order)
 {
        int i;
        int nr_pages = 1 << order;
 
-       page[1].mapping = NULL;
-       page[1].index = order;
+       page[1].lru.next = (void *)free_compound_page;  /* set dtor */
+       page[1].lru.prev = (void *)order;
        for (i = 0; i < nr_pages; i++) {
                struct page *p = page + i;
 
@@ -196,7 +200,7 @@ static void destroy_compound_page(struct page *page, unsigned long order)
        int i;
        int nr_pages = 1 << order;
 
-       if (unlikely(page[1].index != order))
+       if (unlikely((unsigned long)page[1].lru.prev != order))
                bad_page(page);
 
        for (i = 0; i < nr_pages; i++) {
index 76247424dea185d92997032d7c848dc5a550482a..cce3dda59c595560dc90ede2bf6f12e193e4312f 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -40,7 +40,7 @@ static void put_compound_page(struct page *page)
        if (put_page_testzero(page)) {
                void (*dtor)(struct page *page);
 
-               dtor = (void (*)(struct page *))page[1].mapping;
+               dtor = (void (*)(struct page *))page[1].lru.next;
                (*dtor)(page);
        }
 }
index cc047f7fb6efc9c4deb42d6aab17f48a778d0474..35cf3a07408725608f368ccfe97e338b3ab9e678 100644 (file)
@@ -67,7 +67,7 @@ void br_stp_disable_bridge(struct net_bridge *br)
 {
        struct net_bridge_port *p;
 
-       spin_lock(&br->lock);
+       spin_lock_bh(&br->lock);
        list_for_each_entry(p, &br->port_list, list) {
                if (p->state != BR_STATE_DISABLED)
                        br_stp_disable_port(p);
@@ -76,7 +76,7 @@ void br_stp_disable_bridge(struct net_bridge *br)
 
        br->topology_change = 0;
        br->topology_change_detected = 0;
-       spin_unlock(&br->lock);
+       spin_unlock_bh(&br->lock);
 
        del_timer_sync(&br->hello_timer);
        del_timer_sync(&br->topology_change_timer);
index 52a3d7c579076e8bc7e260534ab4876032cf04af..ed42cdc57cd95c42614d1dc70d60a2b820dc1ed9 100644 (file)
@@ -78,6 +78,47 @@ int ip_route_me_harder(struct sk_buff **pskb)
 }
 EXPORT_SYMBOL(ip_route_me_harder);
 
+#ifdef CONFIG_XFRM
+int ip_xfrm_me_harder(struct sk_buff **pskb)
+{
+       struct flowi fl;
+       unsigned int hh_len;
+       struct dst_entry *dst;
+
+       if (IPCB(*pskb)->flags & IPSKB_XFRM_TRANSFORMED)
+               return 0;
+       if (xfrm_decode_session(*pskb, &fl, AF_INET) < 0)
+               return -1;
+
+       dst = (*pskb)->dst;
+       if (dst->xfrm)
+               dst = ((struct xfrm_dst *)dst)->route;
+       dst_hold(dst);
+
+       if (xfrm_lookup(&dst, &fl, (*pskb)->sk, 0) < 0)
+               return -1;
+
+       dst_release((*pskb)->dst);
+       (*pskb)->dst = dst;
+
+       /* Change in oif may mean change in hh_len. */
+       hh_len = (*pskb)->dst->dev->hard_header_len;
+       if (skb_headroom(*pskb) < hh_len) {
+               struct sk_buff *nskb;
+
+               nskb = skb_realloc_headroom(*pskb, hh_len);
+               if (!nskb)
+                       return -1;
+               if ((*pskb)->sk)
+                       skb_set_owner_w(nskb, (*pskb)->sk);
+               kfree_skb(*pskb);
+               *pskb = nskb;
+       }
+       return 0;
+}
+EXPORT_SYMBOL(ip_xfrm_me_harder);
+#endif
+
 void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
 EXPORT_SYMBOL(ip_nat_decode_session);
 
index 92c54999a19d023d049af354123b096839757aad..7c3f7d380240b6fd1b00f90f9dfd87cea0b7b9b3 100644 (file)
@@ -235,19 +235,19 @@ ip_nat_out(unsigned int hooknum,
                return NF_ACCEPT;
 
        ret = ip_nat_fn(hooknum, pskb, in, out, okfn);
+#ifdef CONFIG_XFRM
        if (ret != NF_DROP && ret != NF_STOLEN
            && (ct = ip_conntrack_get(*pskb, &ctinfo)) != NULL) {
                enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
 
                if (ct->tuplehash[dir].tuple.src.ip !=
                    ct->tuplehash[!dir].tuple.dst.ip
-#ifdef CONFIG_XFRM
                    || ct->tuplehash[dir].tuple.src.u.all !=
                       ct->tuplehash[!dir].tuple.dst.u.all
-#endif
                    )
-                       return ip_route_me_harder(pskb) == 0 ? ret : NF_DROP;
+                       return ip_xfrm_me_harder(pskb) == 0 ? ret : NF_DROP;
        }
+#endif
        return ret;
 }