drm/atomic-helpers: Clear up cleanup_done a bit
Subsystems (4)
PATCH 1/1 drm/atomic-helpers: Clear up cleanup_done a bit
It's not obvious at first sight that this is a fastpath, make that clearer with a goto. Fallout from a discussion with Liviu on irc.
--- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 4 ++-- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 --- drivers/gpu/drm/drm_atomic_helper.c | 8 +++----- include/drm/drm_crtc.h | 23 ++++------------------ 4 files changed, 9 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +2 -2
@@ -187,12 +187,12 @@ int init_pipelines(struct device_queue_manager *dqm,unsigned int get_first_pipe (struct device_queue_manager *dqm);unsigned int get_pipes_num (struct device_queue_manager *dqm); -extern inline unsigned int get_sh_mem_bases_32 (struct kfd_process_device *pdd) +static inline unsigned int get_sh_mem_bases_32 (struct kfd_process_device *pdd) {return (pdd->lds_base >>16 ) &0xFF ; } -extern inline unsigned int +static inline unsigned int get_sh_mem_bases_nybble_64 (struct kfd_process_device *pdd) {return (pdd->lds_base >>60 ) &0x0E ;
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0 -3
@@ -617,10 +617,7 @@ int kgd2kfd_resume(struct kfd_dev *kfd);int kfd_init_apertures (struct kfd_process *process);/* Queue Context Management */ -inline uint32_t lower_32 (uint64_t x); -inline uint32_t upper_32 (uint64_t x);struct cik_sdma_rlc_registers *get_sdma_mqd (void *mqd); -inline uint32_t get_sdma_base_addr (struct cik_sdma_rlc_registers *m);int init_queue (struct queue **q,struct queue_properties properties);void uninit_queue (struct queue *q);
drivers/gpu/drm/drm_atomic_helper.c +3 -5
@@ -1579,11 +1579,8 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state)/* commit_list borrows our reference, need to remove before we * clean up our drm_atomic_state. But only after it actually * completed, otherwise subsequent commits won't stall properly. */ -if (try_wait_for_completion (&commit->flip_done)) { -list_del (&commit->commit_entry); -spin_unlock (&crtc->commit_lock); -continue ; - } +if (try_wait_for_completion (&commit->flip_done)) + goto del_commit: spin_unlock(&crtc->commit_lock);
@@ -1597,6 +1594,7 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state) crtc->base.id, crtc->name);spin_lock (&crtc->commit_lock); +del_commit:list_del (&commit->commit_entry);spin_unlock (&crtc->commit_lock); }
include/drm/drm_crtc.h +4 -19
@@ -2820,29 +2820,14 @@ static inline void drm_connector_unreference(struct drm_connector *connector)#define drm_for_each_crtc (crtc, dev) \ list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head) -static inline void -assert_drm_connector_list_read_locked (struct drm_mode_config *mode_config) -{ -/* -* The connector hotadd/remove code currently grabs both locks when -* updating lists. Hence readers need only hold either of them to be -* safe and the check amounts to -* -* WARN_ON(not_holding(A) && not_holding(B)). -*/ -WARN_ON (!mutex_is_locked (&mode_config->mutex) && - !drm_modeset_is_locked (&mode_config->connection_mutex)); -} -#define drm_for_each_connector (connector, dev) \/* loop to wrap everything into a srcu read-side critical section */ \ - for (bool __conn_loop_srcu = true, \ - int __conn_loop_srcu_ret = srcu_read_lock(&drm_connector_list_srcu);\ - __conn_loop_srcu; __conn_loop_srcu = false, \ + for (int __conn_loop_srcu = 1, \ + __conn_loop_srcu_ret = srcu_read_lock(&drm_connector_list_srcu);\ + __conn_loop_srcu; __conn_loop_srcu = 0, \ srcu_read_unlock(&drm_connector_list_srcu, __conn_loop_srcu_ret)) \/* loop to iterate over the connector_list, rcu-protected */ \ - for (assert_drm_connector_list_read_locked(&(dev)->mode_config), \ - connector = list_entry_rcu((dev)->mode_config.connector_list.next, \ + for (connector = list_entry_rcu((dev)->mode_config.connector_list.next, \ struct drm_connector, head); \ &connector->head != (&(dev)->mode_config.connector_list); \ connector = list_entry_rcu(connector->head.next, \
Signature · 6 lines
2.8.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 5 lines · Daniel Vetter
It's not obvious at first sight that this is a fastpath, make that clearer with a goto. Fallout from a discussion with Liviu on irc.
Acked-by [email protected]
Nope, I did not agree to *all* those changes, only the drm_atomic_helper.c one :)
Best regards,
Liviu
Quoted 109 lines
Signed-off-by Daniel Vetter <[email protected]>--- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 4 ++-- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 --- drivers/gpu/drm/drm_atomic_helper.c | 8 +++----- include/drm/drm_crtc.h | 23 ++++------------------ 4 files changed, 9 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +2
-2@@ -187,12 +187,12 @@ int init_pipelines(struct device_queue_manager *dqm,unsigned int get_first_pipe (struct device_queue_manager *dqm);unsigned int get_pipes_num (struct device_queue_manager *dqm); -extern inline unsigned int get_sh_mem_bases_32 (struct kfd_process_device *pdd) +static inline unsigned int get_sh_mem_bases_32 (struct kfd_process_device *pdd) {return (pdd->lds_base >>16 ) &0xFF ; } -extern inline unsigned int +static inline unsigned int get_sh_mem_bases_nybble_64 (struct kfd_process_device *pdd) {return (pdd->lds_base >>60 ) &0x0E ;drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0
-3@@ -617,10 +617,7 @@ int kgd2kfd_resume(struct kfd_dev *kfd);int kfd_init_apertures (struct kfd_process *process);/* Queue Context Management */ -inline uint32_t lower_32 (uint64_t x); -inline uint32_t upper_32 (uint64_t x);struct cik_sdma_rlc_registers *get_sdma_mqd (void *mqd); -inline uint32_t get_sdma_base_addr (struct cik_sdma_rlc_registers *m);int init_queue (struct queue **q,struct queue_properties properties);void uninit_queue (struct queue *q);drivers/gpu/drm/drm_atomic_helper.c +3
-5@@ -1579,11 +1579,8 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state)/* commit_list borrows our reference, need to remove before we * clean up our drm_atomic_state. But only after it actually * completed, otherwise subsequent commits won't stall properly. */ -if (try_wait_for_completion (&commit->flip_done)) { -list_del (&commit->commit_entry); -spin_unlock (&crtc->commit_lock); -continue ; - } +if (try_wait_for_completion (&commit->flip_done)) + goto del_commit: spin_unlock(&crtc->commit_lock);@@ -1597,6 +1594,7 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state) crtc->base.id, crtc->name);spin_lock (&crtc->commit_lock); +del_commit:list_del (&commit->commit_entry);spin_unlock (&crtc->commit_lock); }include/drm/drm_crtc.h +4
-19@@ -2820,29 +2820,14 @@ static inline void drm_connector_unreference(struct drm_connector *connector)#define drm_for_each_crtc (crtc, dev) \ list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head) -static inline void -assert_drm_connector_list_read_locked (struct drm_mode_config *mode_config) -{ -/* -* The connector hotadd/remove code currently grabs both locks when -* updating lists. Hence readers need only hold either of them to be -* safe and the check amounts to -* -* WARN_ON(not_holding(A) && not_holding(B)). -*/ -WARN_ON (!mutex_is_locked (&mode_config->mutex) && - !drm_modeset_is_locked (&mode_config->connection_mutex)); -} -#define drm_for_each_connector (connector, dev) \/* loop to wrap everything into a srcu read-side critical section */ \ - for (bool __conn_loop_srcu = true, \ - int __conn_loop_srcu_ret = srcu_read_lock(&drm_connector_list_srcu);\ - __conn_loop_srcu; __conn_loop_srcu = false, \ + for (int __conn_loop_srcu = 1, \ + __conn_loop_srcu_ret = srcu_read_lock(&drm_connector_list_srcu);\ + __conn_loop_srcu; __conn_loop_srcu = 0, \ srcu_read_unlock(&drm_connector_list_srcu, __conn_loop_srcu_ret)) \/* loop to iterate over the connector_list, rcu-protected */ \ - for (assert_drm_connector_list_read_locked(&(dev)->mode_config), \ - connector = list_entry_rcu((dev)->mode_config.connector_list.next, \ + for (connector = list_entry_rcu((dev)->mode_config.connector_list.next, \ struct drm_connector, head); \ &connector->head != (&(dev)->mode_config.connector_list); \ connector = list_entry_rcu(connector->head.next, \Signature · 1 line
2.8.1
Signature · 12 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develQuoted 9 lines · Daniel Vetter
It's not obvious at first sight that this is a fastpath, make that clearer with a goto. Fallout from a discussion with Liviu on irc.
--- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 4 ++-- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 ---
Hi Daniel,
I'm a bit confused, how the kfd changes relate to this specific commit ? The commit message seems to talk about something else.
Oded
Quoted 105 lines
drivers/gpu/drm/drm_atomic_helper.c | 8 +++----- include/drm/drm_crtc.h | 23 ++++------------------ 4 files changed, 9 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +2
-2@@ -187,12 +187,12 @@ int init_pipelines(struct device_queue_manager *dqm,unsigned int get_first_pipe (struct device_queue_manager *dqm);unsigned int get_pipes_num (struct device_queue_manager *dqm); -extern inline unsigned int get_sh_mem_bases_32 (struct kfd_process_device *pdd) +static inline unsigned int get_sh_mem_bases_32 (struct kfd_process_device *pdd) {return (pdd->lds_base >>16 ) &0xFF ; } -extern inline unsigned int +static inline unsigned int get_sh_mem_bases_nybble_64 (struct kfd_process_device *pdd) {return (pdd->lds_base >>60 ) &0x0E ;drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0
-3@@ -617,10 +617,7 @@ int kgd2kfd_resume(struct kfd_dev *kfd);int kfd_init_apertures (struct kfd_process *process);/* Queue Context Management */ -inline uint32_t lower_32 (uint64_t x); -inline uint32_t upper_32 (uint64_t x);struct cik_sdma_rlc_registers *get_sdma_mqd (void *mqd); -inline uint32_t get_sdma_base_addr (struct cik_sdma_rlc_registers *m);int init_queue (struct queue **q,struct queue_properties properties);void uninit_queue (struct queue *q);drivers/gpu/drm/drm_atomic_helper.c +3
-5@@ -1579,11 +1579,8 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state)/* commit_list borrows our reference, need to remove before we * clean up our drm_atomic_state. But only after it actually * completed, otherwise subsequent commits won't stall properly. */ -if (try_wait_for_completion (&commit->flip_done)) { -list_del (&commit->commit_entry); -spin_unlock (&crtc->commit_lock); -continue ; - } +if (try_wait_for_completion (&commit->flip_done)) + goto del_commit: spin_unlock(&crtc->commit_lock);@@ -1597,6 +1594,7 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state) crtc->base.id, crtc->name);spin_lock (&crtc->commit_lock); +del_commit:list_del (&commit->commit_entry);spin_unlock (&crtc->commit_lock); }include/drm/drm_crtc.h +4
-20@@ -2820,29 +2820,14 @@ static inline void drm_connector_unreference(struct drm_connector *connector)#define drm_for_each_crtc (crtc, dev) \ list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head) -static inline void -assert_drm_connector_list_read_locked (struct drm_mode_config *mode_config) -{ -/* -* The connector hotadd/remove code currently grabs both locks when -* updating lists. Hence readers need only hold either of them to be -* safe and the check amounts to -* -* WARN_ON(not_holding(A) && not_holding(B)). -*/ -WARN_ON (!mutex_is_locked (&mode_config->mutex) && - !drm_modeset_is_locked (&mode_config->connection_mutex)); -} -#define drm_for_each_connector (connector, dev) \/* loop to wrap everything into a srcu read-side critical section */ \ - for (bool __conn_loop_srcu = true, \ - int __conn_loop_srcu_ret = srcu_read_lock(&drm_connector_list_srcu);\ - __conn_loop_srcu; __conn_loop_srcu = false, \ + for (int __conn_loop_srcu = 1, \ + __conn_loop_srcu_ret = srcu_read_lock(&drm_connector_list_srcu);\ + __conn_loop_srcu; __conn_loop_srcu = 0, \ srcu_read_unlock(&drm_connector_list_srcu, __conn_loop_srcu_ret)) \/* loop to iterate over the connector_list, rcu-protected */ \ - for (assert_drm_connector_list_read_locked(&(dev)->mode_config), \ - connector = list_entry_rcu((dev)->mode_config.connector_list.next, \ + for (connector = list_entry_rcu((dev)->mode_config.connector_list.next, \ struct drm_connector, head); \ &connector->head != (&(dev)->mode_config.connector_list); \ connector = list_entry_rcu(connector->head.next, \ --2.8.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Oded Gabbay
Quoted 9 lines · Daniel Vetter
It's not obvious at first sight that this is a fastpath, make that clearer with a goto. Fallout from a discussion with Liviu on irc.
--- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 4 ++-- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 ---
Quoted 4 lines
Hi Daniel,
I'm a bit confused, how the kfd changes relate to this specific commit ? The commit message seems to talk about something else.
They don't, this is just git fail on my side.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel