From: "Michel Dänzer" <michel@daenzer.net>
To: "Christian König" <deathsimple@vodafone.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 10/13] drm/radeon: return -ENOENT in fence_wait_*
Date: Fri, 20 Apr 2012 11:15:26 +0200 [thread overview]
Message-ID: <1334913326.5989.424.camel@thor.local> (raw)
In-Reply-To: <4F912304.80407@vodafone.de>
On Fre, 2012-04-20 at 10:49 +0200, Christian König wrote:
> On 20.04.2012 09:20, Michel Dänzer wrote:
> > On Fre, 2012-04-20 at 00:39 +0200, Christian König wrote:
> >> Signed-off-by: Christian König<deathsimple@vodafone.de>
> >> ---
> >> drivers/gpu/drm/radeon/radeon_fence.c | 4 ++--
> >> 1 files changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
> >> index 1a9765a..764ab7e 100644
> >> --- a/drivers/gpu/drm/radeon/radeon_fence.c
> >> +++ b/drivers/gpu/drm/radeon/radeon_fence.c
> >> @@ -286,7 +286,7 @@ int radeon_fence_wait_next(struct radeon_device *rdev, int ring)
> >> }
> >> if (list_empty(&rdev->fence_drv[ring].emitted)) {
> >> write_unlock_irqrestore(&rdev->fence_lock, irq_flags);
> >> - return 0;
> >> + return -ENOENT;
> >> }
> >> fence = list_entry(rdev->fence_drv[ring].emitted.next,
> >> struct radeon_fence, list);
> >> @@ -310,7 +310,7 @@ int radeon_fence_wait_last(struct radeon_device *rdev, int ring)
> >> }
> >> if (list_empty(&rdev->fence_drv[ring].emitted)) {
> >> write_unlock_irqrestore(&rdev->fence_lock, irq_flags);
> >> - return 0;
> >> + return -ENOENT;
> >> }
> >> fence = list_entry(rdev->fence_drv[ring].emitted.prev,
> >> struct radeon_fence, list);
> > It seems weird to declare a fence wait as failed when there are no
> > outstanding fences in the first place. If there are callers which
> > require outstanding fences, they should probably handle that themselves.
>
> Why that sounds so weird? Ok, maybe for radeon_fence_wait_last that's
> questionable,
Indeed. It happens not to break radeon_suspend_kms because it doesn't
check the return value, but otherwise it would fail spuriously.
> but for radeon_fence_wait_next it's quite clear to me that
> we should signal the caller that there is no fence to wait for.
>
> The problem I wanted to fix with that is the usage of
> radeon_fence_wait_next in radeon_ring_alloc (for example):
> > int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring
> > *ring, unsigned ndw)
> > {
> > int r;
> >
> > /* Align requested size with padding so unlock_commit can
> > * pad safely */
> > ndw = (ndw + ring->align_mask) & ~ring->align_mask;
> > while (ndw > (ring->ring_free_dw - 1)) {
> > radeon_ring_free_size(rdev, ring);
> > if (ndw < ring->ring_free_dw) {
> > break;
> > }
> > r = radeon_fence_wait_next(rdev,
> > radeon_ring_index(rdev, ring));
> > if (r)
> > return r;
> > }
> > ring->count_dw = ndw;
> > ring->wptr_old = ring->wptr;
> > return 0;
> > }
> If the ring is full, but actually has no more fences in it (which in my
> case was caused by my stupidity and actually shouldn't happen otherwise)
> this loop will just busy wait with a critical mutex locked for something
> that never happens.
My suggestion was to explicitly check for that in radeon_ring_alloc. But
I guess right now it doesn't really matter, as it's the only caller. :)
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Debian, X and DRI developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2012-04-20 9:15 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-19 22:39 Reworking of GPU reset logic Christian König
2012-04-19 22:39 ` [PATCH 01/13] drm/radeon: make radeon_gpu_is_lockup a per ring function Christian König
2012-04-19 22:39 ` [PATCH 02/13] drm/radeon: replace gpu_lockup with ring->ready flag Christian König
2012-04-19 22:39 ` [PATCH 03/13] drm/radeon: register ring debugfs handlers on init Christian König
2012-04-19 22:39 ` [PATCH 04/13] drm/radeon: use central function for IB testing Christian König
2012-04-19 22:39 ` [PATCH 05/13] drm/radeon: rework gpu lockup detection and processing Christian König
2012-04-19 22:39 ` [PATCH 06/13] drm/radeon: improve sub allocator Christian König
2012-04-20 7:24 ` Michel Dänzer
2012-04-20 9:11 ` Christian König
2012-04-19 22:39 ` [PATCH 07/13] drm/radeon: add sub allocator debugfs file Christian König
2012-04-19 22:39 ` [PATCH 08/13] drm/radeon: add biggest hole tracking and wakequeue to the sa Christian König
2012-04-19 22:39 ` [PATCH 09/13] drm/radeon: simplify semaphore handling Christian König
2012-04-19 22:39 ` [PATCH 10/13] drm/radeon: return -ENOENT in fence_wait_* Christian König
2012-04-20 7:20 ` Michel Dänzer
2012-04-20 8:49 ` Christian König
2012-04-20 9:15 ` Michel Dänzer [this message]
2012-04-20 10:24 ` Christian König
2012-04-20 11:30 ` Michel Dänzer
2012-04-19 22:39 ` [PATCH 11/13] drm/radeon: rip out the ib pool Christian König
2012-04-19 22:39 ` [PATCH 12/13] drm/radeon: fix a bug with the ring syncing code Christian König
2012-04-24 14:04 ` Dave Airlie
2012-04-24 14:23 ` Christian König
2012-04-19 22:39 ` [PATCH 13/13] drm/radeon: rework recursive gpu reset handling Christian König
2012-04-20 6:57 ` Dave Airlie
2012-04-20 7:50 ` Daniel Vetter
2012-04-20 9:38 ` Christian König
2012-04-19 23:47 ` Reworking of GPU reset logic Jerome Glisse
2012-04-21 9:42 ` Christian König
2012-04-21 14:14 ` Jerome Glisse
2012-04-25 13:01 ` Christian König
2012-04-25 13:30 ` Dave Airlie
2012-04-25 13:46 ` Alex Deucher
2012-04-25 14:26 ` Jerome Glisse
2012-04-23 7:40 ` Michel Dänzer
2012-04-25 12:50 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334913326.5989.424.camel@thor.local \
--to=michel@daenzer.net \
--cc=deathsimple@vodafone.de \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox