drm/radeon: Remove deprecated create_singlethread_workqueue
Subsystems (2)
PATCH 1/1 drm/radeon: Remove deprecated create_singlethread_workqueue
alloc_workqueue replaces deprecated create_singlethread_workqueue().
A dedicated workqueue has been used since work items need to be flushed as a group rather than individually.
Since the flip_queue workqueue is involved in page-flipping and is not being used on a memory reclaim path, WQ_MEM_RECLAIM has not been set.
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
--- drivers/gpu/drm/radeon/radeon_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_display.c +1 -1
@@ -711,7 +711,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index)drm_mode_crtc_set_gamma_size (&radeon_crtc->base,256 ); radeon_crtc->crtc_id = index; - radeon_crtc->flip_queue =create_singlethread_workqueue ("radeon-crtc" ); + radeon_crtc->flip_queue =alloc_workqueue ("radeon-crtc" ,0 ,0 ); rdev->mode_info.crtcs[index] = radeon_crtc;if (rdev->family >=CHIP_BONAIRE ) {
--
2.1.4
Quoted 10 lines · Bhaktipriya Shridhar
alloc_workqueuereplaces deprecatedcreate_singlethread_workqueue().A dedicated workqueue has been used since work items need to be flushed as a group rather than individually.
Since the
flip_queueworkqueue is involved in page-flipping and is not being used on a memory reclaim path,WQ_MEM_RECLAIMhas not been set.Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
What are the involved work items? Is it safe to run them concurrently?
Thanks.
Signature · 5 lines
tejun _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Tejun Heo
Quoted 5 lines · Bhaktipriya Shridhar
alloc_workqueuereplaces deprecatedcreate_singlethread_workqueue().A dedicated workqueue has been used since work items need to be flushed as a group rather than individually.
Quoted 7 lines
Quoted 5 lines
Since the
flip_queueworkqueue is involved in page-flipping and is not being used on a memory reclaim path,WQ_MEM_RECLAIMhas not been set.Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
What are the involved work items?
drivers/gpu/drm/radeon/radeon_display.c:radeon_flip_work_func()
Quoted 1 line
Is it safe to run them concurrently?
Concurrently with what exactly?
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hello,
Quoted 6 lines · Michel Dänzer
Quoted 5 lines · Tejun Heo
Quoted 4 lines · Bhaktipriya Shridhar
alloc_workqueuereplaces deprecatedcreate_singlethread_workqueue().A dedicated workqueue has been used since work items need to be flushed as a group rather than individually.
There seem to be two work items involved, the flip one and unpin one. Provided that there's no ordering requirement between the two, can't we just flush them individually?
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Since the
flip_queueworkqueue is involved in page-flipping and is not being used on a memory reclaim path,WQ_MEM_RECLAIMhas not been set.Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
Quoted 7 lines
Quoted 1 line
What are the involved work items?
drivers/gpu/drm/radeon/radeon_display.c:radeon_flip_work_func()
Quoted 1 line
Is it safe to run them concurrently?
Concurrently with what exactly?
The flip and unpin work items.
Thanks.
Signature · 5 lines
tejun _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Tejun Heo
Quoted 6 lines · Michel Dänzer
Quoted 5 lines · Tejun Heo
Quoted 4 lines · Bhaktipriya Shridhar
alloc_workqueuereplaces deprecatedcreate_singlethread_workqueue().A dedicated workqueue has been used since work items need to be flushed as a group rather than individually.
There seem to be two work items involved, the flip one and unpin one. Provided that there's no ordering requirement between the two, can't we just flush them individually?
There is an ordering requirement between the two queues, but it's enforced by the driver (by only queuing the unpin work once a flip has completed, which only happens after the corresponding flip work has run).
Not being very familiar with the workqueue APIs, I'll describe how it's supposed to work from a driver POV, which will hopefully help you guys decide on the most appropriate alloc_workqueue parameters.
There is one flip work queue for each hardware CRTC. At most one radeon_flip_work_func item can be queued for any of them at any time. When a radeon_flip_work_func item is queued, it should be executed ASAP (so WQ_HIGHPRI might be appropriate?).
In contrast, the radeon_unpin_work_func items aren't particularly urgent, and it's okay for several of them to be queued up. So I guess it would actually make sense to use a different workqueue for them, maybe even the default one?
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
What are the involved work items?
Quoted 7 lines
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_display.c:radeon_flip_work_func()
Quoted 1 line
Is it safe to run them concurrently?
Concurrently with what exactly?
The flip and unpin work items.
Yes, it's safe to run those concurrently.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hello, Michel.
Quoted 3 lines · Michel Dänzer
There is an ordering requirement between the two queues, but it's enforced by the driver (by only queuing the unpin work once a flip has completed, which only happens after the corresponding flip work has run).
Oh I see.
Quoted 8 lines
Not being very familiar with the workqueue APIs, I'll describe how it's supposed to work from a driver POV, which will hopefully help you guys decide on the most appropriate
alloc_workqueueparameters.There is one flip work queue for each hardware CRTC. At most one
radeon_flip_work_funcitem can be queued for any of them at any time. When aradeon_flip_work_funcitem is queued, it should be executed ASAP (soWQ_HIGHPRImight be appropriate?).
Hmmm... the only time WQ_HIGHPRI should be used is when it'd otherwise require a kthread w/ nice value at -20. Would that be the case here? What are the consequences of the work item getting delayed? Also, what kind of delays matter here? Is it millisec range or micro?
Quoted 4 lines
In contrast, the
radeon_unpin_work_funcitems aren't particularly urgent, and it's okay for several of them to be queued up. So I guess it would actually make sense to use a different workqueue for them, maybe even the default one?
If the flip work doesn't require high priority kthread, both of them can be queued to system_wq and flushed individually on shutdown. The default workqueue now has high enough concurrency that it isn't necessary to worry about getting delayed by other work items.
Thanks.
Signature · 5 lines
tejun _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Tejun Heo
Quoted 4 lines · Michel Dänzer
Not being very familiar with the workqueue APIs, I'll describe how it's supposed to work from a driver POV, which will hopefully help you guys decide on the most appropriate
alloc_workqueueparameters.
Quoted 8 lines
Quoted 4 lines
There is one flip work queue for each hardware CRTC. At most one
radeon_flip_work_funcitem can be queued for any of them at any time. When aradeon_flip_work_funcitem is queued, it should be executed ASAP (soWQ_HIGHPRImight be appropriate?).Hmmm... the only time
WQ_HIGHPRIshould be used is when it'd otherwise require a kthread w/ nice value at -20. Would that be the case here? What are the consequences of the work item getting delayed?
A page flip may be delayed to a later display refresh cycle.
Quoted 1 line
Also, what kind of delays matter here? Is it millisec range or micro?
It can be the latter in theory, but normally rather the former.
Signature · 2 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König
maintainerAm 07.07.2016 um 05:32 schrieb Michel Dänzer:
Quoted 11 lines · Tejun Heo
Quoted 10 lines · Michel Dänzer
Quoted 9 lines
Not being very familiar with the workqueue APIs, I'll describe how it's supposed to work from a driver POV, which will hopefully help you guys decide on the most appropriate
alloc_workqueueparameters.There is one flip work queue for each hardware CRTC. At most one
radeon_flip_work_funcitem can be queued for any of them at any time. When aradeon_flip_work_funcitem is queued, it should be executed ASAP (soWQ_HIGHPRImight be appropriate?).
Quoted 8 lines
Quoted 3 lines
Hmmm... the only time
WQ_HIGHPRIshould be used is when it'd otherwise require a kthread w/ nice value at -20. Would that be the case here? What are the consequences of the work item getting delayed?A page flip may be delayed to a later display refresh cycle.
Quoted 1 line
Also, what kind of delays matter here? Is it millisec range or micro?
It can be the latter in theory, but normally rather the former.
Well to be precise with a typical 1920x1080@60 resolution you have about 2.16ms time under ideal conditions for the flip.
So using the high priority queue still sounds like a good idea to me.
Regards,
Christian.
Quoted 18 lines · Christian König
Am 07.07.2016 um 05:32 schrieb Michel Dänzer:
Quoted 17 lines · Tejun Heo
Quoted 6 lines · Michel Dänzer
Quoted 5 lines
Not being very familiar with the workqueue APIs, I'll describe how it's supposed to work from a driver POV, which will hopefully help you guys decide on the most appropriate
alloc_workqueueparameters.Quoted 7 lines
Quoted 4 lines
There is one flip work queue for each hardware CRTC. At most one
radeon_flip_work_funcitem can be queued for any of them at any time. When aradeon_flip_work_funcitem is queued, it should be executed ASAP (soWQ_HIGHPRImight be appropriate?).Hmmm... the only time
WQ_HIGHPRIshould be used is when it'd otherwise require a kthread w/ nice value at -20. Would that be the case here? What are the consequences of the work item getting delayed?A page flip may be delayed to a later display refresh cycle.
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Also, what kind of delays matter here? Is it millisec range or micro?
It can be the latter in theory, but normally rather the former.
Well to be precise with a typical 1920x1080@60 resolution you have about 2.16ms time under ideal conditions for the flip.
So using the high priority queue still sounds like a good idea to me.
How did you arrive at 2.16ms?
Userspace can call the ioctl up to one full refresh cycle ahead of time, which is ~16ms at 60 Hz. On the other hand userspace can also call the ioctl arbitrarily close to the vertical blank period, in which case even a delay of just 1ms (or even significantly less) may cause the flip to be delayed by one refresh cycle.
Signature · 2 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hello,
Quoted 9 lines · Michel Dänzer
Quoted 7 lines · Christian König
Quoted 2 lines
Quoted 1 line
Also, what kind of delays matter here? Is it millisec range or micro?
It can be the latter in theory, but normally rather the former.
Well to be precise with a typical 1920x1080@60 resolution you have about 2.16ms time under ideal conditions for the flip.
So using the high priority queue still sounds like a good idea to me.
Quoted 7 lines
How did you arrive at 2.16ms?
Userspace can call the ioctl up to one full refresh cycle ahead of time, which is ~16ms at 60 Hz. On the other hand userspace can also call the ioctl arbitrarily close to the vertical blank period, in which case even a delay of just 1ms (or even significantly less) may cause the flip to be delayed by one refresh cycle.
If there's too long a delay, the outcome is missing the refresh cycle, right? Hmmm... yeah, WQ_HIGHPRI probably is the right answer here. Bhaktipriya, can you please update the patch to use a dedicated workqueue with WQ_HIGHPRI?
Thanks.
Signature · 5 lines
tejun _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/1 drm/radeon: Remove deprecated create_singlethread_workqueue
alloc_workqueue replaces deprecated create_singlethread_workqueue().
Each hardware CRTC has a single flip work queue.
When a radeon_flip_work_func item is queued, it needs to be executed ASAP because even a slight delay may cause the flip to be delayed by one refresh cycle.
Hence, a dedicated workqueue with WQ_HIGHPRI set, has been used here since a delay can cause the outcome to miss the refresh cycle.
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
---
Changes in v2:
-Used a dedicated work queue with WQ_HIGHPRI
drivers/gpu/drm/radeon/radeon_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_display.c +1 -1
@@ -711,7 +711,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index)drm_mode_crtc_set_gamma_size (&radeon_crtc->base,256 ); radeon_crtc->crtc_id = index; - radeon_crtc->flip_queue =create_singlethread_workqueue ("radeon-crtc" ); + radeon_crtc->flip_queue =alloc_workqueue ("radeon-crtc" ,WQ_HIGHPRI ,0 ); rdev->mode_info.crtcs[index] = radeon_crtc;if (rdev->family >=CHIP_BONAIRE ) {
--
2.1.4
Am 16.07.2016 um 13:30 schrieb Bhaktipriya Shridhar:
Quoted 7 lines
alloc_workqueuereplaces deprecatedcreate_singlethread_workqueue().Each hardware CRTC has a single flip work queue.
When aradeon_flip_work_funcitem is queued, it needs to be executed ASAP because even a slight delay may cause the flip to be delayed by one refresh cycle.
Quoted 7 lines
Hence, a dedicated workqueue with
WQ_HIGHPRIset, has been used here since a delay can cause the outcome to miss the refresh cycle.Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
Signed-off-by Bhaktipriya Shridhar <[email protected]>
Quoted 23 lines
---
Changes in v2:
-Used a dedicated work queue withWQ_HIGHPRIdrivers/gpu/drm/radeon/radeon_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon_display.c +1
-2@@ -711,7 +711,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index)drm_mode_crtc_set_gamma_size (&radeon_crtc->base,256 ); radeon_crtc->crtc_id = index; - radeon_crtc->flip_queue =create_singlethread_workqueue ("radeon-crtc" ); + radeon_crtc->flip_queue =alloc_workqueue ("radeon-crtc" ,WQ_HIGHPRI ,0 ); rdev->mode_info.crtcs[index] = radeon_crtc;if (rdev->family >=CHIP_BONAIRE ) { --2.1.4
Quoted 8 lines · Bhaktipriya Shridhar
alloc_workqueuereplaces deprecatedcreate_singlethread_workqueue().Each hardware CRTC has a single flip work queue.
When aradeon_flip_work_funcitem is queued, it needs to be executed ASAP because even a slight delay may cause the flip to be delayed by one refresh cycle.
Quoted 7 lines
Hence, a dedicated workqueue with
WQ_HIGHPRIset, has been used here since a delay can cause the outcome to miss the refresh cycle.Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
Signed-off-by Bhaktipriya Shridhar <[email protected]>
Thanks.
Signature · 5 lines
tejun _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher
AppliedQuoted 12 lines · Tejun Heo
Quoted 11 lines · Bhaktipriya Shridhar
alloc_workqueuereplaces deprecatedcreate_singlethread_workqueue().Each hardware CRTC has a single flip work queue.
When aradeon_flip_work_funcitem is queued, it needs to be executed ASAP because even a slight delay may cause the flip to be delayed by one refresh cycle.Hence, a dedicated workqueue with
WQ_HIGHPRIset, has been used here since a delay can cause the outcome to miss the refresh cycle.
Quoted 7 lines
Quoted 4 lines
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.
Signed-off-by Bhaktipriya Shridhar <[email protected]>Acked-by Tejun Heo <[email protected]>
Applied. thanks!
Alex
Quoted 8 lines
Thanks.
--
tejun
_______________________________________________
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