29 Oct, 2016

5 commits

  • The recent changes, which forced the registration of the boot cpu on UP
    systems, which do not have ACPI tables, have been fixed for systems w/o
    local APIC, but left a wreckage for systems which have neither ACPI nor
    mptables, but the CPU has an APIC, e.g. virtualbox.

    The boot process crashes in prefill_possible_map() as it wants to register
    the boot cpu, which needs to access the local apic, but the local APIC is
    not yet mapped.

    There is no reason why init_apic_mapping() can't be invoked before
    prefill_possible_map(). So instead of playing another silly early mapping
    game, as the ACPI/mptables code does, we just move init_apic_mapping()
    before the call to prefill_possible_map().

    In hindsight, I should have noticed that combination earlier.

    Sorry for the churn (also in stable)!

    Fixes: ff8560512b8d ("x86/boot/smp: Don't try to poke disabled/non-existent APIC")
    Reported-and-debugged-by: Michal Necasek
    Reported-and-tested-by: Wolfgang Bauer
    Cc: prarit@redhat.com
    Cc: ville.syrjala@linux.intel.com
    Cc: michael.thayer@oracle.com
    Cc: knut.osmundsen@oracle.com
    Cc: frank.mehnert@oracle.com
    Cc: Borislav Petkov
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1610282114380.5053@nanos
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • Pull ACPI fixes from Rafael Wysocki:
    "These fix recent ACPICA regressions, an older PCI IRQ management
    regression, and an incorrect return value of a function in the APEI
    code.

    Specifics:

    - Fix three ACPICA issues related to the interpreter locking and
    introduced by recent changes in that area (Lv Zheng).

    - Fix a PCI IRQ management regression introduced during the 4.7 cycle
    and related to the configuration of shared IRQs on systems with an
    ISA bus (Sinan Kaya).

    - Fix up a return value of one function in the APEI code (Punit
    Agrawal)"

    * tag 'acpi-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    ACPICA: Dispatcher: Fix interpreter locking around acpi_ev_initialize_region()
    ACPICA: Dispatcher: Fix an unbalanced lock exit path in acpi_ds_auto_serialize_method()
    ACPICA: Dispatcher: Fix order issue of method termination
    ACPI / APEI: Fix incorrect return value of ghes_proc()
    ACPI/PCI: pci_link: Include PIRQ_PENALTY_PCI_USING for ISA IRQs
    ACPI/PCI: pci_link: penalize SCI correctly
    ACPI/PCI/IRQ: assign ISA IRQ directly during early boot stages

    Linus Torvalds
     
  • Pull perf fixes from Ingo Molnar:
    "Misc kernel fixes: a virtualization environment related fix, an uncore
    PMU driver removal handling fix, a PowerPC fix and new events for
    Knights Landing"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf/x86/intel: Honour the CPUID for number of fixed counters in hypervisors
    perf/powerpc: Don't call perf_event_disable() from atomic context
    perf/core: Protect PMU device removal with a 'pmu_bus_running' check, to fix CONFIG_DEBUG_TEST_DRIVER_REMOVE=y kernel panic
    perf/x86/intel/cstate: Add C-state residency events for Knights Landing

    Linus Torvalds
     
  • Pull x86 fixes from Ingo Molnar:
    "Misc fixes: three build fixes, an unwinder fix and a microcode loader
    fix"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/microcode/AMD: Fix more fallout from CONFIG_RANDOMIZE_MEMORY=y
    x86: Fix export for mcount and __fentry__
    x86/quirks: Hide maybe-uninitialized warning
    x86/build: Fix build with older GCC versions
    x86/unwind: Fix empty stack dereference in guess unwinder

    Linus Torvalds
     
  • Pull drm x86/pat regression fixes from Dave Airlie:
    "This is a standalone pull request for the fix for a regression
    introduced in -rc1 by a change to vm_insert_mixed to start using the
    PAT range tracking to validate page protections. With this fix in
    place, all the VRAM mappings for GPU drivers ended up at UC instead of
    WC.

    There are probably better ways to fix this long term, but nothing I'd
    considered for -fixes that wouldn't need more settling in time. So
    I've just created a new arch API that the drivers can reserve all
    their VRAM aperture ranges as WC"

    * tag 'drm-x86-pat-regression-fix' of git://people.freedesktop.org/~airlied/linux:
    drm/drivers: add support for using the arch wc mapping API.
    x86/io: add interface to reserve io memtype for a resource range. (v1.1)

    Linus Torvalds
     

28 Oct, 2016

3 commits

  • perf doesn't seem to honour the number of fixed counters specified by CPUID
    leaf 0xa. It always assumes that Intel CPUs have at least 3 fixed counters.

    So if some of the fixed counters are masked out by the hypervisor, it still
    tries to check/set them.

    This patch makes perf behave nicer when the kernel is running under a
    hypervisor that doesn't expose all the counters.

    This patch contains some ideas from Matt Wilson.

    Signed-off-by: Imre Palik
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Andi Kleen
    Cc: Alexander Kozyrev
    Cc: Alexander Shishkin
    Cc: Arnaldo Carvalho de Melo
    Cc: Artyom Kuanbekov
    Cc: David Carrillo-Cisneros
    Cc: David Woodhouse
    Cc: H. Peter Anvin
    Cc: Jiri Olsa
    Cc: Kan Liang
    Cc: Linus Torvalds
    Cc: Matt Wilson
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1477037939-15605-1-git-send-email-imrep.amz@gmail.com
    Signed-off-by: Ingo Molnar

    Imre Palik
     
  • We needed the physical address of the container in order to compute the
    offset within the relocated ramdisk. And we did this by doing __pa() on
    the virtual address.

    However, __pa() does checks whether the physical address is within
    PAGE_OFFSET and __START_KERNEL_map - see __phys_addr() - which fail
    if we have CONFIG_RANDOMIZE_MEMORY enabled: we feed a virtual address
    which *doesn't* have the randomization offset into a function which uses
    PAGE_OFFSET which *does* have that offset.

    This makes this check fire:

    VIRTUAL_BUG_ON((x > y) || !phys_addr_valid(x));
    ^^^^^^

    due to the randomization offset.

    The fix is as simple as using __pa_nodebug() because we do that
    randomization offset accounting later in that function ourselves.

    Reported-by: Bob Peterson
    Tested-by: Bob Peterson
    Signed-off-by: Borislav Petkov
    Cc: Andreas Gruenbacher
    Cc: Andy Lutomirski
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Mel Gorman
    Cc: Peter Zijlstra
    Cc: Steven Whitehouse
    Cc: Thomas Gleixner
    Cc: linux-mm
    Cc: stable@vger.kernel.org # 4.9
    Link: http://lkml.kernel.org/r/20161027123623.j2jri5bandimboff@pd.tnic
    Signed-off-by: Ingo Molnar

    Borislav Petkov
     
  • The use of config_enabled() is ambiguous. For config options,
    IS_ENABLED(), IS_REACHABLE(), etc. will make intention clearer.
    Sometimes config_enabled() has been used for non-config options because
    it is useful to check whether the given symbol is defined or not.

    I have been tackling on deprecating config_enabled(), and now is the
    time to finish this work.

    Some new users have appeared for v4.9-rc1, but it is trivial to replace
    them:

    - arch/x86/mm/kaslr.c
    replace config_enabled() with IS_ENABLED() because
    CONFIG_X86_ESPFIX64 and CONFIG_EFI are boolean.

    - include/asm-generic/export.h
    replace config_enabled() with __is_defined().

    Then, config_enabled() can be removed now.

    Going forward, please use IS_ENABLED(), IS_REACHABLE(), etc. for config
    options, and __is_defined() for non-config symbols.

    Link: http://lkml.kernel.org/r/1476616078-32252-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Acked-by: Ingo Molnar
    Acked-by: Nicolas Pitre
    Cc: Peter Oberparleiter
    Cc: Arnd Bergmann
    Cc: Kees Cook
    Cc: Michal Marek
    Cc: "H. Peter Anvin"
    Cc: Thomas Gleixner
    Cc: Thomas Garnier
    Cc: Paul Bolle
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

26 Oct, 2016

2 commits

  • Commit 784d5699eddc5 ("x86: move exports to actual definitions") removed the
    EXPORT_SYMBOL(__fentry__) and EXPORT_SYMBOL(mcount) from x8664_ksyms_64.c,
    and added EXPORT_SYMBOL(function_hook) in mcount_64.S instead. The problem
    is that function_hook isn't a function at all, but a macro that is defined
    as either mcount or __fentry__ depending on the support from gcc.

    Originally, I thought this was a macro issue, like what __stringify()
    is used for. But the problem is a bit deeper. The Makefile.build has
    some magic that does post processing of files to create the CRC
    bindings. It does some searches for EXPORT_SYMBOL() and because it
    finds a macro name and not the actual functions, this causes
    function_hook not to be converted into mcount or __fentry__ and they
    are missed.

    Instead of adding more magic to Makefile.build, just add
    EXPORT_SYMBOL() for mcount and __fentry__ where the ifdef is used.
    Since this is assembly and not C, it doesn't require being set after
    the function is defined.

    Signed-off-by: Steven Rostedt
    Tested-by: Borislav Petkov
    Cc: Gabriel C
    Cc: Nicholas Piggin
    Cc: Al Viro
    Link: http://lkml.kernel.org/r/20161024150148.4f9d90e4@gandalf.local.home
    Signed-off-by: Thomas Gleixner

    Steven Rostedt
     
  • A recent change to the mm code in:
    87744ab3832b mm: fix cache mode tracking in vm_insert_mixed()

    started enforcing checking the memory type against the registered list for
    amixed pfn insertion mappings. It happens that the drm drivers for a number
    of gpus relied on this being broken. Currently the driver only inserted
    VRAM mappings into the tracking table when they came from the kernel,
    and userspace mappings never landed in the table. This led to a regression
    where all the mapping end up as UC instead of WC now.

    I've considered a number of solutions but since this needs to be fixed
    in fixes and not next, and some of the solutions were going to introduce
    overhead that hadn't been there before I didn't consider them viable at
    this stage. These mainly concerned hooking into the TTM io reserve APIs,
    but these API have a bunch of fast paths I didn't want to unwind to add
    this to.

    The solution I've decided on is to add a new API like the arch_phys_wc
    APIs (these would have worked but wc_del didn't take a range), and
    use them from the drivers to add a WC compatible mapping to the table
    for all VRAM on those GPUs. This means we can then create userspace
    mapping that won't get degraded to UC.

    v1.1: use CONFIG_X86_PAT + add some comments in io.h

    Cc: Toshi Kani
    Cc: Borislav Petkov
    Cc: H. Peter Anvin
    Cc: Andy Lutomirski
    Cc: Denys Vlasenko
    Cc: Brian Gerst
    Cc: x86@kernel.org
    Cc: mcgrof@suse.com
    Cc: Dan Williams
    Acked-by: Ingo Molnar
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Dave Airlie

    Dave Airlie
     

25 Oct, 2016

4 commits

  • gcc -Wmaybe-uninitialized detects that quirk_intel_brickland_xeon_ras_cap
    uses uninitialized data when CONFIG_PCI is not set:

    arch/x86/kernel/quirks.c: In function ‘quirk_intel_brickland_xeon_ras_cap’:
    arch/x86/kernel/quirks.c:641:13: error: ‘capid0’ is used uninitialized in this function [-Werror=uninitialized]

    However, the function is also not called in this configuration, so we
    can avoid the warning by moving the existing #ifdef to cover it as well.

    Signed-off-by: Arnd Bergmann
    Cc: Bjorn Helgaas
    Cc: Borislav Petkov
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: linux-pci@vger.kernel.org
    Link: http://lkml.kernel.org/r/20161024153325.2752428-1-arnd@arndb.de
    Signed-off-by: Ingo Molnar

    Arnd Bergmann
     
  • Older GCC (observed with 4.1.x) doesn't support -Wno-override-init and
    also doesn't ignore unknown -Wno-* options.

    Signed-off-by: Jan Beulich
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Valdis Kletnieks
    Cc: Valdis.Kletnieks@vt.edu
    Fixes: 5e44258d16 "x86/build: Reduce the W=1 warnings noise when compiling x86 syscall tables"
    Link: http://lkml.kernel.org/r/580E3E1C02000078001191C4@prv-mh.provo.novell.com
    Signed-off-by: Ingo Molnar

    Jan Beulich
     
  • Vince Waver reported the following bug:

    WARNING: CPU: 0 PID: 21338 at arch/x86/mm/fault.c:435 vmalloc_fault+0x58/0x1f0
    CPU: 0 PID: 21338 Comm: perf_fuzzer Not tainted 4.8.0+ #37
    Hardware name: Hewlett-Packard HP Compaq Pro 6305 SFF/1850, BIOS K06 v02.57 08/16/2013
    Call Trace:
    ? dump_stack+0x46/0x59
    ? __warn+0xd5/0xee
    ? vmalloc_fault+0x58/0x1f0
    ? __do_page_fault+0x6d/0x48e
    ? perf_log_throttle+0xa4/0xf4
    ? trace_page_fault+0x22/0x30
    ? __unwind_start+0x28/0x42
    ? perf_callchain_kernel+0x75/0xac
    ? get_perf_callchain+0x13a/0x1f0
    ? perf_callchain+0x6a/0x6c
    ? perf_prepare_sample+0x71/0x2eb
    ? perf_event_output_forward+0x1a/0x54
    ? __default_send_IPI_shortcut+0x10/0x2d
    ? __perf_event_overflow+0xfb/0x167
    ? x86_pmu_handle_irq+0x113/0x150
    ? native_read_msr+0x6/0x34
    ? perf_event_nmi_handler+0x22/0x39
    ? perf_ibs_nmi_handler+0x4a/0x51
    ? perf_event_nmi_handler+0x22/0x39
    ? nmi_handle+0x4d/0xf0
    ? perf_ibs_handle_irq+0x3d1/0x3d1
    ? default_do_nmi+0x3c/0xd5
    ? do_nmi+0x92/0x102
    ? end_repeat_nmi+0x1a/0x1e
    ? entry_SYSCALL_64_after_swapgs+0x12/0x4a
    ? entry_SYSCALL_64_after_swapgs+0x12/0x4a
    ? entry_SYSCALL_64_after_swapgs+0x12/0x4a
    ^A4---[ end trace 632723104d47d31a ]---
    BUG: stack guard page was hit at ffffc90008500000 (stack is ffffc900084fc000..ffffc900084fffff)
    kernel stack overflow (page fault): 0000 [#1] SMP
    ...

    The NMI hit in the entry code right after setting up the stack pointer
    from 'cpu_current_top_of_stack', so the kernel stack was empty. The
    'guess' version of __unwind_start() attempted to dereference the "top of
    stack" pointer, which is not actually *on* the stack.

    Add a check in the guess unwinder to deal with an empty stack. (The
    frame pointer unwinder already has such a check.)

    Reported-by: Vince Weaver
    Signed-off-by: Josh Poimboeuf
    Cc: Andy Lutomirski
    Cc: Arnaldo Carvalho de Melo
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Fixes: 7c7900f89770 ("x86/unwind: Add new unwind interface and implementations")
    Link: http://lkml.kernel.org/r/20161024133127.e5evgeebdbohnmpb@treble
    Signed-off-by: Ingo Molnar

    Josh Poimboeuf
     
  • Pull xen fixes from David Vrabel:

    - advertise control feature flags in xenstore

    - fix x86 build when XEN_PVHVM is disabled

    * tag 'for-linus-4.9-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
    xenbus: check return value of xenbus_scanf()
    xenbus: prefer list_for_each()
    x86: xen: move cpu_up functions out of ifdef
    xenbus: advertise control feature flags

    Linus Torvalds
     

24 Oct, 2016

2 commits

  • Three newly introduced functions are not defined when CONFIG_XEN_PVHVM is
    disabled, but are still being used:

    arch/x86/xen/enlighten.c:141:12: warning: ‘xen_cpu_up_prepare’ used but never defined
    arch/x86/xen/enlighten.c:142:12: warning: ‘xen_cpu_up_online’ used but never defined
    arch/x86/xen/enlighten.c:143:12: warning: ‘xen_cpu_dead’ used but never defined

    Fixes: 4d737042d6c4 ("xen/x86: Convert to hotplug state machine")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: David Vrabel

    Arnd Bergmann
     
  • Ondrej reported that IRQs stopped working in v4.7 on several
    platforms. A typical scenario, from Ondrej's VT82C694X/694X, is:

    ACPI: Using PIC for interrupt routing
    ACPI: PCI Interrupt Link [LNKA] (IRQs 1 3 4 5 6 7 10 *11 12 14 15)
    ACPI: No IRQ available for PCI Interrupt Link [LNKA]
    8139too 0000:00:0f.0: PCI INT A: no GSI

    We're using PIC routing, so acpi_irq_balance == 0, and LNKA is already
    active at IRQ 11. In that case, acpi_pci_link_allocate() only tries
    to use the active IRQ (IRQ 11) which also happens to be the SCI.

    We should penalize the SCI by PIRQ_PENALTY_PCI_USING, but
    irq_get_trigger_type(11) returns something other than
    IRQ_TYPE_LEVEL_LOW, so we penalize it by PIRQ_PENALTY_ISA_ALWAYS
    instead, which makes acpi_pci_link_allocate() assume the IRQ isn't
    available and give up.

    Add acpi_penalize_sci_irq() so platforms can tell us the SCI IRQ,
    trigger, and polarity directly and we don't have to depend on
    irq_get_trigger_type().

    Fixes: 103544d86976 (ACPI,PCI,IRQ: reduce resource requirements)
    Link: http://lkml.kernel.org/r/201609251512.05657.linux@rainbow-software.org
    Reported-by: Ondrej Zary
    Acked-by: Bjorn Helgaas
    Signed-off-by: Sinan Kaya
    Tested-by: Jonathan Liu
    Signed-off-by: Rafael J. Wysocki

    Sinan Kaya
     

23 Oct, 2016

1 commit

  • Pull x86 fixes from Ingo Molnar:
    "Three fixes, a hw-enablement and a cross-arch fix/enablement change:

    - SGI/UV fix for older platforms

    - x32 signal handling fix

    - older x86 platform bootup APIC fix

    - AVX512-4VNNIW (Neural Network Instructions) and AVX512-4FMAPS
    (Multiply Accumulation Single precision instructions) enablement.

    - move thread_info back into x86 specific code, to make life easier
    for other architectures trying to make use of
    CONFIG_THREAD_INFO_IN_TASK_STRUCT=y"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/boot/smp: Don't try to poke disabled/non-existent APIC
    sched/core, x86: Make struct thread_info arch specific again
    x86/signal: Remove bogus user_64bit_mode() check from sigaction_compat_abi()
    x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates
    x86/cpufeature: Add AVX512_4VNNIW and AVX512_4FMAPS features
    x86/vmware: Skip timer_irq_works() check on VMware

    Linus Torvalds
     

22 Oct, 2016

2 commits

  • Apparently trying to poke a disabled or non-existent APIC
    leads to a box that doesn't even boot. Let's not do that.

    No real clue if this is the right fix, but at least my
    P3 machine boots again.

    Signed-off-by: Ville Syrjälä
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: Eric Biederman
    Cc: H. Peter Anvin
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Juergen Gross
    Cc: Len Brown
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Prarit Bhargava
    Cc: Thomas Gleixner
    Cc: Yinghai Lu
    Cc: dyoung@redhat.com
    Cc: kexec@lists.infradead.org
    Cc: stable@vger.kernel.org
    Fixes: 2a51fe083eba ("arch/x86: Handle non enumerated CPU after physical hotplug")
    Link: http://lkml.kernel.org/r/1477102684-5092-1-git-send-email-ville.syrjala@linux.intel.com
    Signed-off-by: Ingo Molnar

    Ville Syrjälä
     
  • Pull KVM fixes from Radim Krčmář:
    "ARM:
    - avoid livelock when walking guest page tables
    - fix HYP mode static keys without CC_HAVE_ASM_GOTO

    MIPS:
    - fix a build error without TRACEPOINTS_ENABLED

    s390:
    - reject a malformed userspace configuration

    x86:
    - suppress a warning without CONFIG_CPU_FREQ
    - initialize whole irq_eoi array"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
    arm/arm64: KVM: Map the BSS at HYP
    arm64: KVM: Take S1 walks into account when determining S2 write faults
    KVM: s390: reject invalid modes for runtime instrumentation
    kvm: x86: memset whole irq_eoi
    kvm/x86: Fix unused variable warning in kvm_timer_init()
    KVM: MIPS: Add missing uaccess.h include

    Linus Torvalds
     

20 Oct, 2016

5 commits

  • gcc 7 warns:
    arch/x86/kvm/ioapic.c: In function 'kvm_ioapic_reset':
    arch/x86/kvm/ioapic.c:597:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]

    And it is right. Memset whole array using sizeof operator.

    Signed-off-by: Jiri Slaby
    Cc: Paolo Bonzini
    Cc: Radim Krčmář
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: H. Peter Anvin
    Cc: x86@kernel.org
    Cc: kvm@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: stable@vger.kernel.org
    Reviewed-by: Paolo Bonzini
    [Added x86 subject tag]
    Signed-off-by: Radim Krčmář

    Jiri Slaby
     
  • When CONFIG_CPU_FREQ is not set, int cpu is unused and gcc rightfully
    warns about it:

    arch/x86/kvm/x86.c: In function ‘kvm_timer_init’:
    arch/x86/kvm/x86.c:5697:6: warning: unused variable ‘cpu’ [-Wunused-variable]
    int cpu;
    ^~~

    But since it is used only in the CONFIG_CPU_FREQ block, simply move it
    there, thus squashing the warning too.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Radim Krčmář

    Borislav Petkov
     
  • The following commit:

    c65eacbe290b ("sched/core: Allow putting thread_info into task_struct")

    ... made 'struct thread_info' a generic struct with only a
    single ::flags member, if CONFIG_THREAD_INFO_IN_TASK_STRUCT=y is
    selected.

    This change however seems to be quite x86 centric, since at least the
    generic preemption code (asm-generic/preempt.h) assumes that struct
    thread_info also has a preempt_count member, which apparently was not
    true for x86.

    We could add a bit more #ifdefs to solve this problem too, but it seems
    to be much simpler to make struct thread_info arch specific
    again. This also makes the conversion to THREAD_INFO_IN_TASK_STRUCT a
    bit easier for architectures that have a couple of arch specific stuff
    in their thread_info definition.

    The arch specific stuff _could_ be moved to thread_struct. However
    keeping them in thread_info makes it easier: accessing thread_info
    members is simple, since it is at the beginning of the task_struct,
    while the thread_struct is at the end. At least on s390 the offsets
    needed to access members of the thread_struct (with task_struct as
    base) are too large for various asm instructions. This is not a
    problem when keeping these members within thread_info.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Mark Rutland
    Acked-by: Thomas Gleixner
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: keescook@chromium.org
    Cc: linux-arch@vger.kernel.org
    Link: http://lkml.kernel.org/r/1476901693-8492-2-git-send-email-mark.rutland@arm.com
    Signed-off-by: Ingo Molnar

    Heiko Carstens
     
  • The recent introduction of SA_X32/IA32 sa_flags added a check for
    user_64bit_mode() into sigaction_compat_abi(). user_64bit_mode() is true
    for native 64-bit processes and x32 processes.

    Due to that the function returns w/o setting the SA_X32_ABI flag for X32
    processes. In consequence the kernel attempts to deliver the signal to the
    X32 process in native 64-bit mode causing the process to segfault.

    Remove the check, so the actual check for X32 mode which sets the ABI flag
    can be reached. There is no side effect for native 64-bit mode.

    [ tglx: Rewrote changelog ]

    Fixes: 6846351052e6 ("x86/signal: Add SA_{X32,IA32}_ABI sa_flags")
    Reported-by: Mikulas Patocka
    Tested-by: Adam Borowski
    Signed-off-by: Dmitry Safonov
    Cc: Dmitry Safonov
    Cc: Oleg Nesterov
    Cc: linux-mm@kvack.org
    Cc: Cyrill Gorcunov
    Cc: Pavel Emelyanov
    Link: http://lkml.kernel.org/r/CAJwJo6Z8ZWPqNfT6t-i8GW1MKxQrKDUagQqnZ%2B0%2B697%3DMyVeGg@mail.gmail.com
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Dmitry Safonov
     
  • Some time ago, we brought our UV BIOS callback code up to speed with the
    new EFI memory mapping scheme, in commit:

    d1be84a232e3 ("x86/uv: Update uv_bios_call() to use efi_call_virt_pointer()")

    By leveraging some changes that I made to a few of the EFI runtime
    callback mechanisms, in commit:

    80e75596079f ("efi: Convert efi_call_virt() to efi_call_virt_pointer()")

    This got everything running smoothly on UV, with the new EFI mapping
    code. However, this left one, small loose end, in that EFI_OLD_MEMMAP
    (a.k.a. efi=old_map) will no longer work on UV, on kernels that include
    the aforementioned changes.

    At the time this was not a major issue (in fact, it still really isn't),
    but there's no reason that EFI_OLD_MEMMAP *shouldn't* work on our
    systems. This commit adds a check into uv_bios_call(), to see if we have
    the EFI_OLD_MEMMAP bit set in efi.flags. If it is set, we fall back to
    using our old callback method, which uses efi_call() directly on the __va()
    of our function pointer.

    Signed-off-by: Alex Thorlton
    Acked-by: Matt Fleming
    Cc: # v4.7 and later
    Cc: Andy Lutomirski
    Cc: Ard Biesheuvel
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: Dimitri Sivanich
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Masahiro Yamada
    Cc: Mike Travis
    Cc: Peter Zijlstra
    Cc: Russ Anderson
    Cc: Thomas Gleixner
    Cc: linux-efi@vger.kernel.org
    Link: http://lkml.kernel.org/r/1476928131-170101-1-git-send-email-athorlton@sgi.com
    Signed-off-by: Ingo Molnar

    Alex Thorlton
     

19 Oct, 2016

10 commits

  • Merge the gup_flags cleanups from Lorenzo Stoakes:
    "This patch series adjusts functions in the get_user_pages* family such
    that desired FOLL_* flags are passed as an argument rather than
    implied by flags.

    The purpose of this change is to make the use of FOLL_FORCE explicit
    so it is easier to grep for and clearer to callers that this flag is
    being used. The use of FOLL_FORCE is an issue as it overrides missing
    VM_READ/VM_WRITE flags for the VMA whose pages we are reading
    from/writing to, which can result in surprising behaviour.

    The patch series came out of the discussion around commit 38e088546522
    ("mm: check VMA flags to avoid invalid PROT_NONE NUMA balancing"),
    which addressed a BUG_ON() being triggered when a page was faulted in
    with PROT_NONE set but having been overridden by FOLL_FORCE.
    do_numa_page() was run on the assumption the page _must_ be one marked
    for NUMA node migration as an actual PROT_NONE page would have been
    dealt with prior to this code path, however FOLL_FORCE introduced a
    situation where this assumption did not hold.

    See

    https://marc.info/?l=linux-mm&m=147585445805166

    for the patch proposal"

    Additionally, there's a fix for an ancient bug related to FOLL_FORCE and
    FOLL_WRITE by me.

    [ This branch was rebased recently to add a few more acked-by's and
    reviewed-by's ]

    * gup_flag-cleanups:
    mm: replace access_process_vm() write parameter with gup_flags
    mm: replace access_remote_vm() write parameter with gup_flags
    mm: replace __access_remote_vm() write parameter with gup_flags
    mm: replace get_user_pages_remote() write/force parameters with gup_flags
    mm: replace get_user_pages() write/force parameters with gup_flags
    mm: replace get_vaddr_frames() write/force parameters with gup_flags
    mm: replace get_user_pages_locked() write/force parameters with gup_flags
    mm: replace get_user_pages_unlocked() write/force parameters with gup_flags
    mm: remove write/force parameters from __get_user_pages_unlocked()
    mm: remove write/force parameters from __get_user_pages_locked()
    mm: remove gup_flags FOLL_WRITE games from __get_user_pages()

    Linus Torvalds
     
  • AVX512_4VNNIW - Vector instructions for deep learning enhanced word
    variable precision.
    AVX512_4FMAPS - Vector instructions for deep learning floating-point
    single precision.

    These new instructions are to be used in future Intel Xeon & Xeon Phi
    processors. The bits 2&3 of CPUID[level:0x07, EDX] inform that new
    instructions are supported by a processor.

    The spec can be found in the Intel Software Developer Manual (SDM) or in
    the Instruction Set Extensions Programming Reference (ISE).

    Define new feature flags to enumerate the new instructions in /proc/cpuinfo
    accordingly to CPUID bits and add the required xsave extensions which are
    required for proper operation.

    Signed-off-by: Piotr Luc
    Cc: Denys Vlasenko
    Cc: Peter Zijlstra
    Cc: Brian Gerst
    Cc: Dave Hansen
    Cc: Borislav Petkov
    Cc: Andy Lutomirski
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Link: http://lkml.kernel.org/r/20161018150111.29926-1-piotr.luc@intel.com
    Signed-off-by: Thomas Gleixner

    Piotr Luc
     
  • The timer_irq_works() boot check may sometimes fail in a VM, when
    the Host is overcommitted or when the Guest is running nested.

    Since the intended check is unnecessary on VMware's virtual
    hardware, by-pass it.

    Signed-off-by: Renat Valiullin
    Acked-by: Alok N Kataria
    Cc: virtualization@lists.linux-foundation.org
    Link: http://lkml.kernel.org/r/20161013184539.GA11497@rvaliullin-vm
    Signed-off-by: Thomas Gleixner

    Renat Valiullin
     
  • This removes the 'write' argument from access_process_vm() and replaces
    it with 'gup_flags' as use of this function previously silently implied
    FOLL_FORCE, whereas after this patch callers explicitly pass this flag.

    We make this explicit as use of FOLL_FORCE can result in surprising
    behaviour (and hence bugs) within the mm subsystem.

    Signed-off-by: Lorenzo Stoakes
    Acked-by: Jesper Nilsson
    Acked-by: Michal Hocko
    Acked-by: Michael Ellerman
    Signed-off-by: Linus Torvalds

    Lorenzo Stoakes
     
  • This removes the 'write' and 'force' from get_user_pages() and replaces
    them with 'gup_flags' to make the use of FOLL_FORCE explicit in callers
    as use of this flag can result in surprising behaviour (and hence bugs)
    within the mm subsystem.

    Signed-off-by: Lorenzo Stoakes
    Acked-by: Christian König
    Acked-by: Jesper Nilsson
    Acked-by: Michal Hocko
    Reviewed-by: Jan Kara
    Signed-off-by: Linus Torvalds

    Lorenzo Stoakes
     
  • Although KNL does support C1,C6,PC2,PC3,PC6 states, the patch only
    supports C6,PC2,PC3,PC6, because there is no counter for C1.

    C6 residency counter MSR on KNL has a different address than other
    platforms which is handled as a new quirk flag.

    Signed-off-by: Lukasz Odzioba
    Acked-by: Peter Zijlstra
    Cc: Alexander Shishkin
    Cc: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Cc: Linus Torvalds
    Cc: Rafael J. Wysocki
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Cc: Vince Weaver
    Cc: bp@suse.de
    Cc: dave.hansen@linux.intel.com
    Cc: kan.liang@intel.com
    Link: http://lkml.kernel.org/r/1475598386-19597-1-git-send-email-lukasz.odzioba@intel.com
    Signed-off-by: Ingo Molnar

    Lukasz Odzioba
     
  • This removes the 'write' and 'force' use from get_user_pages_unlocked()
    and replaces them with 'gup_flags' to make the use of FOLL_FORCE
    explicit in callers as use of this flag can result in surprising
    behaviour (and hence bugs) within the mm subsystem.

    Signed-off-by: Lorenzo Stoakes
    Reviewed-by: Jan Kara
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Lorenzo Stoakes
     
  • Pull x86 fixes from Ingo Molnar:
    "Misc fixes, plus hw-enablement changes:

    - fix persistent RAM handling
    - remove pkeys warning
    - remove duplicate macro
    - fix debug warning in irq handler
    - add new 'Knights Mill' CPU related constants and enable the perf bits"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf/x86/intel/uncore: Add Knights Mill CPUID
    perf/x86/intel/rapl: Add Knights Mill CPUID
    perf/x86/intel: Add Knights Mill CPUID
    x86/cpu/intel: Add Knights Mill to Intel family
    x86/e820: Don't merge consecutive E820_PRAM ranges
    pkeys: Remove easily triggered WARN
    x86: Remove duplicate rtit status MSR macro
    x86/smp: Add irq_enter/exit() in smp_reschedule_interrupt()

    Linus Torvalds
     
  • Pull perf fixes from Ingo Molnar:
    "Four tooling fixes, two kprobes KASAN related fixes and an x86 PMU
    driver fix/cleanup"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf jit: Fix build issue on Ubuntu
    perf jevents: Handle events including .c and .o
    perf/x86/intel: Remove an inconsistent NULL check
    kprobes: Unpoison stack in jprobe_return() for KASAN
    kprobes: Avoid false KASAN reports during stack copy
    perf header: Set nr_numa_nodes only when we parsed all the data
    perf top: Fix refreshing hierarchy entries on TUI

    Linus Torvalds
     
  • Pull locking fixes from Ingo Molnar:
    "Two fixes:

    - a file locks fix (missing critical section, bug introduced in this
    merge window)

    - an x86 down_write() stack frame annotation"

    * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    locking, fs/locks: Add missing file_sem locks
    locking/rwsem/x86: Add stack frame dependency for ____down_write()

    Linus Torvalds
     

18 Oct, 2016

2 commits

  • Arnd reported the following objtool warning:

    kernel/locking/rwsem.o: warning: objtool: down_write_killable()+0x16: call without frame pointer save/setup

    The warning means gcc placed the ____down_write() inline asm (and its
    call instruction) before the frame pointer setup in
    down_write_killable(), which breaks frame pointer convention and can
    result in incorrect stack traces.

    Force the stack frame to be created before the call instruction by
    listing the stack pointer as an output operand in the inline asm
    statement.

    Reported-by: Arnd Bergmann
    Signed-off-by: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1188b7015f04baf361e59de499ee2d7272c59dce.1476393828.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar

    Josh Poimboeuf
     
  • pkey_set() and pkey_get() were syscalls present in older versions
    of the protection keys patches. The syscall number definitions
    were inadvertently left in place. This patch removes them.

    I did a git grep and verified that these are the last places in
    the tree that these appear, save for the protection_keys.c tests
    and Documentation. Those spots talk about functions called
    pkey_get/set() which are wrappers for the direct PKRU
    instructions, not the syscalls.

    Signed-off-by: Dave Hansen
    Cc: Thomas Gleixner
    Cc: linux-arch@vger.kernel.org
    Cc: mgorman@techsingularity.net
    Cc: arnd@arndb.de
    Cc: linux-api@vger.kernel.org
    Cc: linux-mm@kvack.org
    Cc: luto@kernel.org
    Cc: akpm@linux-foundation.org
    Fixes: f9afc6197e9bb ("x86: Wire up protection keys system calls")
    Signed-off-by: Linus Torvalds

    Dave Hansen
     

17 Oct, 2016

4 commits

  • Add Knights Mill (KNM) to the list of CPUIDs supported by PMU.

    Signed-off-by: Piotr Luc
    Reviewed-by: Dave Hansen
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20161012182758.2925-1-piotr.luc@intel.com
    Signed-off-by: Ingo Molnar

    Piotr Luc
     
  • Add Knights Mill (KNM) to the list of CPUIDs supported by rapl.

    Signed-off-by: Piotr Luc
    Reviewed-by: Dave Hansen
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20161012182725.2701-1-piotr.luc@intel.com
    Signed-off-by: Ingo Molnar

    Piotr Luc
     
  • Add Knights Mill (KNM) to the list of CPUIDs supported by PMU.

    Signed-off-by: Piotr Luc
    Reviewed-by: Dave Hansen
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20161012182634.2462-1-piotr.luc@intel.com
    Signed-off-by: Ingo Molnar

    Piotr Luc
     
  • Add CPUID of Knights Mill (KNM) processor to Intel family list.

    Signed-off-by: Piotr Luc
    Reviewed-by: Dave Hansen
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20161012180520.30976-1-piotr.luc@intel.com
    Signed-off-by: Ingo Molnar

    Piotr Luc