1. 03 Feb, 2017 7 commits
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 57480b98
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "The main change is we're reverting the initial stack protector support
        we merged this cycle. It turns out to not work on toolchains built
        with libc support, and fixing it will be need to wait for another
        release.
      
        And the rest are all fairly minor:
      
         - Some pasemi machines were not booting due to a missing error check
           in prom_find_boot_cpu()
      
         - In EEH we were checking a pointer rather than the bool it pointed
           to
      
         - The clang build was broken by a BUILD_BUG_ON() we added.
      
         - The radix (Power9 only) version of map_kernel_page() was broken if
           our memory size was a multiple of 2MB, which it generally isn't
      
        Thanks to: Darren Stevens, Gavin Shan, Reza Arbab"
      
      * tag 'powerpc-4.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/mm: Use the correct pointer when setting a 2MB pte
        powerpc: Fix build failure with clang due to BUILD_BUG_ON()
        powerpc: Revert the initial stack protector support
        powerpc/eeh: Fix wrong flag passed to eeh_unfreeze_pe()
        powerpc: Add missing error check to prom_find_boot_cpu()
      57480b98
    • Linus Torvalds's avatar
      Merge tag 'trace-v4.10-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 2d47b8aa
      Linus Torvalds authored
      Pull tracing fix from Steven Rostedt:
       "Simple fix of s/static struct __init/static __init struct/"
      
      * tag 'trace-v4.10-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing/kprobes: Fix __init annotation
      2d47b8aa
    • Linus Torvalds's avatar
      Merge branch 'modversions' (modversions fixes for powerpc from Ard) · 2cb54ce9
      Linus Torvalds authored
      Merge kcrctab entry fixes from Ard Biesheuvel:
       "This is a followup to [0] 'modversions: redefine kcrctab entries as
        relative CRC pointers', but since relative CRC pointers do not work in
        modules, and are actually only needed by powerpc with
        CONFIG_RELOCATABLE=y, I have made it a Kconfig selectable feature
        instead.
      
        First it introduces the MODULE_REL_CRCS Kconfig symbol, and adds the
        kbuild handling of it, i.e., modpost, genksyms and kallsyms.
      
        Then it switches all architectures to 32-bit CRC entries in kcrctab,
        where all architectures except powerpc with CONFIG_RELOCATABLE=y use
        absolute ELF symbol references as before"
      
      [0] http://marc.info/?l=linux-arch&m=148493613415294&w=2
      
      * emailed patches from Ard Biesheuvel:
        module: unify absolute krctab definitions for 32-bit and 64-bit
        modversions: treat symbol CRCs as 32 bit quantities
        kbuild: modversions: add infrastructure for emitting relative CRCs
      2cb54ce9
    • Ard Biesheuvel's avatar
      log2: make order_base_2() behave correctly on const input value zero · 29905b52
      Ard Biesheuvel authored
      The function order_base_2() is defined (according to the comment block)
      as returning zero on input zero, but subsequently passes the input into
      roundup_pow_of_two(), which is explicitly undefined for input zero.
      
      This has gone unnoticed until now, but optimization passes in GCC 7 may
      produce constant folded function instances where a constant value of
      zero is passed into order_base_2(), resulting in link errors against the
      deliberately undefined '____ilog2_NaN'.
      
      So update order_base_2() to adhere to its own documented interface.
      
      [ See
      
           http://marc.info/?l=linux-kernel&m=147672952517795&w=2
      
        and follow-up discussion for more background. The gcc "optimization
        pass" is really just broken, but now the GCC trunk problem seems to
        have escaped out of just specially built daily images, so we need to
        work around it in mainline.    - Linus ]
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      29905b52
    • Ard Biesheuvel's avatar
      module: unify absolute krctab definitions for 32-bit and 64-bit · 4b9eee96
      Ard Biesheuvel authored
      The previous patch introduced a separate inline asm version of the
      krcrctab declaration template for use with 64-bit architectures, which
      cannot refer to ELF symbols using 32-bit quantities.
      
      This declaration should be equivalent to the C one for 32-bit
      architectures, but just in case - unify them in a separate patch, which
      can simply be dropped if it turns out to break anything.
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4b9eee96
    • Ard Biesheuvel's avatar
      modversions: treat symbol CRCs as 32 bit quantities · 71810db2
      Ard Biesheuvel authored
      The modversion symbol CRCs are emitted as ELF symbols, which allows us
      to easily populate the kcrctab sections by relying on the linker to
      associate each kcrctab slot with the correct value.
      
      This has a couple of downsides:
      
       - Given that the CRCs are treated as memory addresses, we waste 4 bytes
         for each CRC on 64 bit architectures,
      
       - On architectures that support runtime relocation, a R_<arch>_RELATIVE
         relocation entry is emitted for each CRC value, which identifies it
         as a quantity that requires fixing up based on the actual runtime
         load offset of the kernel. This results in corrupted CRCs unless we
         explicitly undo the fixup (and this is currently being handled in the
         core module code)
      
       - Such runtime relocation entries take up 24 bytes of __init space
         each, resulting in a x8 overhead in [uncompressed] kernel size for
         CRCs.
      
      Switching to explicit 32 bit values on 64 bit architectures fixes most
      of these issues, given that 32 bit values are not treated as quantities
      that require fixing up based on the actual runtime load offset.  Note
      that on some ELF64 architectures [such as PPC64], these 32-bit values
      are still emitted as [absolute] runtime relocatable quantities, even if
      the value resolves to a build time constant.  Since relative relocations
      are always resolved at build time, this patch enables MODULE_REL_CRCS on
      powerpc when CONFIG_RELOCATABLE=y, which turns the absolute CRC
      references into relative references into .rodata where the actual CRC
      value is stored.
      
      So redefine all CRC fields and variables as u32, and redefine the
      __CRC_SYMBOL() macro for 64 bit builds to emit the CRC reference using
      inline assembler (which is necessary since 64-bit C code cannot use
      32-bit types to hold memory addresses, even if they are ultimately
      resolved using values that do not exceed 0xffffffff).  To avoid
      potential problems with legacy 32-bit architectures using legacy
      toolchains, the equivalent C definition of the kcrctab entry is retained
      for 32-bit architectures.
      
      Note that this mostly reverts commit d4703aef ("module: handle ppc64
      relocating kcrctabs when CONFIG_RELOCATABLE=y")
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      71810db2
    • Ard Biesheuvel's avatar
      kbuild: modversions: add infrastructure for emitting relative CRCs · 56067812
      Ard Biesheuvel authored
      This add the kbuild infrastructure that will allow architectures to emit
      vmlinux symbol CRCs as 32-bit offsets to another location in the kernel
      where the actual value is stored. This works around problems with CRCs
      being mistaken for relocatable symbols on kernels that self relocate at
      runtime (i.e., powerpc with CONFIG_RELOCATABLE=y)
      
      For the kbuild side of things, this comes down to the following:
      
       - introducing a Kconfig symbol MODULE_REL_CRCS
      
       - adding a -R switch to genksyms to instruct it to emit the CRC symbols
         as references into the .rodata section
      
       - making modpost distinguish such references from absolute CRC symbols
         by the section index (SHN_ABS)
      
       - making kallsyms disregard non-absolute symbols with a __crc_ prefix
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      56067812
  2. 02 Feb, 2017 8 commits
  3. 01 Feb, 2017 16 commits
    • Ard Biesheuvel's avatar
      efi/fdt: Avoid FDT manipulation after ExitBootServices() · c8f325a5
      Ard Biesheuvel authored
      Some AArch64 UEFI implementations disable the MMU in ExitBootServices(),
      after which unaligned accesses to RAM are no longer supported.
      
      Commit:
      
        abfb7b68 ("efi/libstub/arm*: Pass latest memory map to the kernel")
      
      fixed an issue in the memory map handling of the stub FDT code, but
      inadvertently created an issue with such firmware, by moving some
      of the FDT manipulation to after the invocation of ExitBootServices().
      
      Given that the stub's libfdt implementation uses the ordinary, accelerated
      string functions, which rely on hardware handling of unaligned accesses,
      manipulating the FDT with the MMU off may result in alignment faults.
      
      So fix the situation by moving the update_fdt_memmap() call into the
      callback function invoked by efi_exit_boot_services() right before it
      calls the ExitBootServices() UEFI service (which is arguably a better
      place for it anyway)
      
      Note that disabling the MMU in ExitBootServices() is not compliant with
      the UEFI spec, and carries great risk due to the fact that switching from
      cached to uncached memory accesses halfway through compiler generated code
      (i.e., involving a stack) can never be done in a way that is architecturally
      safe.
      
      Fixes: abfb7b68 ("efi/libstub/arm*: Pass latest memory map to the kernel")
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Tested-by: default avatarRiku Voipio <riku.voipio@linaro.org>
      Cc: <stable@vger.kernel.org>
      Cc: mark.rutland@arm.com
      Cc: linux-efi@vger.kernel.org
      Cc: matt@codeblueprint.co.uk
      Cc: leif.lindholm@linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/1485971102-23330-2-git-send-email-ard.biesheuvel@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c8f325a5
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 6d04dfc8
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Fix handling of interrupt status in stmmac driver. Just because we
          have masked the event from generating interrupts, doesn't mean the
          bit won't still be set in the interrupt status register. From Alexey
          Brodkin.
      
       2) Fix DMA API debugging splats in gianfar driver, from Arseny Solokha.
      
       3) Fix off-by-one error in __ip6_append_data(), from Vlad Yasevich.
      
       4) cls_flow does not match on icmpv6 codes properly, from Simon Horman.
      
       5) Initial MAC address can be set incorrectly in some scenerios, from
          Ivan Vecera.
      
       6) Packet header pointer arithmetic fix in ip6_tnl_parse_tlv_end_lim(),
          from Dan Carpenter.
      
       7) Fix divide by zero in __tcp_select_window(), from Eric Dumazet.
      
       8) Fix crash in iwlwifi when unregistering thermal zone, from Jens
          Axboe.
      
       9) Check for DMA mapping errors in starfire driver, from Alexey
          Khoroshilov.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (31 commits)
        tcp: fix 0 divide in __tcp_select_window()
        ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()
        net: fix ndo_features_check/ndo_fix_features comment ordering
        net/sched: matchall: Fix configuration race
        be2net: fix initial MAC setting
        ipv6: fix flow labels when the traffic class is non-0
        net: thunderx: avoid dereferencing xcv when NULL
        net/sched: cls_flower: Correct matching on ICMPv6 code
        ipv6: Paritially checksum full MTU frames
        net/mlx4_core: Avoid command timeouts during VF driver device shutdown
        gianfar: synchronize DMA API usage by free_skb_rx_queue w/ gfar_new_page
        net: ethtool: add support for 2500BaseT and 5000BaseT link modes
        can: bcm: fix hrtimer/tasklet termination in bcm op removal
        net: adaptec: starfire: add checks for dma mapping errors
        net: phy: micrel: KSZ8795 do not set SUPPORTED_[Asym_]Pause
        can: Fix kernel panic at security_sock_rcv_skb
        net: macb: Fix 64 bit addressing support for GEM
        stmmac: Discard masked flags in interrupt status register
        net/mlx5e: Check ets capability before ets query FW command
        net/mlx5e: Fix update of hash function/key via ethtool
        ...
      6d04dfc8
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 2883aaea
      Linus Torvalds authored
      Pull fscache fixes from Al Viro.
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        fscache: Fix dead object requeue
        fscache: Clear outstanding writes when disabling a cookie
        FS-Cache: Initialise stores_lock in netfs cookie
      2883aaea
    • Eric Dumazet's avatar
      tcp: fix 0 divide in __tcp_select_window() · 06425c30
      Eric Dumazet authored
      syszkaller fuzzer was able to trigger a divide by zero, when
      TCP window scaling is not enabled.
      
      SO_RCVBUF can be used not only to increase sk_rcvbuf, also
      to decrease it below current receive buffers utilization.
      
      If mss is negative or 0, just return a zero TCP window.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarDmitry Vyukov  <dvyukov@google.com>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      06425c30
    • Dan Carpenter's avatar
      ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim() · 63117f09
      Dan Carpenter authored
      Casting is a high precedence operation but "off" and "i" are in terms of
      bytes so we need to have some parenthesis here.
      
      Fixes: fbfa743a ("ipv6: fix ip6_tnl_parse_tlv_enc_lim()")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      63117f09
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · e387dc12
      Linus Torvalds authored
      Pull crypto fixes from Herbert Xu:
       "This fixes a bug in CBC/CTR on ARM64 that breaks chaining as well as a
        bug in the core API that causes registration failures when a driver
        unloads and then reloads an algorithm"
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: arm64/aes-blk - honour iv_out requirement in CBC and CTR modes
        crypto: api - Clear CRYPTO_ALG_DEAD bit before registering an alg
      e387dc12
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-fix-4.10-rc7' of git://git.infradead.org/users/vkoul/slave-dma · 35609502
      Linus Torvalds authored
      Pull dmaengine fixes from Vinod Koul:
       "A couple of fixes showed up late in the cycle so sending them up and
        sending early in the week and not on Friday :).
      
        They fix a double lock in pl330 driver and runtime pm fixes for cppi
        driver"
      
      * tag 'dmaengine-fix-4.10-rc7' of git://git.infradead.org/users/vkoul/slave-dma:
        dmaengine: pl330: fix double lock
        dmaengine: cppi41: Clean up pointless warnings
        dmaengine: cppi41: Fix oops in cppi41_runtime_resume
        dmaengine: cppi41: Fix runtime PM timeouts with USB mass storage
      35609502
    • Dimitris Michailidis's avatar
      net: fix ndo_features_check/ndo_fix_features comment ordering · 1a2a1444
      Dimitris Michailidis authored
      Commit cdba756f ("net: move ndo_features_check() close to
      ndo_start_xmit()") inadvertently moved the doc comment for
      .ndo_fix_features instead of .ndo_features_check. Fix the comment
      ordering.
      
      Fixes: cdba756f ("net: move ndo_features_check() close to ndo_start_xmit()")
      Signed-off-by: default avatarDimitris Michailidis <dmichail@google.com>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a2a1444
    • Yotam Gigi's avatar
      net/sched: matchall: Fix configuration race · fd62d9f5
      Yotam Gigi authored
      In the current version, the matchall internal state is split into two
      structs: cls_matchall_head and cls_matchall_filter. This makes little
      sense, as matchall instance supports only one filter, and there is no
      situation where one exists and the other does not. In addition, that led
      to some races when filter was deleted while packet was processed.
      
      Unify that two structs into one, thus simplifying the process of matchall
      creation and deletion. As a result, the new, delete and get callbacks have
      a dummy implementation where all the work is done in destroy and change
      callbacks, as was done in cls_cgroup.
      
      Fixes: bf3994d2 ("net/sched: introduce Match-all classifier")
      Reported-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarYotam Gigi <yotamg@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fd62d9f5
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v4.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · c325b353
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "Another week, another set of pin control fixes. The subsystem has seen
        high patch-spot activity recently.
      
        The majority of the patches are for Intel, I vaguely think it mostly
        concern phones, tablets and maybe chromebooks and even laptops with
        this Intel Atom family chips.
      
        Driver fixes only:
      
         - one fix to the Berlin driver making the SD card work fully again.
      
         - one fix to the Allwinner/sunxi bias function: one premature change
           needs to be partially reverted.
      
         - the remaining four patches are to Intel embedded SoCs: baytrail
           (three patches) and merrifield (one patch): register access
           debounce fixes and a missing spinlock"
      
      * tag 'pinctrl-v4.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler
        pinctrl: baytrail: Debounce register is one per community
        pinctrl: baytrail: Rectify debounce support (part 2)
        pinctrl: intel: merrifield: Add missed check in mrfld_config_set()
        pinctrl: sunxi: Don't enforce bias disable (for now)
        pinctrl: berlin-bg4ct: fix the value for "sd1a" of pin SCRD0_CRD_PRES
      c325b353
    • Ivan Vecera's avatar
      be2net: fix initial MAC setting · 4993b39a
      Ivan Vecera authored
      Recent commit 34393529 ("be2net: fix MAC addr setting on privileged
      BE3 VFs") allows privileged BE3 VFs to set its MAC address during
      initialization. Although the initial MAC for such VFs is already
      programmed by parent PF the subsequent setting performed by VF is OK,
      but in certain cases (after fresh boot) this command in VF can fail.
      
      The MAC should be initialized only when:
      1) no MAC is programmed (always except BE3 VFs during first init)
      2) programmed MAC is different from requested (e.g. MAC is set when
         interface is down). In this case the initial MAC programmed by PF
         needs to be deleted.
      
      The adapter->dev_mac contains MAC address currently programmed in HW so
      it should be zeroed when the MAC is deleted from HW and should not be
      filled when MAC is set when interface is down in be_mac_addr_set() as
      no programming is performed in this case.
      
      Example of failure without the fix (immediately after fresh boot):
      
      # ip link set eth0 up  <- eth0 is BE3 PF
      be2net 0000:01:00.0 eth0: Link is Up
      
      # echo 1 > /sys/class/net/eth0/device/sriov_numvfs  <- Create 1 VF
      ...
      be2net 0000:01:04.0: Emulex OneConnect(be3): VF  port 0
      
      # ip link set eth8 up  <- eth8 is created privileged VF
      be2net 0000:01:04.0: opcode 59-1 failed:status 1-76
      RTNETLINK answers: Input/output error
      
      # echo 0 > /sys/class/net/eth0/device/sriov_numvfs  <- Delete VF
      iommu: Removing device 0000:01:04.0 from group 33
      ...
      
      # echo 1 > /sys/class/net/eth0/device/sriov_numvfs  <- Create it again
      iommu: Removing device 0000:01:04.0 from group 33
      ...
      
      # ip link set eth8 up
      be2net 0000:01:04.0 eth8: Link is Up
      
      Initialization is now OK.
      
      v2 - Corrected the comment and condition check suggested by Suresh & Harsha
      
      Fixes: 34393529 ("be2net: fix MAC addr setting on privileged BE3 VFs")
      Cc: Sathya Perla <sathya.perla@broadcom.com>
      Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>
      Cc: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
      Cc: Somnath Kotur <somnath.kotur@broadcom.com>
      Signed-off-by: default avatarIvan Vecera <cera@cera.cz>
      Acked-by: default avatarSriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4993b39a
    • Thomas Gleixner's avatar
      perf/x86/intel/uncore: Make package handling more robust · fff4b87e
      Thomas Gleixner authored
      The package management code in uncore relies on package mapping being
      available before a CPU is started. This changed with:
      
        9d85eb91 ("x86/smpboot: Make logical package management more robust")
      
      because the ACPI/BIOS information turned out to be unreliable, but that
      left uncore in broken state. This was not noticed because on a regular boot
      all CPUs are online before uncore is initialized.
      
      Move the allocation to the CPU online callback and simplify the hotplug
      handling. At this point the package mapping is established and correct.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
      Fixes: 9d85eb91 ("x86/smpboot: Make logical package management more robust")
      Link: http://lkml.kernel.org/r/20170131230141.377156255@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      fff4b87e
    • Thomas Gleixner's avatar
      perf/x86/intel/uncore: Clean up hotplug conversion fallout · 1aa6cfd3
      Thomas Gleixner authored
      The recent conversion to the hotplug state machine kept two mechanisms from
      the original code:
      
       1) The first_init logic which adds the number of online CPUs in a package
          to the refcount. That's wrong because the callbacks are executed for
          all online CPUs.
      
          Remove it so the refcounting is correct.
      
       2) The on_each_cpu() call to undo box->init() in the error handling
          path. That's bogus because when the prepare callback fails no box has
          been initialized yet.
      
          Remove it.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: Yasuaki Ishimatsu <yasu.isimatu@gmail.com>
      Fixes: 1a246b9f ("perf/x86/intel/uncore: Convert to hotplug state machine")
      Link: http://lkml.kernel.org/r/20170131230141.298032324@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1aa6cfd3
    • Thomas Gleixner's avatar
      perf/x86/intel/rapl: Make package handling more robust · dd86e373
      Thomas Gleixner authored
      The package management code in RAPL relies on package mapping being
      available before a CPU is started. This changed with:
      
        9d85eb91 ("x86/smpboot: Make logical package management more robust")
      
      because the ACPI/BIOS information turned out to be unreliable, but that
      left RAPL in broken state. This was not noticed because on a regular boot
      all CPUs are online before RAPL is initialized.
      
      A possible fix would be to reintroduce the mess which allocates a package
      data structure in CPU prepare and when it turns out to already exist in
      starting throw it away later in the CPU online callback. But that's a
      horrible hack and not required at all because RAPL becomes functional for
      perf only in the CPU online callback. That's correct because user space is
      not yet informed about the CPU being onlined, so nothing caan rely on RAPL
      being available on that particular CPU.
      
      Move the allocation to the CPU online callback and simplify the hotplug
      handling. At this point the package mapping is established and correct.
      
      This also adds a missing check for available package data in the
      event_init() function.
      Reported-by: default avatarYasuaki Ishimatsu <yasu.isimatu@gmail.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Fixes: 9d85eb91 ("x86/smpboot: Make logical package management more robust")
      Link: http://lkml.kernel.org/r/20170131230141.212593966@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      dd86e373
    • Max Filippov's avatar
      xtensa: fix noMMU build on cores with MMU · 4b3e6f2e
      Max Filippov authored
      Commit bf15f86b ("xtensa: initialize MMU before jumping to reset
      vector") calls MMU management functions even when CONFIG_MMU is not
      selected. That breaks noMMU build on cores with MMU.
      
      Don't manage MMU when CONFIG_MMU is not selected.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      4b3e6f2e
    • Linus Torvalds's avatar
      Merge tag 'trace-4.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · a2ca3d61
      Linus Torvalds authored
      Pull tracing fix from Steven Rostedt:
       "It was reported to me that the thread created by the hwlat tracer does
        not migrate after the first instance. I found that there was as small
        bug in the logic, and fixed it. It's minor, but should be fixed
        regardless. There's not much impact outside the hwlat tracer"
      
      * tag 'trace-4.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing: Fix hwlat kthread migration
      a2ca3d61
  4. 31 Jan, 2017 9 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 283725af
      Linus Torvalds authored
      Pull input subsystem fixes from Dmitry Torokhov:
       "A fix for a crash in the wm97xx driver and synaptics-rmi4 will stop
        throwing erroneous warnings."
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: synaptics-rmi4 - fix reversed conditions in enable/disable_irq_wake
        Input: wm97xx - make missing platform data non-fatal
      283725af
    • Linus Torvalds's avatar
      Merge branch 'for-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup · f1774f46
      Linus Torvalds authored
      Pull cgroup fix from Tejun Heo:
       "The cgroup creation path was getting the order of operations wrong and
        exposing cgroups which don't have their names set yet to controllers
        which can lead to NULL derefs.
      
        This contains the fix for the bug"
      
      * 'for-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
        cgroup: don't online subsystems before cgroup_name/path() are operational
      f1774f46
    • Linus Torvalds's avatar
      Merge branch 'for-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu · 298a2d87
      Linus Torvalds authored
      Pull percpu fix from Tejun Heo:
       "Douglas found and fixed a ref leak bug in percpu_ref_tryget[_live]().
      
        The bug is caused by storing the return value of atomic_long_inc_not_zero()
        into an int temp variable before returning it as a bool. The interim
        cast to int loses the upper bits and can lead to false negatives. As
        percpu_ref uses a high bit to mark a draining counter, this can happen
        relatively easily.
      
        Fixed by using bool for the temp variable"
      
      * 'for-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
        percpu-refcount: fix reference leak during percpu-atomic transition
      298a2d87
    • Linus Torvalds's avatar
      Merge branch 'for-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata · 52e02f27
      Linus Torvalds authored
      Pull libata fixes from Tejun Heo:
       "Three libata fixes: an error handling fix, blacklist addition for
        another fallout from upping the default max sectors, and fix for a
        sense data reporting bug which affects new harddrives which can report
        sense data"
      
      * 'for-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
        ata: sata_mv:- Handle return value of devm_ioremap.
        libata: Fix ATA request sense
        libata: apply MAX_SEC_1024 to all CX1-JB*-HP devices
      52e02f27
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid · c9194b99
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - regression fix (sleeping while atomic) for cp2112, from Johan Hovold
      
       - regression fix for proximity handling under certain circumstances in
         Wacom driver, from Jason Gerecke
      
       - functional fix for Logitech Rumblepad 2, from Ardinartsev Nikita
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
        HID: cp2112: fix gpio-callback error handling
        HID: cp2112: fix sleep-while-atomic
        HID: hid-lg: Fix immediate disconnection of Logitech Rumblepad 2
        HID: usbhid: Quirk a AMI virtual mouse and keyboard with ALWAYS_POLL
        HID: wacom: Fix poor prox handling in 'wacom_pl_irq'
      c9194b99
    • Thomas Gleixner's avatar
      x86/mce: Make timer handling more robust · 0becc0ae
      Thomas Gleixner authored
      Erik reported that on a preproduction hardware a CMCI storm triggers the
      BUG_ON in add_timer_on(). The reason is that the per CPU MCE timer is
      started by the CMCI logic before the MCE CPU hotplug callback starts the
      timer with add_timer_on(). So the timer is already queued which triggers
      the BUG.
      
      Using add_timer_on() is pretty pointless in this code because the timer is
      strictlty per CPU, initialized as pinned and all operations which arm the
      timer happen on the CPU to which the timer belongs.
      
      Simplify the whole machinery by using mod_timer() instead of add_timer_on()
      which avoids the problem because mod_timer() can handle already queued
      timers. Use __start_timer() everywhere so the earliest armed expiry time is
      preserved.
      Reported-by: default avatarErik Veijola <erik.veijola@intel.com>
      Tested-by: default avatarBorislav Petkov <bp@alien8.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarBorislav Petkov <bp@alien8.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701310936080.3457@nanosSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      0becc0ae
    • Linus Torvalds's avatar
      Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6 · 415f9b71
      Linus Torvalds authored
      Pull cifs fix from Steve French:
       "A small cifs fix for stable"
      
      * 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: initialize file_info_lock
      415f9b71
    • David Howells's avatar
      fscache: Fix dead object requeue · e26bfebd
      David Howells authored
      Under some circumstances, an fscache object can become queued such that it
      fscache_object_work_func() can be called once the object is in the
      OBJECT_DEAD state.  This results in the kernel oopsing when it tries to
      invoke the handler for the state (which is hard coded to 0x2).
      
      The way this comes about is something like the following:
      
       (1) The object dispatcher is processing a work state for an object.  This
           is done in workqueue context.
      
       (2) An out-of-band event comes in that isn't masked, causing the object to
           be queued, say EV_KILL.
      
       (3) The object dispatcher finishes processing the current work state on
           that object and then sees there's another event to process, so,
           without returning to the workqueue core, it processes that event too.
           It then follows the chain of events that initiates until we reach
           OBJECT_DEAD without going through a wait state (such as
           WAIT_FOR_CLEARANCE).
      
           At this point, object->events may be 0, object->event_mask will be 0
           and oob_event_mask will be 0.
      
       (4) The object dispatcher returns to the workqueue processor, and in due
           course, this sees that the object's work item is still queued and
           invokes it again.
      
       (5) The current state is a work state (OBJECT_DEAD), so the dispatcher
           jumps to it - resulting in an OOPS.
      
      When I'm seeing this, the work state in (1) appears to have been either
      LOOK_UP_OBJECT or CREATE_OBJECT (object->oob_table is
      fscache_osm_lookup_oob).
      
      The window for (2) is very small:
      
       (A) object->event_mask is cleared whilst the event dispatch process is
           underway - though there's no memory barrier to force this to the top
           of the function.
      
           The window, therefore is from the time the object was selected by the
           workqueue processor and made requeueable to the time the mask was
           cleared.
      
       (B) fscache_raise_event() will only queue the object if it manages to set
           the event bit and the corresponding event_mask bit was set.
      
           The enqueuement is then deferred slightly whilst we get a ref on the
           object and get the per-CPU variable for workqueue congestion.  This
           slight deferral slightly increases the probability by allowing extra
           time for the workqueue to make the item requeueable.
      
      Handle this by giving the dead state a processor function and checking the
      for the dead state address rather than seeing if the processor function is
      address 0x2.  The dead state processor function can then set a flag to
      indicate that it's occurred and give a warning if it occurs more than once
      per object.
      
      If this race occurs, an oops similar to the following is seen (note the RIP
      value):
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000002
      IP: [<0000000000000002>] 0x1
      PGD 0
      Oops: 0010 [#1] SMP
      Modules linked in: ...
      CPU: 17 PID: 16077 Comm: kworker/u48:9 Not tainted 3.10.0-327.18.2.el7.x86_64 #1
      Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS P89 12/27/2015
      Workqueue: fscache_object fscache_object_work_func [fscache]
      task: ffff880302b63980 ti: ffff880717544000 task.ti: ffff880717544000
      RIP: 0010:[<0000000000000002>]  [<0000000000000002>] 0x1
      RSP: 0018:ffff880717547df8  EFLAGS: 00010202
      RAX: ffffffffa0368640 RBX: ffff880edf7a4480 RCX: dead000000200200
      RDX: 0000000000000002 RSI: 00000000ffffffff RDI: ffff880edf7a4480
      RBP: ffff880717547e18 R08: 0000000000000000 R09: dfc40a25cb3a4510
      R10: dfc40a25cb3a4510 R11: 0000000000000400 R12: 0000000000000000
      R13: ffff880edf7a4510 R14: ffff8817f6153400 R15: 0000000000000600
      FS:  0000000000000000(0000) GS:ffff88181f420000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000002 CR3: 000000000194a000 CR4: 00000000001407e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Stack:
       ffffffffa0363695 ffff880edf7a4510 ffff88093f16f900 ffff8817faa4ec00
       ffff880717547e60 ffffffff8109d5db 00000000faa4ec18 0000000000000000
       ffff8817faa4ec18 ffff88093f16f930 ffff880302b63980 ffff88093f16f900
      Call Trace:
       [<ffffffffa0363695>] ? fscache_object_work_func+0xa5/0x200 [fscache]
       [<ffffffff8109d5db>] process_one_work+0x17b/0x470
       [<ffffffff8109e4ac>] worker_thread+0x21c/0x400
       [<ffffffff8109e290>] ? rescuer_thread+0x400/0x400
       [<ffffffff810a5acf>] kthread+0xcf/0xe0
       [<ffffffff810a5a00>] ? kthread_create_on_node+0x140/0x140
       [<ffffffff816460d8>] ret_from_fork+0x58/0x90
       [<ffffffff810a5a00>] ? kthread_create_on_node+0x140/0x140
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarJeremy McNicoll <jeremymc@redhat.com>
      Tested-by: default avatarFrank Sorenson <sorenson@redhat.com>
      Tested-by: default avatarBenjamin Coddington <bcodding@redhat.com>
      Reviewed-by: default avatarBenjamin Coddington <bcodding@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      e26bfebd
    • David Howells's avatar
      fscache: Clear outstanding writes when disabling a cookie · 6bdded59
      David Howells authored
      fscache_disable_cookie() needs to clear the outstanding writes on the
      cookie it's disabling because they cannot be completed after.
      
      Without this, fscache_nfs_open_file() gets stuck because it disables the
      cookie when the file is opened for writing but can't uncache the pages till
      afterwards - otherwise there's a race between the open routine and anyone
      who already has it open R/O and is still reading from it.
      
      Looking in /proc/pid/stack of the offending process shows:
      
      [<ffffffffa0142883>] __fscache_wait_on_page_write+0x82/0x9b [fscache]
      [<ffffffffa014336e>] __fscache_uncache_all_inode_pages+0x91/0xe1 [fscache]
      [<ffffffffa01740fa>] nfs_fscache_open_file+0x59/0x9e [nfs]
      [<ffffffffa01ccf41>] nfs4_file_open+0x17f/0x1b8 [nfsv4]
      [<ffffffff8117350e>] do_dentry_open+0x16d/0x2b7
      [<ffffffff811743ac>] vfs_open+0x5c/0x65
      [<ffffffff81184185>] path_openat+0x785/0x8fb
      [<ffffffff81184343>] do_filp_open+0x48/0x9e
      [<ffffffff81174710>] do_sys_open+0x13b/0x1cb
      [<ffffffff811747b9>] SyS_open+0x19/0x1b
      [<ffffffff81001c44>] do_syscall_64+0x80/0x17a
      [<ffffffff8165c2da>] return_from_SYSCALL_64+0x0/0x7a
      [<ffffffffffffffff>] 0xffffffffffffffff
      Reported-by: default avatarJianhong Yin <jiyin@redhat.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarJeff Layton <jlayton@redhat.com>
      Acked-by: default avatarSteve Dickson <steved@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      6bdded59