1. 19 8月, 2008 1 次提交
  2. 24 5月, 2008 2 次提交
  3. 26 4月, 2008 3 次提交
  4. 17 4月, 2008 3 次提交
    • M
      x86: fix test_poke for vmalloced pages · 15a601eb
      Mathieu Desnoyers 提交于
      * Ingo Molnar (mingo@elte.hu) wrote:
      >
      > * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
      >
      > > The shadow vmap for DEBUG_RODATA kernel text modification uses
      > > virt_to_page to get the pages from the pointer address.
      > >
      > > However, I think vmalloc_to_page would be required in case the page is
      > > used for modules.
      > >
      > > Since only the core kernel text is marked read-only, use
      > > kernel_text_address() to make sure we only shadow map the core kernel
      > > text, not modules.
      >
      > actually, i think we should mark module text readonly too.
      >
      
      Yes, but in the meantime, the x86 tree would need this patch to make
      kprobes work correctly on modules.
      
      I suspect that without this fix, with the enhanced hotplug and kprobes
      patch, kprobes will use text_poke to insert breakpoints in modules
      (vmalloced pages used), which will map the wrong pages and corrupt
      random kernel locations instead of updating the correct page.
      
      Work that would write protect the module pages should clearly be done,
      but it can come in a later time. We have to make sure we interact
      correctly with the page allocation debugging, as an example.
      
      Here is the patch against x86.git 2.6.25-rc5 :
      
      The shadow vmap for DEBUG_RODATA kernel text modification uses virt_to_page to
      get the pages from the pointer address.
      
      However, I think vmalloc_to_page would be required in case the page is used for
      modules.
      
      Since only the core kernel text is marked read-only, use kernel_text_address()
      to make sure we only shadow map the core kernel text, not modules.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      CC: akpm@linux-foundation.org
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      15a601eb
    • M
      x86: enhance DEBUG_RODATA support - alternatives · e587cadd
      Mathieu Desnoyers 提交于
      Fix a memcpy that should be a text_poke (in apply_alternatives).
      
      Use kernel_wp_save/kernel_wp_restore in text_poke to support DEBUG_RODATA
      correctly and so the CPU HOTPLUG special case can be removed.
      
      Add text_poke_early, for alternatives and paravirt boot-time and module load
      time patching.
      
      Changelog:
      
      - Fix text_set and text_poke alignment check (mixed up bitwise and and or)
      - Remove text_set
      - Export add_nops, so it can be used by others.
      - Document text_poke_early.
      - Remove clflush, since it breaks some VIA architectures and is not strictly
        necessary.
      - Add kerneldoc to text_poke and text_poke_early.
      - Create a second vmap instead of using the WP bit to support Xen and VMI.
      - Move local_irq disable within text_poke and text_poke_early to be able to
        be sleepable in these functions.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      CC: Andi Kleen <andi@firstfloor.org>
      CC: pageexec@freemail.hu
      CC: H. Peter Anvin <hpa@zytor.com>
      CC: Jeremy Fitzhardinge <jeremy@goop.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e587cadd
    • H
      x86: replace remaining __FUNCTION__ occurances · 77bf90ed
      Harvey Harrison 提交于
      __FUNCTION__ is gcc-specific, use __func__
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      77bf90ed
  5. 10 4月, 2008 1 次提交
    • S
      pop previous section in alternative.c · f4be31ec
      Steven Rostedt 提交于
      gcc expects all toplevel assembly to return to the original section type.
      The code in alteranative.c does not do this. This caused some strange bugs
      in sched-devel where code would end up in the .rodata section and when
      the kernel sets the NX bit on all .rodata, the kernel would crash when
      executing this code.
      
      This patch adds a .previous marker to return the code back to the
      original section.
      
      Credit goes to Andrew Pinski for telling me it wasn't a gcc bug but a
      bug in the toplevel asm code in the kernel.  ;-)
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f4be31ec
  6. 30 1月, 2008 3 次提交
  7. 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
  8. 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
  9. 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
  10. 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
  11. 11 10月, 2007 1 次提交
  12. 11 9月, 2007 1 次提交
  13. 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
  14. 12 8月, 2007 2 次提交
  15. 27 7月, 2007 1 次提交
  16. 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
  17. 22 7月, 2007 1 次提交
  18. 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
  19. 03 5月, 2007 8 次提交
  20. 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
  21. 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
  22. 04 12月, 2006 1 次提交