diff mbox

dma-buf/fence: fix fence_is_later v2

Message ID 1456761191-8043-1-git-send-email-alexander.deucher@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher Feb. 29, 2016, 3:53 p.m. UTC
From: Christian König <christian.koenig@amd.com>

A fence is never later than itself. This caused a bunch of overhead for AMDGPU.

v2: simplify check as suggested by Michel.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 include/linux/fence.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gustavo Padovan Feb. 29, 2016, 10:13 p.m. UTC | #1
2016-02-29 Alex Deucher <alexdeucher@gmail.com>:

> From: Christian König <christian.koenig@amd.com>
> 
> A fence is never later than itself. This caused a bunch of overhead for AMDGPU.
> 
> v2: simplify check as suggested by Michel.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  include/linux/fence.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

	Gustavo
Maarten Lankhorst March 1, 2016, 8:36 a.m. UTC | #2
Op 29-02-16 om 23:13 schreef Gustavo Padovan:
> 2016-02-29 Alex Deucher <alexdeucher@gmail.com>:
>
>> From: Christian König <christian.koenig@amd.com>
>>
>> A fence is never later than itself. This caused a bunch of overhead for AMDGPU.
>>
>> v2: simplify check as suggested by Michel.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
>> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> ---
>>  include/linux/fence.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> 	Gustavo
Why is it causing overhead? Not really opposed to the patch though.
Christian König March 1, 2016, 8:42 a.m. UTC | #3
Am 01.03.2016 um 09:36 schrieb Maarten Lankhorst:
> Op 29-02-16 om 23:13 schreef Gustavo Padovan:
>> 2016-02-29 Alex Deucher <alexdeucher@gmail.com>:
>>
>>> From: Christian König <christian.koenig@amd.com>
>>>
>>> A fence is never later than itself. This caused a bunch of overhead for AMDGPU.
>>>
>>> v2: simplify check as suggested by Michel.
>>>
>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
>>> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>> ---
>>>   include/linux/fence.h | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>
>> 	Gustavo
> Why is it causing overhead? Not really opposed to the patch though.

We tested if flushing the VM is necessary by remembering the last 
flushed VM update operation and comparing that to what operation we need 
to have flushed for the current command submission to work.

So when we where already at the last operation in the timeline we would 
flush anyway which was superfluous.

Regards,
Christian.
Sumit Semwal March 3, 2016, 12:43 p.m. UTC | #4
Hi Alex,

On 29 February 2016 at 21:23, Alex Deucher <alexdeucher@gmail.com> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> A fence is never later than itself. This caused a bunch of overhead for AMDGPU.
>

Thanks; added to for-next.

> v2: simplify check as suggested by Michel.
>
Best regards,
~Sumit.
diff mbox

Patch

diff --git a/include/linux/fence.h b/include/linux/fence.h
index bb52201..5aa95eb 100644
--- a/include/linux/fence.h
+++ b/include/linux/fence.h
@@ -292,7 +292,7 @@  static inline bool fence_is_later(struct fence *f1, struct fence *f2)
 	if (WARN_ON(f1->context != f2->context))
 		return false;
 
-	return f1->seqno - f2->seqno < INT_MAX;
+	return (int)(f1->seqno - f2->seqno) > 0;
 }
 
 /**