1. 30 1月, 2008 1 次提交
  2. 20 10月, 2007 1 次提交
    • M
      x86: convert cpuinfo_x86 array to a per_cpu array · 92cb7612
      Mike Travis 提交于
      cpu_data is currently an array defined using NR_CPUS.  This means that
      we overallocate since we will rarely really use maximum configured cpus.
      When NR_CPU count is raised to 4096 the size of cpu_data becomes
      3,145,728 bytes.
      
      These changes were adopted from the sparc64 (and ia64) code.  An
      additional field was added to cpuinfo_x86 to be a non-ambiguous cpu
      index.  This corresponds to the index into a cpumask_t as well as the
      per_cpu index.  It's used in various places like show_cpuinfo().
      
      cpu_data is defined to be the boot_cpu_data structure for the NON-SMP
      case.
      Signed-off-by: NMike Travis <travis@sgi.com>
      Acked-by: NChristoph Lameter <clameter@sgi.com>
      Cc: Andi Kleen <ak@suse.de>
      Cc: James Bottomley <James.Bottomley@steeleye.com>
      Cc: Dmitry Torokhov <dtor@mail.ru>
      Cc: "Antonino A. Daplas" <adaplas@pol.net>
      Cc: Mark M. Hoffman <mhoffman@lightlink.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      92cb7612
  3. 18 10月, 2007 3 次提交
    • J
      x86: multi-byte single instruction NOPs · 32c464f5
      Jan Beulich 提交于
      Add support for and use the multi-byte NOPs recently documented to be
      available on all PentiumPro and later processors.
      
      This patch only applies cleanly on top of the "x86: misc.
      constifications" patch sent earlier.
      
      [ tglx: arch/x86 adaptation ]
      Signed-off-by: NJan Beulich <jbeulich@novell.com>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      
       arch/x86/kernel/alternative.c  |   23 ++++++++++++++++++++++-
       include/asm-x86/processor_32.h |   22 ++++++++++++++++++++++
       include/asm-x86/processor_64.h |   22 ++++++++++++++++++++++
       3 files changed, 66 insertions(+), 1 deletion(-)
      32c464f5
    • J
      x86: misc. constifications · 121d7bf5
      Jan Beulich 提交于
      Miscellaneous x86 stuff that can live in .rodata.
      
      [ tglx: arch/x86 adaptation ]
      Signed-off-by: NJan Beulich <jbeulich@novell.com>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      121d7bf5
    • F
      x86: call free_init_pages() with irqs enabled in alternative_instructions() · f68fd5f4
      Fengguang Wu 提交于
      In alternative_instructions(), call free_init_pages() with irqs enabled.
      
      It fixes the warning message in smp_call_function*(), which should not be
      called with irqs disabled.
      
      [    0.310000] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
      [    0.310000] CPU: L2 Cache: 512K (64 bytes/line)
      [    0.310000] CPU 0/0 -> Node 0
      [    0.310000] SMP alternatives: switching to UP code
      [    0.310000] Freeing SMP alternatives: 25k freed
      [    0.310000] WARNING: at arch/x86_64/kernel/smp.c:397 smp_call_function_mask()
      [    0.310000]
      [    0.310000] Call Trace:
      [    0.310000]  [<ffffffff8100dbde>] dump_trace+0x3ee/0x4a0
      [    0.310000]  [<ffffffff8100dcd3>] show_trace+0x43/0x70
      [    0.310000]  [<ffffffff8100dd15>] dump_stack+0x15/0x20
      [    0.310000]  [<ffffffff8101cd44>] smp_call_function_mask+0x94/0xa0
      [    0.310000]  [<ffffffff8101d0b2>] smp_call_function+0x32/0x40
      [    0.310000]  [<ffffffff8104277f>] on_each_cpu+0x1f/0x50
      [    0.310000]  [<ffffffff81026eac>] global_flush_tlb+0x8c/0x110
      [    0.310000]  [<ffffffff81025c85>] free_init_pages+0xe5/0xf0
      [    0.310000]  [<ffffffff81549b5e>] alternative_instructions+0x7e/0x150
      [    0.310000]  [<ffffffff8154a2ea>] check_bugs+0x1a/0x20
      [    0.310000]  [<ffffffff81540c4a>] start_kernel+0x2da/0x380
      [    0.310000]  [<ffffffff81540132>] _sinittext+0x132/0x140
      [    0.310000]
      [    0.320000] ACPI: Core revision 20070126
      [    0.560000] Using local APIC timer interrupts.
      [    0.590000] Detected 62.496 MHz APIC timer.
      [    0.590000] Brought up 1 CPUs
      
      [ tglx: arch/x86 adaptation ]
      
      Cc: Laurent Vivier <Laurent.Vivier@bull.net>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NFengguang Wu <wfg@mail.ustc.edu.cn>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      f68fd5f4
  4. 17 10月, 2007 1 次提交
    • J
      paravirt: refactor struct paravirt_ops into smaller pv_*_ops · 93b1eab3
      Jeremy Fitzhardinge 提交于
      This patch refactors the paravirt_ops structure into groups of
      functionally related ops:
      
      pv_info - random info, rather than function entrypoints
      pv_init_ops - functions used at boot time (some for module_init too)
      pv_misc_ops - lazy mode, which didn't fit well anywhere else
      pv_time_ops - time-related functions
      pv_cpu_ops - various privileged instruction ops
      pv_irq_ops - operations for managing interrupt state
      pv_apic_ops - APIC operations
      pv_mmu_ops - operations for managing pagetables
      
      There are several motivations for this:
      
      1. Some of these ops will be general to all x86, and some will be
         i386/x86-64 specific.  This makes it easier to share common stuff
         while allowing separate implementations where needed.
      
      2. At the moment we must export all of paravirt_ops, but modules only
         need selected parts of it.  This allows us to export on a case by case
         basis (and also choose which export license we want to apply).
      
      3. Functional groupings make things a bit more readable.
      
      Struct paravirt_ops is now only used as a template to generate
      patch-site identifiers, and to extract function pointers for inserting
      into jmp/calls when patching.  It is only instantiated when needed.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Andi Kleen <ak@suse.de>
      Cc: Zach Amsden <zach@vmware.com>
      Cc: Avi Kivity <avi@qumranet.com>
      Cc: Anthony Liguory <aliguori@us.ibm.com>
      Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
      Cc: Jun Nakajima <jun.nakajima@intel.com>
      93b1eab3
  5. 15 10月, 2007 1 次提交
    • D
      x86: fix missing include for vsyscall · b097976e
      Dave Jones 提交于
       > Maybe I just picked a bad time to try, but...
       > 
       > arch/x86/kernel/alternative.c: In function 'apply_alternatives':
       > arch/x86/kernel/alternative.c:191: error: 'VSYSCALL_START' undeclared (first use in this function)
       > arch/x86/kernel/alternative.c:191: error: (Each undeclared identifier is reported only once
       > arch/x86/kernel/alternative.c:191: error: for each function it appears in.)
       > arch/x86/kernel/alternative.c:191: error: 'VSYSCALL_END' undeclared (first use in this function)
       > make[1]: *** [arch/x86/kernel/alternative.o] Error 1
       > make: *** [arch/x86/kernel] Error 2
      
      Try this.
      
      Include missing header for vsyscall.
      Signed-off-by: NDave Jones <davej@redhat.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      b097976e
  6. 11 10月, 2007 1 次提交
  7. 11 9月, 2007 1 次提交
  8. 19 8月, 2007 1 次提交
    • C
      x86: properly initialize temp insn buffer for paravirt patching · d34fda4a
      Chris Wright 提交于
      With commit ab144f5e the patching code
      now collects the complete new instruction stream into a temp buffer
      before finally patching in the new insns.  In some cases the paravirt
      patchers will choose to leave the patch site unpatched (length mismatch,
      clobbers mismatch, etc).
      
      This causes the new patching code to copy an uninitialized temp buffer,
      i.e.  garbage, to the callsite.  Simply make sure to always initialize
      the buffer with the original instruction stream.  A better fix is to
      audit all the patchers and return proper length so that apply_paravirt()
      can skip copies when we leave the patch site untouched.
      Signed-off-by: NChris Wright <chrisw@sous-sol.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d34fda4a
  9. 12 8月, 2007 2 次提交
  10. 27 7月, 2007 1 次提交
  11. 23 7月, 2007 2 次提交
    • A
      x86: Stop MCEs and NMIs during code patching · 8f4e956b
      Andi Kleen 提交于
      When a machine check or NMI occurs while multiple byte code is patched
      the CPU could theoretically see an inconsistent instruction and crash.
      Prevent this by temporarily disabling MCEs and returning early in the
      NMI handler.
      
      Based on discussion with Mathieu Desnoyers.
      
      Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8f4e956b
    • A
      x86: Fix alternatives and kprobes to remap write-protected kernel text · 19d36ccd
      Andi Kleen 提交于
      Reenable kprobes and alternative patching when the kernel text is write
      protected by DEBUG_RODATA
      
      Add a general utility function to change write protected text.  The new
      function remaps the code using vmap to write it and takes care of CPU
      synchronization.  It also does CLFLUSH to make icache recovery faster.
      
      There are some limitations on when the function can be used, see the
      comment.
      
      This is a newer version that also changes the paravirt_ops code.
      text_poke also supports multi byte patching now.
      
      Contains bug fixes from Zach Amsden and suggestions from Mathieu
      Desnoyers.
      
      Cc: Jan Beulich <jbeulich@novell.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org>
      Cc: Zach Amsden <zach@vmware.com>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      19d36ccd
  12. 22 7月, 2007 1 次提交
  13. 07 5月, 2007 1 次提交
    • L
      Revert "[PATCH] x86: __pa and __pa_symbol address space separation" · e3ebadd9
      Linus Torvalds 提交于
      This was broken.  It adds complexity, for no good reason.  Rather than
      separate __pa() and __pa_symbol(), we should deprecate __pa_symbol(),
      and preferably __pa() too - and just use "virt_to_phys()" instead, which
      is more readable and has nicer semantics.
      
      However, right now, just undo the separation, and make __pa_symbol() be
      the exact same as __pa().  That fixes the bugs this patch introduced,
      and we can do the fairly obvious cleanups later.
      
      Do the new __phys_addr() function (which is now the actual workhorse for
      the unified __pa()/__pa_symbol()) as a real external function, that way
      all the potential issues with compile/link-time optimizations of
      constant symbol addresses go away, and we can also, if we choose to, add
      more sanity-checking of the argument.
      
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Vivek Goyal <vgoyal@in.ibm.com>
      Cc: Andi Kleen <ak@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e3ebadd9
  14. 03 5月, 2007 8 次提交
  15. 24 4月, 2007 1 次提交
    • A
      [PATCH] x86: Remove noreplacement option · 9ce883be
      Andi Kleen 提交于
      noreplacement is dangerous on modern systems because it will not replace the
      context switch FNSAVE with SSE aware FXSAVE. But other places in the kernel still assume
      SSE and do FXSAVE and the CPU will then access FXSAVE information with
      FNSAVE and cause corruption.
      
      Easiest way to avoid this is to remove the option. It was mostly for paranoia
      reasons anyways and alternative()s have been stable for some time.
      
      Thanks to Jeremy F. for reporting and helping debug it.
      Signed-off-by: NAndi Kleen <ak@suse.de>
      9ce883be
  16. 07 12月, 2006 1 次提交
    • R
      [PATCH] paravirt: Patch inline replacements for paravirt intercepts · 139ec7c4
      Rusty Russell 提交于
      It turns out that the most called ops, by several orders of magnitude,
      are the interrupt manipulation ops.  These are obvious candidates for
      patching, so mark them up and create infrastructure for it.
      
      The method used is that the ops structure has a patch function, which
      is called for each place which needs to be patched: this returns a
      number of instructions (the rest are NOP-padded).
      
      Usually we can spare a register (%eax) for the binary patched code to
      use, but in a couple of critical places in entry.S we can't: we make
      the clobbers explicit at the call site, and manually clobber the
      allowed registers in debug mode as an extra check.
      
      And:
      
      Don't abuse CONFIG_DEBUG_KERNEL, add CONFIG_DEBUG_PARAVIRT.
      
      And:
      
      AK:  Fix warnings in x86-64 alternative.c build
      
      And:
      
      AK: Fix compilation with defconfig
      
      And:
      
      ^From: Andrew Morton <akpm@osdl.org>
      
      Some binutlises still like to emit references to __stop_parainstructions and
      __start_parainstructions.
      
      And:
      
      AK: Fix warnings about unused variables when PARAVIRT is disabled.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Signed-off-by: NChris Wright <chrisw@sous-sol.org>
      Signed-off-by: NZachary Amsden <zach@vmware.com>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      139ec7c4
  17. 04 12月, 2006 1 次提交
  18. 21 10月, 2006 1 次提交
  19. 04 7月, 2006 1 次提交
  20. 02 7月, 2006 1 次提交
  21. 27 6月, 2006 1 次提交
    • G
      [PATCH] x86_64: x86_64 version of the smp alternative patch. · d167a518
      Gerd Hoffmann 提交于
      Changes are largely identical to the i386 version:
      
       * alternative #define are moved to the new alternative.h file.
       * one new elf section with pointers to the lock prefixes which can be
         nop'ed out for non-smp.
       * two new elf sections simliar to the "classic" alternatives to
         replace SMP code with simpler UP code.
       * fixup headers to use alternative.h instead of defining their own
         LOCK / LOCK_PREFIX macros.
      
      The patch reuses the i386 version of the alternatives code to avoid code
      duplication.  The code in alternatives.c was shuffled around a bit to
      reduce the number of #ifdefs needed.  It also got some tweaks needed for
      x86_64 (vsyscall page handling) and new features (noreplacement option
      which was x86_64 only up to now).  Debug printk's are changed from
      compile-time to runtime.
      
      Loosely based on a early version from Bastian Blank <waldi@debian.org>
      Signed-off-by: NGerd Hoffmann <kraxel@suse.de>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d167a518
  22. 23 3月, 2006 1 次提交
    • G
      [PATCH] x86: SMP alternatives · 9a0b5817
      Gerd Hoffmann 提交于
      Implement SMP alternatives, i.e.  switching at runtime between different
      code versions for UP and SMP.  The code can patch both SMP->UP and UP->SMP.
      The UP->SMP case is useful for CPU hotplug.
      
      With CONFIG_CPU_HOTPLUG enabled the code switches to UP at boot time and
      when the number of CPUs goes down to 1, and switches to SMP when the number
      of CPUs goes up to 2.
      
      Without CONFIG_CPU_HOTPLUG or on non-SMP-capable systems the code is
      patched once at boot time (if needed) and the tables are released
      afterwards.
      
      The changes in detail:
      
        * The current alternatives bits are moved to a separate file,
          the SMP alternatives code is added there.
      
        * The patch adds some new elf sections to the kernel:
          .smp_altinstructions
      	like .altinstructions, also contains a list
      	of alt_instr structs.
          .smp_altinstr_replacement
      	like .altinstr_replacement, but also has some space to
      	save original instruction before replaving it.
          .smp_locks
      	list of pointers to lock prefixes which can be nop'ed
      	out on UP.
          The first two are used to replace more complex instruction
          sequences such as spinlocks and semaphores.  It would be possible
          to deal with the lock prefixes with that as well, but by handling
          them as special case the table sizes become much smaller.
      
       * The sections are page-aligned and padded up to page size, so they
         can be free if they are not needed.
      
       * Splitted the code to release init pages to a separate function and
         use it to release the elf sections if they are unused.
      Signed-off-by: NGerd Hoffmann <kraxel@suse.de>
      Signed-off-by: NChuck Ebbert <76306.1226@compuserve.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9a0b5817