24 Dec, 2011

2 commits

  • Currently "nox2apic" boot parameter was not enabling x2apic mode if the cpu,
    kernel are all capable of enabling x2apic mode and the OS handover
    happened in xapic mode.

    However If the bios enabled x2apic prior to OS handover, using "nox2apic"
    boot parameter had no effect.

    If the boot cpu's apicid is < 255, enable "nox2apic" boot parameter to
    disable the x2apic mode setup by the bios. This will enable the kernel to
    fallback to xapic mode and bringup only the cpu's which has apic-id < 255.

    -v2: fix patch error and two compiling warning
    make disable_x2apic to be __init

    Signed-off-by: Yinghai Lu
    Signed-off-by: Suresh Siddha
    Link: http://lkml.kernel.org/r/CAE9FiQUeB-3uxJAMiHsz=uPWoFv5Hg1pVepz7aU6YtqOxMC-=Q@mail.gmail.com
    Signed-off-by: H. Peter Anvin

    Yinghai Lu
     
  • On some of the recent Intel SNB platforms, by default bios is pre-enabling
    x2apic mode in the cpu with out setting up interrupt-remapping.
    This case was resulting in the kernel to panic as the cpu is already in
    x2apic mode but the OS was not able to enable interrupt-remapping (which
    is a pre-req for using x2apic capability).

    On these platforms all the apic-ids are < 255 and the kernel can fallback to
    xapic mode if the bios has not enabled interrupt-remapping (which is
    mostly the case if the bios has not exported interrupt-remapping tables to the
    OS).

    Reported-by: Berck E. Nash
    Signed-off-by: Yinghai Lu
    Link: http://lkml.kernel.org/r/20111222014632.600418637@sbsiddha-desk.sc.intel.com
    Signed-off-by: Suresh Siddha
    Signed-off-by: H. Peter Anvin

    Yinghai Lu
     

18 Dec, 2011

1 commit


14 Dec, 2011

1 commit

  • In the IPI delivery slow path (NMI delivery) we retry the ICR
    read to check for delivery completion a limited number of times.

    [ The reason for the limited retries is that some of the places
    where it is used (cpu boot, kdump, etc) IPI delivery might not
    succeed (due to a firmware bug or system crash, for example)
    and in such a case it is better to give up and resume
    execution of other code. ]

    This patch adds a new entry to /proc/interrupts, RTR, which
    tells user space the number of times we retried the ICR read in
    the IPI delivery slow path.

    This should give some insight into how well the APIC
    message delivery hardware is working - if the counts are way
    too large then we are hitting a (very-) slow path way too
    often.

    Signed-off-by: Fernando Luis Vazquez Cao
    Cc: Jörn Engel
    Cc: Suresh Siddha
    Link: http://lkml.kernel.org/n/tip-vzsp20lo2xdzh5f70g0eis2s@git.kernel.org
    [ extended the changelog ]
    Signed-off-by: Ingo Molnar

    Fernando Luis Vázquez Cao
     

10 Nov, 2011

1 commit

  • lapic timer calibration can be combined with tsc in platform
    specific calibration functions. if such calibration result is
    obtained early, we can skip the redundant calibration loops.

    Signed-off-by: Jacob Pan
    Signed-off-by: Jacob Pan
    Signed-off-by: Alan Cox
    Signed-off-by: Dirk Brandewie
    Signed-off-by: Ingo Molnar

    Jacob Pan
     

29 Sep, 2011

1 commit

  • These warnings (generally one per CPU) are a result of
    initializing x86_cpu_to_logical_apicid while apic_default is
    still in use, but the check in setup_local_APIC() being done
    when apic_bigsmp was already used as an override in
    default_setup_apic_routing():

    Overriding APIC driver with bigsmp
    Enabling APIC mode: Physflat. Using 5 I/O APICs
    ------------[ cut here ]------------
    WARNING: at .../arch/x86/kernel/apic/apic.c:1239
    ...
    CPU 1 irqstacks, hard=f1c9a000 soft=f1c9c000
    Booting Node 0, Processors #1
    smpboot cpu 1: start_ip = 9e000
    Initializing CPU#1
    ------------[ cut here ]------------
    WARNING: at .../arch/x86/kernel/apic/apic.c:1239
    setup_local_APIC+0x137/0x46b() Hardware name: ...
    CPU1 logical APIC ID: 2 != 8
    ...

    Fix this (for the time being, i.e. until
    x86_32_early_logical_apicid() will get removed again, as Tejun
    says ought to be possible) by overriding the previously stored
    values at the point where the APIC driver gets overridden.

    v2: Move this and the pre-existing override logic into
    arch/x86/kernel/apic/bigsmp_32.c.

    Signed-off-by: Jan Beulich
    Acked-by: Tejun Heo
    Cc: (2.6.39 and onwards)
    Link: http://lkml.kernel.org/r/4E835D16020000780005844C@nat28.tlf.novell.com
    Signed-off-by: Ingo Molnar

    Jan Beulich
     

27 Jul, 2011

1 commit

  • This allows us to move duplicated code in
    (atomic_inc_not_zero() for now) to

    Signed-off-by: Arun Sharma
    Reviewed-by: Eric Dumazet
    Cc: Ingo Molnar
    Cc: David Miller
    Cc: Eric Dumazet
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun Sharma
     

22 May, 2011

3 commits

  • Apic probe now looks at the apic drivers listed in the
    .apicdrivers section. Remove apic_probe[] and make each apic
    driver static.

    Signed-off-by: Suresh Siddha
    Tested-by: Cyrill Gorcunov
    Cc: steiner@sgi.com
    Cc: gorcunov@openvz.org
    Cc: yinghai@kernel.org
    Link: http://lkml.kernel.org/r/20110521005526.341718626@sbsiddha-MOBL3.sc.intel.com
    Signed-off-by: Ingo Molnar

    Suresh Siddha
     
  • Make generic_bigsmp_probe() return struct apic *. This will
    avoid exporting apic_bigsmp, which will be consistent with
    others.

    Signed-off-by: Suresh Siddha
    Tested-by: Cyrill Gorcunov
    Cc: steiner@sgi.com
    Cc: gorcunov@openvz.org
    Cc: yinghai@kernel.org
    Link: http://lkml.kernel.org/r/20110521005526.252703851@sbsiddha-MOBL3.sc.intel.com
    Signed-off-by: Ingo Molnar

    Suresh Siddha
     
  • This will pave the way for each apic driver to be self-contained
    and eliminate the need for apic_probe[].

    Order in which apic drivers are listed in the .apicdrivers
    section is important, as this determines the apic probe order.
    And this is enforced by the ordering of apic driver files in the
    Makefile and the macros apic_driver()/apic_drivers().

    Signed-off-by: Suresh Siddha
    Tested-by: Cyrill Gorcunov
    Cc: steiner@sgi.com
    Cc: gorcunov@openvz.org
    Cc: yinghai@kernel.org
    Link: http://lkml.kernel.org/r/20110521005526.068775085@sbsiddha-MOBL3.sc.intel.com
    Signed-off-by: Ingo Molnar

    Suresh Siddha
     

02 May, 2011

1 commit

  • NUMAQ is the only meaningful user of this callback and
    setup_local_APIC() the only callsite. Stop torturing everyone else by
    making the callback optional and removing all the boilerplate
    implementations and assignments.

    Signed-off-by: Tejun Heo
    Cc: Ingo Molnar
    Cc: Yinghai Lu
    Cc: David Rientjes
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"

    Tejun Heo
     

29 Mar, 2011

1 commit

  • Stop including in x86 header files which don't
    need it. This will let the compiler complain when this header is
    not included by source files when it should, so that
    contributors can fix the problem before building on other
    architectures starts to fail.

    Credits go to Geert for the idea.

    Signed-off-by: Jean Delvare
    Cc: James E.J. Bottomley
    Cc: Geert Uytterhoeven
    Cc: Stephen Rothwell
    LKML-Reference:
    [ this also fixes an upstream build bug in drivers/media/rc/ite-cir.c ]
    Signed-off-by: Ingo Molnar

    Jean Delvare
     

16 Mar, 2011

1 commit

  • …el/git/tip/linux-2.6-tip

    * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (27 commits)
    x86: Clean up apic.c and apic.h
    x86: Remove superflous goal definition of tsc_sync
    x86: dt: Correct local apic documentation in device tree bindings
    x86: dt: Cleanup local apic setup
    x86: dt: Fix OLPC=y/INTEL_CE=n build
    rtc: cmos: Add OF bindings
    x86: ce4100: Use OF to setup devices
    x86: ioapic: Add OF bindings for IO_APIC
    x86: dtb: Add generic bus probe
    x86: dtb: Add support for PCI devices backed by dtb nodes
    x86: dtb: Add device tree support for HPET
    x86: dtb: Add early parsing of IO_APIC
    x86: dtb: Add irq domain abstraction
    x86: dtb: Add a device tree for CE4100
    x86: Add device tree support
    x86: e820: Remove conditional early mapping in parse_e820_ext
    x86: OLPC: Make OLPC=n build again
    x86: OLPC: Remove extra OLPC_OPENFIRMWARE_DT indirection
    x86: OLPC: Cleanup config maze completely
    x86: OLPC: Hide OLPC_OPENFIRMWARE config switch
    ...

    Fix up conflicts in arch/x86/platform/ce4100/ce4100.c

    Linus Torvalds
     

15 Mar, 2011

1 commit


11 Mar, 2011

1 commit


25 Feb, 2011

1 commit

  • Up to now we force enable the local apic in the devicetree setup
    uncoditionally and set smp_found_config unconditionally to 1 when a
    devicetree blob is available. This breaks, when local apic is disabled
    in the Kconfig.

    Make it consistent by initializing device tree explicitely before
    smp_get_config() so a non lapic configuration could be used as well.
    To be functional that would require to implement PIT as an interrupt
    host, but the only user of this code until now is ce4100 which
    requires apics to be available. So we leave this up to those who need
    it.

    Tested-by: Sebastian Siewior
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

10 Feb, 2011

1 commit

  • Additionally doing things conditionally upon smp_processor_id()
    being zero is generally a bad idea, as this means CPU 0 cannot
    be offlined and brought back online later again.

    While there may be other places where this is done, I think adding
    more of those should be avoided so that some day SMP can really
    become "symmetrical".

    Signed-off-by: Jan Beulich
    Cc: Cyrill Gorcunov
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Jan Beulich
     

28 Jan, 2011

4 commits

  • apic->apicid_to_node() is 32bit specific apic operation which
    determines NUMA node for a CPU. Depending on the APIC
    implementation, it can be easier to determine NUMA node from
    either physical or logical apicid. Currently,
    ->apicid_to_node() takes @logical_apicid and calls
    hard_smp_processor_id() if the physical apicid is needed.

    This prevents NUMA mapping from being queried from a different
    CPU, which in turn makes it impossible to initialize NUMA
    mapping before SMP bringup.

    This patch replaces apic->apicid_to_node() with
    ->x86_32_numa_cpu_node() which takes @cpu, from which both
    logical and physical apicids can easily be determined. While at
    it, drop duplicate implementations from bigsmp_32 and summit_32,
    and use the default one.

    Signed-off-by: Tejun Heo
    Reviewed-by: Pekka Enberg
    Cc: eric.dumazet@gmail.com
    Cc: yinghai@kernel.org
    Cc: brgerst@gmail.com
    Cc: gorcunov@gmail.com
    Cc: shaohui.zheng@intel.com
    Cc: rientjes@google.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tejun Heo
     
  • On x86_32, the mapping between cpu and logical apic ID differs
    depending on the specific apic implementation in use. The
    mapping is initialized while bringing up CPUs; however, this
    makes early inits ignore memory topology.

    Add a x86_32 specific apic->x86_32_early_logical_apicid() which
    is called early during boot to query the mapping. The mapping
    is later verified against the result of init_apic_ldr(). The
    method is allowed to return BAD_APICID if it can't be determined
    early.

    noop variant which always returns BAD_APICID is implemented and
    added to all x86_32 apic implementations.

    Signed-off-by: Tejun Heo
    Cc: eric.dumazet@gmail.com
    Cc: yinghai@kernel.org
    Cc: brgerst@gmail.com
    Cc: gorcunov@gmail.com
    Cc: penberg@kernel.org
    Cc: shaohui.zheng@intel.com
    Cc: rientjes@google.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tejun Heo
     
  • After the previous patch, apic->cpu_to_logical_apicid() is no
    longer used. Kill it.

    For apic types with custom cpu_to_logical_apicid() which is also
    used for other purposes, remove the function and modify its
    users to do the mapping directly.

    #ifdef's on CONFIG_SMP in es7000_32 and summit_32 are ignored
    during conversion as they are not used for UP kernels.

    Signed-off-by: Tejun Heo
    Cc: eric.dumazet@gmail.com
    Cc: yinghai@kernel.org
    Cc: brgerst@gmail.com
    Cc: gorcunov@gmail.com
    Cc: penberg@kernel.org
    Cc: shaohui.zheng@intel.com
    Cc: rientjes@google.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tejun Heo
     
  • Unlike x86_64, on x86_32, the mapping from cpu to logical apicid
    may vary depending on apic in use. cpu_2_logical_apicid[] array
    is used for this mapping. Replace it with early percpu variable
    x86_cpu_to_logical_apicid to make it better aligned with other
    mappings.

    Signed-off-by: Tejun Heo
    Cc: eric.dumazet@gmail.com
    Cc: yinghai@kernel.org
    Cc: brgerst@gmail.com
    Cc: gorcunov@gmail.com
    Cc: penberg@kernel.org
    Cc: shaohui.zheng@intel.com
    Cc: rientjes@google.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tejun Heo
     

10 Dec, 2010

3 commits


10 Nov, 2010

1 commit

  • native_apic_msr_read() and x2apic_enabled() use rdmsr(msr, low, high),
    but only use the low part.

    gcc4.6 complains about this:
    .../apic.h:144:11: warning: variable 'high' set but not used [-Wunused-but-set-variable]

    rdmsr() is just a wrapper around rdmsrl() which splits the 64bit value
    into low and high, so using rdmsrl() directly solves this.

    [tglx: Changed the variables to u64 as suggested by Cyrill. It's less
    confusing and has no code impact as this is 64bit only anyway.
    Massaged changelog as well. ]

    Signed-off-by: Andi Kleen
    Cc: x86@kernel.org
    Cc: Cyrill Gorcunov
    LKML-Reference:
    Signed-off-by: Thomas Gleixner

    Andi Kleen
     

23 Oct, 2010

1 commit

  • Some embedded x86 platforms don't setup the APIC in the
    BIOS/bootloader and would be forced to add "lapic" on the kernel
    command line. That's a bit akward.

    Split out the force enable code from detect_init_APIC() and allow
    platform code to call it from the platform setup. That avoids the
    command line parameter and possible replication of the MSR dance in
    the force enable code.

    Signed-off-by: Thomas Gleixner
    LKML-Reference:
    Signed-off-by: Dirk Brandewie

    Thomas Gleixner
     

20 Oct, 2010

1 commit

  • We want the BIOS to setup the EILVT APIC registers. The offsets
    were hardcoded and BIOS settings were overwritten by the OS.
    Now, the subsystems for MCE threshold and IBS determine the LVT
    offset from the registers the BIOS has setup. If the BIOS setup
    is buggy on a family 10h system, a workaround enables IBS. If
    the OS determines an invalid register setup, a "[Firmware Bug]:
    " error message is reported.

    We need this change also for upcomming cpu families.

    Signed-off-by: Robert Richter
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Robert Richter
     

19 Mar, 2010

1 commit

  • In case even if the kernel is configured so that
    no APIC support is built-in we still may allow
    to use certain apic functions as dummy calls.

    In particular we start using it in perf-events code.

    Note that this is not that same as NOOP apic driver (which
    is used if APIC support is present but no physical APIC is
    available), this is for the case when we don't have apic code
    compiled in at all.

    Signed-off-by: Cyrill Gorcunov
    Cc: H. Peter Anvin
    Cc: Yinghai Lu
    Cc: Yinghai Lu
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Cyrill Gorcunov
     

10 Nov, 2009

1 commit

  • We should not use physid_mask_t as a stack based
    variable in apic code. This type depends on MAX_APICS
    parameter which may be huge enough.

    Especially it became a problem with apic NOOP driver which
    is portable between 32 bit and 64 bit environment
    (where we have really huge MAX_APICS).

    So apic driver should operate with pointers and a caller
    in turn should aware of allocation physid_mask_t variable.

    As a side (but positive) effect -- we may use already
    implemented physid_set_mask_of_physid function eliminating
    default_apicid_to_cpu_present completely.

    Note that physids_coerce and physids_promote turned into static
    inline from macro (since macro hides the fact that parameter is
    being interpreted as unsigned long, make it explicit).

    Signed-off-by: Cyrill Gorcunov
    Cc: Yinghai Lu
    Cc: Maciej W. Rozycki
    Cc: Stephen Rothwell
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Cyrill Gorcunov
     

14 Oct, 2009

1 commit

  • Introduce NOOP APIC driver. We should use it in case if apic was
    disabled due to hardware of software/firmware problems (including
    user requested to disable it case).

    The driver is attempting to catch any inappropriate apic operation
    call with warning issue.

    Also it is possible to use some apic operation like IPI calls,
    read/write without checking for apic presence which should make
    callers code easier.

    Signed-off-by: Cyrill Gorcunov
    Cc: yinghai@kernel.org
    Cc: macro@linux-mips.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Cyrill Gorcunov
     

21 Sep, 2009

2 commits


19 Sep, 2009

1 commit

  • …el/git/tip/linux-2.6-tip

    * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (38 commits)
    x86: Move get/set_wallclock to x86_platform_ops
    x86: platform: Fix section annotations
    x86: apic namespace cleanup
    x86: Distangle ioapic and i8259
    x86: Add Moorestown early detection
    x86: Add hardware_subarch ID for Moorestown
    x86: Add early platform detection
    x86: Move tsc_init to late_time_init
    x86: Move tsc_calibration to x86_init_ops
    x86: Replace the now identical time_32/64.c by time.c
    x86: time_32/64.c unify profile_pc
    x86: Move calibrate_cpu to tsc.c
    x86: Make timer setup and global variables the same in time_32/64.c
    x86: Remove mca bus ifdef from timer interrupt
    x86: Simplify timer_ack magic in time_32.c
    x86: Prepare unification of time_32/64.c
    x86: Remove do_timer hook
    x86: Add timer_init to x86_init_ops
    x86: Move percpu clockevents setup to x86_init_ops
    x86: Move xen_post_allocator_init into xen_pagetable_setup_done
    ...

    Fix up conflicts in arch/x86/include/asm/io_apic.h

    Linus Torvalds
     

01 Sep, 2009

1 commit


31 Aug, 2009

1 commit


05 Aug, 2009

1 commit

  • KVM would like to provide x2APIC interface to a guest without emulating
    interrupt remapping device. The reason KVM prefers guest to use x2APIC
    is that x2APIC interface is better virtualizable and provides better
    performance than mmio xAPIC interface:

    - msr exits are faster than mmio (no page table walk, emulation)
    - no need to read back ICR to look at the busy bit
    - one 64 bit ICR write instead of two 32 bit writes
    - shared code with the Hyper-V paravirt interface

    Included patch changes x2APIC enabling logic to enable it even if IR
    initialization failed, but kernel runs under KVM and no apic id is
    greater than 255 (if there is one spec requires BIOS to move to x2apic
    mode before starting an OS).

    -v2: fix build
    -v3: fix bug causing compiler warning

    Signed-off-by: Gleb Natapov
    Acked-by: Suresh Siddha
    Cc: Sheng Yang
    Cc: "avi@redhat.com"
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Gleb Natapov
     

11 Jun, 2009

2 commits

  • …/git/tip/linux-2.6-tip

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86: Clear TS in irq_ts_save() when in an atomic section
    x86: Detect use of extended APIC ID for AMD CPUs
    x86: memtest: remove 64-bit division
    x86, UV: Fix macros for multiple coherency domains
    x86: Fix non-lazy GS handling in sys_vm86()
    x86: Add quirk for reboot stalls on a Dell Optiplex 360
    x86: Fix UV BAU activation descriptor init

    Linus Torvalds
     
  • …el/git/tip/linux-2.6-tip

    * 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86, nmi: Use predefined numbers instead of hardcoded one
    x86: asm/processor.h: remove double declaration
    x86, mtrr: replace MTRRdefType_MSR with msr-index's MSR_MTRRdefType
    x86, mtrr: replace MTRRfix4K_C0000_MSR with msr-index's MSR_MTRRfix4K_C0000
    x86, mtrr: remove mtrr MSRs double declaration
    x86, mtrr: replace MTRRfix16K_80000_MSR with msr-index's MSR_MTRRfix16K_80000
    x86, mtrr: replace MTRRfix64K_00000_MSR with msr-index's MSR_MTRRfix64K_00000
    x86, mtrr: replace MTRRcap_MSR with msr-index's MSR_MTRRcap
    x86: mce: remove duplicated #include
    x86: msr-index.h remove duplicate MSR C001_0015 declaration
    x86: clean up arch/x86/kernel/tsc_sync.c a bit
    x86: use symbolic name for VM86_SIGNAL when used as vm86 default return
    x86: added 'ifndef _ASM_X86_IOMAP_H' to iomap.h
    x86: avoid multiple declaration of kstack_depth_to_print
    x86: vdso/vma.c declare vdso_enabled and arch_setup_additional_pages before they get used
    x86: clean up declarations and variables
    x86: apic/x2apic_cluster.c x86_cpu_to_logical_apicid should be static
    x86 early quirks: eliminate unused function

    Linus Torvalds
     

09 Jun, 2009

1 commit

  • Booting a 32-bit kernel on Magny-Cours results in the following panic:

    ...
    Using APIC driver default
    ...
    Overriding APIC driver with bigsmp
    ...
    Getting VERSION: 80050010
    Getting VERSION: 80050010
    Getting ID: 10000000
    Getting ID: ef000000
    Getting LVT0: 700
    Getting LVT1: 10000
    Kernel panic - not syncing: Boot APIC ID in local APIC unexpected (16 vs 0)
    Pid: 1, comm: swapper Not tainted 2.6.30-rcX #2
    Call Trace:
    [] ? panic+0x38/0xd3
    [] ? native_smp_prepare_cpus+0x259/0x31f
    [] ? kernel_init+0x3e/0x141
    [] ? kernel_init+0x0/0x141
    [] ? kernel_thread_helper+0x7/0x10

    The reason is that default_get_apic_id handled extension of local APIC
    ID field just in case of XAPIC.

    Thus for this AMD CPU, default_get_apic_id() returns 0 and
    bigsmp_get_apic_id() returns 16 which leads to the respective kernel
    panic.

    This patch introduces a Linux specific feature flag to indicate
    support for extended APIC id (8 bits instead of 4 bits width) and sets
    the flag on AMD CPUs if applicable.

    Signed-off-by: Andreas Herrmann
    Cc:
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Andreas Herrmann
     

21 Apr, 2009

1 commit