Skip to content
  1. Mar 11, 2021
    • Noralf Trønnes's avatar
      drm/shmem-helpers: vunmap: Don't put pages for dma-buf · 64e194e2
      Noralf Trønnes authored
      dma-buf importing was reworked in commit 7d2cd72a
      
      
      ("drm/shmem-helpers: Simplify dma-buf importing"). Before that commit
      drm_gem_shmem_prime_import_sg_table() did set ->pages_use_count=1 and
      drm_gem_shmem_vunmap_locked() could call drm_gem_shmem_put_pages()
      unconditionally. Now without the use count set, put pages is called also
      on dma-bufs. Fix this by only putting pages if it's not imported.
      
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Fixes: 7d2cd72a
      
       ("drm/shmem-helpers: Simplify dma-buf importing")
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Tested-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210219122203.51130-1-noralf@tronnes.org
      (cherry picked from commit cdea7251
      
      )
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      64e194e2
    • Artem Lapkin's avatar
      drm: meson_drv add shutdown function · fa0c16ca
      Artem Lapkin authored
      Problem: random stucks on reboot stage about 1/20 stuck/reboots
      // debug kernel log
      [    4.496660] reboot: kernel restart prepare CMD:(null)
      [    4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
      [    4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
      ...STUCK...
      
      Solution: add shutdown function to meson_drm driver
      // debug kernel log
      [    5.231896] reboot: kernel restart prepare CMD:(null)
      [    5.246135] [drm:meson_drv_shutdown]
      ...
      [    5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin
      [    5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
      [    5.338331] reboot: Restarting system
      [    5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null)
      bl31 reboot reason: 0xd
      bl31 reboot reason: 0x0
      system cmd  1.
      ...REBOOT...
      
      Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots
      and Odroid boards, WeTek Play2 (GXBB)
      
      Fixes: bbbe775e
      
       ("drm: Add support for Amlogic Meson Graphic Controller")
      Signed-off-by: default avatarArtem Lapkin <art@khadas.com>
      Tested-by: default avatarChristian Hewitt <christianshewitt@gmail.com>
      Acked-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Acked-by: default avatarKevin Hilman <khilman@baylibre.com>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210302042202.3728113-1-art@khadas.com
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      fa0c16ca
    • Neil Roberts's avatar
      drm/shmem-helper: Don't remove the offset in vm_area_struct pgoff · 11d5a474
      Neil Roberts authored
      When mmapping the shmem, it would previously adjust the pgoff in the
      vm_area_struct to remove the fake offset that is added to be able to
      identify the buffer. This patch removes the adjustment and makes the
      fault handler use the vm_fault address to calculate the page offset
      instead. Although using this address is apparently discouraged, several
      DRM drivers seem to be doing it anyway.
      
      The problem with removing the pgoff is that it prevents
      drm_vma_node_unmap from working because that searches the mapping tree
      by address. That doesn't work because all of the mappings are at offset
      0. drm_vma_node_unmap is being used by the shmem helpers when purging
      the buffer.
      
      This fixes a bug in Panfrost which is using drm_gem_shmem_purge. Without
      this the mapping for the purged buffer can still be accessed which might
      mean it would access random pages from other buffers
      
      v2: Don't check whether the unsigned page_offset is less than 0.
      
      Cc: stable@vger.kernel.org
      Fixes: 17acb9f3
      
       ("drm/shmem: Add madvise state and purge helpers")
      Signed-off-by: default avatarNeil Roberts <nroberts@igalia.com>
      Reviewed-by: default avatarSteven Price <steven.price@arm.com>
      Signed-off-by: default avatarSteven Price <steven.price@arm.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210223155125.199577-3-nroberts@igalia.com
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      11d5a474
    • Neil Roberts's avatar
      drm/shmem-helper: Check for purged buffers in fault handler · d611b4a0
      Neil Roberts authored
      When a buffer is madvised as not needed and then purged, any attempts to
      access the buffer from user-space should cause a bus fault. This patch
      adds a check for that.
      
      Cc: stable@vger.kernel.org
      Fixes: 17acb9f3
      
       ("drm/shmem: Add madvise state and purge helpers")
      Signed-off-by: default avatarNeil Roberts <nroberts@igalia.com>
      Reviewed-by: default avatarSteven Price <steven.price@arm.com>
      Signed-off-by: default avatarSteven Price <steven.price@arm.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210223155125.199577-2-nroberts@igalia.com
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      d611b4a0
    • Colin Ian King's avatar
      qxl: Fix uninitialised struct field head.surface_id · 738acd49
      Colin Ian King authored
      The surface_id struct field in head is not being initialized and
      static analysis warns that this is being passed through to
      dev->monitors_config->heads[i] on an assignment. Clear up this
      warning by initializing it to zero.
      
      Addresses-Coverity: ("Uninitialized scalar variable")
      Fixes: a6d3c4d7
      
       ("qxl: hook monitors_config updates into crtc, not encoder.")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20210304094928.2280722-1-colin.king@canonical.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      738acd49
    • Anthony DeRossi's avatar
      drm/ttm: Fix TTM page pool accounting · ca63d76f
      Anthony DeRossi authored
      Freed pages are not subtracted from the allocated_pages counter in
      ttm_pool_type_fini(), causing a leak in the count on device removal.
      The next shrinker invocation loops forever trying to free pages that are
      no longer in the pool:
      
        rcu: INFO: rcu_sched self-detected stall on CPU
        rcu:  3-....: (9998 ticks this GP) idle=54e/1/0x4000000000000000 softirq=434857/434857 fqs=2237
          (t=10001 jiffies g=2194533 q=49211)
        NMI backtrace for cpu 3
        CPU: 3 PID: 1034 Comm: kswapd0 Tainted: P           O      5.11.0-com #1
        Hardware name: System manufacturer System Product Name/PRIME X570-PRO, BIOS 1405 11/19/2019
        Call Trace:
         <IRQ>
         ...
         </IRQ>
         sysvec_apic_timer_interrupt+0x77/0x80
         asm_sysvec_apic_timer_interrupt+0x12/0x20
        RIP: 0010:mutex_unlock+0x16/0x20
        Code: e7 48 8b 70 10 e8 7a 53 77 ff eb aa e8 43 6c ff ff 0f 1f 00 65 48 8b 14 25 00 6d 01 00 31 c9 48 89 d0 f0 48 0f b1 0f 48 39 c2 <74> 05 e9 e3 fe ff ff c3 66 90 48 8b 47 20 48 85 c0 74 0f 8b 50 10
        RSP: 0018:ffffbdb840797be8 EFLAGS: 00000246
        RAX: ffff9ff445a41c00 RBX: ffffffffc02a9ef8 RCX: 0000000000000000
        RDX: ffff9ff445a41c00 RSI: ffffbdb840797c78 RDI: ffffffffc02a9ac0
        RBP: 0000000000000080 R08: 0000000000000000 R09: ffffbdb840797c80
        R10: 0000000000000000 R11: fffffffffffffff5 R12: 0000000000000000
        R13: 0000000000000000 R14: 0000000000000084 R15: ffffffffc02a9a60
         ttm_pool_shrink+0x7d/0x90 [ttm]
         ttm_pool_shrinker_scan+0x5/0x20 [ttm]
         do_shrink_slab+0x13a/0x1a0
      ...
      
      debugfs shows the incorrect total:
      
        $ cat /sys/kernel/debug/dri/0/ttm_page_pool
                  --- 0--- --- 1--- --- 2--- --- 3--- --- 4--- --- 5--- --- 6--- --- 7--- --- 8--- --- 9--- ---10---
        wc      :        0        0        0        0        0        0        0        0        0        0        0
        uc      :        0        0        0        0        0        0        0        0        0        0        0
        wc 32   :        0        0        0        0        0        0        0        0        0        0        0
        uc 32   :        0        0        0        0        0        0        0        0        0        0        0
        DMA uc  :        0        0        0        0        0        0        0        0        0        0        0
        DMA wc  :        0        0        0        0        0        0        0        0        0        0        0
        DMA     :        0        0        0        0        0        0        0        0        0        0        0
      
        total   :     3029 of  8244261
      
      Using ttm_pool_type_take() to remove pages from the pool before freeing
      them correctly accounts for the freed pages.
      
      Fixes: d099fc8f
      
       ("drm/ttm: new TT backend allocation pool v3")
      Signed-off-by: default avatarAnthony DeRossi <ajderossi@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210303011723.22512-1-ajderossi@gmail.com
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      ca63d76f
    • Christian König's avatar
      drm/ttm: soften TTM warnings · d228f8d8
      Christian König authored
      
      
      QXL indeed unrefs pinned BOs and the warnings are spamming peoples log files.
      
      Make sure we warn only once until the QXL driver is fixed.
      
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      References: https://lore.kernel.org/lkml/YD+eYcMMcdlXB8PY@alley/
      Link: https://patchwork.freedesktop.org/patch/422834/
      Reviewed-by: default avatarDaniel Vetter <daniel@ffwll.ch>
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      d228f8d8
    • Thomas Zimmermann's avatar
      drm: Use USB controller's DMA mask when importing dmabufs · 659ab7a4
      Thomas Zimmermann authored
      
      
      USB devices cannot perform DMA and hence have no dma_mask set in their
      device structure. Therefore importing dmabuf into a USB-based driver
      fails, which breaks joining and mirroring of display in X11.
      
      For USB devices, pick the associated USB controller as attachment device.
      This allows the DRM import helpers to perform the DMA setup. If the DMA
      controller does not support DMA transfers, we're out of luck and cannot
      import. Our current USB-based DRM drivers don't use DMA, so the actual
      DMA device is not important.
      
      Tested by joining/mirroring displays of udl and radeon under Gnome/X11.
      
      v8:
      	* release dmadev if device initialization fails (Noralf)
      	* fix commit description (Noralf)
      v7:
      	* fix use-before-init bug in gm12u320 (Dan)
      v6:
      	* implement workaround in DRM drivers and hold reference to
      	  DMA device while USB device is in use
      	* remove dev_is_usb() (Greg)
      	* collapse USB helper into usb_intf_get_dma_device() (Alan)
      	* integrate Daniel's TODO statement (Daniel)
      	* fix typos (Greg)
      v5:
      	* provide a helper for USB interfaces (Alan)
      	* add FIXME item to documentation and TODO list (Daniel)
      v4:
      	* implement workaround with USB helper functions (Greg)
      	* use struct usb_device->bus->sysdev as DMA device (Takashi)
      v3:
      	* drop gem_create_object
      	* use DMA mask of USB controller, if any (Daniel, Christian, Noralf)
      v2:
      	* move fix to importer side (Christian, Daniel)
      	* update SHMEM and CMA helpers for new PRIME callbacks
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Fixes: 6eb0233e
      
       ("usb: don't inherity DMA properties for USB devices")
      Tested-by: default avatarPavel Machek <pavel@ucw.cz>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Acked-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: <stable@vger.kernel.org> # v5.10+
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210303133229.3288-1-tzimmermann@suse.de
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      659ab7a4
    • Pavel Turinský's avatar
      MAINTAINERS: update drm bug reporting URL · 301469c1
      Pavel Turinský authored
      
      
      The original bugzilla seems to be read-only now, linking to the gitlab
      for new bugs.
      
      Signed-off-by: default avatarPavel Turinský <ledoian@kam.mff.cuni.cz>
      Cc: trivial@kernel.org
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210228163658.54962-1-ledoian@kam.mff.cuni.cz
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      301469c1
    • Randy Dunlap's avatar
      fbdev: atyfb: use LCD management functions for PPC_PMAC also · b2664093
      Randy Dunlap authored
      
      
      Include PPC_PMAC in the configs that use aty_ld_lcd() and
      aty_st_lcd() implementations so that the PM code may work
      correctly for PPC_PMAC.
      
      Suggested-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: linux-fbdev@vger.kernel.org
      Cc: dri-devel@lists.freedesktop.org
      Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210226173008.18236-1-rdunlap@infradead.org
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      b2664093
    • Randy Dunlap's avatar
      fbdev: atyfb: always declare aty_{ld,st}_lcd() · 39a3898a
      Randy Dunlap authored
      The previously added stubs for aty_{ld,}st_lcd() make it
      so that these functions are used regardless of the config
      options that were guarding them, so remove the #ifdef/#endif
      lines and make their declarations always visible.
      This fixes build warnings that were reported by clang:
      
         drivers/video/fbdev/aty/atyfb_base.c:180:6: warning: no previous prototype for function 'aty_st_lcd' [-Wmissing-prototypes]
         void aty_st_lcd(int index, u32 val, const struct atyfb_par *par)
              ^
         drivers/video/fbdev/aty/atyfb_base.c:180:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
         void aty_st_lcd(int index, u32 val, const struct atyfb_par *par)
      
         drivers/video/fbdev/aty/atyfb_base.c:183:5: warning: no previous prototype for function 'aty_ld_lcd' [-Wmissing-prototypes]
         u32 aty_ld_lcd(int index, const struct atyfb_par *par)
             ^
         drivers/video/fbdev/aty/atyfb_base.c:183:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
         u32 aty_ld_lcd(int index, const struct atyfb_par *par)
      
      They should not be marked as static since they are used in
      mach64_ct.c.
      
      Fixes: bfa5782b
      
       ("fbdev: atyfb: add stubs for aty_{ld,st}_lcd()")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: linux-fbdev@vger.kernel.org
      Cc: dri-devel@lists.freedesktop.org
      Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210224215528.822-1-rdunlap@infradead.org
      Acked-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      39a3898a
    • Gerd Hoffmann's avatar
      drm/qxl: fix lockdep issue in qxl_alloc_release_reserved · e998d3c8
      Gerd Hoffmann authored
      Call qxl_bo_unpin (which does a reservation) without holding the
      release_mutex lock.  Fixes lockdep (correctly) warning on a possible
      deadlock.
      
      Fixes: e8dd3506
      
       ("drm/qxl: unpin release objects")
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: http://patchwork.freedesktop.org/patch/msgid/20210217123213.2199186-5-kraxel@redhat.com
      (cherry picked from commit 19089b76
      
      )
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      e998d3c8
    • Gerd Hoffmann's avatar
      drm/qxl: unpin release objects · e8dd3506
      Gerd Hoffmann authored
      
      
      Balances the qxl_create_bo(..., pinned=true, ...);
      call in qxl_release_bo_alloc().
      
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: http://patchwork.freedesktop.org/patch/msgid/20210204145712.1531203-5-kraxel@redhat.com
      (cherry picked from commit 65ffea3c
      
      )
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      e8dd3506
    • Tong Zhang's avatar
      drm/fb-helper: only unmap if buffer not null · 874a52f9
      Tong Zhang authored
      
      
      drm_fbdev_cleanup() can be called when fb_helper->buffer is null, hence
      fb_helper->buffer should be checked before calling
      drm_client_buffer_vunmap(). This buffer is also checked in
      drm_client_framebuffer_delete(), so we should also do the same thing for
      drm_client_buffer_vunmap().
      
      [  199.128742] RIP: 0010:drm_client_buffer_vunmap+0xd/0x20
      [  199.129031] Code: 43 18 48 8b 53 20 49 89 45 00 49 89 55 08 5b 44 89 e0 41 5c 41 5d 41 5e 5d
      c3 0f 1f 00 53 48 89 fb 48 8d 7f 10 e8 73 7d a1 ff <48> 8b 7b 10 48 8d 73 18 5b e9 75 53 fc ff 0
      f 1f 44 00 00 48 b8 00
      [  199.130041] RSP: 0018:ffff888103f3fc88 EFLAGS: 00010282
      [  199.130329] RAX: 0000000000000001 RBX: 0000000000000000 RCX: ffffffff8214d46d
      [  199.130733] RDX: 1ffffffff079c6b9 RSI: 0000000000000246 RDI: ffffffff83ce35c8
      [  199.131119] RBP: ffff888103d25458 R08: 0000000000000001 R09: fffffbfff0791761
      [  199.131505] R10: ffffffff83c8bb07 R11: fffffbfff0791760 R12: 0000000000000000
      [  199.131891] R13: ffff888103d25468 R14: ffff888103d25418 R15: ffff888103f18120
      [  199.132277] FS:  00007f36fdcbb6a0(0000) GS:ffff88815b400000(0000) knlGS:0000000000000000
      [  199.132721] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  199.133033] CR2: 0000000000000010 CR3: 0000000103d26000 CR4: 00000000000006f0
      [  199.133420] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  199.133807] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  199.134195] Call Trace:
      [  199.134333]  drm_fbdev_cleanup+0x179/0x1a0
      [  199.134562]  drm_fbdev_client_unregister+0x2b/0x40
      [  199.134828]  drm_client_dev_unregister+0xa8/0x180
      [  199.135088]  drm_dev_unregister+0x61/0x110
      [  199.135315]  mgag200_pci_remove+0x38/0x52 [mgag200]
      [  199.135586]  pci_device_remove+0x62/0xe0
      [  199.135806]  device_release_driver_internal+0x148/0x270
      [  199.136094]  driver_detach+0x76/0xe0
      [  199.136294]  bus_remove_driver+0x7e/0x100
      [  199.136521]  pci_unregister_driver+0x28/0xf0
      [  199.136759]  __x64_sys_delete_module+0x268/0x300
      [  199.137016]  ? __ia32_sys_delete_module+0x300/0x300
      [  199.137285]  ? call_rcu+0x3e4/0x580
      [  199.137481]  ? fpregs_assert_state_consistent+0x4d/0x60
      [  199.137767]  ? exit_to_user_mode_prepare+0x2f/0x130
      [  199.138037]  do_syscall_64+0x33/0x40
      [  199.138237]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [  199.138517] RIP: 0033:0x7f36fdc3dcf7
      
      Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
      Fixes: 763aea17
      
       ("drm/fb-helper: Unmap client buffer during shutdown")
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v5.11+
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210228044625.171151-1-ztong0001@gmail.com
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      874a52f9
  2. Mar 06, 2021
    • Linus Torvalds's avatar
      Linux 5.12-rc2 · a38fd874
      Linus Torvalds authored
      a38fd874
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · f3ed4de6
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "Nothing special here, though Bob's regression fixes for rxe would have
        made it before the rc cycle had there not been such strong winter
        weather!
      
         - Fix corner cases in the rxe reference counting cleanup that are
           causing regressions in blktests for SRP
      
         - Two kdoc fixes so W=1 is clean
      
         - Missing error return in error unwind for mlx5
      
         - Wrong lock type nesting in IB CM"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/rxe: Fix errant WARN_ONCE in rxe_completer()
        RDMA/rxe: Fix extra deref in rxe_rcv_mcast_pkt()
        RDMA/rxe: Fix missed IB reference counting in loopback
        RDMA/uverbs: Fix kernel-doc warning of _uverbs_alloc
        RDMA/mlx5: Set correct kernel-doc identifier
        IB/mlx5: Add missing error code
        RDMA/rxe: Fix missing kconfig dependency on CRYPTO
        RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep
      f3ed4de6
    • Linus Torvalds's avatar
      Merge tag 'gcc-plugins-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · de5bd6c5
      Linus Torvalds authored
      Pull gcc-plugins fixes from Kees Cook:
       "Tiny gcc-plugin fixes for v5.12-rc2. These issues are small but have
        been reported a couple times now by static analyzers, so best to get
        them fixed to reduce the noise. :)
      
         - Fix coding style issues (Jason Yan)"
      
      * tag 'gcc-plugins-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        gcc-plugins: latent_entropy: remove unneeded semicolon
        gcc-plugins: structleak: remove unneeded variable 'ret'
      de5bd6c5
    • Linus Torvalds's avatar
      Merge tag 'pstore-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 8b24ef44
      Linus Torvalds authored
      Pull pstore fixes from Kees Cook:
      
       - Rate-limit ECC warnings (Dmitry Osipenko)
      
       - Fix error path check for NULL (Tetsuo Handa)
      
      * tag 'pstore-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        pstore/ram: Rate-limit "uncorrectable error in header" message
        pstore: Fix warning in pstore_kill_sb()
      8b24ef44
    • Linus Torvalds's avatar
      Merge tag 'for-5.12/dm-fixes' of... · 63dcd69d
      Linus Torvalds authored
      Merge tag 'for-5.12/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
      
      Pull device mapper fixes from Mike Snitzer:
       "Fix DM verity target's optional Forward Error Correction (FEC) for
        Reed-Solomon roots that are unaligned to block size"
      
      * tag 'for-5.12/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm verity: fix FEC for RS roots unaligned to block size
        dm bufio: subtract the number of initial sectors in dm_bufio_get_device_size
      63dcd69d
    • Linus Torvalds's avatar
      Merge tag 'block-5.12-2021-03-05' of git://git.kernel.dk/linux-block · 47454caf
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - NVMe fixes:
            - more device quirks (Julian Einwag, Zoltán Böszörményi, Pascal
              Terjan)
            - fix a hwmon error return (Daniel Wagner)
            - fix the keep alive timeout initialization (Martin George)
            - ensure the model_number can't be changed on a used subsystem
              (Max Gurtovoy)
      
       - rsxx missing -EFAULT on copy_to_user() failure (Dan)
      
       - rsxx remove unused linux.h include (Tian)
      
       - kill unused RQF_SORTED (Jean)
      
       - updated outdated BFQ comments (Joseph)
      
       - revert work-around commit for bd_size_lock, since we removed the
         offending user in this merge window (Damien)
      
      * tag 'block-5.12-2021-03-05' of git://git.kernel.dk/linux-block:
        nvmet: model_number must be immutable once set
        nvme-fabrics: fix kato initialization
        nvme-hwmon: Return error code when registration fails
        nvme-pci: add quirks for Lexar 256GB SSD
        nvme-pci: mark Kingston SKC2000 as not supporting the deepest power state
        nvme-pci: mark Seagate Nytro XM1440 as QUIRK_NO_NS_DESC_LIST.
        rsxx: Return -EFAULT if copy_to_user() fails
        block/bfq: update comments and default value in docs for fifo_expire
        rsxx: remove unused including <linux/version.h>
        block: Drop leftover references to RQF_SORTED
        block: revert "block: fix bd_size_lock use"
      47454caf
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.12-2021-03-05' of git://git.kernel.dk/linux-block · f292e873
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "A bit of a mix between fallout from the worker change, cleanups and
        reductions now possible from that change, and fixes in general. In
        detail:
      
         - Fully serialize manager and worker creation, fixing races due to
           that.
      
         - Clean up some naming that had gone stale.
      
         - SQPOLL fixes.
      
         - Fix race condition around task_work rework that went into this
           merge window.
      
         - Implement unshare. Used for when the original task does unshare(2)
           or setuid/seteuid and friends, drops the original workers and forks
           new ones.
      
         - Drop the only remaining piece of state shuffling we had left, which
           was cred. Move it into issue instead, and we can drop all of that
           code too.
      
         - Kill f_op->flush() usage. That was such a nasty hack that we had
           out of necessity, we no longer need it.
      
         - Following from ->flush() removal, we can also drop various bits of
           ctx state related to SQPOLL and cancelations.
      
         - Fix an issue with IOPOLL retry, which originally was fallout from a
           filemap change (removing iov_iter_revert()), but uncovered an issue
           with iovec re-import too late.
      
         - Fix an issue with system suspend.
      
         - Use xchg() for fallback work, instead of cmpxchg().
      
         - Properly destroy io-wq on exec.
      
         - Add create_io_thread() core helper, and use that in io-wq and
           io_uring. This allows us to remove various silly completion events
           related to thread setup.
      
         - A few error handling fixes.
      
        This should be the grunt of fixes necessary for the new workers, next
        week should be quieter. We've got a pending series from Pavel on
        cancelations, and how tasks and rings are indexed. Outside of that,
        should just be minor fixes. Even with these fixes, we're still killing
        a net ~80 lines"
      
      * tag 'io_uring-5.12-2021-03-05' of git://git.kernel.dk/linux-block: (41 commits)
        io_uring: don't restrict issue_flags for io_openat
        io_uring: make SQPOLL thread parking saner
        io-wq: kill hashed waitqueue before manager exits
        io_uring: clear IOCB_WAITQ for non -EIOCBQUEUED return
        io_uring: don't keep looping for more events if we can't flush overflow
        io_uring: move to using create_io_thread()
        kernel: provide create_io_thread() helper
        io_uring: reliably cancel linked timeouts
        io_uring: cancel-match based on flags
        io-wq: ensure all pending work is canceled on exit
        io_uring: ensure that threads freeze on suspend
        io_uring: remove extra in_idle wake up
        io_uring: inline __io_queue_async_work()
        io_uring: inline io_req_clean_work()
        io_uring: choose right tctx->io_wq for try cancel
        io_uring: fix -EAGAIN retry with IOPOLL
        io-wq: fix error path leak of buffered write hash map
        io_uring: remove sqo_task
        io_uring: kill sqo_dead and sqo submission halting
        io_uring: ignore double poll add on the same waitqueue head
        ...
      f292e873
    • Linus Torvalds's avatar
      Merge tag 'pm-5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 6d47254c
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "These fix the usage of device links in the runtime PM core code and
        update the DTPM (Dynamic Thermal Power Management) feature added
        recently.
      
        Specifics:
      
         - Make the runtime PM core code avoid attempting to suspend supplier
           devices before updating the PM-runtime status of a consumer to
           'suspended' (Rafael Wysocki).
      
         - Fix DTPM (Dynamic Thermal Power Management) root node
           initialization and label that feature as EXPERIMENTAL in Kconfig
           (Daniel Lezcano)"
      
      * tag 'pm-5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        powercap/drivers/dtpm: Add the experimental label to the option description
        powercap/drivers/dtpm: Fix root node initialization
        PM: runtime: Update device status before letting suppliers suspend
      6d47254c
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · ea6be461
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "Make the empty stubs of some helper functions used when CONFIG_ACPI is
        not set actually match those functions (Andy Shevchenko)"
      
      * tag 'acpi-5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: bus: Constify is_acpi_node() and friends (part 2)
      ea6be461
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · fc2c8d0a
      Linus Torvalds authored
      Pull iommu fixes from Joerg Roedel:
      
       - Fix a sleeping-while-atomic issue in the AMD IOMMU code
      
       - Disable lazy IOTLB flush for untrusted devices in the Intel VT-d
         driver
      
       - Fix status code definitions for Intel VT-d
      
       - Fix IO Page Fault issue in Tegra IOMMU driver
      
      * tag 'iommu-fixes-v5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/vt-d: Fix status code for Allocate/Free PASID command
        iommu: Don't use lazy flush for untrusted device
        iommu/tegra-smmu: Fix mc errors on tegra124-nyan
        iommu/amd: Fix sleeping in atomic in increase_address_space()
      fc2c8d0a
    • Linus Torvalds's avatar
      Merge tag 'for-5.12-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · f09b04cc
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "More regression fixes and stabilization.
      
        Regressions:
      
         - zoned mode
            - count zone sizes in wider int types
            - fix space accounting for read-only block groups
      
         - subpage: fix page tail zeroing
      
        Fixes:
      
         - fix spurious warning when remounting with free space tree
      
         - fix warning when creating a directory with smack enabled
      
         - ioctl checks for qgroup inheritance when creating a snapshot
      
         - qgroup
            - fix missing unlock on error path in zero range
            - fix amount of released reservation on error
            - fix flushing from unsafe context with open transaction,
              potentially deadlocking
      
         - minor build warning fixes"
      
      * tag 'for-5.12-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: zoned: do not account freed region of read-only block group as zone_unusable
        btrfs: zoned: use sector_t for zone sectors
        btrfs: subpage: fix the false data csum mismatch error
        btrfs: fix warning when creating a directory with smack enabled
        btrfs: don't flush from btrfs_delayed_inode_reserve_metadata
        btrfs: export and rename qgroup_reserve_meta
        btrfs: free correct amount of space in btrfs_delayed_inode_reserve_metadata
        btrfs: fix spurious free_space_tree remount warning
        btrfs: validate qgroup inherit for SNAP_CREATE_V2 ioctl
        btrfs: unlock extents in btrfs_zero_range in case of quota reservation errors
        btrfs: ref-verify: use 'inline void' keyword ordering
      f09b04cc
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-5.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 6bf331d5
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
      
       - Another batch of graph and video-interfaces schema conversions
      
       - Drop DT header symlink for dropped C6X arch
      
       - Fix bcm2711-hdmi schema error
      
      * tag 'devicetree-fixes-for-5.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: media: Use graph and video-interfaces schemas, round 2
        dts: drop dangling c6x symlink
        dt-bindings: bcm2711-hdmi: Fix broken schema
      6bf331d5
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 54663cf3
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
       "Functional fixes:
      
         - Fix big endian conversion for arm64 in recordmcount processing
      
         - Fix timestamp corruption in ring buffer on discarding events
      
         - Fix memory leak in __create_synth_event()
      
         - Skip selftests if tracing is disabled as it will cause them to
           fail.
      
        Non-functional fixes:
      
         - Fix help text in Kconfig
      
         - Remove duplicate prototype for trace_empty()
      
         - Fix stale comment about the trace_event_call flags.
      
        Self test update:
      
         - Add more information to the validation output of when a corrupt
           timestamp is found in the ring buffer, and also trigger a warning
           to make sure that tests catch it"
      
      * tag 'trace-v5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing: Fix comment about the trace_event_call flags
        tracing: Skip selftests if tracing is disabled
        tracing: Fix memory leak in __create_synth_event()
        ring-buffer: Add a little more information and a WARN when time stamp going backwards is detected
        ring-buffer: Force before_stamp and write_stamp to be different on discard
        tracing: Fix help text of TRACEPOINT_BENCHMARK in Kconfig
        tracing: Remove duplicate declaration from trace.h
        ftrace: Have recordmcount use w8 to read relp->r_info in arm64_is_fake_mcount
      54663cf3
    • Bob Pearson's avatar
      RDMA/rxe: Fix errant WARN_ONCE in rxe_completer() · 545c4ab4
      Bob Pearson authored
      In rxe_comp.c in rxe_completer() the function free_pkt() did not clear skb
      which triggered a warning at 'done:' and could possibly at 'exit:'. The
      WARN_ONCE() calls are not actually needed.  The call to free_pkt() is
      moved to the end to clearly show that all skbs are freed.
      
      Fixes: 899aba89
      
       ("RDMA/rxe: Fix FIXME in rxe_udp_encap_recv()")
      Link: https://lore.kernel.org/r/20210304192048.2958-1-rpearson@hpe.com
      Signed-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      545c4ab4
    • Bob Pearson's avatar
      RDMA/rxe: Fix extra deref in rxe_rcv_mcast_pkt() · 5e4a7ccc
      Bob Pearson authored
      rxe_rcv_mcast_pkt() dropped a reference to ib_device when no error
      occurred causing an underflow on the reference counter.  This code is
      cleaned up to be clearer and easier to read.
      
      Fixes: 899aba89
      
       ("RDMA/rxe: Fix FIXME in rxe_udp_encap_recv()")
      Link: https://lore.kernel.org/r/20210304192048.2958-1-rpearson@hpe.com
      Signed-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      5e4a7ccc
    • Bob Pearson's avatar
      RDMA/rxe: Fix missed IB reference counting in loopback · 21e27ac8
      Bob Pearson authored
      When the noted patch below extending the reference taken by
      rxe_get_dev_from_net() in rxe_udp_encap_recv() until each skb is freed it
      was not matched by a reference in the loopback path resulting in
      underflows.
      
      Fixes: 899aba89
      
       ("RDMA/rxe: Fix FIXME in rxe_udp_encap_recv()")
      Link: https://lore.kernel.org/r/20210304192048.2958-1-rpearson@hpe.com
      Signed-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      21e27ac8
    • Pavel Begunkov's avatar
      io_uring: don't restrict issue_flags for io_openat · e45cff58
      Pavel Begunkov authored
      45d189c6
      
       ("io_uring: replace force_nonblock with flags") did
      something strange for io_openat() slicing all issue_flags but
      IO_URING_F_NONBLOCK. Not a bug for now, but better to just forward the
      flags.
      
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      e45cff58
    • Jens Axboe's avatar
      Merge tag 'nvme-5.12-2021-03-05' of git://git.infradead.org/nvme into block-5.12 · a2b658e4
      Jens Axboe authored
      Pull NVMe fixes from Christoph:
      
      "nvme fixes for 5.12:
      
       - more device quirks (Julian Einwag, Zoltán Böszörményi, Pascal Terjan)
       - fix a hwmon error return (Daniel Wagner)
       - fix the keep alive timeout initialization (Martin George)
       - ensure the model_number can't be changed on a used subsystem
         (Max Gurtovoy)"
      
      * tag 'nvme-5.12-2021-03-05' of git://git.infradead.org/nvme:
        nvmet: model_number must be immutable once set
        nvme-fabrics: fix kato initialization
        nvme-hwmon: Return error code when registration fails
        nvme-pci: add quirks for Lexar 256GB SSD
        nvme-pci: mark Kingston SKC2000 as not supporting the deepest power state
        nvme-pci: mark Seagate Nytro XM1440 as QUIRK_NO_NS_DESC_LIST.
      a2b658e4
  3. Mar 05, 2021
    • Jens Axboe's avatar
      io_uring: make SQPOLL thread parking saner · 86e0d676
      Jens Axboe authored
      
      
      We have this weird true/false return from parking, and then some of the
      callers decide to look at that. It can lead to unbalanced parks and
      sqd locking. Have the callers check the thread status once it's parked.
      We know we have the lock at that point, so it's either valid or it's NULL.
      
      Fix race with parking on thread exit. We need to be careful here with
      ordering of the sdq->lock and the IO_SQ_THREAD_SHOULD_PARK bit.
      
      Rename sqd->completion to sqd->parked to reflect that this is the only
      thing this completion event doesn.
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      86e0d676
    • Jens Axboe's avatar
      io-wq: kill hashed waitqueue before manager exits · 09ca6c40
      Jens Axboe authored
      If we race with shutting down the io-wq context and someone queueing
      a hashed entry, then we can exit the manager with it armed. If it then
      triggers after the manager has exited, we can have a use-after-free where
      io_wqe_hash_wake() attempts to wake a now gone manager process.
      
      Move the killing of the hashed write queue into the manager itself, so
      that we know we've killed it before the task exits.
      
      Fixes: e941894e
      
       ("io-wq: make buffered file write hashed work map per-ctx")
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      09ca6c40
    • Jens Axboe's avatar
      io_uring: clear IOCB_WAITQ for non -EIOCBQUEUED return · b5b0ecb7
      Jens Axboe authored
      
      
      The callback can only be armed, if we get -EIOCBQUEUED returned. It's
      important that we clear the WAITQ bit for other cases, otherwise we can
      queue for async retry and filemap will assume that we're armed and
      return -EAGAIN instead of just blocking for the IO.
      
      Cc: stable@vger.kernel.org # 5.9+
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      b5b0ecb7
    • Jens Axboe's avatar
      io_uring: don't keep looping for more events if we can't flush overflow · ca0a2651
      Jens Axboe authored
      
      
      It doesn't make sense to wait for more events to come in, if we can't
      even flush the overflow we already have to the ring. Return -EBUSY for
      that condition, just like we do for attempts to submit with overflow
      pending.
      
      Cc: stable@vger.kernel.org # 5.11
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      ca0a2651
    • Jens Axboe's avatar
      io_uring: move to using create_io_thread() · 46fe18b1
      Jens Axboe authored
      
      
      This allows us to do task creation and setup without needing to use
      completions to try and synchronize with the starting thread. Get rid of
      the old io_wq_fork_thread() wrapper, and the 'wq' and 'worker' startup
      completion events - we can now do setup before the task is running.
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      46fe18b1
    • Rafael J. Wysocki's avatar
      Merge branch 'powercap' · 7bff4c26
      Rafael J. Wysocki authored
      * powercap:
        powercap/drivers/dtpm: Add the experimental label to the option description
        powercap/drivers/dtpm: Fix root node initialization
      7bff4c26
    • Max Gurtovoy's avatar
      nvmet: model_number must be immutable once set · d9f273b7
      Max Gurtovoy authored
      
      
      In case we have already established connection to nvmf target, it
      shouldn't be allowed to change the model_number. E.g. if someone will
      identify ctrl and get model_number of "my_model" later on will change
      the model_numbel via configfs to "my_new_model" this will break the NVMe
      specification for "Get Log Page – Persistent Event Log" that refers to
      Model Number as: "This field contains the same value as reported in the
      Model Number field of the Identify Controller data structure, bytes
      63:24."
      
      Although it doesn't mentioned explicitly that this field can't be
      changed, we can assume it.
      
      So allow setting this field only once: using configfs or in the first
      identify ctrl operation.
      
      Signed-off-by: default avatarMax Gurtovoy <mgurtovoy@nvidia.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      d9f273b7
    • Martin George's avatar
      nvme-fabrics: fix kato initialization · 32feb6de
      Martin George authored
      
      
      Currently kato is initialized to NVME_DEFAULT_KATO for both
      discovery & i/o controllers. This is a problem specifically
      for non-persistent discovery controllers since it always ends
      up with a non-zero kato value. Fix this by initializing kato
      to zero instead, and ensuring various controllers are assigned
      appropriate kato values as follows:
      
      non-persistent controllers  - kato set to zero
      persistent controllers      - kato set to NVMF_DEV_DISC_TMO
                                    (or any positive int via nvme-cli)
      i/o controllers             - kato set to NVME_DEFAULT_KATO
                                    (or any positive int via nvme-cli)
      
      Signed-off-by: default avatarMartin George <marting@netapp.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      32feb6de