Now that we have the new release_event wait queue we can just
use that in qxl_fence_wait() and simplify the code alot.
Signed-off-by: Gerd Hoffmann <[email protected]>
---
drivers/gpu/drm/qxl/qxl_release.c | 42 +++----------------------------
1 file changed, 4 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
index 43a5436853b7..b6f4b8dcf228 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/qxl/qxl_release.c
@@ -59,53 +59,19 @@ static long qxl_fence_wait(struct dma_fence *fence, bool intr,
{
struct qxl_device *qdev;
struct qxl_release *release;
- int count = 0, sc = 0;
- bool have_drawable_releases;
unsigned long cur, end = jiffies + timeout;
qdev = container_of(fence->lock, struct qxl_device, release_lock);
release = container_of(fence, struct qxl_release, base);
- have_drawable_releases = release->type == QXL_RELEASE_DRAWABLE;
-
-retry:
- sc++;
if (dma_fence_is_signaled(fence))
goto signaled;
qxl_io_notify_oom(qdev);
-
- for (count = 0; count < 11; count++) {
- if (!qxl_queue_garbage_collect(qdev, true))
- break;
-
- if (dma_fence_is_signaled(fence))
- goto signaled;
- }
-
- if (dma_fence_is_signaled(fence))
- goto signaled;
-
- if (have_drawable_releases || sc < 4) {
- if (sc > 2)
- /* back off */
- usleep_range(500, 1000);
-
- if (time_after(jiffies, end))
- return 0;
-
- if (have_drawable_releases && sc > 300) {
- DMA_FENCE_WARN(fence, "failed to wait on release %llu "
- "after spincount %d\n",
- fence->context & ~0xf0000000, sc);
- goto signaled;
- }
- goto retry;
- }
- /*
- * yeah, original sync_obj_wait gave up after 3 spins when
- * have_drawable_releases is not set.
- */
+ if (!wait_event_timeout(qdev->release_event,
+ dma_fence_is_signaled(fence),
+ timeout))
+ return 0;
signaled:
cur = jiffies;
--
2.29.2
Am 03.02.21 um 14:16 schrieb Gerd Hoffmann:
> Now that we have the new release_event wait queue we can just
> use that in qxl_fence_wait() and simplify the code alot.
>
> Signed-off-by: Gerd Hoffmann <[email protected]>
Acked-by: Thomas Zimmermann <[email protected]>
> ---
> drivers/gpu/drm/qxl/qxl_release.c | 42 +++----------------------------
> 1 file changed, 4 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
> index 43a5436853b7..b6f4b8dcf228 100644
> --- a/drivers/gpu/drm/qxl/qxl_release.c
> +++ b/drivers/gpu/drm/qxl/qxl_release.c
> @@ -59,53 +59,19 @@ static long qxl_fence_wait(struct dma_fence *fence, bool intr,
> {
> struct qxl_device *qdev;
> struct qxl_release *release;
> - int count = 0, sc = 0;
> - bool have_drawable_releases;
> unsigned long cur, end = jiffies + timeout;
>
> qdev = container_of(fence->lock, struct qxl_device, release_lock);
> release = container_of(fence, struct qxl_release, base);
> - have_drawable_releases = release->type == QXL_RELEASE_DRAWABLE;
> -
> -retry:
> - sc++;
>
> if (dma_fence_is_signaled(fence))
> goto signaled;
>
> qxl_io_notify_oom(qdev);
> -
> - for (count = 0; count < 11; count++) {
> - if (!qxl_queue_garbage_collect(qdev, true))
> - break;
> -
> - if (dma_fence_is_signaled(fence))
> - goto signaled;
> - }
> -
> - if (dma_fence_is_signaled(fence))
> - goto signaled;
> -
> - if (have_drawable_releases || sc < 4) {
> - if (sc > 2)
> - /* back off */
> - usleep_range(500, 1000);
> -
> - if (time_after(jiffies, end))
> - return 0;
> -
> - if (have_drawable_releases && sc > 300) {
> - DMA_FENCE_WARN(fence, "failed to wait on release %llu "
> - "after spincount %d\n",
> - fence->context & ~0xf0000000, sc);
> - goto signaled;
> - }
> - goto retry;
> - }
> - /*
> - * yeah, original sync_obj_wait gave up after 3 spins when
> - * have_drawable_releases is not set.
> - */
> + if (!wait_event_timeout(qdev->release_event,
> + dma_fence_is_signaled(fence),
> + timeout))
> + return 0;
>
> signaled:
> cur = jiffies;
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Hi Gerd,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next linus/master v5.11-rc6 next-20210125]
[cannot apply to drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Gerd-Hoffmann/drm-qxl-fix-driver-shutdown-issues/20210203-211739
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-a013-20210202 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/0b11c8d52de8c79900ab632aa3527f19c442efc6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Gerd-Hoffmann/drm-qxl-fix-driver-shutdown-issues/20210203-211739
git checkout 0b11c8d52de8c79900ab632aa3527f19c442efc6
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
drivers/gpu/drm/qxl/qxl_release.c: In function 'qxl_fence_wait':
>> drivers/gpu/drm/qxl/qxl_release.c:61:22: warning: variable 'release' set but not used [-Wunused-but-set-variable]
61 | struct qxl_release *release;
| ^~~~~~~
vim +/release +61 drivers/gpu/drm/qxl/qxl_release.c
2f453ed4038526 Maarten Lankhorst 2014-04-02 56
f54d1867005c33 Chris Wilson 2016-10-25 57 static long qxl_fence_wait(struct dma_fence *fence, bool intr,
f54d1867005c33 Chris Wilson 2016-10-25 58 signed long timeout)
2f453ed4038526 Maarten Lankhorst 2014-04-02 59 {
2f453ed4038526 Maarten Lankhorst 2014-04-02 60 struct qxl_device *qdev;
2f453ed4038526 Maarten Lankhorst 2014-04-02 @61 struct qxl_release *release;
2f453ed4038526 Maarten Lankhorst 2014-04-02 62 unsigned long cur, end = jiffies + timeout;
2f453ed4038526 Maarten Lankhorst 2014-04-02 63
2f453ed4038526 Maarten Lankhorst 2014-04-02 64 qdev = container_of(fence->lock, struct qxl_device, release_lock);
2f453ed4038526 Maarten Lankhorst 2014-04-02 65 release = container_of(fence, struct qxl_release, base);
2f453ed4038526 Maarten Lankhorst 2014-04-02 66
f54d1867005c33 Chris Wilson 2016-10-25 67 if (dma_fence_is_signaled(fence))
2f453ed4038526 Maarten Lankhorst 2014-04-02 68 goto signaled;
2f453ed4038526 Maarten Lankhorst 2014-04-02 69
2f453ed4038526 Maarten Lankhorst 2014-04-02 70 qxl_io_notify_oom(qdev);
0b11c8d52de8c7 Gerd Hoffmann 2021-02-03 71 if (!wait_event_timeout(qdev->release_event,
0b11c8d52de8c7 Gerd Hoffmann 2021-02-03 72 dma_fence_is_signaled(fence),
0b11c8d52de8c7 Gerd Hoffmann 2021-02-03 73 timeout))
2f453ed4038526 Maarten Lankhorst 2014-04-02 74 return 0;
2f453ed4038526 Maarten Lankhorst 2014-04-02 75
2f453ed4038526 Maarten Lankhorst 2014-04-02 76 signaled:
2f453ed4038526 Maarten Lankhorst 2014-04-02 77 cur = jiffies;
2f453ed4038526 Maarten Lankhorst 2014-04-02 78 if (time_after(cur, end))
2f453ed4038526 Maarten Lankhorst 2014-04-02 79 return 0;
2f453ed4038526 Maarten Lankhorst 2014-04-02 80 return end - cur;
2f453ed4038526 Maarten Lankhorst 2014-04-02 81 }
2f453ed4038526 Maarten Lankhorst 2014-04-02 82
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]