diff mbox series

[i-g-t,4/7] gem_wsim: Stop keeping batches mapped

Message ID 20180814150519.20204-5-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series gem_wsim fixes and new features | expand

Commit Message

Tvrtko Ursulin Aug. 14, 2018, 3:05 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

The reason, which I assume was there at some point, to keep the batches
persistently memory mapped does not appear to be there. So unmap them
after creation and remove the unused structure members.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 benchmarks/gem_wsim.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Chris Wilson Aug. 14, 2018, 3:13 p.m. UTC | #1
Quoting Tvrtko Ursulin (2018-08-14 16:05:16)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> The reason, which I assume was there at some point, to keep the batches
> persistently memory mapped does not appear to be there. So unmap them
> after creation and remove the unused structure members.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  benchmarks/gem_wsim.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
> index 34758419254a..24f518a7770f 100644
> --- a/benchmarks/gem_wsim.c
> +++ b/benchmarks/gem_wsim.c
> @@ -128,7 +128,6 @@ struct w_step
>         struct drm_i915_gem_relocation_entry reloc[4];
>         unsigned long bb_sz;
>         uint32_t bb_handle;
> -       uint32_t *mapped_batch;
>         uint32_t *seqno_value;
>         uint32_t *seqno_address;
>         uint32_t *rt0_value;
> @@ -136,7 +135,6 @@ struct w_step
>         uint32_t *rt1_address;
>         uint32_t *latch_value;
>         uint32_t *latch_address;
> -       unsigned int mapped_len;
>  };
>  
>  DECLARE_EWMA(uint64_t, rt, 4, 2)
> @@ -755,8 +753,7 @@ terminate_bb(struct w_step *w, unsigned int flags)
>  
>         *cs = bbe;
>  
> -       w->mapped_batch = ptr;
> -       w->mapped_len = mmap_len;
> +       munmap(ptr, mmap_len);

The mapped_batch/ptr contains seqno_value/seqno_address etc which is
used after terminate_bb().
-Chris
Tvrtko Ursulin Aug. 14, 2018, 3:16 p.m. UTC | #2
On 14/08/2018 16:13, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-08-14 16:05:16)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> The reason, which I assume was there at some point, to keep the batches
>> persistently memory mapped does not appear to be there. So unmap them
>> after creation and remove the unused structure members.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>>   benchmarks/gem_wsim.c | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
>> index 34758419254a..24f518a7770f 100644
>> --- a/benchmarks/gem_wsim.c
>> +++ b/benchmarks/gem_wsim.c
>> @@ -128,7 +128,6 @@ struct w_step
>>          struct drm_i915_gem_relocation_entry reloc[4];
>>          unsigned long bb_sz;
>>          uint32_t bb_handle;
>> -       uint32_t *mapped_batch;
>>          uint32_t *seqno_value;
>>          uint32_t *seqno_address;
>>          uint32_t *rt0_value;
>> @@ -136,7 +135,6 @@ struct w_step
>>          uint32_t *rt1_address;
>>          uint32_t *latch_value;
>>          uint32_t *latch_address;
>> -       unsigned int mapped_len;
>>   };
>>   
>>   DECLARE_EWMA(uint64_t, rt, 4, 2)
>> @@ -755,8 +753,7 @@ terminate_bb(struct w_step *w, unsigned int flags)
>>   
>>          *cs = bbe;
>>   
>> -       w->mapped_batch = ptr;
>> -       w->mapped_len = mmap_len;
>> +       munmap(ptr, mmap_len);
> 
> The mapped_batch/ptr contains seqno_value/seqno_address etc which is
> used after terminate_bb().

Oh dear, I was blind.. Thanks for being sharp as always.

Regards,

Tvrtko
diff mbox series

Patch

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 34758419254a..24f518a7770f 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -128,7 +128,6 @@  struct w_step
 	struct drm_i915_gem_relocation_entry reloc[4];
 	unsigned long bb_sz;
 	uint32_t bb_handle;
-	uint32_t *mapped_batch;
 	uint32_t *seqno_value;
 	uint32_t *seqno_address;
 	uint32_t *rt0_value;
@@ -136,7 +135,6 @@  struct w_step
 	uint32_t *rt1_address;
 	uint32_t *latch_value;
 	uint32_t *latch_address;
-	unsigned int mapped_len;
 };
 
 DECLARE_EWMA(uint64_t, rt, 4, 2)
@@ -755,8 +753,7 @@  terminate_bb(struct w_step *w, unsigned int flags)
 
 	*cs = bbe;
 
-	w->mapped_batch = ptr;
-	w->mapped_len = mmap_len;
+	munmap(ptr, mmap_len);
 }
 
 static const unsigned int eb_engine_map[NUM_ENGINES] = {