1. 25 Oct, 2022 3 commits
    • Luben Tuikov's avatar
      drm/scheduler: Set the FIFO scheduling policy as the default · 977d97f1
      Luben Tuikov authored
      The currently default Round-Robin GPU scheduling can result in starvation
      of entities which have a large number of jobs, over entities which have
      a very small number of jobs (single digit).
      
      This can be illustrated in the following diagram, where jobs are
      alphabetized to show their chronological order of arrival, where job A is
      the oldest, B is the second oldest, and so on, to J, the most recent job to
      arrive.
      
          ---> entities
      j | H-F-----A--E--I--
      o | --G-----B-----J--
      b | --------C--------
      s\/ --------D--------
      
      WLOG, assuming all jobs are "ready", then a R-R scheduling will execute them
      in the following order (a slice off of the top of the entities' list),
      
      H, F, A, E, I, G, B, J, C, D.
      
      However, to mitigate job starvation, we'd rather execute C and D before E,
      and so on, given, of course, that they're all ready to be executed.
      
      So, if all jobs are ready at this instant, the order of execution for this
      and the next 9 instances of picking the next job to execute, should really
      be,
      
      A, B, C, D, E, F, G, H, I, J,
      
      which is their chronological order. The only reason for this order to be
      broken, is if an older job is not yet ready, but a younger job is ready, at
      an instant of picking a new job to execute. For instance if job C wasn't
      ready at time 2, but job D was ready, then we'd pick job D, like this:
      
      0 +1 +2  ...
      A, B, D, ...
      
      And from then on, C would be preferred before all other jobs, if it is ready
      at the time when a new job for execution is picked. So, if C became ready
      two steps later, the execution order would look like this:
      
      ......0 +1 +2  ...
      A, B, D, E, C, F, G, H, I, J
      
      This is what the FIFO GPU scheduling algorithm achieves. It uses a
      Red-Black tree to keep jobs sorted in chronological order, where picking
      the oldest job is O(1) (we use the "cached" structure), and balancing the
      tree is O(log n). IOW, it picks the *oldest ready* job to execute now.
      
      The implementation is already in the kernel, and this commit only changes
      the default GPU scheduling algorithm to use.
      
      This was tested and achieves about 1% faster performance over the Round
      Robin algorithm.
      
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Alex Deucher <Alexander.Deucher@amd.com>
      Cc: Direct Rendering Infrastructure - Development <dri-devel@lists.freedesktop.org>
      Signed-off-by: default avatarLuben Tuikov <luben.tuikov@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221024212634.27230-1-luben.tuikov@amd.comSigned-off-by: default avatarChristian König <christian.koenig@amd.com>
      977d97f1
    • Simon Ser's avatar
      drm/connector: send hotplug uevent on connector cleanup · 6fdc2d49
      Simon Ser authored
      A typical DP-MST unplug removes a KMS connector. However care must
      be taken to properly synchronize with user-space. The expected
      sequence of events is the following:
      
      1. The kernel notices that the DP-MST port is gone.
      2. The kernel marks the connector as disconnected, then sends a
         uevent to make user-space re-scan the connector list.
      3. User-space notices the connector goes from connected to disconnected,
         disables it.
      4. Kernel handles the IOCTL disabling the connector. On success,
         the very last reference to the struct drm_connector is dropped and
         drm_connector_cleanup() is called.
      5. The connector is removed from the list, and a uevent is sent to tell
         user-space that the connector disappeared.
      
      The very last step was missing. As a result, user-space thought the
      connector still existed and could try to disable it again. Since the
      kernel no longer knows about the connector, that would end up with
      EINVAL and confused user-space.
      
      Fix this by sending a hotplug uevent from drm_connector_cleanup().
      Signed-off-by: default avatarSimon Ser <contact@emersion.fr>
      Cc: stable@vger.kernel.org
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: Jonas Ådahl <jadahl@redhat.com>
      Tested-by: default avatarJonas Ådahl <jadahl@redhat.com>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221017153150.60675-2-contact@emersion.fr
      6fdc2d49
    • Simon Ser's avatar
      Revert "drm: hide unregistered connectors from GETCONNECTOR IOCTL" · 754c2a52
      Simon Ser authored
      This reverts commit 981f0929.
      
      It turns out this causes logically active but disconnected DP MST
      connectors to disappear from the KMS resources list, and Mutter
      then assumes the connector is already disabled. Later on Mutter tries
      to re-use the same CRTC but fails since on the kernel side it's still
      tied to the disconnected DP MST connector.
      Signed-off-by: default avatarSimon Ser <contact@emersion.fr>
      Tested-by: default avatarJonas Ådahl <jadahl@redhat.com>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221017153150.60675-1-contact@emersion.fr
      754c2a52
  2. 24 Oct, 2022 7 commits
  3. 21 Oct, 2022 5 commits
  4. 20 Oct, 2022 3 commits
  5. 18 Oct, 2022 2 commits
  6. 17 Oct, 2022 20 commits