26 Sep, 2006

40 commits

  • kexec: Avoid overwriting the current pgd (V4, i386)

    This patch upgrades the i386-specific kexec code to avoid overwriting the
    current pgd. Overwriting the current pgd is bad when CONFIG_CRASH_DUMP is used
    to start a secondary kernel that dumps the memory of the previous kernel.

    The code introduces a new set of page tables. These tables are used to provide
    an executable identity mapping without overwriting the current pgd.

    Signed-off-by: Magnus Damm
    Signed-off-by: Andi Kleen

    Magnus Damm
     
  • The EDD code would scan the command line as a fixed array, without
    taking account of either whitespace, null-termination, the old
    command-line protocol, late overrides early, or the fact that the
    command line may not be reachable from INITSEG.

    This should fix those problems, and enable us to use a longer command
    line.

    Signed-off-by: H. Peter Anvin
    Signed-off-by: Andi Kleen

    H. Peter Anvin
     
  • In i386's entry.S, FIX_STACK() needs annotation because it
    replaces the stack pointer. And the rest of nmi() needs
    annotation in order to compile with these new annotations.

    Signed-off-by: Chuck Ebbert
    Signed-off-by: Andi Kleen

    Chuck Ebbert
     
  • A kprobe executes IRET early and that could cause NMI recursion and stack
    corruption.

    Note: This problem was originally spotted and solved by Andi Kleen in the
    x86_64 architecture. This patch is an adaption of his patch for i386.

    AK: Merged with current code which was a bit different.
    AK: Removed printk in nmi handler that shouldn't be there in the first time
    AK: Added missing include.
    AK: added KPROBES_END

    Signed-off-by: Fernando Vazquez
    Signed-off-by: Andi Kleen

    Fernando Luis Vázquez Cao
     
  • A kprobe executes IRET early and that could cause NMI recursion and stack
    corruption.

    Note: This problem was originally spotted by Andi Kleen. This patch
    adds fixes not included in his original patch.
    [AK: Jan Beulich originally discovered these classes of bugs]

    Signed-off-by: Fernando Vazquez
    Signed-off-by: Andi Kleen

    Fernando Luis Vázquez Cao
     
  • Mark i386-specific cpu cache functions as __cpuinit. They are all
    only called from arch/i386/common.c:display_cache_info() that already is
    marked as __cpuinit.

    Signed-off-by: Magnus Damm
    Signed-off-by: Andi Kleen

    Magnus Damm
     
  • Mark i386-specific cpu identification functions as __cpuinit. They are all
    only called from arch/i386/common.c:identify_cpu() that already is marked as
    __cpuinit.

    Signed-off-by: Magnus Damm
    Signed-off-by: Andi Kleen

    Magnus Damm
     
  • Mark i386-specific cpu init functions as __cpuinit. They are all
    only called from arch/i386/common.c:identify_cpu() that already is marked as
    __cpuinit. This patch also removes the empty function init_umc().

    Signed-off-by: Magnus Damm
    Signed-off-by: Andi Kleen

    Magnus Damm
     
  • The different cpu_dev structures are all used from __cpuinit callers what
    I can tell. So mark them as __cpuinitdata instead of __initdata. I am a
    little bit unsure about arch/i386/common.c:default_cpu, especially when it
    comes to the purpose of this_cpu.

    Signed-off-by: Magnus Damm
    Signed-off-by: Andi Kleen

    Magnus Damm
     
  • cpu_dev->c_identify is only called from arch/i386/common.c:identify_cpu(), and
    this after generic_identify() already has been called. There is no need to call
    this function twice and hook it in c_identify - but I may be wrong, please
    double check before applying.

    This patch also removes generic_identify() from cpu.h to avoid unnecessary
    future nesting.

    Signed-off-by: Magnus Damm
    Signed-off-by: Andi Kleen

    Magnus Damm
     
  • This patch enables ACPI based physical CPU hotplug support for x86_64.
    Implements acpi_map_lsapic() and acpi_unmap_lsapic() to support physical cpu
    hotplug.

    Signed-off-by: Ashok Raj
    Signed-off-by: Andi Kleen
    Cc: Andi Kleen
    Cc: "Brown, Len"
    Signed-off-by: Andrew Morton

    Ashok Raj
     
  • cyrix_identify() should be __init because transmeta_identify() is.
    tsc_init() is only called from setup_arch() which is marked as __init.

    These two section mismatches have been detected using running modpost on
    a vmlinux image compiled with CONFIG_RELOCATABLE=y.

    Signed-off-by: Magnus Damm
    Signed-off-by: Andi Kleen

    Magnus Damm
     
  • There is no need to duplicate the topology_init() function.

    Signed-off-by: Magnus Damm
    Signed-off-by: Andi Kleen

    Magnus Damm
     
  • The implementation comes from Zach's [RFC, PATCH 10/24] i386 Vmi
    descriptor changes:

    Descriptor and trap table cleanups. Add cleanly written accessors for
    IDT and GDT gates so the subarch may override them. Note that this
    allows the hypervisor to transparently tweak the DPL of the descriptors
    as well as the RPL of segments in those descriptors, with no unnecessary
    kernel code modification. It also allows the hypervisor implementation
    of the VMI to tweak the gates, allowing for custom exception frames or
    extra layers of indirection above the guest fault / IRQ handlers.

    Signed-off-by: Zachary Amsden
    Signed-off-by: Rusty Russell
    Signed-off-by: Andi Kleen

    Rusty Russell
     
  • And add proper CFI annotation to it which was previously
    impossible. This prevents "stuck" messages by the dwarf2 unwinder
    when reaching the top of a kernel stack.

    Includes feedback from Jan Beulich

    Cc: jbeulich@novell.com
    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • enable_local_apic can now become static.

    Cc: len.brown@intel.com

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andi Kleen

    Adrian Bunk
     
  • acpi_force can become static.

    Cc: len.brown@intel.com

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andi Kleen

    Adrian Bunk
     
  • It's needed for external debuggers and overhead is very small.

    Also make the actual notifier chain they use static

    Cc: jbeulich@novell.com

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • Fix

    linux/arch/i386/kernel/mpparse.c: In function #MP_bus_info#:
    linux/arch/i386/kernel/mpparse.c:232: warning: comparison is always false due to limited range of data type

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • Improve Kconfig description of CONFIG_CRASH_DUMP. Previously
    it was too brief to be useful.

    Cc: vgoyal@in.ibm.com
    Cc: ebiederm@xmission.com

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • This patch moves the entry.S:error_entry to .kprobes.text section,
    since code marked unsafe for kprobes jumps directly to entry.S::error_entry,
    that must be marked unsafe as well.
    This patch also moves all the ".previous.text" asm directives to ".previous"
    for kprobes section.

    AK: Following a similar i386 patch from Chuck Ebbert
    AK: Also merged Jeremy's fix in.

    +From: Jeremy Fitzhardinge

    KPROBE_ENTRY does a .section .kprobes.text, and expects its users to
    do a .previous at the end of the function.

    Unfortunately, if any code within the function switches sections, for
    example .fixup, then the .previous ends up putting all subsequent code
    into .fixup. Worse, any subsequent .fixup code gets intermingled with
    the code its supposed to be fixing (which is also in .fixup). It's
    surprising this didn't cause more havok.

    The fix is to use .pushsection/.popsection, so this stuff nests
    properly. A further cleanup would be to get rid of all
    .section/.previous pairs, since they're inherently fragile.

    +From: Chuck Ebbert

    Because code marked unsafe for kprobes jumps directly to
    entry.S::error_code, that must be marked unsafe as well.
    The easiest way to do that is to move the page fault entry
    point to just before error_code and let it inherit the same
    section.

    Also moved all the ".previous" asm directives for kprobes
    sections to column 1 and removed ".text" from them.

    Signed-off-by: Chuck Ebbert
    Signed-off-by: Andi Kleen

    Prasanna S.P
     
  • We have a test that looks for invalid pairings of certain athlon/durons
    that weren't designed for SMP, and taint accordingly (with 'S') if we find
    such a configuration. However, this test shouldn't fire if there's only
    a single CPU present. It's perfectly valid for an SMP kernel to boot on UP
    hardware for example.

    AK: changed to num_possible_cpus()

    Signed-off-by: Dave Jones
    Signed-off-by: Andi Kleen

    Dave Jones
     
  • Fix a very dubious piece of code in
    arch/i386/kernel/cpu/common.c:cpu_init(). This clears out %fs and
    %gs, but clobbers %eax in the process without telling gcc. It turns
    out that gcc happens to be not using %eax at that point anyway so it
    doesn't matter much, but it looks like a bomb waiting to go off.

    This does end up saving an instruction, because gcc wants %eax==0 for
    the set_debugreg()s below.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Andi Kleen

    Jeremy Fitzhardinge
     
  • Cc: jbeulich@novell.com
    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • Cc: jbeulich@novell.com
    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • Following x86-64 patches. Reuses code from them in fact.

    Convert the standard backtracer to do all output using
    callbacks. Use the x86-64 stack tracer implementation
    that uses these callbacks to implement the stacktrace interface.

    This allows to use the new dwarf2 unwinder for stacktrace
    and get better backtraces.

    Cc: mingo@elte.hu

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • - Remove unused all_contexts parameter
    No caller used it
    - Move skip argument into the structure (needed for
    followon patches)

    Cc: mingo@elte.hu

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • is_at_popf() needs to test for the iret instruction as well as
    popf. So add that test and rename it to is_setting_trap_flag().

    Also change max insn length from 16 to 15 to match reality.

    LAHF / SAHF can't affect TF, so the comment in x86_64 is removed.

    Signed-off-by: Chuck Ebbert
    Signed-off-by: Andi Kleen

    Chuck Ebbert
     
  • And move one into proto.h

    Cc: len.brown@intel.com
    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • Removes code duplication between i386/x86-64.

    Not needed anymore in setup.c since early_param cleanup

    Cc: len.brown@intel.com
    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • This patch replaces the open-coded early commandline parsing
    throughout the i386 boot code with the generic mechanism (already used
    by ppc, powerpc, ia64 and s390). The code was inconsistent with
    whether it deletes the option from the cmdline or not, meaning some of
    these will get passed through the environment into init.

    This transformation is mainly mechanical, but there are some notable
    parts:

    1) Grammar: s/linux never set's it up/linux never sets it up/

    2) Remove hacked-in earlyprintk= option scanning. When someone
    actually implements CONFIG_EARLY_PRINTK, then they can use
    early_param().
    [AK: actually it is implemented, but I'm adding the early_param it in the next
    x86-64 patch]

    3) Move declaration of generic_apic_probe() from setup.c into asm/apic.h

    4) Various parameters now moved into their appropriate files (thanks Andi).

    5) All parse functions which examine arg need to check for NULL,
    except one where it has subtle humor value.

    AK: readded acpi_sci handling which was completely dropped
    AK: moved some more variables into acpi/boot.c

    Cc: len.brown@intel.com

    Signed-off-by: Rusty Russell
    Signed-off-by: Andi Kleen

    Rusty Russell
     
  • Lock sections don't work the new dwarf2 unwinder
    This generates slightly smaller code. It adds one more taken
    jump to the fast path.

    Also move the trampolines into semaphore.S and add proper CFI
    annotations.

    Cc: jbeulich@novell.com

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • Move initialization of all memory end variables to as early as
    possible, so that dependent code doesn't need to check whether these
    variables have already been set.

    Change the range check in kunmap_atomic to actually make use of this
    so that the no-mapping-estabished path (under CONFIG_DEBUG_HIGHMEM)
    gets used only when the address is inside the lowmem area (and BUG()
    otherwise).

    Signed-off-by: Jan Beulich
    Signed-off-by: Andi Kleen

    Jan Beulich
     
  • ... instead of using a CONFIG option. The config option still controls
    if the resulting executable actually has unwind information.

    This is useful to prevent compilation errors when users select
    CONFIG_STACK_UNWIND on old binutils and also allows to use
    CFI in the future for non kernel debugging applications.

    Cc: jbeulich@novell.com
    Cc: sam@ravnborg.org

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • Remove some unlinuxy ways to write function parameter definitions.
    Remove some stray "return;"s

    No functional change.

    Cc: len.brown@intel.com
    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • Bugzilla #6552 says:

    "In arch/i386/boot/setup.S, movw is used instead of movb for PS/2 mouse
    information, although it is unsigned char. This does not harm, because
    the jmp instruction overwritten by movw is used before executing movw,
    and never be used again"

    I've no idea if this is a real bug or how it gets fixed, so I'm submitting
    it for review instead of letting it die of boredom in bugzilla. Aditionally
    to i386, I've changed x86-64, which mirrors the same code.

    Credits to Yoshinori K. Okuji, who found the problem and suggested a fix.

    Signed-off-by: Diego Calleja
    Signed-off-by: Andi Kleen

    Diego Calleja
     
  • The IO APIC code had lots of duplicated code to read/write 64bit
    routing entries into the IO-APIC. Factor this out int common read/write
    functions

    In a few cases the IO APIC lock is taken more often now, but this
    isn't a problem because it's all initialization/shutdown only
    slow path code.

    Similar to earlier x86-64 patch.

    Includes a fix by Jiri Slaby for a mistake that broke resume

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • It apparently has never triggered in many years.

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • - Move them to a pure assembly file. Previously they were in
    a C file that only consisted of inline assembly. Doing it in pure
    assembler is much nicer.
    - Add a frame.i include with FRAME/ENDFRAME macros to easily
    add frame pointers to assembly functions
    - Add dwarf2 annotation to them so that the new dwarf2 unwinder
    doesn't get stuck on them
    - Random cleanups

    Includes feedback from Jan Beulich and a UML build fix from Andrew
    Morton.

    Cc: jbeulich@novell.com
    Cc: jdike@addtoit.com
    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • This ports the algorithm from x86-64 (with improvements) to i386.
    Previously this only worked for frame pointer enabled kernels.
    But spinlocks have a very simple stack frame that can be manually
    analyzed. Do this.

    Signed-off-by: Andi Kleen

    Andi Kleen