From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: "Christian König" <deathsimple@vodafone.de>
Cc: dri-devel@lists.freedesktop.org, linux-arch@vger.kernel.org,
linaro-mm-sig@lists.linaro.org,
Alex Deucher <alexander.deucher@amd.com>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [RFC PATCH] drm/radeon: rework to new fence interface
Date: Mon, 19 Aug 2013 21:37:53 +0200 [thread overview]
Message-ID: <52127411.2010106@canonical.com> (raw)
In-Reply-To: <5212112C.70808@vodafone.de>
Op 19-08-13 14:35, Christian König schreef:
> Am 19.08.2013 12:17, schrieb Maarten Lankhorst:
>> [SNIP]
>> @@ -190,25 +225,24 @@ void radeon_fence_process(struct radeon_device *rdev, int ring)
>> }
>> } while (atomic64_xchg(&rdev->fence_drv[ring].last_seq, seq) > seq);
>> - if (wake) {
>> + if (wake)
>> rdev->fence_drv[ring].last_activity = jiffies;
>> - wake_up_all(&rdev->fence_queue);
>> - }
>> + return wake;
>> }
>
> Very bad idea, when sequence numbers change, you always want to wake up the whole fence queue here.
Yes, and the callers of this function call wake_up_all or wake_up_all_locked themselves, based on the return value..
>> [SNIP]
>> +/**
>> + * radeon_fence_enable_signaling - enable signalling on fence
>> + * @fence: fence
>> + *
>> + * This function is called with fence_queue lock held, and adds a callback
>> + * to fence_queue that checks if this fence is signaled, and if so it
>> + * signals the fence and removes itself.
>> + */
>> +static bool radeon_fence_enable_signaling(struct fence *f)
>> +{
>> + struct radeon_fence *fence = to_radeon_fence(f);
>> +
>> + if (atomic64_read(&fence->rdev->fence_drv[fence->ring].last_seq) >= fence->seq ||
>> + !fence->rdev->ddev->irq_enabled)
>> + return false;
>> +
>
> Do I get that right that you rely on IRQs to be enabled and working here? Cause that would be a quite bad idea from the conceptual side.
For cross-device synchronization it would be nice to have working irqs, it allows signalling fences faster,
and it allows for callbacks on completion to be called. For internal usage it's no more required than it was before.
>> + radeon_irq_kms_sw_irq_get(fence->rdev, fence->ring);
>> +
>> + if (__radeon_fence_process(fence->rdev, fence->ring))
>> + wake_up_all_locked(&fence->rdev->fence_queue);
>> +
>> + /* did fence get signaled after we enabled the sw irq? */
>> + if (atomic64_read(&fence->rdev->fence_drv[fence->ring].last_seq) >= fence->seq) {
>> + radeon_irq_kms_sw_irq_put(fence->rdev, fence->ring);
>> + return false;
>> + }
>> +
>> + fence->fence_wake.flags = 0;
>> + fence->fence_wake.private = NULL;
>> + fence->fence_wake.func = radeon_fence_check_signaled;
>> + __add_wait_queue(&fence->rdev->fence_queue, &fence->fence_wake);
>> + fence_get(f);
>> +
>> + return true;
>> +}
>> +
>> /**
>> * radeon_fence_signaled - check if a fence has signaled
>> *
>>
>
> Christian.
>
~Maarten
next prev parent reply other threads:[~2013-08-19 19:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-15 12:43 [PATCH] fence: dma-buf cross-device synchronization (v14) Maarten Lankhorst
2013-08-19 10:11 ` [RFC PATCH] drm/nouveau: rework to new fence interface Maarten Lankhorst
2013-08-19 10:17 ` [RFC PATCH] drm/radeon: " Maarten Lankhorst
2013-08-19 12:35 ` Christian König
2013-08-19 12:35 ` Christian König
2013-08-19 19:37 ` Maarten Lankhorst [this message]
2013-08-20 8:37 ` Christian König
2013-08-20 8:37 ` Christian König
2013-08-20 9:36 ` Maarten Lankhorst
2013-08-20 9:36 ` Maarten Lankhorst
2013-08-20 9:51 ` Christian König
2013-08-20 9:51 ` Christian König
2013-08-20 13:21 ` Maarten Lankhorst
2013-08-20 14:16 ` 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=52127411.2010106@canonical.com \
--to=maarten.lankhorst@canonical.com \
--cc=alexander.deucher@amd.com \
--cc=deathsimple@vodafone.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).