1. 13 Nov, 2018 40 commits
    • Nathan Chancellor's avatar
      spi: spi-ep93xx: Use dma_data_direction for ep93xx_spi_dma_{finish,prepare} · c2128082
      Nathan Chancellor authored
      [ Upstream commit a1108c7b ]
      
      Clang warns when one enumerated type is implicitly converted to another.
      
      drivers/spi/spi-ep93xx.c:342:62: warning: implicit conversion from
      enumeration type 'enum dma_transfer_direction' to different enumeration
      type 'enum dma_data_direction' [-Wenum-conversion]
              nents = dma_map_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
      ./include/linux/dma-mapping.h:428:58: note: expanded from macro
      'dma_map_sg'
      #define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, 0)
                                     ~~~~~~~~~~~~~~~~          ^
      drivers/spi/spi-ep93xx.c:348:57: warning: implicit conversion from
      enumeration type 'enum dma_transfer_direction' to different enumeration
      type 'enum dma_data_direction' [-Wenum-conversion]
                      dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
      ./include/linux/dma-mapping.h:429:62: note: expanded from macro
      'dma_unmap_sg'
      #define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, 0)
                                       ~~~~~~~~~~~~~~~~~~          ^
      drivers/spi/spi-ep93xx.c:377:56: warning: implicit conversion from
      enumeration type 'enum dma_transfer_direction' to different enumeration
      type 'enum dma_data_direction' [-Wenum-conversion]
              dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
      ./include/linux/dma-mapping.h:429:62: note: expanded from macro
      'dma_unmap_sg'
      #define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, 0)
                                       ~~~~~~~~~~~~~~~~~~          ^
      3 warnings generated.
      
      dma_{,un}map_sg expect an enum of type dma_data_direction but this
      driver uses dma_transfer_direction for everything. Convert the driver to
      use dma_data_direction for these two functions.
      
      There are two places that strictly require an enum of type
      dma_transfer_direction: the direction member in struct dma_slave_config
      and the direction parameter in dmaengine_prep_slave_sg. To avoid using
      an explicit cast, add a simple function, ep93xx_dma_data_to_trans_dir,
      to safely map between the two types because they are not 1 to 1 in
      meaning.
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c2128082
    • Javier González's avatar
      lightnvm: pblk: fix race condition on metadata I/O · 013b559a
      Javier González authored
      [ Upstream commit d8adaa3b ]
      
      In pblk, when a new line is allocated, metadata for the previously
      written line is scheduled. This is done through a fixed memory region
      that is shared through time and contexts across different lines and
      therefore protected by a lock. Unfortunately, this lock is not properly
      covering all the metadata used for sharing this memory regions,
      resulting in a race condition.
      
      This patch fixes this race condition by protecting this metadata
      properly.
      
      Fixes: dd2a4343 ("lightnvm: pblk: sched. metadata on write thread")
      Signed-off-by: default avatarJavier González <javier@cnexlabs.com>
      Signed-off-by: default avatarMatias Bjørling <mb@lightnvm.io>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      013b559a
    • Jia-Ju Bai's avatar
      lightnvm: pblk: fix two sleep-in-atomic-context bugs · 3c5b1d33
      Jia-Ju Bai authored
      [ Upstream commit 7325b4bb ]
      
      The driver may sleep with holding a spinlock.
      
      The function call paths (from bottom to top) in Linux-4.16 are:
      
      [FUNC] nvm_dev_dma_alloc(GFP_KERNEL)
      drivers/lightnvm/pblk-core.c, 754:
      	nvm_dev_dma_alloc in pblk_line_submit_smeta_io
      drivers/lightnvm/pblk-core.c, 1048:
      	pblk_line_submit_smeta_io in pblk_line_init_bb
      drivers/lightnvm/pblk-core.c, 1434:
      	pblk_line_init_bb in pblk_line_replace_data
      drivers/lightnvm/pblk-recovery.c, 980:
      	pblk_line_replace_data in pblk_recov_l2p
      drivers/lightnvm/pblk-recovery.c, 976:
      	spin_lock in pblk_recov_l2p
      
      [FUNC] bio_map_kern(GFP_KERNEL)
      drivers/lightnvm/pblk-core.c, 762:
      	bio_map_kern in pblk_line_submit_smeta_io
      drivers/lightnvm/pblk-core.c, 1048:
      	pblk_line_submit_smeta_io in pblk_line_init_bb
      drivers/lightnvm/pblk-core.c, 1434:
      	pblk_line_init_bb in pblk_line_replace_data
      drivers/lightnvm/pblk-recovery.c, 980:
      	pblk_line_replace_data in pblk_recov_l2p
      drivers/lightnvm/pblk-recovery.c, 976:
      	spin_lock in pblk_recov_l2p
      
      To fix these bugs, the call to pblk_line_replace_data()
      is moved out of the spinlock protection.
      
      These bugs are found by my static analysis tool DSAC.
      Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
      Reviewed-by: default avatarJavier González <javier@cnexlabs.com>
      Signed-off-by: default avatarMatias Bjørling <mb@lightnvm.io>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c5b1d33
    • Javier González's avatar
      lightnvm: pblk: fix race on sysfs line state · bd206a06
      Javier González authored
      [ Upstream commit 44cdbdc6 ]
      
      pblk exposes a sysfs interface that represents its internal state. Part
      of this state is the map bitmap for the current open line, which should
      be protected by the line lock to avoid a race when freeing the line
      metadata. Currently, it is not.
      
      This patch makes sure that the line state is consistent and NULL
      bitmap pointers are not dereferenced.
      Signed-off-by: default avatarJavier González <javier@cnexlabs.com>
      Signed-off-by: default avatarMatias Bjørling <mb@lightnvm.io>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bd206a06
    • Thierry Reding's avatar
      hwmon: (pwm-fan) Set fan speed to 0 on suspend · 5764ffc8
      Thierry Reding authored
      [ Upstream commit 95dcd64b ]
      
      Technically this is not required because disabling the PWM should be
      enough. However, when support for atomic operations was implemented in
      the PWM subsystem, only actual changes to the PWM channel are applied
      during pwm_config(), which means that during after resume from suspend
      the old settings won't be applied.
      
      One possible solution is for the PWM driver to implement its own PM
      operations such that settings from before suspend get applied on resume.
      This has the disadvantage of completely ignoring any particular ordering
      requirements that PWM user drivers might have, so it is best to leave it
      up to the user drivers to apply the settings that they want at the
      appropriate time.
      
      Another way to solve this would be to read back the current state of the
      PWM at the time of resume. That way, in case the configuration was lost
      during suspend, applying the old settings in PWM user drivers would
      actually get them applied because they differ from the current settings.
      However, not all PWM drivers support reading the hardware state, and not
      all hardware may support it.
      
      The best workaround at this point seems to be to let PWM user drivers
      tell the PWM subsystem that the PWM is turned off by, in addition to
      disabling it, also setting the duty cycle to 0. This causes the resume
      operation to apply a configuration that is different from the current
      configuration, resulting in the proper state from before suspend getting
      restored.
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5764ffc8
    • Janosch Frank's avatar
      s390/sthyi: Fix machine name validity indication · bb1d8085
      Janosch Frank authored
      [ Upstream commit b5130dc2 ]
      
      When running as a level 3 guest with no host provided sthyi support
      sclp_ocf_cpc_name_copy() will only return zeroes. Zeroes are not a
      valid group name, so let's not indicate that the group name field is
      valid.
      
      Also the group name is not dependent on stsi, let's not return based
      on stsi before setting it.
      
      Fixes: 95ca2cb5 ("KVM: s390: Add sthyi emulation")
      Signed-off-by: default avatarJanosch Frank <frankja@linux.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bb1d8085
    • Serhey Popovych's avatar
      tun: Consistently configure generic netdev params via rtnetlink · 45d66e3d
      Serhey Popovych authored
      [ Upstream commit df52eab2 ]
      
      Configuring generic network device parameters on tun will fail in
      presence of IFLA_INFO_KIND attribute in IFLA_LINKINFO nested attribute
      since tun_validate() always return failure.
      
      This can be visualized with following ip-link(8) command sequences:
      
        # ip link set dev tun0 group 100
        # ip link set dev tun0 group 100 type tun
        RTNETLINK answers: Invalid argument
      
      with contrast to dummy and veth drivers:
      
        # ip link set dev dummy0 group 100
        # ip link set dev dummy0 type dummy
      
        # ip link set dev veth0 group 100
        # ip link set dev veth0 group 100 type veth
      
      Fix by returning zero in tun_validate() when @data is NULL that is
      always in case since rtnl_link_ops->maxtype is zero in tun driver.
      
      Fixes: f019a7a5 ("tun: Implement ip link del tunXXX")
      Signed-off-by: default avatarSerhey Popovych <serhe.popovych@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      45d66e3d
    • Ryan C Goodfellow's avatar
      nfp: devlink port split support for 1x100G CXP NIC · 2951868e
      Ryan C Goodfellow authored
      [ Upstream commit 5948185b ]
      
      This commit makes it possible to use devlink to split the 100G CXP
      Netronome into two 40G interfaces. Currently when you ask for 2
      interfaces, the math in src/nfp_devlink.c:nfp_devlink_port_split
      calculates that you want 5 lanes per port because for some reason
      eth_port.port_lanes=10 (shouldn't this be 12 for CXP?). What we really
      want when asking for 2 breakout interfaces is 4 lanes per port. This
      commit makes that happen by calculating based on 8 lanes if 10 are
      present.
      Signed-off-by: default avatarRyan C Goodfellow <rgoodfel@isi.edu>
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: default avatarGreg Weeks <greg.weeks@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2951868e
    • Haiyang Zhang's avatar
      hv_netvsc: fix vf serial matching with pci slot info · 3d7d10b9
      Haiyang Zhang authored
      [ Upstream commit 00547955 ]
      
      The VF device's serial number is saved as a string in PCI slot's
      kobj name, not the slot->number. This patch corrects the netvsc
      driver, so the VF device can be successfully paired with synthetic
      NIC.
      
      Fixes: 00d7ddba ("hv_netvsc: pair VF based on serial number")
      Reported-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Reviewed-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3d7d10b9
    • Suzuki K Poulose's avatar
      arm64: cpufeature: ctr: Fix cpu capability check for late CPUs · b85000e8
      Suzuki K Poulose authored
      [ Upstream commit 8ab66cbe ]
      
      The matches() routine for a capability must honor the "scope"
      passed to it and return the proper results.
      i.e, when passed with SCOPE_LOCAL_CPU, it should check the
      status of the capability on the current CPU. This is used by
      verify_local_cpu_capabilities() on a late secondary CPU to make
      sure that it's compliant with the established system features.
      However, ARM64_HAS_CACHE_{IDC/DIC} always checks the system wide
      registers and this could mean that a late secondary CPU could return
      "true" (since the CPU hasn't updated the system wide registers yet)
      and thus lead the system in an inconsistent state, where
      the system assumes it has IDC/DIC feature, while the new CPU
      doesn't.
      
      Fixes: commit 6ae4b6e0 ("arm64: Add support for new control bits CTR_EL0.DIC and CTR_EL0.IDC")
      Cc: Philip Elcan <pelcan@codeaurora.org>
      Cc: Shanker Donthineni <shankerd@codeaurora.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b85000e8
    • Omar Sandoval's avatar
      swim: fix cleanup on setup error · 2ee36fb7
      Omar Sandoval authored
      [ Upstream commit 1448a2a5 ]
      
      If we fail to allocate the request queue for a disk, we still need to
      free that disk, not just the previous ones. Additionally, we need to
      cleanup the previous request queues.
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2ee36fb7
    • Omar Sandoval's avatar
      ataflop: fix error handling during setup · 8e00f452
      Omar Sandoval authored
      [ Upstream commit 71327f54 ]
      
      Move queue allocation next to disk allocation to fix a couple of issues:
      
      - If add_disk() hasn't been called, we should clear disk->queue before
        calling put_disk().
      - If we fail to allocate a request queue, we still need to put all of
        the disks, not just the ones that we allocated queues for.
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e00f452
    • Paolo Abeni's avatar
      netfilter: xt_nat: fix DNAT target for shifted portmap ranges · 703acc32
      Paolo Abeni authored
      [ Upstream commit cb20f2d2 ]
      
      The commit 2eb0f624 ("netfilter: add NAT support for shifted
      portmap ranges") did not set the checkentry/destroy callbacks for
      the newly added DNAT target. As a result, rulesets using only
      such nat targets are not effective, as the relevant conntrack hooks
      are not enabled.
      The above affect also nft_compat rulesets.
      Fix the issue adding the missing initializers.
      
      Fixes: 2eb0f624 ("netfilter: add NAT support for shifted portmap ranges")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      703acc32
    • Waiman Long's avatar
      locking/lockdep: Fix debug_locks off performance problem · 117d5fbd
      Waiman Long authored
      [ Upstream commit 9506a742 ]
      
      It was found that when debug_locks was turned off because of a problem
      found by the lockdep code, the system performance could drop quite
      significantly when the lock_stat code was also configured into the
      kernel. For instance, parallel kernel build time on a 4-socket x86-64
      server nearly doubled.
      
      Further analysis into the cause of the slowdown traced back to the
      frequent call to debug_locks_off() from the __lock_acquired() function
      probably due to some inconsistent lockdep states with debug_locks
      off. The debug_locks_off() function did an unconditional atomic xchg
      to write a 0 value into debug_locks which had already been set to 0.
      This led to severe cacheline contention in the cacheline that held
      debug_locks.  As debug_locks is being referenced in quite a few different
      places in the kernel, this greatly slow down the system performance.
      
      To prevent that trashing of debug_locks cacheline, lock_acquired()
      and lock_contended() now checks the state of debug_locks before
      proceeding. The debug_locks_off() function is also modified to check
      debug_locks before calling __debug_locks_off().
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1539913518-15598-1-git-send-email-longman@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      117d5fbd
    • Eric Dumazet's avatar
      net: loopback: clear skb->tstamp before netif_rx() · 3fdf483b
      Eric Dumazet authored
      [ Upstream commit 4c16128b ]
      
      At least UDP / TCP stacks can now cook skbs with a tstamp using
      MONOTONIC base (or arbitrary values with SCM_TXTIME)
      
      Since loopback driver does not call (directly or indirectly)
      skb_scrub_packet(), we need to clear skb->tstamp so that
      net_timestamp_check() can eventually resample the time,
      using ktime_get_real().
      
      Fixes: 80b14dee ("net: Add a new socket option for a future transmit time.")
      Fixes: fb420d5d ("tcp/fq: move back to CLOCK_MONOTONIC")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Cc: Soheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3fdf483b
    • Masahisa Kojima's avatar
      net: socionext: Reset tx queue in ndo_stop · cf5819b2
      Masahisa Kojima authored
      [ Upstream commit 8d5b0bf6 ]
      
      We observed that packets and bytes count are not reset
      when user performs interface down. Eventually, tx queue is
      exhausted and packets will not be sent out.
      To avoid this problem, resets tx queue in ndo_stop.
      
      Fixes: 533dd11a ("net: socionext: Add Synquacer NetSec driver")
      Signed-off-by: default avatarMasahisa Kojima <masahisa.kojima@linaro.org>
      Signed-off-by: default avatarYoshitoyo Osaki <osaki.yoshitoyo@socionext.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cf5819b2
    • Marek Szyprowski's avatar
      ARM: dts: exynos: Disable pull control for MAX8997 interrupts on Origen · 3f8141b1
      Marek Szyprowski authored
      commit f5e758b8 upstream.
      
      PMIC_IRQB and PMIC_KEYINB lines on Exynos4210-based Origen board have
      external pull-up resistors, so disable any pull control for those lines
      in respective pin controller node. This fixes support for MAX8997
      interrupts and enables operation of wakeup from MAX8997 RTC alarm.
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Fixes: 17419726 ("ARM: dts: add max8997 device node for exynos4210-origen board")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f8141b1
    • Dave Jiang's avatar
      x86/numa_emulation: Fix uniform-split numa emulation · d9f91499
      Dave Jiang authored
      commit c6ee7a54 upstream.
      
      The numa_emulation() routine in the 'uniform' case walks through all the
      physical 'memblk' instances and divides them into N emulated nodes with
      split_nodes_size_interleave_uniform(). As each physical node is consumed it
      is removed from the physical memblk array in the numa_remove_memblk_from()
      helper.
      
      Since split_nodes_size_interleave_uniform() handles advancing the array as
      the 'memblk' is consumed it is expected that the base of the array is
      always specified as the argument.
      
      Otherwise, on multi-socket (> 2) configurations the uniform-split
      capability can generate an invalid numa configuration leading to boot
      failures with signatures like the following:
      
          rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
          Sending NMI from CPU 0 to CPUs 2:
          NMI backtrace for cpu 2
          CPU: 2 PID: 1332 Comm: pgdatinit0 Not tainted 4.19.0-rc8-next-20181019-baseline #59
          RIP: 0010:__init_single_page.isra.74+0x81/0x90
          [..]
          Call Trace:
           deferred_init_pages+0xaa/0xe3
           deferred_init_memmap+0x18f/0x318
           kthread+0xf8/0x130
           ? deferred_free_pages.isra.105+0xc9/0xc9
           ? kthread_stop+0x110/0x110
           ret_from_fork+0x35/0x40
      
      Fixes: 1f6a2c6d9f121 ("x86/numa_emulation: Introduce uniform split capability")
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarAlexander Duyck <alexander.h.duyck@linux.intel.com>
      Reviewed-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/154049911459.2685845.9210186007479774286.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9f91499
    • Sebastian Andrzej Siewior's avatar
      x86/mm/pat: Disable preemption around __flush_tlb_all() · e36453b6
      Sebastian Andrzej Siewior authored
      commit f77084d9 upstream.
      
      The WARN_ON_ONCE(__read_cr3() != build_cr3()) in switch_mm_irqs_off()
      triggers every once in a while during a snapshotted system upgrade.
      
      The warning triggers since commit decab088 ("x86/mm: Remove
      preempt_disable/enable() from __native_flush_tlb()"). The callchain is:
      
        get_page_from_freelist() -> post_alloc_hook() -> __kernel_map_pages()
      
      with CONFIG_DEBUG_PAGEALLOC enabled.
      
      Disable preemption during CR3 reset / __flush_tlb_all() and add a comment
      why preemption has to be disabled so it won't be removed accidentaly.
      
      Add another preemptible() check in __flush_tlb_all() to catch callers with
      enabled preemption when PGE is enabled, because PGE enabled does not
      trigger the warning in __native_flush_tlb(). Suggested by Andy Lutomirski.
      
      Fixes: decab088 ("x86/mm: Remove preempt_disable/enable() from __native_flush_tlb()")
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20181017103432.zgv46nlu3hc7k4rq@linutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e36453b6
    • Vitaly Kuznetsov's avatar
      x86/kvm/nVMX: allow bare VMXON state migration · 97dc5051
      Vitaly Kuznetsov authored
      commit a1b0c1c6 upstream.
      
      It is perfectly valid for a guest to do VMXON and not do VMPTRLD. This
      state needs to be preserved on migration.
      
      Cc: stable@vger.kernel.org
      Fixes: 8fcc4b59Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      97dc5051
    • He Zhe's avatar
      x86/corruption-check: Fix panic in memory_corruption_check() when boot option... · 967afd9a
      He Zhe authored
      x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided
      
      commit ccde460b upstream.
      
      memory_corruption_check[{_period|_size}]()'s handlers do not check input
      argument before passing it to kstrtoul() or simple_strtoull(). The argument
      would be a NULL pointer if each of the kernel parameters, without its
      value, is set in command line and thus cause the following panic.
      
      PANIC: early exception 0xe3 IP 10:ffffffff73587c22 error 0 cr2 0x0
      [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.18-rc8+ #2
      [    0.000000] RIP: 0010:kstrtoull+0x2/0x10
      ...
      [    0.000000] Call Trace
      [    0.000000]  ? set_corruption_check+0x21/0x49
      [    0.000000]  ? do_early_param+0x4d/0x82
      [    0.000000]  ? parse_args+0x212/0x330
      [    0.000000]  ? rdinit_setup+0x26/0x26
      [    0.000000]  ? parse_early_options+0x20/0x23
      [    0.000000]  ? rdinit_setup+0x26/0x26
      [    0.000000]  ? parse_early_param+0x2d/0x39
      [    0.000000]  ? setup_arch+0x2f7/0xbf4
      [    0.000000]  ? start_kernel+0x5e/0x4c2
      [    0.000000]  ? load_ucode_bsp+0x113/0x12f
      [    0.000000]  ? secondary_startup_64+0xa5/0xb0
      
      This patch adds checks to prevent the panic.
      Signed-off-by: default avatarHe Zhe <zhe.he@windriver.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: gregkh@linuxfoundation.org
      Cc: kstewart@linuxfoundation.org
      Cc: pombredanne@nexb.com
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/1534260823-87917-1-git-send-email-zhe.he@windriver.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      967afd9a
    • Juergen Gross's avatar
      x86/xen: Fix boot loader version reported for PVH guests · 9f775ed2
      Juergen Gross authored
      commit 357d291c upstream.
      
      The boot loader version reported via sysfs is wrong in case of the
      kernel being booted via the Xen PVH boot entry. it should be 2.12
      (0x020c), but it is reported to be 2.18 (0x0212).
      
      As the current way to set the version is error prone use the more
      readable variant (2 << 8) | 12.
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: <stable@vger.kernel.org> # 4.12
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: boris.ostrovsky@oracle.com
      Cc: bp@alien8.de
      Cc: corbet@lwn.net
      Cc: linux-doc@vger.kernel.org
      Cc: xen-devel@lists.xenproject.org
      Link: http://lkml.kernel.org/r/20181010061456.22238-2-jgross@suse.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f775ed2
    • Jiri Kosina's avatar
      x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation · 233b9d7d
      Jiri Kosina authored
      commit 53c613fe upstream.
      
      STIBP is a feature provided by certain Intel ucodes / CPUs. This feature
      (once enabled) prevents cross-hyperthread control of decisions made by
      indirect branch predictors.
      
      Enable this feature if
      
      - the CPU is vulnerable to spectre v2
      - the CPU supports SMT and has SMT siblings online
      - spectre_v2 mitigation autoselection is enabled (default)
      
      After some previous discussion, this leaves STIBP on all the time, as wrmsr
      on crossing kernel boundary is a no-no. This could perhaps later be a bit
      more optimized (like disabling it in NOHZ, experiment with disabling it in
      idle, etc) if needed.
      
      Note that the synchronization of the mask manipulation via newly added
      spec_ctrl_mutex is currently not strictly needed, as the only updater is
      already being serialized by cpu_add_remove_lock, but let's make this a
      little bit more future-proof.
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc:  "WoodhouseDavid" <dwmw@amazon.co.uk>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc:  "SchauflerCasey" <casey.schaufler@intel.com>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/nycvar.YFH.7.76.1809251438240.15880@cbobk.fhfr.pmSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      233b9d7d
    • Takashi Iwai's avatar
      ALSA: hda - Fix incorrect clearance of thinkpad_acpi hooks · 1e3430e2
      Takashi Iwai authored
      commit 5e93a125 upstream.
      
      Since the commit c647f806 ("ALSA: hda - Allow multiple ADCs for
      mic mute LED controls") we allow enabling the mic mute LED with
      multiple ADCs.  The commit changed the function return value to be
      zero or a negative error, while this change was overlooked in the
      thinkpad_acpi helper code where it still expects a positive return
      value for success.  This eventually leads to a NULL dereference on a
      system that has only a mic mute LED.
      
      This patch corrects the return value check in the corresponding code
      as well.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201621
      Fixes: c647f806 ("ALSA: hda - Allow multiple ADCs for mic mute LED controls")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e3430e2
    • Alex Stanoev's avatar
      ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops · e3a6b6ed
      Alex Stanoev authored
      commit ac237c28 upstream.
      
      The Creative Audigy SE (SB0570) card currently exhibits an audible pop
      whenever playback is stopped or resumed, or during silent periods of an
      audio stream. Initialise the IZD bit to the 0 to eliminate these pops.
      
      The Infinite Zero Detection (IZD) feature on the DAC causes the output
      to be shunted to Vcap after 2048 samples of silence. This discharges the
      AC coupling capacitor through the output and causes the aforementioned
      pop/click noise.
      
      The behaviour of the IZD bit is described on page 15 of the WM8768GEDS
      datasheet: "With IZD=1, applying MUTE for 1024 consecutive input samples
      will cause all outputs to be connected directly to VCAP. This also
      happens if 2048 consecutive zero input samples are applied to all 6
      channels, and IZD=0. It will be removed as soon as any channel receives
      a non-zero input". I believe the second sentence might be referring to
      IZD=1 instead of IZD=0 given the observed behaviour of the card.
      
      This change should make the DAC initialisation consistent with
      Creative's Windows driver, as this popping persists when initialising
      the card in Linux and soft rebooting into Windows, but is not present on
      a cold boot to Windows.
      Signed-off-by: default avatarAlex Stanoev <alex@astanoev.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e3a6b6ed
    • Hans de Goede's avatar
      ALSA: hda: Add 2 more models to the power_save blacklist · 3e10f0f1
      Hans de Goede authored
      commit 5cb6b5fc upstream.
      
      Power-saving is causing plops on audio start/stop on Dell Precision T3600
      laptops and Intel DZ77BH boards, add these to the power_save blacklist.
      
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1525104Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e10f0f1
    • Jeremy Cline's avatar
      ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905) · e989f4b3
      Jeremy Cline authored
      commit e7bb6ad5 upstream.
      
      The Lenovo G50-30, like other G50 models, has a Conexant codec that
      requires a quirk for its inverted stereo dmic.
      
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1249364Reported-by: default avatarAlexander Ploumistos <alex.ploumistos@gmail.com>
      Tested-by: default avatarAlexander Ploumistos <alex.ploumistos@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJeremy Cline <jcline@redhat.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e989f4b3
    • Hui Wang's avatar
      ALSA: hda/realtek - Fix the problem of the front MIC on the Lenovo M715 · 7ea3c763
      Hui Wang authored
      commit d06fb562 upstream.
      
      The front MIC on the Lenovo M715 can't record sound, after applying
      the ALC294_FIXUP_LENOVO_MIC_LOCATION, the problem is fixed. So add
      the pin configuration of this machine to the pin quirk table.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ea3c763
    • Takashi Iwai's avatar
      ALSA: hda - Fix headphone pin config for ASUS G751 · 4306ad59
      Takashi Iwai authored
      commit 5b7c5e1f upstream.
      
      BIOS on ASUS G751 doesn't seem to map the headphone pin (NID 0x16)
      correctly.  Add a quirk to address it, as well as chaining to the
      previous fix for the microphone.
      Reported-by: default avatarHåvard <hovardslill@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4306ad59
    • Takashi Iwai's avatar
      ALSA: hda - Add quirk for ASUS G751 laptop · 096cd55d
      Takashi Iwai authored
      commit 11ba6111 upstream.
      
      ASUS G751 requires the extra COEF initialization to make it microphone
      working properly.
      Reported-and-tested-by: default avatarHåvard <hovardslill@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      096cd55d
    • Helge Deller's avatar
      parisc: Fix exported address of os_hpmc handler · e41a6afd
      Helge Deller authored
      commit 99a3ae51 upstream.
      
      In the C-code we need to put the physical address of the hpmc handler in
      the interrupt vector table (IVA) in order to get HPMCs working.  Since
      on parisc64 function pointers are indirect (in fact they are function
      descriptors) we instead export the address as variable and not as
      function.
      
      This reverts a small part of commit f39cce65 ("parisc: Add
      cfi_startproc and cfi_endproc to assembly code").
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org>    [4.9+]
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e41a6afd
    • Helge Deller's avatar
      parisc: Fix map_pages() to not overwrite existing pte entries · 72f6b9c0
      Helge Deller authored
      commit 3c229b3f upstream.
      
      Fix a long-existing small nasty bug in the map_pages() implementation which
      leads to overwriting already written pte entries with zero, *if* map_pages() is
      called a second time with an end address which isn't aligned on a pmd boundry.
      This happens for example if we want to remap only the text segment read/write
      in order to run alternative patching on the code. Exiting the loop when we
      reach the end address fixes this.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      72f6b9c0
    • John David Anglin's avatar
      parisc: Fix address in HPMC IVA · dcfc4972
      John David Anglin authored
      commit 1138b671 upstream.
      
      Helge noticed that the address of the os_hpmc handler was not being
      correctly calculated in the hpmc macro.  As a result, PDCE_CHECK would
      fail to call os_hpmc:
      
      <Cpu2> e800009802e00000  0000000000000000  CC_ERR_CHECK_HPMC
      <Cpu2> 37000f7302e00000  8040004000000000  CC_ERR_CPU_CHECK_SUMMARY
      <Cpu2> f600105e02e00000  fffffff0f0c00000  CC_MC_HPMC_MONARCH_SELECTED
      <Cpu2> 140003b202e00000  000000000000000b  CC_ERR_HPMC_STATE_ENTRY
      <Cpu2> 5600100b02e00000  00000000000001a0  CC_MC_OS_HPMC_LEN_ERR
      <Cpu2> 5600106402e00000  fffffff0f0438e70  CC_MC_BR_TO_OS_HPMC_FAILED
      <Cpu2> e800009802e00000  0000000000000000  CC_ERR_CHECK_HPMC
      <Cpu2> 37000f7302e00000  8040004000000000  CC_ERR_CPU_CHECK_SUMMARY
      <Cpu2> 4000109f02e00000  0000000000000000  CC_MC_HPMC_INITIATED
      <Cpu2> 4000101902e00000  0000000000000000  CC_MC_MULTIPLE_HPMCS
      <Cpu2> 030010d502e00000  0000000000000000  CC_CPU_STOP
      
      The address problem can be seen by dumping the fault vector:
      
      0000000040159000 <fault_vector_20>:
          40159000:   63 6f 77 73     stb r15,-2447(dp)
          40159004:   20 63 61 6e     ldil L%b747000,r3
          40159008:   20 66 6c 79     ldil L%-1c3b3000,r3
              ...
          40159020:   08 00 02 40     nop
          40159024:   20 6e 60 02     ldil L%15d000,r3
          40159028:   34 63 00 00     ldo 0(r3),r3
          4015902c:   e8 60 c0 02     bv,n r0(r3)
          40159030:   08 00 02 40     nop
          40159034:   00 00 00 00     break 0,0
          40159038:   c0 00 70 00     bb,*< r0,sar,40159840 <fault_vector_20+0x840>
          4015903c:   00 00 00 00     break 0,0
      
      Location 40159038 should contain the physical address of os_hpmc:
      
      000000004015d000 <os_hpmc>:
          4015d000:   08 1a 02 43     copy r26,r3
          4015d004:   01 c0 08 a4     mfctl iva,r4
          4015d008:   48 85 00 68     ldw 34(r4),r5
      
      This patch moves the address setup into initialize_ivt to resolve the
      above problem.  I tested the change by dumping the HPMC entry after setup:
      
      0000000040209020:  8000240
      0000000040209024: 206a2004
      0000000040209028: 34630ac0
      000000004020902c: e860c002
      0000000040209030:  8000240
      0000000040209034: 1bdddce6
      0000000040209038:   15d000
      000000004020903c:      1a0
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dcfc4972
    • David Arcari's avatar
      mailbox: PCC: handle parse error · 316f31f1
      David Arcari authored
      commit afd0b1fb upstream.
      
      acpi_pcc_probe() calls acpi_table_parse_entries_array() but fails
      to check for an error return.  This in turn can result in calling
      kcalloc() with a negative count as well as emitting the following
      misleading erorr message:
      
      [    2.642015] Could not allocate space for PCC mbox channels
      
      Fixes: 8f8027c5 (mailbox: PCC: erroneous error message when parsing ACPI PCCT)
      Signed-off-by: default avatarDavid Arcari <darcari@redhat.com>
      Reviewed-by: default avatarAl Stone <ahs3@redhat.com>
      Cc: 4.18+ <stable@vger.kernel.org> # 4.18+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      316f31f1
    • Jan Glauber's avatar
      ipmi: Fix timer race with module unload · 8e071518
      Jan Glauber authored
      commit 0711e8c1 upstream.
      
      Please note that below oops is from an older kernel, but the same
      race seems to be present in the upstream kernel too.
      
      ---8<---
      
      The following panic was encountered during removing the ipmi_ssif
      module:
      
      [ 526.352555] Unable to handle kernel paging request at virtual address ffff000006923090
      [ 526.360464] Mem abort info:
      [ 526.363257] ESR = 0x86000007
      [ 526.366304] Exception class = IABT (current EL), IL = 32 bits
      [ 526.372221] SET = 0, FnV = 0
      [ 526.375269] EA = 0, S1PTW = 0
      [ 526.378405] swapper pgtable: 4k pages, 48-bit VAs, pgd = 000000008ae60416
      [ 526.385185] [ffff000006923090] *pgd=000000bffcffe803, *pud=000000bffcffd803, *pmd=0000009f4731a003, *pte=0000000000000000
      [ 526.396141] Internal error: Oops: 86000007 [#1] SMP
      [ 526.401008] Modules linked in: nls_iso8859_1 ipmi_devintf joydev input_leds ipmi_msghandler shpchp sch_fq_codel ib_iser rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ip_tables x_tables autofs4 btrfs zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear i2c_smbus hid_generic usbhid uas hid usb_storage ast aes_ce_blk i2c_algo_bit aes_ce_cipher qede ttm crc32_ce ptp crct10dif_ce drm_kms_helper ghash_ce syscopyarea sha2_ce sysfillrect sysimgblt pps_core fb_sys_fops sha256_arm64 sha1_ce mpt3sas qed drm raid_class ahci scsi_transport_sas libahci gpio_xlp i2c_xlp9xx aes_neon_bs aes_neon_blk crypto_simd cryptd aes_arm64 [last unloaded: ipmi_ssif]
      [ 526.468085] CPU: 125 PID: 0 Comm: swapper/125 Not tainted 4.15.0-35-generic #38~lp1775396+build.1
      [ 526.476942] Hardware name: To be filled by O.E.M. Saber/Saber, BIOS 0ACKL022 08/14/2018
      [ 526.484932] pstate: 00400009 (nzcv daif +PAN -UAO)
      [ 526.489713] pc : 0xffff000006923090
      [ 526.493198] lr : call_timer_fn+0x34/0x178
      [ 526.497194] sp : ffff000009b0bdd0
      [ 526.500496] x29: ffff000009b0bdd0 x28: 0000000000000082
      [ 526.505796] x27: 0000000000000002 x26: ffff000009515188
      [ 526.511096] x25: ffff000009515180 x24: ffff0000090f1018
      [ 526.516396] x23: ffff000009519660 x22: dead000000000200
      [ 526.521696] x21: ffff000006923090 x20: 0000000000000100
      [ 526.526995] x19: ffff809eeb466a40 x18: 0000000000000000
      [ 526.532295] x17: 000000000000000e x16: 0000000000000007
      [ 526.537594] x15: 0000000000000000 x14: 071c71c71c71c71c
      [ 526.542894] x13: 0000000000000000 x12: 0000000000000000
      [ 526.548193] x11: 0000000000000001 x10: ffff000009b0be88
      [ 526.553493] x9 : 0000000000000000 x8 : 0000000000000005
      [ 526.558793] x7 : ffff80befc1f8528 x6 : 0000000000000020
      [ 526.564092] x5 : 0000000000000040 x4 : 0000000020001b20
      [ 526.569392] x3 : 0000000000000000 x2 : ffff809eeb466a40
      [ 526.574692] x1 : ffff000006923090 x0 : ffff809eeb466a40
      [ 526.579992] Process swapper/125 (pid: 0, stack limit = 0x000000002eb50acc)
      [ 526.586854] Call trace:
      [ 526.589289] 0xffff000006923090
      [ 526.592419] expire_timers+0xc8/0x130
      [ 526.596070] run_timer_softirq+0xec/0x1b0
      [ 526.600070] __do_softirq+0x134/0x328
      [ 526.603726] irq_exit+0xc8/0xe0
      [ 526.606857] __handle_domain_irq+0x6c/0xc0
      [ 526.610941] gic_handle_irq+0x84/0x188
      [ 526.614679] el1_irq+0xe8/0x180
      [ 526.617822] cpuidle_enter_state+0xa0/0x328
      [ 526.621993] cpuidle_enter+0x34/0x48
      [ 526.625564] call_cpuidle+0x44/0x70
      [ 526.629040] do_idle+0x1b8/0x1f0
      [ 526.632256] cpu_startup_entry+0x2c/0x30
      [ 526.636174] secondary_start_kernel+0x11c/0x130
      [ 526.640694] Code: bad PC value
      [ 526.643800] ---[ end trace d020b0b8417c2498 ]---
      [ 526.648404] Kernel panic - not syncing: Fatal exception in interrupt
      [ 526.654778] SMP: stopping secondary CPUs
      [ 526.658734] Kernel Offset: disabled
      [ 526.662211] CPU features: 0x5800c38
      [ 526.665688] Memory Limit: none
      [ 526.668768] ---[ end Kernel panic - not syncing: Fatal exception in interrupt
      
      Prevent mod_timer from arming a timer that was already removed by
      del_timer during module unload.
      Signed-off-by: default avatarJan Glauber <jglauber@cavium.com>
      Cc: <stable@vger.kernel.org> # 3.19
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e071518
    • Masami Hiramatsu's avatar
      kprobes/x86: Use preempt_enable() in optimized_callback() · b7e4138c
      Masami Hiramatsu authored
      commit 2e62024c upstream.
      
      The following commit:
      
        a19b2e3d ("kprobes/x86: Remove IRQ disabling from ftrace-based/optimized kprobes”)
      
      removed local_irq_save/restore() from optimized_callback(), the handler
      might be interrupted by the rescheduling interrupt and might be
      rescheduled - so we must not use the preempt_enable_no_resched() macro.
      
      Use preempt_enable() instead, to not lose preemption events.
      
      [ mingo: Improved the changelog. ]
      Reported-by: default avatarNadav Amit <namit@vmware.com>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: dwmw@amazon.co.uk
      Fixes: a19b2e3d ("kprobes/x86: Remove IRQ disabling from ftrace-based/optimized kprobes”)
      Link: http://lkml.kernel.org/r/154002887331.7627.10194920925792947001.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7e4138c
    • Dan Williams's avatar
      acpi, nfit: Fix Address Range Scrub completion tracking · 96f81d51
      Dan Williams authored
      commit d3abaf43 upstream.
      
      The Address Range Scrub implementation tried to skip running scrubs
      against ranges that were already scrubbed by the BIOS. Unfortunately
      that support also resulted in early scrub completions as evidenced by
      this debug output from nfit_test:
      
          nd_region region9: ARS: range 1 short complete
          nd_region region3: ARS: range 1 short complete
          nd_region region4: ARS: range 2 ARS start (0)
          nd_region region4: ARS: range 2 short complete
      
      ...i.e. completions without any indications that the scrub was started.
      
      This state of affairs was hard to see in the code due to the
      proliferation of state bits and mistakenly trying to track done state
      per-range when the completion is a global property of the bus.
      
      So, kill the four ARS state bits (ARS_REQ, ARS_REQ_REDO, ARS_DONE, and
      ARS_SHORT), and replace them with just 2 request flags ARS_REQ_SHORT and
      ARS_REQ_LONG. The implementation will still complete and reap the
      results of BIOS initiated ARS, but it will not attempt to use that
      information to affect the completion status of scrubbing the ranges from
      a Linux perspective.
      
      Instead, try to synchronously run a short ARS per range at init time and
      schedule a long scrub in the background. If ARS is busy with an ARS
      request, schedule both a short and a long scrub for when ARS returns to
      idle. This logic also satisfies the intent of what ARS_REQ_REDO was
      trying to achieve. The new rule is that the REQ flag stays set until the
      next successful ars_start() for that range.
      
      With the new policy that the REQ flags are not cleared until the next
      start, the implementation no longer loses requests as can be seen from
      the following log:
      
          nd_region region3: ARS: range 1 ARS start short (0)
          nd_region region9: ARS: range 1 ARS start short (0)
          nd_region region3: ARS: range 1 complete
          nd_region region4: ARS: range 2 ARS start short (0)
          nd_region region9: ARS: range 1 complete
          nd_region region9: ARS: range 1 ARS start long (0)
          nd_region region4: ARS: range 2 complete
          nd_region region3: ARS: range 1 ARS start long (0)
          nd_region region9: ARS: range 1 complete
          nd_region region3: ARS: range 1 complete
          nd_region region4: ARS: range 2 ARS start long (0)
          nd_region region4: ARS: range 2 complete
      
      ...note that the nfit_test emulated driver provides 2 buses, that is why
      some of the range indices are duplicated. Notice that each range
      now successfully completes a short and long scrub.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 14c73f99 ("nfit, address-range-scrub: introduce nfit_spa->ars_state")
      Fixes: cc3d3458 ("acpi/nfit: queue issuing of ars when an uc error...")
      Reported-by: default avatarJacek Zloch <jacek.zloch@intel.com>
      Reported-by: default avatarKrzysztof Rusocki <krzysztof.rusocki@intel.com>
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      96f81d51
    • Erik Schmauss's avatar
      ACPICA: AML Parser: fix parse loop to correctly skip erroneous extended opcodes · 8badf7c3
      Erik Schmauss authored
      commit c64baa3a upstream.
      
      AML opcodes come in two lengths: 1-byte opcodes and 2-byte, extended opcodes.
      If an error occurs due to illegal opcodes during table load, the AML parser
      needs to continue loading the table. In order to do this, it needs to skip
      parsing of the offending opcode and operands associated with that opcode.
      
      This change fixes the AML parse loop to correctly skip parsing of incorrect
      extended opcodes. Previously, only the short opcodes were skipped correctly.
      Signed-off-by: default avatarErik Schmauss <erik.schmauss@intel.com>
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8badf7c3
    • Erik Schmauss's avatar
      ACPICA: AML interpreter: add region addresses in global list during initialization · 22083c02
      Erik Schmauss authored
      commit 4abb951b upstream.
      
      The table load process omitted adding the operation region address
      range to the global list. This omission is problematic because the OS
      queries the global list to check for address range conflicts before
      deciding which drivers to load. This commit may result in warning
      messages that look like the following:
      
      [    7.871761] ACPI Warning: system_IO range 0x00000428-0x0000042F conflicts with op_region 0x00000400-0x0000047F (\PMIO) (20180531/utaddress-213)
      [    7.871769] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
      
      However, these messages do not signify regressions. It is a result of
      properly adding address ranges within the global address list.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=200011Tested-by: default avatarJean-Marc Lenoir <archlinux@jihemel.com>
      Signed-off-by: default avatarErik Schmauss <erik.schmauss@intel.com>
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22083c02
    • Bart Van Assche's avatar
      ACPI / OSL: Use 'jiffies' as the time bassis for acpi_os_get_timer() · a3b026a3
      Bart Van Assche authored
      commit 83b2348e upstream.
      
      Since acpi_os_get_timer() may be called after the timer subsystem has
      been suspended, use the jiffies counter instead of ktime_get(). This
      patch avoids that the following warning is reported during hibernation:
      
      WARNING: CPU: 0 PID: 612 at kernel/time/timekeeping.c:751 ktime_get+0x116/0x120
      RIP: 0010:ktime_get+0x116/0x120
      Call Trace:
       acpi_os_get_timer+0xe/0x30
       acpi_ds_exec_begin_control_op+0x175/0x1de
       acpi_ds_exec_begin_op+0x2c7/0x39a
       acpi_ps_create_op+0x573/0x5e4
       acpi_ps_parse_loop+0x349/0x1220
       acpi_ps_parse_aml+0x25b/0x6da
       acpi_ps_execute_method+0x327/0x41b
       acpi_ns_evaluate+0x4e9/0x6f5
       acpi_ut_evaluate_object+0xd9/0x2f2
       acpi_rs_get_method_data+0x8f/0x114
       acpi_walk_resources+0x122/0x1b6
       acpi_pci_link_get_current.isra.2+0x157/0x280
       acpi_pci_link_set+0x32f/0x4a0
       irqrouter_resume+0x58/0x80
       syscore_resume+0x84/0x380
       hibernation_snapshot+0x20c/0x4f0
       hibernate+0x22d/0x3a6
       state_store+0x99/0xa0
       kobj_attr_store+0x37/0x50
       sysfs_kf_write+0x87/0xa0
       kernfs_fop_write+0x1a5/0x240
       __vfs_write+0xd2/0x410
       vfs_write+0x101/0x250
       ksys_write+0xab/0x120
       __x64_sys_write+0x43/0x50
       do_syscall_64+0x71/0x220
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fixes: 164a08ce (ACPICA: Dispatcher: Introduce timeout mechanism for infinite loop detection)
      Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      References: https://lists.01.org/pipermail/lkp/2018-April/008406.htmlSigned-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Cc: 4.16+ <stable@vger.kernel.org> # 4.16+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a3b026a3