diff mbox

[igt] igt/gem_exec_await: Flush the WCB before attempting to queue more work

Message ID 20171221154823.23766-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Dec. 21, 2017, 3:48 p.m. UTC
Ensure that the terminating write into WC-memory is flushed before we
might trigger a wait for ring space.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_exec_await.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Tvrtko Ursulin Dec. 22, 2017, 5:03 p.m. UTC | #1
On 21/12/2017 15:48, Chris Wilson wrote:
> Ensure that the terminating write into WC-memory is flushed before we
> might trigger a wait for ring space.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   tests/gem_exec_await.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tests/gem_exec_await.c b/tests/gem_exec_await.c
> index 9c4467922..28b280ff6 100644
> --- a/tests/gem_exec_await.c
> +++ b/tests/gem_exec_await.c
> @@ -222,6 +222,7 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags)
>   
>   		for (unsigned e = 0; e < nengine; e++)
>   			exec[e].cmd[0] = MI_BATCH_BUFFER_END;
> +		__sync_synchronize();
>   	}
>   
>   	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
> 

In case someone is reading from the same uneducated situation as I was, 
__sync_synchronize emits an mfence instructions which indeed forces a 
flush of the write combine buffer.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
diff mbox

Patch

diff --git a/tests/gem_exec_await.c b/tests/gem_exec_await.c
index 9c4467922..28b280ff6 100644
--- a/tests/gem_exec_await.c
+++ b/tests/gem_exec_await.c
@@ -222,6 +222,7 @@  static void wide(int fd, int ring_size, int timeout, unsigned int flags)
 
 		for (unsigned e = 0; e < nengine; e++)
 			exec[e].cmd[0] = MI_BATCH_BUFFER_END;
+		__sync_synchronize();
 	}
 
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);