1. 08 Nov, 2019 14 commits
    • Linus Torvalds's avatar
      Merge tag 'pwm/for-5.4-rc7' of... · abf6c397
      Linus Torvalds authored
      Merge tag 'pwm/for-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm
      
      Pull pwm fix from Thierry Reding:
       "One more fix to keep a reference to the driver's module as long as
        there are users of the PWM exposed by the driver"
      
      * tag 'pwm/for-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
        pwm: bcm-iproc: Prevent unloading the driver module while in use
      abf6c397
    • Linus Torvalds's avatar
      Merge tag 'ceph-for-5.4-rc7' of git://github.com/ceph/ceph-client · 0689acfa
      Linus Torvalds authored
      Pull ceph fixes from Ilya Dryomov:
       "Some late-breaking dentry handling fixes from Al and Jeff, a patch to
        further restrict copy_file_range() to avoid potential data corruption
        from Luis and a fix for !CONFIG_CEPH_FSCACHE kernels.
      
        Everything but the fscache fix is marked for stable"
      
      * tag 'ceph-for-5.4-rc7' of git://github.com/ceph/ceph-client:
        ceph: return -EINVAL if given fsc mount option on kernel w/o support
        ceph: don't allow copy_file_range when stripe_count != 1
        ceph: don't try to handle hashed dentries in non-O_CREAT atomic_open
        ceph: add missing check in d_revalidate snapdir handling
        ceph: fix RCU case handling in ceph_d_revalidate()
        ceph: fix use-after-free in __ceph_remove_cap()
      0689acfa
    • Linus Torvalds's avatar
      Merge tag 'modules-for-v5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux · 6737e763
      Linus Torvalds authored
      Pull modules fix from Jessica Yu:
       "Fix `make nsdeps` for modules composed of multiple source files.
      
        Since $mod_source_files was not in quotes in the call to
        generate_deps_for_ns(), not all the source files for a module were
        being passed to spatch"
      
      * tag 'modules-for-v5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
        scripts/nsdeps: make sure to pass all module source files to spatch
      6737e763
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 9e8ed26e
      Linus Torvalds authored
      Pull arm64 fix from Will Deacon:
       "Fix pte_same() to avoid getting stuck on write fault.
      
        This single arm64 fix is a revert of 747a70e6 ("arm64: Fix
        copy-on-write referencing in HugeTLB"), not because that patch was
        wrong, but because it was broken by aa57157b ("arm64: Ensure
        VM_WRITE|VM_SHARED ptes are clean by default") which we merged in
        -rc6.
      
        We spotted the issue in Android (AOSP), where one of the JIT threads
        gets stuck on a write fault during boot because the faulting pte is
        marked as PTE_DIRTY | PTE_WRITE | PTE_RDONLY and the fault handler
        decides that there's nothing to do thanks to pte_same() masking out
        PTE_RDONLY.
      
        Thanks to John Stultz for reporting this and testing this so quickly,
        and to Steve Capper for confirming that the HugeTLB tests continue to
        pass"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: Do not mask out PTE_RDONLY in pte_same()
      9e8ed26e
    • Uwe Kleine-König's avatar
      pwm: bcm-iproc: Prevent unloading the driver module while in use · 24906a41
      Uwe Kleine-König authored
      The owner member of struct pwm_ops must be set to THIS_MODULE to
      increase the reference count of the module such that the module cannot
      be removed while its code is in use.
      
      Fixes: daa5abc4 ("pwm: Add support for Broadcom iProc PWM controller")
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
      24906a41
    • Linus Torvalds's avatar
      Merge tag 'xarray-5.4' of git://git.infradead.org/users/willy/linux-dax · 410ef736
      Linus Torvalds authored
      Pull XArray fixes from Matthew Wilcox:
       "These all fix various bugs, some of which people have tripped over and
        some of which have been caught by automatic tools"
      
      * tag 'xarray-5.4' of git://git.infradead.org/users/willy/linux-dax:
        idr: Fix idr_alloc_u32 on 32-bit systems
        idr: Fix integer overflow in idr_for_each_entry
        radix tree: Remove radix_tree_iter_find
        idr: Fix idr_get_next_ul race with idr_remove
        XArray: Fix xas_next() with a single entry at 0
      410ef736
    • Linus Torvalds's avatar
      Merge tag 'pm-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 4d8b3262
      Linus Torvalds authored
      Pull power management fix from Rafael Wysocki:
       "Fix an 'unchecked MSR access' warning in the intel_pstate cpufreq
        driver (Srinivas Pandruvada)"
      
      * tag 'pm-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        cpufreq: intel_pstate: Fix invalid EPB setting
      4d8b3262
    • Linus Torvalds's avatar
      Merge tag 'sound-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 8ac2a114
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "It became a bit largish, but all small and good for 5.4:
      
         - A regression fix of ALSA timer code bug that sneaked in by a recent
           cleanup; never trust innocent-looking guys...
      
         - Fix for compress API max size check signedness
      
         - Fixes in HD-audio: CA0132 work stall, Intel Tigerlake HDMI
      
         - A few fixes for SOF: memory leak, sanity-check and build fixes
      
         - A collection of device-specific fixes: firewire, rockchip, ASoC
           HDMI, rsnd, ASoC HDA, stm32, TI, kirkwood, msm, max98373"
      
      * tag 'sound-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: timer: Fix incorrectly assigned timer instance
        ASoC: SOF: topology: Fix bytes control size checks
        ALSA: hda: hdmi - add Tigerlake support
        ASoC: max98373: replace gpio_request with devm_gpio_request
        ASoC: stm32: sai: add restriction on mmap support
        ALSA: hda/ca0132 - Fix possible workqueue stall
        ASoC: hdac_hda: fix race in device removal
        ALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire Pro i/o series
        ASoC: rockchip: rockchip_max98090: Enable SHDN to fix headset detection
        ASoC: ti: sdma-pcm: Add back the flags parameter for non standard dma names
        ASoC: SOF: ipc: Fix memory leak in sof_set_get_large_ctrl_data
        ASoC: SOF: Fix memory leak in sof_dfsentry_write
        ASoC: SOF: Intel: hda-stream: fix the CONFIG_ prefix missing
        ASoC: kirkwood: fix device remove ordering
        ASoC: rsnd: dma: fix SSI9 4/5/6/7 busif dma address
        ASoC: hdmi-codec: drop mutex locking again
        ASoC: kirkwood: fix external clock probe defer
        ASoC: compress: fix unsigned integer overflow check
        ASoC: msm8916-wcd-analog: Fix RX1 selection in RDAC2 MUX
      8ac2a114
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2019-11-08' of git://anongit.freedesktop.org/drm/drm · efc61f7c
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Weekly fixes for drm: amdgpu has a few but they are pretty scattered
        fixes, the fbdev one is a build regression fix that we didn't want to
        risk leaving out, otherwise a couple of i915, one radeon and a core
        atomic fix.
      
        core:
         - add missing documentation for GEM shmem madvise helpers
         - Fix for a state dereference in atomic self-refresh helpers
      
        fbdev:
         - One compilation fix for c2p fbdev helpers
      
        amdgpu:
         - Fix navi14 display issue root cause and revert workaround
         - GPU reset scheduler interaction fix
         - Fix fan boost on multi-GPU
         - Gfx10 and sdma5 fixes for navi
         - GFXOFF fix for renoir
         - Add navi14 PCI ID
         - GPUVM fix for arcturus
      
        radeon:
         - Port an SI power fix from amdgpu
      
        i915:
         - Fix HPD poll to avoid kworker consuming a lot of cpu cycles.
         - Do not use TBT type for non Type-C ports"
      
      * tag 'drm-fixes-2019-11-08' of git://anongit.freedesktop.org/drm/drm:
        drm/radeon: fix si_enable_smc_cac() failed issue
        drm/amdgpu/renoir: move gfxoff handling into gfx9 module
        drm/amdgpu: add warning for GRBM 1-cycle delay issue in gfx9
        drm/amdgpu: add dummy read by engines for some GCVM status registers in gfx10
        drm/amdgpu: register gpu instance before fan boost feature enablment
        drm/amd/swSMU: fix smu workload bit map error
        drm/shmem: Add docbook comments for drm_gem_shmem_object madvise fields
        drm/amdgpu: add navi14 PCI ID
        Revert "drm/amd/display: setting the DIG_MODE to the correct value."
        drm/amd/display: Add ENGINE_ID_DIGD condition check for Navi14
        drm/amdgpu: dont schedule jobs while in reset
        drm/amdgpu/arcturus: properly set BANK_SELECT and FRAGMENT_SIZE
        drm/atomic: fix self-refresh helpers crtc state dereference
        drm/i915/dp: Do not switch aux to TBT mode for non-TC ports
        drm/i915: Avoid HPD poll detect triggering a new detect cycle
        fbdev: c2p: Fix link failure on non-inlining
      efc61f7c
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · d988f887
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "Fixes for various clk driver issues that happened because of code we
        merged this merge window.
      
        The Amlogic driver was missing some flags causing rates to be rounded
        improperly or clk_set_rate() to fail. The Samsung driver wasn't
        freeing everything on error paths and improperly saving/restoring PLL
        state across suspend/resume. The at91 driver was calling msleep() too
        early when scheduling hadn't started, so we put in place a quick
        solution until we can handle this sort of problem in the core
        framework.
      
        There were also problems with the Allwinner driver and operator
        precedence being incorrect causing subtle bugs. Finally, the TI driver
        was duplicating aliases and not delaying long enough leading to some
        unexpected timeouts"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: ti: clkctrl: Fix failed to enable error with double udelay timeout
        clk: ti: dra7-atl-clock: Remove ti_clk_add_alias call
        clk: sunxi-ng: a80: fix the zero'ing of bits 16 and 18
        clk: sunxi: Fix operator precedence in sunxi_divs_clk_setup
        clk: ast2600: Fix enabling of clocks
        clk: at91: avoid sleeping early
        clk: imx8m: Use SYS_PLL1_800M as intermediate parent of CLK_ARM
        clk: samsung: exynos5420: Preserve PLL configuration during suspend/resume
        clk: samsung: exynos542x: Move G3D subsystem clocks to its sub-CMU
        clk: samsung: exynos5433: Fix error paths
        clk: at91: sam9x60: fix programmable clock
        clk: meson: g12a: set CLK_MUX_ROUND_CLOSEST on the cpu clock muxes
        clk: meson: g12a: fix cpu clock rate setting
        clk: meson: gxbb: let sar_adc_clk_div set the parent clock rate
      d988f887
    • Srinivas Pandruvada's avatar
      cpufreq: intel_pstate: Fix invalid EPB setting · c31432fa
      Srinivas Pandruvada authored
      The max value of EPB can only be 0x0F. Attempting to set more than that
      triggers an "unchecked MSR access error" warning which happens in
      intel_pstate_hwp_force_min_perf() called via cpufreq stop_cpu().
      
      However, it is not even necessary to touch the EPB from intel_pstate,
      because it is restored on every CPU online by the intel_epb.c code,
      so let that code do the right thing and drop the redundant (and
      incorrect) EPB update from intel_pstate.
      
      Fixes: af3b7379 ("cpufreq: intel_pstate: Force HWP min perf before offline")
      Reported-by: default avatarQian Cai <cai@lca.pw>
      Cc: 5.2+ <stable@vger.kernel.org> # 5.2+
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      [ rjw: Changelog ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c31432fa
    • Dave Airlie's avatar
      Merge tag 'drm-fixes-5.4-2019-11-06' of git://people.freedesktop.org/~agd5f/linux into drm-fixes · ff923458
      Dave Airlie authored
      drm-fixes-5.4-2019-11-06:
      
      amdgpu:
      - Fix navi14 display issue root cause and revert workaround
      - GPU reset scheduler interaction fix
      - Fix fan boost on multi-GPU
      - Gfx10 and sdma5 fixes for navi
      - GFXOFF fix for renoir
      - Add navi14 PCI ID
      - GPUVM fix for arcturus
      
      radeon:
      - Port an SI power fix from amdgpu
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexdeucher@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191107032241.1021217-1-alexander.deucher@amd.com
      ff923458
    • Dave Airlie's avatar
      Merge tag 'drm-intel-fixes-2019-11-06' of... · 67322bec
      Dave Airlie authored
      Merge tag 'drm-intel-fixes-2019-11-06' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
      
      - Fix HPD poll to avoid kworker consuming a lot of cpu cycles.
      - Do not use TBT type for non Type-C ports.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191106213958.GA16525@intel.com
      67322bec
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2019-11-07-1' of... · 72d74a06
      Dave Airlie authored
      Merge tag 'drm-misc-fixes-2019-11-07-1' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
      
       - Some new documentation for GEM shmem madvise helpers
       - Fix for a state dereference in atomic self-refresh helpers
       - One compilation fix for c2p fbdev helpers
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Maxime Ripard <mripard@kernel.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191107082215.GA34850@gilmour.lan
      72d74a06
  2. 07 Nov, 2019 9 commits
  3. 06 Nov, 2019 17 commits
    • Rob Herring's avatar
      drm/shmem: Add docbook comments for drm_gem_shmem_object madvise fields · 105401b6
      Rob Herring authored
      Add missing docbook comments to madvise fields in struct
      drm_gem_shmem_object which fixes these warnings:
      
      include/drm/drm_gem_shmem_helper.h:87: warning: Function parameter or member 'madv' not described in 'drm_gem_shmem_object'
      include/drm/drm_gem_shmem_helper.h:87: warning: Function parameter or member 'madv_list' not described in 'drm_gem_shmem_object'
      
      Fixes: 17acb9f3 ("drm/shmem: Add madvise state and purge helpers")
      Reported-by: default avatarSean Paul <sean@poorly.run>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Reviewed-by: default avatarSean Paul <sean@poorly.run>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191101153754.22803-1-robh@kernel.org
      105401b6
    • Jason Gerecke's avatar
      HID: wacom: generic: Treat serial number and related fields as unsigned · ff479731
      Jason Gerecke authored
      The HID descriptors for most Wacom devices oddly declare the serial
      number and other related fields as signed integers. When these numbers
      are ingested by the HID subsystem, they are automatically sign-extended
      into 32-bit integers. We treat the fields as unsigned elsewhere in the
      kernel and userspace, however, so this sign-extension causes problems.
      In particular, the sign-extended tool ID sent to userspace as ABS_MISC
      does not properly match unsigned IDs used by xf86-input-wacom and libwacom.
      
      We introduce a function 'wacom_s32tou' that can undo the automatic sign
      extension performed by 'hid_snto32'. We call this function when processing
      the serial number and related fields to ensure that we are dealing with
      and reporting the unsigned form. We opt to use this method rather than
      adding a descriptor fixup in 'wacom_hid_usage_quirk' since it should be
      more robust in the face of future devices.
      
      Ref: https://github.com/linuxwacom/input-wacom/issues/134
      Fixes: f85c9dc6 ("HID: wacom: generic: Support tool ID and additional tool types")
      CC: <stable@vger.kernel.org> # v4.10+
      Signed-off-by: default avatarJason Gerecke <jason.gerecke@wacom.com>
      Reviewed-by: default avatarAaron Armstrong Skomra <aaron.skomra@wacom.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      ff479731
    • Tianci.Yin's avatar
      drm/amdgpu: add navi14 PCI ID · 5e200fb9
      Tianci.Yin authored
      Add the navi14 PCI device id.
      Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
      Signed-off-by: default avatarTianci.Yin <tianci.yin@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      5e200fb9
    • Zhan Liu's avatar
      Revert "drm/amd/display: setting the DIG_MODE to the correct value." · a85a64d3
      Zhan Liu authored
      This reverts commit 385857ad.
      
      Reason for revert: Root cause of this issue is found. The workaround is not needed anymore.
      Signed-off-by: default avatarZhan Liu <zhan.liu@amd.com>
      Reviewed-by: default avatarHersen Wu <hersenxs.wu@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      a85a64d3
    • Zhan Liu's avatar
      drm/amd/display: Add ENGINE_ID_DIGD condition check for Navi14 · f9686cee
      Zhan Liu authored
      [Why]
      Navi10 has 6 PHY, but Navi14 only has 5 PHY, that is
      because there is no ENGINE_ID_DIGD in Navi14. Without
      this patch, many HDMI related issues (e.g. HDMI S3
      resume failure, HDMI pink screen on boot) will be
      observed.
      
      [How]
      If "eng_id" is larger than ENGINE_ID_DIGD, then
      add "eng_id" by 1.
      Signed-off-by: default avatarZhan Liu <zhan.liu@amd.com>
      Reviewed-by: default avatarHersen Wu <hersenxs.wu@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      f9686cee
    • Shirish S's avatar
      drm/amdgpu: dont schedule jobs while in reset · f2efc6e6
      Shirish S authored
      [Why]
      
      doing kthread_park()/unpark() from drm_sched_entity_fini
      while GPU reset is in progress defeats all the purpose of
      drm_sched_stop->kthread_park.
      If drm_sched_entity_fini->kthread_unpark() happens AFTER
      drm_sched_stop->kthread_park nothing prevents from another
      (third) thread to keep submitting job to HW which will be
      picked up by the unparked scheduler thread and try to submit
      to HW but fail because the HW ring is deactivated.
      
      [How]
      grab the reset lock before calling drm_sched_entity_fini()
      Signed-off-by: default avatarShirish S <shirish.s@amd.com>
      Suggested-by: default avatarChristian König <christian.koenig@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Reviewed-by: default avatarAndrey Grodzovsky <andrey.grodzovsky@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      f2efc6e6
    • Alex Deucher's avatar
      drm/amdgpu/arcturus: properly set BANK_SELECT and FRAGMENT_SIZE · 576daab3
      Alex Deucher authored
      These were not aligned for optimal performance for GPUVM.
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      576daab3
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 4dd58158
      Linus Torvalds authored
      Merge more fixes from Andrew Morton:
       "17 fixes"
      
      Mostly mm fixes and one ocfs2 locking fix.
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm: memcontrol: fix network errors from failing __GFP_ATOMIC charges
        mm/memory_hotplug: fix updating the node span
        scripts/gdb: fix debugging modules compiled with hot/cold partitioning
        mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly
        MAINTAINERS: update information for "MEMORY MANAGEMENT"
        dump_stack: avoid the livelock of the dump_lock
        zswap: add Vitaly to the maintainers list
        mm/page_alloc.c: ratelimit allocation failure warnings more aggressively
        mm/khugepaged: fix might_sleep() warn with CONFIG_HIGHPTE=y
        mm, vmstat: reduce zone->lock holding time by /proc/pagetypeinfo
        mm, vmstat: hide /proc/pagetypeinfo from normal users
        mm/mmu_notifiers: use the right return code for WARN_ON
        ocfs2: protect extent tree in ocfs2_prepare_inode_for_write()
        mm: thp: handle page cache THP correctly in PageTransCompoundMap
        mm, meminit: recalculate pcpu batch and high limits after init completes
        mm/gup_benchmark: fix MAP_HUGETLB case
        mm: memcontrol: fix NULL-ptr deref in percpu stats flush
      4dd58158
    • Catalin Marinas's avatar
      arm64: Do not mask out PTE_RDONLY in pte_same() · 6767df24
      Catalin Marinas authored
      Following commit 73e86cb0 ("arm64: Move PTE_RDONLY bit handling out
      of set_pte_at()"), the PTE_RDONLY bit is no longer managed by
      set_pte_at() but built into the PAGE_* attribute definitions.
      Consequently, pte_same() must include this bit when checking two PTEs
      for equality.
      
      Remove the arm64-specific pte_same() function, practically reverting
      commit 747a70e6 ("arm64: Fix copy-on-write referencing in HugeTLB")
      
      Fixes: 73e86cb0 ("arm64: Move PTE_RDONLY bit handling out of set_pte_at()")
      Cc: <stable@vger.kernel.org> # 4.14.x-
      Cc: Will Deacon <will@kernel.org>
      Cc: Steve Capper <steve.capper@arm.com>
      Reported-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      6767df24
    • Rob Clark's avatar
      drm/atomic: fix self-refresh helpers crtc state dereference · 86de88cf
      Rob Clark authored
      drm_self_refresh_helper_update_avg_times() was incorrectly accessing the
      new incoming state after drm_atomic_helper_commit_hw_done().  But this
      state might have already been superceeded by an !nonblock atomic update
      resulting in dereferencing an already free'd crtc_state.
      
      TODO I *think* this will more or less do the right thing.. althought I'm
      not 100% sure if, for example, we enter psr in a nonblock commit, and
      then leave psr in a !nonblock commit that overtakes the completion of
      the nonblock commit.  Not sure if this sort of scenario can happen in
      practice.  But not crashing is better than crashing, so I guess we
      should either take this patch or rever the self-refresh helpers until
      Sean can figure out a better solution.
      
      Fixes: d4da4e33 ("drm: Measure Self Refresh Entry/Exit times to avoid thrashing")
      Cc: Sean Paul <seanpaul@chromium.org>
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      [seanpaul fixed up some checkpatch warns]
      Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191104173737.142558-1-robdclark@gmail.com
      86de88cf
    • Takashi Iwai's avatar
      ALSA: timer: Fix incorrectly assigned timer instance · e7af6307
      Takashi Iwai authored
      The clean up commit 41672c0c ("ALSA: timer: Simplify error path in
      snd_timer_open()") unified the error handling code paths with the
      standard goto, but it introduced a subtle bug: the timer instance is
      stored in snd_timer_open() incorrectly even if it returns an error.
      This may eventually lead to UAF, as spotted by fuzzer.
      
      The culprit is the snd_timer_open() code checks the
      SNDRV_TIMER_IFLG_EXCLUSIVE flag with the common variable timeri.
      This variable is supposed to be the newly created instance, but we
      (ab-)used it for a temporary check before the actual creation of a
      timer instance.  After that point, there is another check for the max
      number of instances, and it bails out if over the threshold.  Before
      the refactoring above, it worked fine because the code returned
      directly from that point.  After the refactoring, however, it jumps to
      the unified error path that stores the timeri variable in return --
      even if it returns an error.  Unfortunately this stored value is kept
      in the caller side (snd_timer_user_tselect()) in tu->timeri.  This
      causes inconsistency later, as if the timer was successfully
      assigned.
      
      In this patch, we fix it by not re-using timeri variable but a
      temporary variable for testing the exclusive connection, so timeri
      remains NULL at that point.
      
      Fixes: 41672c0c ("ALSA: timer: Simplify error path in snd_timer_open()")
      Reported-and-tested-by: default avatarTristan Madani <tristmd@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20191106165547.23518-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e7af6307
    • Johannes Weiner's avatar
      mm: memcontrol: fix network errors from failing __GFP_ATOMIC charges · 869712fd
      Johannes Weiner authored
      While upgrading from 4.16 to 5.2, we noticed these allocation errors in
      the log of the new kernel:
      
        SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
          cache: tw_sock_TCPv6(960:helper-logs), object size: 232, buffer size: 240, default order: 1, min order: 0
          node 0: slabs: 5, objs: 170, free: 0
      
              slab_out_of_memory+1
              ___slab_alloc+969
              __slab_alloc+14
              kmem_cache_alloc+346
              inet_twsk_alloc+60
              tcp_time_wait+46
              tcp_fin+206
              tcp_data_queue+2034
              tcp_rcv_state_process+784
              tcp_v6_do_rcv+405
              __release_sock+118
              tcp_close+385
              inet_release+46
              __sock_release+55
              sock_close+17
              __fput+170
              task_work_run+127
              exit_to_usermode_loop+191
              do_syscall_64+212
              entry_SYSCALL_64_after_hwframe+68
      
      accompanied by an increase in machines going completely radio silent
      under memory pressure.
      
      One thing that changed since 4.16 is e699e2c6 ("net, mm: account
      sock objects to kmemcg"), which made these slab caches subject to cgroup
      memory accounting and control.
      
      The problem with that is that cgroups, unlike the page allocator, do not
      maintain dedicated atomic reserves.  As a cgroup's usage hovers at its
      limit, atomic allocations - such as done during network rx - can fail
      consistently for extended periods of time.  The kernel is not able to
      operate under these conditions.
      
      We don't want to revert the culprit patch, because it indeed tracks a
      potentially substantial amount of memory used by a cgroup.
      
      We also don't want to implement dedicated atomic reserves for cgroups.
      There is no point in keeping a fixed margin of unused bytes in the
      cgroup's memory budget to accomodate a consumer that is impossible to
      predict - we'd be wasting memory and get into configuration headaches,
      not unlike what we have going with min_free_kbytes.  We do this for
      physical mem because we have to, but cgroups are an accounting game.
      
      Instead, account these privileged allocations to the cgroup, but let
      them bypass the configured limit if they have to.  This way, we get the
      benefits of accounting the consumed memory and have it exert pressure on
      the rest of the cgroup, but like with the page allocator, we shift the
      burden of reclaimining on behalf of atomic allocations onto the regular
      allocations that can block.
      
      Link: http://lkml.kernel.org/r/20191022233708.365764-1-hannes@cmpxchg.org
      Fixes: e699e2c6 ("net, mm: account sock objects to kmemcg")
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Cc: Suleiman Souhlal <suleiman@google.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: <stable@vger.kernel.org>	[4.18+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      869712fd
    • David Hildenbrand's avatar
      mm/memory_hotplug: fix updating the node span · 656d5711
      David Hildenbrand authored
      We recently started updating the node span based on the zone span to
      avoid touching uninitialized memmaps.
      
      Currently, we will always detect the node span to start at 0, meaning a
      node can easily span too many pages.  pgdat_is_empty() will still work
      correctly if all zones span no pages.  We should skip over all zones
      without spanned pages and properly handle the first detected zone that
      spans pages.
      
      Unfortunately, in contrast to the zone span (/proc/zoneinfo), the node
      span cannot easily be inspected and tested.  The node span gives no real
      guarantees when an architecture supports memory hotplug, meaning it can
      easily contain holes or span pages of different nodes.
      
      The node span is not really used after init on architectures that
      support memory hotplug.
      
      E.g., we use it in mm/memory_hotplug.c:try_offline_node() and in
      mm/kmemleak.c:kmemleak_scan().  These users seem to be fine.
      
      Link: http://lkml.kernel.org/r/20191027222714.5313-1-david@redhat.com
      Fixes: 00d6c019 ("mm/memory_hotplug: don't access uninitialized memmaps in shrink_pgdat_span()")
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      656d5711
    • Ilya Leoshkevich's avatar
      scripts/gdb: fix debugging modules compiled with hot/cold partitioning · 8731acc5
      Ilya Leoshkevich authored
      gcc's -freorder-blocks-and-partition option makes it group frequently
      and infrequently used code in .text.hot and .text.unlikely sections
      respectively.  At least when building modules on s390, this option is
      used by default.
      
      gdb assumes that all code is located in .text section, and that .text
      section is located at module load address.  With such modules this is no
      longer the case: there is code in .text.hot and .text.unlikely, and
      either of them might precede .text.
      
      Fix by explicitly telling gdb the addresses of code sections.
      
      It might be tempting to do this for all sections, not only the ones in
      the white list.  Unfortunately, gdb appears to have an issue, when
      telling it about e.g. loadable .note.gnu.build-id section causes it to
      think that non-loadable .note.Linux section is loaded at address 0,
      which in turn causes NULL pointers to be resolved to bogus symbols.  So
      keep using the white list approach for the time being.
      
      Link: http://lkml.kernel.org/r/20191028152734.13065-1-iii@linux.ibm.comSigned-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Reviewed-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
      Cc: Kieran Bingham <kbingham@kernel.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8731acc5
    • Roman Gushchin's avatar
      mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly · 221ec5c0
      Roman Gushchin authored
      page_cgroup_ino() doesn't return a valid memcg pointer for non-compound
      slab pages, because it depends on PgHead AND PgSlab flags to be set to
      determine the memory cgroup from the kmem_cache.  It's correct for
      compound pages, but not for generic small pages.  Those don't have PgHead
      set, so it ends up returning zero.
      
      Fix this by replacing the condition to PageSlab() && !PageTail().
      
      Before this patch:
        [root@localhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.slice/user@0.service/ | grep slab
        0x0000000000000080	        38        0  _______S___________________________________	slab
      
      After this patch:
        [root@localhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.slice/user@0.service/ | grep slab
        0x0000000000000080	       147        0  _______S___________________________________	slab
      
      Also, hwpoison_filter_task() uses output of page_cgroup_ino() in order
      to filter error injection events based on memcg.  So if
      page_cgroup_ino() fails to return memcg pointer, we just fail to inject
      memory error.  Considering that hwpoison filter is for testing, affected
      users are limited and the impact should be marginal.
      
      [n-horiguchi@ah.jp.nec.com: changelog additions]
      Link: http://lkml.kernel.org/r/20191031012151.2722280-1-guro@fb.com
      Fixes: 4d96ba35 ("mm: memcg/slab: stop setting page->mem_cgroup pointer for slab pages")
      Signed-off-by: default avatarRoman Gushchin <guro@fb.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      221ec5c0
    • Song Liu's avatar
      MAINTAINERS: update information for "MEMORY MANAGEMENT" · 6981b76c
      Song Liu authored
      I was trying to find the mm tree in MAINTAINERS by searching "Morton".
      Unfortunately, I didn't find one.  And I didn't even locate the MEMORY
      MANAGEMENT section quickly, because Andrew's name was not listed there.
      
      Thanks to Johannes who helped me find the mm tree.
      
      Let save other's time searching around by adding:
      
      M:	Andrew Morton <akpm@linux-foundation.org>
      T:	git git://github.com/hnaz/linux-mm.git
      
      [akpm@linux-foundation.org: add ozlabs.org quilt trees]
      Link: http://lkml.kernel.org/r/20191030202217.3498133-1-songliubraving@fb.comSigned-off-by: default avatarSong Liu <songliubraving@fb.com>
      Acked-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6981b76c
    • Kevin Hao's avatar
      dump_stack: avoid the livelock of the dump_lock · 5cbf2fff
      Kevin Hao authored
      In the current code, we use the atomic_cmpxchg() to serialize the output
      of the dump_stack(), but this implementation suffers the thundering herd
      problem.  We have observed such kind of livelock on a Marvell cn96xx
      board(24 cpus) when heavily using the dump_stack() in a kprobe handler.
      Actually we can let the competitors to wait for the releasing of the
      lock before jumping to atomic_cmpxchg().  This will definitely mitigate
      the thundering herd problem.  Thanks Linus for the suggestion.
      
      [akpm@linux-foundation.org: fix comment]
      Link: http://lkml.kernel.org/r/20191030031637.6025-1-haokexin@gmail.com
      Fixes: b58d9774 ("dump_stack: serialize the output from dump_stack()")
      Signed-off-by: default avatarKevin Hao <haokexin@gmail.com>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5cbf2fff