10 May, 2007

2 commits

  • hard_smp_processor_id used to be just a macro that hard-coded
    hard_smp_processor_id to 0 in the non SMP case. When booting non SMP kernels
    on hardware where the boot ioapic id is not 0 this turns out to be a problem.
    This is happens frequently in the case of kdump and once in a great while in
    the case of real hardware.

    Use the APIC to determine the hardware processor id in both UP and SMP kernels
    to fix this issue.

    Notice that hard_smp_processor_id is only used by SMP code or by code that
    works with apics so we do not need to handle the case when apics are not
    present and hard_smp_processor_id should never be called there.

    Signed-off-by: Fernando Luis Vazquez Cao
    Cc: "Luck, Tony"
    Acked-by: Andi Kleen
    Cc: "Eric W. Biederman"
    Cc: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fernando Luis Vazquez Cao
     
  • With the advent of kdump, the assumption that the boot CPU when booting an UP
    kernel is always the CPU with a particular hardware ID (often 0) (usually
    referred to as BSP on some architectures) is not valid anymore. The reason
    being that the dump capture kernel boots on the crashed CPU (the CPU that
    invoked crash_kexec), which may be or may not be that particular CPU.

    Move definition of hard_smp_processor_id for the UP case to
    architecture-specific code ("asm/smp.h") where it belongs, so that each
    architecture can provide its own implementation.

    Signed-off-by: Fernando Luis Vazquez Cao
    Cc: "Luck, Tony"
    Acked-by: Andi Kleen
    Cc: "Eric W. Biederman"
    Cc: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fernando Luis Vazquez Cao
     

03 May, 2007

2 commits

  • Synchronize i386's smp_send_stop() with x86-64's in only try-locking
    the call lock to prevent deadlocks when called from panic().
    In both version, disable interrupts before clearing the CPU off the
    online map to eliminate races with IRQ handlers inspecting this map.
    Also in both versions, save/restore interrupts rather than disabling/
    enabling them.
    On x86-64, eliminate one function used here by folding it into its
    single caller, convert to static, and rename for consistency with i386
    (lkcd may like this).

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

    Jan Beulich
     
  • Move inclusion of asm/fixmap.h to where it is really used rather than
    where it may have been used long ago (requires a few other adjustments
    to includes due to previous implicit dependencies).

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

    Jan Beulich
     

17 Mar, 2007

1 commit

  • Fix the following section mismatch warnings on x86_64:
    (build using defconfig)

    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:mtrr_bp_init from .text between 'identify_cpu' (at offset 0x65eb) and 'IRQ0x20_interrupt'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data: from .text between 'finish_e820_parsing' (at offset 0x7dc2) and 'early_panic'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:e820_print_map from .text between 'finish_e820_parsing' (at offset 0x7de1) and 'early_panic'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:num_processors from .text between 'acpi_unmap_lsapic' (at offset 0xc88f) and 'acpi_register_ioapic'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:disabled_cpus from .text between 'MP_processor_info' (at offset 0x11f35) and 'mp_register_lapic'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:num_processors from .text between 'MP_processor_info' (at offset 0x11f6e) and 'mp_register_lapic'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:num_processors from .text between 'MP_processor_info' (at offset 0x11f93) and 'mp_register_lapic'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fix_aperture from .text between 'gart_parse_options' (at offset 0x15517) and 'iommu_full'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fix_aperture from .text between 'gart_parse_options' (at offset 0x1552c) and 'iommu_full'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x1553d) and 'iommu_full'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x15552) and 'iommu_full'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x15561) and 'iommu_full'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x15577) and 'iommu_full'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fallback_aper_force from .text between 'gart_parse_options' (at offset 0x1558a) and 'iommu_full'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fallback_aper_order from .text between 'gart_parse_options' (at offset 0x155bf) and 'iommu_full'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:timer_over_8254 from .text between 'ati_bugs' (at offset 0x16344) and 'via_bugs'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:timer_over_8254 from .text between 'ati_bugs' (at offset 0x16356) and 'via_bugs'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'via_bugs' (at offset 0x16380) and 'nvidia_bugs'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_disabled from .text between 'via_bugs' (at offset 0x16397) and 'nvidia_bugs'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:acpi_use_timer_override from .text between 'nvidia_bugs' (at offset 0x163a7) and 'arch_unregister_cpu'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:nvidia_hpet_check from .text between 'nvidia_bugs' (at offset 0x163b1) and 'arch_unregister_cpu'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data: from .text between 'nvidia_bugs' (at offset 0x163be) and 'arch_unregister_cpu'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data: from .text between 'nvidia_bugs' (at offset 0x163d1) and 'arch_unregister_cpu'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:acpi_skip_timer_override from .text between 'nvidia_bugs' (at offset 0x163e1) and 'arch_unregister_cpu'
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:quirk_intel_irqbalance from .text between 'intel_bugs' (at offset 0x1633c) and 'ati_bugs'

    But adds:
    WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:get_mtrr_state from .text between 'mtrr_bp_init' (at offset 0xb887) and 'ipi_handler'

    The warnings does not show up during a normal build due to kbuild
    failing to check for section mismatch in vmlinux.
    To see these warnings run:
    scripts/mod/modpost arch/x86_64/kernel/built-in.o

    kbuild will be fixed but the 'noise-level' had to be decresed first.
    There remains a few section mismatch warnigns for x86_64 for areas where I did
    not feel confident.

    Signed-off-by: Sam Ravnborg
    Signed-off-by: Andi Kleen

    Sam Ravnborg
     

08 Dec, 2006

2 commits

  • * 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6: (156 commits)
    [PATCH] x86-64: Export smp_call_function_single
    [PATCH] i386: Clean up smp_tune_scheduling()
    [PATCH] unwinder: move .eh_frame to RODATA
    [PATCH] unwinder: fully support linker generated .eh_frame_hdr section
    [PATCH] x86-64: don't use set_irq_regs()
    [PATCH] x86-64: check vector in setup_ioapic_dest to verify if need setup_IO_APIC_irq
    [PATCH] x86-64: Make ix86 default to HIGHMEM4G instead of NOHIGHMEM
    [PATCH] i386: replace kmalloc+memset with kzalloc
    [PATCH] x86-64: remove remaining pc98 code
    [PATCH] x86-64: remove unused variable
    [PATCH] x86-64: Fix constraints in atomic_add_return()
    [PATCH] x86-64: fix asm constraints in i386 atomic_add_return
    [PATCH] x86-64: Correct documentation for bzImage protocol v2.05
    [PATCH] x86-64: replace kmalloc+memset with kzalloc in MTRR code
    [PATCH] x86-64: Fix numaq build error
    [PATCH] x86-64: include/asm-x86_64/cpufeature.h isn't a userspace header
    [PATCH] unwinder: Add debugging output to the Dwarf2 unwinder
    [PATCH] x86-64: Clarify error message in GART code
    [PATCH] x86-64: Fix interrupt race in idle callback (3rd try)
    [PATCH] x86-64: Remove unwind stack pointer alignment forcing again
    ...

    Fixed conflict in include/linux/uaccess.h manually

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • smp_call_function_single() needs to be visible in non-SMP builds, to fix:

    arch/x86_64/kernel/vsyscall.c:283: warning: implicit declaration of function 'smp_call_function_single'

    Signed-off-by: Randy Dunlap
    Cc: Ingo Molnar
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

07 Dec, 2006

1 commit


27 Sep, 2006

1 commit

  • * 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6: (225 commits)
    [PATCH] Don't set calgary iommu as default y
    [PATCH] i386/x86-64: New Intel feature flags
    [PATCH] x86: Add a cumulative thermal throttle event counter.
    [PATCH] i386: Make the jiffies compares use the 64bit safe macros.
    [PATCH] x86: Refactor thermal throttle processing
    [PATCH] Add 64bit jiffies compares (for use with get_jiffies_64)
    [PATCH] Fix unwinder warning in traps.c
    [PATCH] x86: Allow disabling early pci scans with pci=noearly or disallowing conf1
    [PATCH] x86: Move direct PCI scanning functions out of line
    [PATCH] i386/x86-64: Make all early PCI scans dependent on CONFIG_PCI
    [PATCH] Don't leak NT bit into next task
    [PATCH] i386/x86-64: Work around gcc bug with noreturn functions in unwinder
    [PATCH] Fix some broken white space in ia32_signal.c
    [PATCH] Initialize argument registers for 32bit signal handlers.
    [PATCH] Remove all traces of signal number conversion
    [PATCH] Don't synchronize time reading on single core AMD systems
    [PATCH] Remove outdated comment in x86-64 mmconfig code
    [PATCH] Use string instructions for Core2 copy/clear
    [PATCH] x86: - restore i8259A eoi status on resume
    [PATCH] i386: Split multi-line printk in oops output.
    ...

    Linus Torvalds
     

26 Sep, 2006

6 commits

  • If we're going to implement smp_call_function_single() on three architecture
    with the same prototype then it should have a declaration in a
    non-arch-specific header file.

    Move it into .

    Cc: Stephane Eranian
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • And replace all users with ordinary smp_processor_id. The function
    was originally added to get some basic oops information out even
    if the GS register was corrupted. However that didn't
    work for some anymore because printk is needed to print the oops
    and it uses smp_processor_id() already. Also GS register corruptions
    are not particularly common anymore.

    This also helps the Xen port which would otherwise need to
    do this in a special way because it can't access the local APIC.

    Cc: Chris Wright

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • PIC mode is an outdated way to drive the APICs that was used on
    some early MP boards. It is not supported in the ACPI model.

    It is unlikely to be ever configured by any x86-64 system

    Remove it thus.

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • IO-APIC or local APIC can only be disabled at runtime anyways and
    Kconfig has forced these options on for a long time now.

    The Kconfigs are kept only now for the benefit of the shared acpi
    boot.c code.

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • No need to include it from entry.S
    Drop all the #ifdef __ASSEMBLY__

    Signed-off-by: Andi Kleen

    Andi Kleen
     
  • This patch adds a vgetcpu vsyscall, which depending on the CPU RDTSCP
    capability uses either the RDTSCP or CPUID to obtain a CPU and node
    numbers and pass them to the program.

    AK: Lots of changes over Vojtech's original code:
    Better prototype for vgetcpu()
    It's better to pass the cpu / node numbers as separate arguments
    to avoid mistakes when going from SMP to NUMA.
    Also add a fast time stamp based cache using a user supplied
    argument to speed things more up.
    Use fast method from Chuck Ebbert to retrieve node/cpu from
    GDT limit instead of CPUID
    Made sure RDTSCP init is always executed after node is known.
    Drop printk

    Signed-off-by: Vojtech Pavlik
    Signed-off-by: Andi Kleen

    Vojtech Pavlik
     

27 Jun, 2006

1 commit


26 Apr, 2006

1 commit


28 Mar, 2006

1 commit

  • Add a new sched domain for representing multi-core with shared caches
    between cores. Consider a dual package system, each package containing two
    cores and with last level cache shared between cores with in a package. If
    there are two runnable processes, with this appended patch those two
    processes will be scheduled on different packages.

    On such systems, with this patch we have observed 8% perf improvement with
    specJBB(2 warehouse) benchmark and 35% improvement with CFP2000 rate(with 2
    users).

    This new domain will come into play only on multi-core systems with shared
    caches. On other systems, this sched domain will be removed by domain
    degeneration code. This new domain can be also used for implementing power
    savings policy (see OLS 2005 CMP kernel scheduler paper for more details..
    I will post another patch for power savings policy soon)

    Most of the arch/* file changes are for cpu_coregroup_map() implementation.

    Signed-off-by: Suresh Siddha
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Siddha, Suresh B
     

12 Jan, 2006

1 commit


15 Nov, 2005

3 commits

  • Linus Torvalds
     
  • With a NR_CPUS==128 kernel with CPU hotplug enabled we would waste 4MB
    on per CPU data of all possible CPUs. The reason was that HOTPLUG
    always set up possible map to NR_CPUS cpus and then we need to allocate
    that much (each per CPU data is roughly ~32k now)

    The underlying problem is that ACPI didn't tell us how many hotplug CPUs
    the platform supports. So the old code just assumed all, which would
    lead to this memory wastage.

    This implements some new heuristics:

    - If the BIOS specified disabled CPUs in the ACPI/mptables assume they
    can be enabled later (this is bending the ACPI specification a bit,
    but seems like a obvious extension)
    - The user can overwrite it with a new additionals_cpus=NUM option
    - Otherwise use half of the available CPUs or 2, whatever is more.

    Cc: ashok.raj@intel.com
    Cc: len.brown@intel.com

    Signed-off-by: Andi Kleen
    Signed-off-by: Linus Torvalds

    Andi Kleen
     
  • We should zap the low mappings, as soon as possible, so that we can catch
    kernel bugs more effectively. Previously early boot had NULL mapped
    and didn't trap on NULL references.

    This patch introduces boot_level4_pgt, which will always have low identity
    addresses mapped. Druing boot, all the processors will use this as their
    level4 pgt. On BP, we will switch to init_level4_pgt as soon as we enter C
    code and zap the low mappings as soon as we are done with the usage of
    identity low mapped addresses. On AP's we will zap the low mappings as
    soon as we jump to C code.

    Signed-off-by: Suresh Siddha
    Signed-off-by: Ashok Raj
    Signed-off-by: Andi Kleen
    Signed-off-by: Linus Torvalds

    Siddha, Suresh B
     

11 Nov, 2005

1 commit

  • MSI hardcoded delivery mode to use logical delivery mode. Recently
    x86_64 moved to use physical mode addressing to support physflat mode.
    With this mode enabled noticed that my eth with MSI werent working.

    msi_address_init() was hardcoded to use logical mode for i386 and x86_64.
    So when we switch to use physical mode, things stopped working.

    Since anyway we dont use lowest priority delivery with MSI, its always
    directed to just a single CPU. Its safe and simpler to use
    physical mode always, even when we use logical delivery mode for IPI's
    or other ioapic RTE's.

    Signed-off-by: Ashok Raj
    Signed-off-by: Greg Kroah-Hartman

    Ashok Raj
     

11 Oct, 2005

1 commit


13 Sep, 2005

1 commit


30 Jul, 2005

1 commit

  • sync_tsc was using smp_call_function to ask the boot processor to report
    it's tsc value. smp_call_function performs an IPI_send_allbutself which is
    a broadcast ipi. There is a window during processor startup during which
    the target cpu has started and before it has initialized it's interrupt
    vectors so it can properly process an interrupt. Receveing an interrupt
    during that window will triple fault the cpu and do other nasty things.

    Why cli does not protect us from that is beyond me.

    The simple fix is to match ia64 and provide a smp_call_function_single.
    Which avoids the broadcast and is more efficient.

    This certainly fixes the problem of getting stuck on boot which was
    very easy to trigger on my SMP Hyperthreaded Xeon, and I think
    it fixes it for the right reasons.

    Minor changes by AK

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     

29 Jul, 2005

1 commit


26 Jun, 2005

2 commits

  • Broadcast IPI's provide un-expected behaviour for cpu hotplug. CPU's in
    offline state also end up receiving the IPI. Once the cpus become online they
    receive these stale IPI's which are bad and introduce unexpected behaviour.

    This is easily avoided by not sending a broadcast and addressing just the
    CPU's in online map. Doing prelim cycle counts it appears there is no big
    overhead and numbers seem around 0x3000-0x3900 on an average on x86 and x86_64
    systems with CPUS running 3G, both for broadcast and mask version of the
    API's.

    The shortcuts are useful only for flat mode (where the perf shows no
    degradation), and in cluster mode, its unicast anyway. Its simpler to just
    not use broadcast anymore.

    Signed-off-by: Ashok Raj
    Acked-by: Andi Kleen
    Acked-by: Zwane Mwaikambo
    Signed-off-by: Shaohua Li
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ashok Raj
     
  • Experimental CPU hotplug patch for x86_64
    -----------------------------------------
    This supports logical CPU online and offline.
    - Test with maxcpus=1, and then kick other cpu's off to test if init code
    is all cleaned up. CONFIG_SCHED_SMT works as well.
    - idle threads are forked on demand from keventd threads for clean startup

    TBD:
    1. Not tested on a real NUMA machine (tested with numa=fake=2)
    2. Handle ACPI pieces for physical hotplug support.

    Signed-off-by: Ashok Raj
    Acked-by: Andi Kleen
    Acked-by: Zwane Mwaikambo
    Signed-off-by: Shaohua.li
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ashok Raj
     

22 Jun, 2005

1 commit

  • This patch implements a number of smp_processor_id() cleanup ideas that
    Arjan van de Ven and I came up with.

    The previous __smp_processor_id/_smp_processor_id/smp_processor_id API
    spaghetti was hard to follow both on the implementational and on the
    usage side.

    Some of the complexity arose from picking wrong names, some of the
    complexity comes from the fact that not all architectures defined
    __smp_processor_id.

    In the new code, there are two externally visible symbols:

    - smp_processor_id(): debug variant.

    - raw_smp_processor_id(): nondebug variant. Replaces all existing
    uses of _smp_processor_id() and __smp_processor_id(). Defined
    by every SMP architecture in include/asm-*/smp.h.

    There is one new internal symbol, dependent on DEBUG_PREEMPT:

    - debug_smp_processor_id(): internal debug variant, mapped to
    smp_processor_id().

    Also, i moved debug_smp_processor_id() from lib/kernel_lock.c into a new
    lib/smp_processor_id.c file. All related comments got updated and/or
    clarified.

    I have build/boot tested the following 8 .config combinations on x86:

    {SMP,UP} x {PREEMPT,!PREEMPT} x {DEBUG_PREEMPT,!DEBUG_PREEMPT}

    I have also build/boot tested x64 on UP/PREEMPT/DEBUG_PREEMPT. (Other
    architectures are untested, but should work just fine.)

    Signed-off-by: Ingo Molnar
    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

17 Apr, 2005

3 commits

  • This will allow hotplug CPU in the future and in general cleans up a lot of
    crufty code. It also should plug some races that the old hackish way
    introduces. Remove one old race workaround in NMI watchdog setup that is not
    needed anymore.

    I removed the old total sum of bogomips reporting code. The brag value of
    BogoMips has been greatly devalued in the last years on the open market.

    Real CPU hotplug will need some more work, but the infrastructure for it is
    there now.

    One drawback: the new TSC sync algorithm is less accurate than before. The
    old way of zeroing TSCs is too intrusive to do later. Instead the TSC of the
    BP is duplicated now, which is less accurate.

    akpm:

    - sync_tsc_bp_init seems to have the sense of `init' inverted.

    - SPIN_LOCK_UNLOCKED is deprecated - use DEFINE_SPINLOCK.

    Cc:
    Cc:
    Signed-off-by: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andi Kleen
     
  • Appended patch adds the support for Intel dual-core detection and displaying
    the core related information in /proc/cpuinfo.

    It adds two new fields "core id" and "cpu cores" to x86 /proc/cpuinfo and the
    "core id" field for x86_64("cpu cores" field is already present in x86_64).

    Number of processor cores in a die is detected using cpuid(4) and this is
    documented in IA-32 Intel Architecture Software Developer's Manual (vol 2a)
    (http://developer.intel.com/design/pentium4/manuals/index_new.htm#sdm_vol2a)

    This patch also adds cpu_core_map similar to cpu_sibling_map.

    Slightly hacked by AK.

    Signed-off-by: Suresh Siddha
    Signed-off-by: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andi Kleen
     
  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds