• Wayne Lin's avatar
    drm/amd/display: Fork thread to offload work of hpd_rx_irq · 8e794421
    Wayne Lin authored
    [Why]
    Currently, we will try to get dm.dc_lock in handle_hpd_rx_irq() when
    link lost happened, which is risky and could cause deadlock.
    e.g. If we are under procedure to enable MST streams and then monitor
    happens to toggle short hpd to notify link lost, then
    handle_hpd_rx_irq() will get blocked due to stream enabling flow has
    dc_lock. However, under MST, enabling streams involves communication
    with remote sinks which need to use handle_hpd_rx_irq() to handle
    sideband messages. Thus, we have deadlock here.
    
    [How]
    Target is to have handle_hpd_rx_irq() finished as soon as possilble.
    Hence we can react to interrupt quickly. Besides, we should avoid to
    grabe dm.dc_lock within handle_hpd_rx_irq() to avoid deadlock situation.
    
    Firstly, revert patches which introduced to use dm.dc_lock in
    handle_hpd_rx_irq():
    
    * commit ("drm/amd/display: NULL pointer error during ")
    
    * commit ("drm/amd/display: Only one display lights up while using MST")
    
    * commit ("drm/amd/display: take dc_lock in short pulse handler only")
    
    Instead, create work to handle irq events which needs dm.dc_lock.
    Besides:
    
    * Create struct hpd_rx_irq_offload_work_queue for each link to handle
      its short hpd events
    
    * Avoid to handle link lost/ automated test if the link is disconnected
    
    * Defer dc_lock needed works in dc_link_handle_hpd_rx_irq(). This
      function should just handle simple stuff for us (e.g. DPCD R/W).
      However, deferred works should still be handled by the order that
      dc_link_handle_hpd_rx_irq() used to be.
    
    * Change function name dm_handle_hpd_rx_irq() to
      dm_handle_mst_sideband_msg() to be more specific
    Reviewed-by: default avatarNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
    Acked-by: default avatarMikita Lipski <mikita.lipski@amd.com>
    Signed-off-by: default avatarWayne Lin <Wayne.Lin@amd.com>
    Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    8e794421
amdgpu_dm.h 18.1 KB