Skip to content
Snippets Groups Projects
  1. Jul 12, 2022
    • Rob Clark's avatar
      drm/msm/mdp5: Fix global state lock backoff · f0d9e490
      Rob Clark authored and Tomeu Vizoso's avatar Tomeu Vizoso committed
      
      We need to grab the lock after the early return for !hwpipe case.
      Otherwise, we could have hit contention yet still returned 0.
      
      Fixes an issue that the new CONFIG_DRM_DEBUG_MODESET_LOCK stuff flagged
      in CI:
      
         WARNING: CPU: 0 PID: 282 at drivers/gpu/drm/drm_modeset_lock.c:296 drm_modeset_lock+0xf8/0x154
         Modules linked in:
         CPU: 0 PID: 282 Comm: kms_cursor_lega Tainted: G        W         5.19.0-rc2-15930-g875cc8bc536a #1
         Hardware name: Qualcomm Technologies, Inc. DB820c (DT)
         pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
         pc : drm_modeset_lock+0xf8/0x154
         lr : drm_atomic_get_private_obj_state+0x84/0x170
         sp : ffff80000cfab6a0
         x29: ffff80000cfab6a0 x28: 0000000000000000 x27: ffff000083bc4d00
         x26: 0000000000000038 x25: 0000000000000000 x24: ffff80000957ca58
         x23: 0000000000000000 x22: ffff000081ace080 x21: 0000000000000001
         x20: ffff000081acec18 x19: ffff80000cfabb80 x18: 0000000000000038
         x17: 0000000000000000 x16: 0000000000000000 x15: fffffffffffea0d0
         x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 5f534b434f4c5f47
         x11: ffff80000a386aa8 x10: 0000000000000029 x9 : ffff80000cfab610
         x8 : 0000000000000029 x7 : 0000000000000014 x6 : 0000000000000000
         x5 : 0000000000000001 x4 : ffff8000081ad904 x3 : 0000000000000029
         x2 : ffff0000801db4c0 x1 : ffff80000cfabb80 x0 : ffff000081aceb58
         Call trace:
          drm_modeset_lock+0xf8/0x154
          drm_atomic_get_private_obj_state+0x84/0x170
          mdp5_get_global_state+0x54/0x6c
          mdp5_pipe_release+0x2c/0xd4
          mdp5_plane_atomic_check+0x2ec/0x414
          drm_atomic_helper_check_planes+0xd8/0x210
          drm_atomic_helper_check+0x54/0xb0
          ...
         ---[ end trace 0000000000000000 ]---
         drm_modeset_lock attempting to lock a contended lock without backoff:
            drm_modeset_lock+0x148/0x154
            mdp5_get_global_state+0x30/0x6c
            mdp5_pipe_release+0x2c/0xd4
            mdp5_plane_atomic_check+0x290/0x414
            drm_atomic_helper_check_planes+0xd8/0x210
            drm_atomic_helper_check+0x54/0xb0
            drm_atomic_check_only+0x4b0/0x8f4
            drm_atomic_commit+0x68/0xe0
      
      Fixes: d59be579 ("drm/msm/mdp5: Return error code in mdp5_pipe_release when deadlock is detected")
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
      Patchwork: https://patchwork.freedesktop.org/patch/492701/
      Link: https://lore.kernel.org/r/20220707162040.1594855-1-robdclark@gmail.com
      f0d9e490
  2. Jul 04, 2022
  3. Jun 30, 2022
    • Dave Airlie's avatar
      Merge tag 'drm-misc-next-2022-06-30' of git://anongit.freedesktop.org/drm/drm-misc into drm-next · f9292174
      Dave Airlie authored
      
      drm-misc-next for v5.20:
      
      UAPI Changes:
      
       * fourcc: Update documentation
      
      Cross-subsystem Changes:
      
       * iosys-map: Rework iosys_map_{rd,wr} for improved performance
      
       * vfio: Use aperture helpers
      
      Core Changes:
      
       * aperture: Export for use with other subsystems
      
       * connector: Remove deprecated ida_simple_get()
      
       * crtc: Add helper with general state checks, convert drivers
      
       * format-helper: Add Kunit tests for RGB32 to RGB8
      
      Driver Changes:
      
       * ast: Fix black screen on resume
      
       * bridge: tc358767: Simplify DSI lane handling
      
       * mcde: Fix ref-count leak
      
       * mxsfb/lcdif: Support i.MX8MP LCD controller
      
       * stm/ltdc: Support dynamic Z order; Support mirroring; Fixes and cleanups
      
       * vc4: Many small fixes throughout the driver
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      # -----BEGIN PGP SIGNATURE-----
      #
      # iQEzBAABCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAmK9TnYACgkQaA3BHVML
      # eiMJcgf+JsGWlFutkxlJCEUDKTXk6BYHQL4czyskDvpBoLrdU1tyrAfKKtqP5k+0
      # SMvS6h1CFa/fSUCYpbdpJ6ER1fZ9r19WdgoPTBc4b97/uQTOJDzd5zuHDiJZquwC
      # O6HD/rptUzPFe6HJuY2cYVtwMlWb2NhITMHfctgyeQJSMK8TwoU1bDVFftwxaWFt
      # ISscTz0enn38sCjEarSpyKkBCinuaWDcpe5BI2Dp3imkDWR3ktzuh4B11QWS0DKs
      # Q/FLGTEl1sDrV7r93WiA5BIAPVwNMm1Pl0syd1p42SNLNnv0gcap4GL6qni4h9Ev
      # P/3fIInor/Sht8fyhlFsOUA8k2x7MA==
      # =6NoJ
      # -----END PGP SIGNATURE-----
      # gpg: Signature made Thu 30 Jun 2022 17:19:18 AEST
      # gpg:                using RSA key 7217FBAC8CE9CF6344A168E5680DC11D530B7A23
      # gpg: Can't check signature: No public key
      From: Thomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/Yr1On+eT1mCvIMzW@linux-uq9g
      f9292174
    • Lucas De Marchi's avatar
      iosys-map: Add per-word write · 6fb5ee7c
      Lucas De Marchi authored
      
      Like was done for read, provide the equivalent for write. Even if
      current users are not in the hot path, this should future-proof it.
      
      v2:
        - Remove default from _Generic() - callers wanting to write more
          than u64 should use iosys_map_memcpy_to()
        - Add WRITE_ONCE() cases dereferencing the pointer when using system
          memory
      v3:
        - Fix precedence issue when casting inside WRITE_ONCE(). By not using ()
          around vaddr__ the offset was not part of the cast, but rather added
          to it, producing a wrong address
        - Remove compiletime_assert() as WRITE_ONCE() already contains it
      
      Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
      Reviewed-by: Reviewed-by: Christian König <christian.koenig@amd.com> # v1
      Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220628191016.3899428-2-lucas.demarchi@intel.com
      6fb5ee7c
    • Lucas De Marchi's avatar
      iosys-map: Add per-word read · 5f278dbd
      Lucas De Marchi authored
      
      Instead of always falling back to memcpy_fromio() for any size, prefer
      using read{b,w,l}(). When reading struct members it's common to read
      individual integer variables individually. Going through memcpy_fromio()
      for each of them poses a high penalty.
      
      Employ a similar trick as __seqprop() by using _Generic() to generate
      only the specific call based on a type-compatible variable.
      
      For a pariticular i915 workload producing GPU context switches,
      __get_engine_usage_record() is particularly hot since the engine usage
      is read from device local memory with dgfx, possibly multiple times
      since it's racy. Test execution time for this test shows a ~12.5%
      improvement with DG2:
      
      Before:
      	nrepeats = 1000; min = 7.63243e+06; max = 1.01817e+07;
      	median = 9.52548e+06; var = 526149;
      After:
      	nrepeats = 1000; min = 7.03402e+06; max = 8.8832e+06;
      	median = 8.33955e+06; var = 333113;
      
      Other things attempted that didn't prove very useful:
      1) Change the _Generic() on x86 to just dereference the memory address
      2) Change __get_engine_usage_record() to do just 1 read per loop,
         comparing with the previous value read
      3) Change __get_engine_usage_record() to access the fields directly as it
         was before the conversion to iosys-map
      
      (3) did gave a small improvement (~3%), but doesn't seem to scale well
      to other similar cases in the driver.
      
      Additional test by Chris Wilson using gem_create from igt with some
      changes to track object creation time. This happens to accidentally
      stress this code path:
      
      	Pre iosys_map conversion of engine busyness:
      	lmem0: Creating    262144 4KiB objects took 59274.2ms
      
      	Unpatched:
      	lmem0: Creating    262144 4KiB objects took 108830.2ms
      
      	With readl (this patch):
      	lmem0: Creating    262144 4KiB objects took 61348.6ms
      
      	s/readl/READ_ONCE/
      	lmem0: Creating    262144 4KiB objects took 61333.2ms
      
      So we do take a little bit more time than before the conversion, but
      that is due to other factors: bringing the READ_ONCE back would be as
      good as just doing this conversion.
      
      v2:
        - Remove default from _Generic() - callers wanting to read more
          than u64 should use iosys_map_memcpy_from()
        - Add READ_ONCE() cases dereferencing the pointer when using system
          memory
      v3:
        - Fix precedence issue when casting inside READ_ONCE(). By not using ()
          around vaddr__ the offset was not part of the cast, but rather added
          to it, producing a wrong address
        - Remove compiletime_assert() as READ_ONCE() already contains it
      
      Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
      Reviewed-by: Christian König <christian.koenig@amd.com> # v1
      Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220628191016.3899428-1-lucas.demarchi@intel.com
      5f278dbd
  4. Jun 28, 2022
Loading