1. 27 5月, 2012 1 次提交
    • L
      x86: use generic strncpy_from_user routine · 4ae73f2d
      Linus Torvalds 提交于
      The generic strncpy_from_user() is not really optimal, since it is
      designed to work on both little-endian and big-endian.  And on
      little-endian you can simplify much of the logic to find the first zero
      byte, since little-endian arithmetic doesn't have to worry about the
      carry bit propagating into earlier bytes (only later bytes, which we
      don't care about).
      
      But I have patches to make the generic routines use the architecture-
      specific <asm/word-at-a-time.h> infrastructure, so that we can regain
      the little-endian optimizations.  But before we do that, switch over to
      the generic routines to make the patches each do just one well-defined
      thing.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4ae73f2d
  2. 25 5月, 2012 1 次提交
  3. 24 5月, 2012 2 次提交
    • H
      x86, relocs: Add jiffies and jiffies_64 to the relative whitelist · ea17e741
      H. Peter Anvin 提交于
      The symbol jiffies is created in the linker script as an alias to
      jiffies_64.  Unfortunately this is done outside any section, and
      apparently GNU ld 2.21 doesn't carry the section with it, so we end up
      with an absolute symbol and therefore a broken kernel.
      
      Add jiffies and jiffies_64 to the whitelist.
      
      The most disturbing bit with this discovery is that it shows that we
      have had multiple linker bugs in this area crossing multiple
      generations, and have been silently building bad kernels for some time.
      
      Link: http://lkml.kernel.org/r/20120524171604.0d98284f3affc643e9714470@canb.auug.org.auReported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      Cc: <stable@vger.kernel.org> v3.4
      ea17e741
    • H
      x86-32, relocs: Whitelist more symbols for ld bug workaround · fd952815
      H. Peter Anvin 提交于
      As noted in checkin:
      
      a3e854d9 x86, relocs: Workaround for binutils 2.22.52.0.1 section bug
      
      ld version 2.22.52.0.[12] can incorrectly promote relative symbols to
      absolute, if the output section they appear in is otherwise empty.
      
      Since checkin:
      
      6520fe55 x86, realmode: 16-bit real-mode code support for relocs tool
      
      we actually check for this and error out rather than silently creating
      a kernel which will malfunction if relocated.
      
      Ingo found a configuration in which __start_builtin_fw triggered the
      warning.
      
      Go through the linker script sources and look for more symbols that
      could plausibly get bogusly promoted to absolute, and add them to the
      whitelist.
      
      In general, if the following error triggers:
      
      	Invalid absolute R_386_32 relocation: <symbol>
      
      ... then we should verify that <symbol> is really meant to be
      relocated, and add it and any related symbols manually to the S_REL
      regexp.
      
      Please note that 6520fe55 does not introduce the error, only the check
      for the error -- without 6520fe55 this version of ld will simply
      produce a corrupt kernel if CONFIG_RELOCATABLE is set on x86-32.
      Reported-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      Cc: <stable@vger.kernel.org> v3.4
      fd952815
  4. 22 5月, 2012 11 次提交
  5. 21 5月, 2012 4 次提交
  6. 19 5月, 2012 3 次提交
    • H
      x86, relocs: When printing an error, say relative or absolute · 24ab82bd
      H. Peter Anvin 提交于
      When the relocs tool throws an error, let the error message say if it
      is an absolute or relative symbol.  This should make it a lot more
      clear what action the programmer needs to take and should help us find
      the reason if additional symbol bugs show up.
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      Cc: <stable@vger.kernel.org>
      24ab82bd
    • H
      x86, relocs: Workaround for binutils 2.22.52.0.1 section bug · a3e854d9
      H. Peter Anvin 提交于
      GNU ld 2.22.52.0.1 has a bug that it blindly changes symbols from
      section-relative to absolute if they are in a section of zero length.
      This turns the symbols __init_begin and __init_end into absolute
      symbols.  Let the relocs program know that those should be treated as
      relative symbols.
      Reported-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      Cc: H.J. Lu <hjl.tools@gmail.com>
      Cc: <stable@vger.kernel.org>
      Cc: Jarkko Sakkinen <jarkko.sakkinen@intel.com>
      a3e854d9
    • H
      x86, realmode: 16-bit real-mode code support for relocs tool · 6520fe55
      H. Peter Anvin 提交于
      A new option is added to the relocs tool called '--realmode'.
      This option causes the generation of 16-bit segment relocations
      and 32-bit linear relocations for the real-mode code. When
      the real-mode code is moved to the low-memory during kernel
      initialization, these relocation entries can be used to
      relocate the code properly.
      
      In the assembly code 16-bit segment relocations must be relative
      to the 'real_mode_seg' absolute symbol. Linear relocations must be
      relative to a symbol prefixed with 'pa_'.
      
      16-bit segment relocation is used to load cs:ip in 16-bit code.
      Linear relocations are used in the 32-bit code for relocatable
      data references. They are declared in the linker script of the
      real-mode code.
      
      The relocs tool is moved to arch/x86/tools/relocs.c, and added new
      target archscripts that can be used to build scripts needed building
      an architecture.  be compiled before building the arch/x86 tree.
      
      [ hpa: accelerating this because it detects invalid absolute
        relocations, a serious bug in binutils 2.22.52.0.x which currently
        produces bad kernels. ]
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      Link: http://lkml.kernel.org/r/1336501366-28617-2-git-send-email-jarkko.sakkinen@intel.comSigned-off-by: NJarkko Sakkinen <jarkko.sakkinen@intel.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      6520fe55
  7. 18 5月, 2012 10 次提交
  8. 17 5月, 2012 8 次提交
    • P
      sched: Remove stale power aware scheduling remnants and dysfunctional knobs · 8e7fbcbc
      Peter Zijlstra 提交于
      It's been broken forever (i.e. it's not scheduling in a power
      aware fashion), as reported by Suresh and others sending
      patches, and nobody cares enough to fix it properly ...
      so remove it to make space free for something better.
      
      There's various problems with the code as it stands today, first
      and foremost the user interface which is bound to topology
      levels and has multiple values per level. This results in a
      state explosion which the administrator or distro needs to
      master and almost nobody does.
      
      Furthermore large configuration state spaces aren't good, it
      means the thing doesn't just work right because it's either
      under so many impossibe to meet constraints, or even if
      there's an achievable state workloads have to be aware of
      it precisely and can never meet it for dynamic workloads.
      
      So pushing this kind of decision to user-space was a bad idea
      even with a single knob - it's exponentially worse with knobs
      on every node of the topology.
      
      There is a proposal to replace the user interface with a single
      3 state knob:
      
       sched_balance_policy := { performance, power, auto }
      
      where 'auto' would be the preferred default which looks at things
      like Battery/AC mode and possible cpufreq state or whatever the hw
      exposes to show us power use expectations - but there's been no
      progress on it in the past many months.
      
      Aside from that, the actual implementation of the various knobs
      is known to be broken. There have been sporadic attempts at
      fixing things but these always stop short of reaching a mergable
      state.
      
      Therefore this wholesale removal with the hopes of spurring
      people who care to come forward once again and work on a
      coherent replacement.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Suresh Siddha <suresh.b.siddha@intel.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Vincent Guittot <vincent.guittot@linaro.org>
      Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/1326104915.2442.53.camel@twinsSigned-off-by: NIngo Molnar <mingo@kernel.org>
      8e7fbcbc
    • D
      x86/vga: fix build with efi disabled. · db2e034d
      Dave Airlie 提交于
      Reported by sfr on -next merge.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      db2e034d
    • S
      ftrace/x86: Have x86 ftrace use the ftrace_modify_all_code() · e4f5d544
      Steven Rostedt 提交于
      To remove duplicate code, have the ftrace arch_ftrace_update_code()
      use the generic ftrace_modify_all_code(). This requires that the
      default ftrace_replace_code() becomes a weak function so that an
      arch may override it.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      e4f5d544
    • S
      x86, fpu: drop the fpu state during thread exit · 1dcc8d7b
      Suresh Siddha 提交于
      There is no need to save any active fpu state to the task structure
      memory if the task is dead. Just drop the state instead.
      
      For example, this saved some 1770 xsave's during the system boot
      of a two socket Xeon system.
      Suggested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSuresh Siddha <suresh.b.siddha@intel.com>
      Link: http://lkml.kernel.org/r/1336692811-30576-4-git-send-email-suresh.b.siddha@intel.com
      Cc: Oleg Nesterov <oleg@redhat.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      1dcc8d7b
    • S
      x86, xsave: remove thread_has_fpu() bug check in __sanitize_i387_state() · d75f1b39
      Suresh Siddha 提交于
      Code paths like fork(), exit() and signal handling flush the fpu
      state explicitly to the structures in memory.
      
      BUG_ON() in __sanitize_i387_state() is checking that the fpu state
      is not live any more. But for preempt kernels, task can be scheduled
      out and in at any place and the preload_fpu logic during context switch
      can make the fpu registers live again.
      
      For example, consider a 64-bit Task which uses fpu frequently and as such
      you will find its fpu_counter mostly non-zero. During its time slice, kernel
      used fpu by doing kernel_fpu_begin/kernel_fpu_end(). After this, in the same
      scheduling slice, task-A got a signal to handle. Then during the signal
      setup path we got preempted when we are just before the sanitize_i387_state()
      in arch/x86/kernel/xsave.c:save_i387_xstate(). And when we come back we
      will have the fpu registers live that can hit the bug_on.
      
      Similarly during core dump, other threads can context-switch in and out
      (because of spurious wakeups while waiting for the coredump to finish in
       kernel/exit.c:exit_mm()) and the main thread dumping core can run into this
      bug when it finds some other thread with its fpu registers live on some other cpu.
      
      So remove the paranoid check for now, even though it caught a bug in the
      multi-threaded core dump case (fixed in the previous patch).
      Signed-off-by: NSuresh Siddha <suresh.b.siddha@intel.com>
      Link: http://lkml.kernel.org/r/1336692811-30576-3-git-send-email-suresh.b.siddha@intel.com
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      d75f1b39
    • S
      fork: move the real prepare_to_copy() users to arch_dup_task_struct() · 55ccf3fe
      Suresh Siddha 提交于
      Historical prepare_to_copy() is mostly a no-op, duplicated for majority of
      the architectures and the rest following the x86 model of flushing the extended
      register state like fpu there.
      
      Remove it and use the arch_dup_task_struct() instead.
      Suggested-by: NOleg Nesterov <oleg@redhat.com>
      Suggested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSuresh Siddha <suresh.b.siddha@intel.com>
      Link: http://lkml.kernel.org/r/1336692811-30576-1-git-send-email-suresh.b.siddha@intel.comAcked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: James E.J. Bottomley <jejb@parisc-linux.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Chen Liqin <liqin.chen@sunplusct.com>
      Cc: Lennox Wu <lennox.wu@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      55ccf3fe
    • A
      KVM: Fix mmu_reload() clash with nested vmx event injection · d8368af8
      Avi Kivity 提交于
      Currently the inject_pending_event() call during guest entry happens after
      kvm_mmu_reload().  This is for historical reasons - we used to
      inject_pending_event() in atomic context, while kvm_mmu_reload() needs task
      context.
      
      A problem is that nested vmx can cause the mmu context to be reset, if event
      injection is intercepted and causes a #VMEXIT instead (the #VMEXIT resets
      CR0/CR3/CR4).  If this happens, we end up with invalid root_hpa, and since
      kvm_mmu_reload() has already run, no one will fix it and we end up entering
      the guest this way.
      
      Fix by reordering event injection to be before kvm_mmu_reload().  Use
      ->cancel_injection() to undo if kvm_mmu_reload() fails.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=42980Reported-by: NLuke-Jr <luke-jr+linuxbugs@utopios.org>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      d8368af8
    • P
      x86: Don't continue booting if we can't load the specified initrd · ab7b64e9
      Peter Jones 提交于
      If we've determined we can't do what the user asked, trying to do
      something else isn't going to make the user's life better.
      
      Without this the screen scrolls a bit and then you get a panic
      anyway, and it's nice not to have so much scroll after the real
      problem in bug reports.
      
      Link: http://lkml.kernel.org/r/1337190206-12121-1-git-send-email-pjones@redhat.comSigned-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      ab7b64e9