1. 13 2月, 2009 3 次提交
    • J
      x86, hpet: fix for LS21 + HPET = boot hang · b13e2464
      john stultz 提交于
      Between 2.6.23 and 2.6.24-rc1 a change was made that broke IBM LS21
      systems that had the HPET enabled in the BIOS, resulting in boot hangs
      for x86_64.
      
      Specifically commit b8ce3359, which
      merges the i386 and x86_64 HPET code.
      
      Prior to this commit, when we setup the HPET timers in x86_64, we did
      the following:
      
      	hpet_writel(HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                          HPET_TN_32BIT, HPET_T0_CFG);
      
      However after the i386/x86_64 HPET merge, we do the following:
      
      	cfg = hpet_readl(HPET_Tn_CFG(timer));
      	cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
      			HPET_TN_SETVAL | HPET_TN_32BIT;
      	hpet_writel(cfg, HPET_Tn_CFG(timer));
      
      However on LS21s with HPET enabled in the BIOS, the HPET_T0_CFG register
      boots with Level triggered interrupts (HPET_TN_LEVEL) enabled. This
      causes the periodic interrupt to be not so periodic, and that results in
      the boot time hang I reported earlier in the delay calibration.
      
      My fix: Always disable HPET_TN_LEVEL when setting up periodic mode.
      Signed-off-by: NJohn Stultz <johnstul@us.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b13e2464
    • T
      x86: warn if arch_flush_lazy_mmu_cpu is called in preemptible context · 34b0900d
      Thomas Gleixner 提交于
      Impact: Catch cases where lazy MMU state is active in a preemtible context
      
      arch_flush_lazy_mmu_cpu() has been changed to disable preemption so
      the checks in enter/leave will never trigger. Put the preemtible()
      check into arch_flush_lazy_mmu_cpu() to catch such cases.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      34b0900d
    • J
      x86/paravirt: make arch_flush_lazy_mmu/cpu disable preemption · d85cf93d
      Jeremy Fitzhardinge 提交于
      Impact: avoid access to percpu vars in preempible context
      
      They are intended to be used whenever there's the possibility
      that there's some stale state which is going to be overwritten
      with a queued update, or to force a state change when we may be
      in lazy mode.  Either way, we could end up calling it with
      preemption enabled, so wrap the functions in their own little
      preempt-disable section so they can be safely called in any
      context (though preemption should never be enabled if we're actually
      in a lazy state).
      
      (Move out of line to avoid #include dependencies.)
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      d85cf93d
  2. 12 2月, 2009 3 次提交
    • H
      x86: merge sys_rt_sigreturn between 32 and 64 bits · 74452509
      H. Peter Anvin 提交于
      Impact: cleanup
      
      With the recent changes in the 32-bit code to make system calls which
      use struct pt_regs take a pointer, sys_rt_sigreturn() have become
      identical between 32 and 64 bits, and both are empty wrappers around
      do_rt_sigreturn().  Remove both wrappers and rename both to
      sys_rt_sigreturn().
      
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Tejun Heo <tj@kernel.org>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      74452509
    • B
      x86: use regparm(3) for passed-in pt_regs pointer · b12bdaf1
      Brian Gerst 提交于
      Some syscalls need to access the pt_regs structure, either to copy
      user register state or to modifiy it.  This patch adds stubs to load
      the address of the pt_regs struct into the %eax register, and changes
      the syscalls to take the pointer as an argument instead of relying on
      the assumption that the pt_regs structure overlaps the function
      arguments.
      
      Drop the use of regparm(1) due to concern about gcc bugs, and to move
      in the direction of the eventual removal of regparm(0) for asmlinkage.
      Signed-off-by: NBrian Gerst <brgerst@gmail.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      b12bdaf1
    • J
      x86: kernel/mpparse.c fix compilation warnings · ba1511bf
      Jaswinder Singh Rajput 提交于
       arch/x86/kernel/mpparse.c: In function ‘smp_scan_config’:
       arch/x86/kernel/mpparse.c:696: warning: format ‘%08lx’ expects type ‘long unsigned int’, but argument 3 has type ‘phys_addr_t’
       arch/x86/kernel/mpparse.c: In function ‘update_mp_table’:
       arch/x86/kernel/mpparse.c:1014: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 2 has type ‘phys_addr_t’
      Signed-off-by: NJaswinder Singh Rajput <jaswinderrajput@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ba1511bf
  3. 11 2月, 2009 9 次提交
    • M
      x86, ptrace, mm: fix double-free on race · 9f339e70
      Markus Metzger 提交于
      Ptrace_detach() races with __ptrace_unlink() if the traced task is
      reaped while detaching. This might cause a double-free of the BTS
      buffer.
      
      Change the ptrace_detach() path to only do the memory accounting in
      ptrace_bts_detach() and leave the buffer free to ptrace_bts_untrace()
      which will be called from __ptrace_unlink().
      
      The fix follows a proposal from Oleg Nesterov.
      Reported-by: NOleg Nesterov <oleg@redhat.com>
      Signed-off-by: NMarkus Metzger <markus.t.metzger@intel.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9f339e70
    • B
      x86: drop -fno-stack-protector annotations after pt_regs fixes · 9c8bb6b5
      Brian Gerst 提交于
      Now that no functions rely on struct pt_regs being passed by value,
      various "no stack protector" annotations can be dropped.
      Signed-off-by: NBrian Gerst <brgerst@gmail.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9c8bb6b5
    • B
      x86: pass in pt_regs pointer for syscalls that need it · 253f29a4
      Brian Gerst 提交于
      Some syscalls need to access the pt_regs structure, either to copy
      user register state or to modifiy it.  This patch adds stubs to load
      the address of the pt_regs struct into the %eax register, and changes
      the syscalls to regparm(1) to receive the pt_regs pointer as the
      first argument.
      Signed-off-by: NBrian Gerst <brgerst@gmail.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      253f29a4
    • B
      x86: use pt_regs pointer in do_device_not_available() · aa78bcfa
      Brian Gerst 提交于
      The generic exception handler (error_code) passes in the pt_regs
      pointer and the error code (unused in this case).  The commit
      "x86: fix math_emu register frame access" changed this to pass by
      value, which doesn't work correctly with stack protector enabled.
      Change it back to use the pt_regs pointer.
      Signed-off-by: NBrian Gerst <brgerst@gmail.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      aa78bcfa
    • T
      x86: fix x86_32 stack protector bugs · 5c79d2a5
      Tejun Heo 提交于
      Impact: fix x86_32 stack protector
      
      Brian Gerst found out that %gs was being initialized to stack_canary
      instead of stack_canary - 20, which basically gave the same canary
      value for all threads.  Fixing this also exposed the following bugs.
      
      * cpu_idle() didn't call boot_init_stack_canary()
      
      * stack canary switching in switch_to() was being done too late making
        the initial run of a new thread use the old stack canary value.
      
      Fix all of them and while at it update comment in cpu_idle() about
      calling boot_init_stack_canary().
      Reported-by: NBrian Gerst <brgerst@gmail.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5c79d2a5
    • I
      x86, apic: make generic_apic_probe() generally available · 160d8dac
      Ingo Molnar 提交于
      Impact: build fix
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      160d8dac
    • A
      x86, apic: fix initialization of wakeup_cpu · 0e81cb59
      Alok Kataria 提交于
      With refactoring of wake_cpu macros the 32bit code in tip doesn't
      execute generic_apic_probe if CONFIG_X86_32_NON_STANDARD is not set.
      
      Even on a x86 STANDARD cpu we need to execute the generic_apic_probe
      function, as we rely on this function to execute the update_genapic
      quirk which initilizes apic->wakeup_cpu.
      
      Failing to do so results in we making a call to a null function in do_boot_cpu.
      
      The stack trace without the patch goes like this.
      
      Booting processor 1 APIC 0x1 ip 0x6000
      BUG: unable to handle kernel NULL pointer dereference at (null)
      IP: [<(null)>] (null)
      *pdpt = 0000000000839001 *pde = 0000000000c97067 *pte = 0000000000000163
      Oops: 0000 [#1] SMP
      last sysfs file:
      Modules linked in:
      
      Pid: 1, comm: swapper Not tainted (2.6.29-rc4-tip #18) VMware Virtual Platform
      EIP: 0062:[<00000000>] EFLAGS: 00010293 CPU: 0
      EIP is at 0x0
      EAX: 00000001 EBX: 00006000 ECX: c077ed00 EDX: 00006000
      ESI: 00000001 EDI: 00000001 EBP: ef04cf40 ESP: ef04cf1c
       DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 006a
      Process swapper (pid: 1, ti=ef04c000 task=ef050000 task.ti=ef04c000)
      Stack:
       c0644e52 00000000 ef04cf24 ef04cf24 c064468d c0886dc0 00000000 c0702aea
       ef055480 00000001 00000101 dead4ead ffffffff ffffffff c08af530 00000000
       c0709715 ef04cf60 ef04cf60 00000001 00000000 00000000 dead4ead ffffffff
      Call Trace:
       [<c0644e52>] ? native_cpu_up+0x2de/0x45b
       [<c064468d>] ? do_fork_idle+0x0/0x19
       [<c0645c5e>] ? _cpu_up+0x88/0xe8
       [<c0645d20>] ? cpu_up+0x42/0x4e
       [<c07e7462>] ? kernel_init+0x99/0x14b
       [<c07e73c9>] ? kernel_init+0x0/0x14b
       [<c040375f>] ? kernel_thread_helper+0x7/0x10
      Code:  Bad EIP value.
      EIP: [<00000000>] 0x0 SS:ESP 006a:ef04cf1c
      
      I think we should call generic_apic_probe unconditionally for 32 bit now.
      Signed-off-by: NAlok N Kataria <akataria@vmware.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0e81cb59
    • S
      tracing, x86: fix constraint for parent variable · f47a454d
      Steven Rostedt 提交于
      The constraint used for retrieving and restoring the parent function
      pointer is incorrect. The parent variable is a pointer, and the
      address of the pointer is modified by the asm statement and not
      the pointer itself. It is incorrect to pass it in as an output
      constraint since the asm will never update the pointer.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f47a454d
    • S
      tracing, x86: fix fixup section to return to original code · e3944bfa
      Steven Rostedt 提交于
      Impact: fix to prevent a kernel crash on fault
      
      If for some reason the pointer to the parent function on the
      stack takes a fault, the fix up code will not return back to
      the original faulting code. This can lead to unpredictable
      results and perhaps even a kernel panic.
      
      A fault should not happen, but if it does, we should simply
      disable the tracer, warn, and continue running the kernel.
      It should not lead to a kernel crash.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      e3944bfa
  4. 10 2月, 2009 9 次提交
    • C
      i8327: fix outb() parameter order · b52af409
      Clemens Ladisch 提交于
      In i8237A_resume(), when resetting the DMA controller, the parameters to
      dma_outb() were mixed up.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      [ cleaned up the file a tiny bit. ]
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b52af409
    • T
      x86: implement x86_32 stack protector · 60a5317f
      Tejun Heo 提交于
      Impact: stack protector for x86_32
      
      Implement stack protector for x86_32.  GDT entry 28 is used for it.
      It's set to point to stack_canary-20 and have the length of 24 bytes.
      CONFIG_CC_STACKPROTECTOR turns off CONFIG_X86_32_LAZY_GS and sets %gs
      to the stack canary segment on entry.  As %gs is otherwise unused by
      the kernel, the canary can be anywhere.  It's defined as a percpu
      variable.
      
      x86_32 exception handlers take register frame on stack directly as
      struct pt_regs.  With -fstack-protector turned on, gcc copies the
      whole structure after the stack canary and (of course) doesn't copy
      back on return thus losing all changed.  For now, -fno-stack-protector
      is added to all files which contain those functions.  We definitely
      need something better.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      60a5317f
    • T
      x86: make lazy %gs optional on x86_32 · ccbeed3a
      Tejun Heo 提交于
      Impact: pt_regs changed, lazy gs handling made optional, add slight
              overhead to SAVE_ALL, simplifies error_code path a bit
      
      On x86_32, %gs hasn't been used by kernel and handled lazily.  pt_regs
      doesn't have place for it and gs is saved/loaded only when necessary.
      In preparation for stack protector support, this patch makes lazy %gs
      handling optional by doing the followings.
      
      * Add CONFIG_X86_32_LAZY_GS and place for gs in pt_regs.
      
      * Save and restore %gs along with other registers in entry_32.S unless
        LAZY_GS.  Note that this unfortunately adds "pushl $0" on SAVE_ALL
        even when LAZY_GS.  However, it adds no overhead to common exit path
        and simplifies entry path with error code.
      
      * Define different user_gs accessors depending on LAZY_GS and add
        lazy_save_gs() and lazy_load_gs() which are noop if !LAZY_GS.  The
        lazy_*_gs() ops are used to save, load and clear %gs lazily.
      
      * Define ELF_CORE_COPY_KERNEL_REGS() which always read %gs directly.
      
      xen and lguest changes need to be verified.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ccbeed3a
    • T
      x86: add %gs accessors for x86_32 · d9a89a26
      Tejun Heo 提交于
      Impact: cleanup
      
      On x86_32, %gs is handled lazily.  It's not saved and restored on
      kernel entry/exit but only when necessary which usually is during task
      switch but there are few other places.  Currently, it's done by
      calling savesegment() and loadsegment() explicitly.  Define
      get_user_gs(), set_user_gs() and task_user_gs() and use them instead.
      
      While at it, clean up register access macros in signal.c.
      
      This cleans up code a bit and will help future changes.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d9a89a26
    • T
      x86: use asm .macro instead of cpp #define in entry_32.S · f0d96110
      Tejun Heo 提交于
      Impact: cleanup
      
      Use .macro instead of cpp #define where approriate.  This cleans up
      code and will ease future changes.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f0d96110
    • T
      x86: fix math_emu register frame access · d315760f
      Tejun Heo 提交于
      do_device_not_available() is the handler for #NM and it declares that
      it takes a unsigned long and calls math_emu(), which takes a long
      argument and surprisingly expects the stack frame starting at the zero
      argument would match struct math_emu_info, which isn't true regardless
      of configuration in the current code.
      
      This patch makes do_device_not_available() take struct pt_regs like
      other exception handlers and initialize struct math_emu_info with
      pointer to it and pass pointer to the math_emu_info to math_emulate()
      like normal C functions do.  This way, unless gcc makes a copy of
      struct pt_regs in do_device_not_available(), the register frame is
      correctly accessed regardless of kernel configuration or compiler
      used.
      
      This doesn't fix all math_emu problems but it at least gets it
      somewhat working.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d315760f
    • J
      x86: unstatic ioapic entry funcs · ca97ab90
      Jeremy Fitzhardinge 提交于
      Unstatic ioapic_write_entry and setup_ioapic_entry functions so that
      the Xen code can do its own ioapic routing setup.
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      ca97ab90
    • J
      x86: add mp_find_ioapic_pin · c3e137d1
      Jeremy Fitzhardinge 提交于
      Add mp_find_ioapic_pin() to find an IO APIC's specific pin from a GSI,
      and use this function within acpi/boot.  Make it non-static so other
      code can use it too.
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      c3e137d1
    • J
  5. 09 2月, 2009 16 次提交