diff mbox series

[v2,2/5] drm/i915/guc: Add unaligned wc memcpy for copying GuC Log

Message ID 20221206092100.274195-3-alan.previn.teres.alexis@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/guc: Update GuC relay logging debugfs | expand

Commit Message

Alan Previn Dec. 6, 2022, 9:20 a.m. UTC
Add usage of unaligned wc mempy in read_update_log_buffer
as newer formats of GuC debug-log-events are no longer
guaranteed to be exactly 4-dwords long per event.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Tvrtko Ursulin Dec. 6, 2022, 10:14 a.m. UTC | #1
On 06/12/2022 09:20, Alan Previn wrote:
> Add usage of unaligned wc mempy in read_update_log_buffer
> as newer formats of GuC debug-log-events are no longer
> guaranteed to be exactly 4-dwords long per event.

If this "newer format" applies to DG2 and GuC log has been "productized" 
there (as in we expect to tell users please collect and attach), pick a 
fixes tag so this gets into 6.2.

Regards,

Tvrtko

> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> ---
>   drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
> index c5a7aecd08ac..2fa952916120 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
> @@ -459,13 +459,16 @@ static void _guc_log_copy_debuglogs_for_relay(struct intel_guc_log *log)
>   
>   		/* Just copy the newly written data */
>   		if (read_offset > write_offset) {
> -			i915_memcpy_from_wc(dst_data, src_data, write_offset);
> +			if (!i915_memcpy_from_wc(dst_data, src_data, write_offset))
> +				i915_unaligned_memcpy_from_wc(dst_data, src_data, write_offset);
>   			bytes_to_copy = buffer_size - read_offset;
>   		} else {
>   			bytes_to_copy = write_offset - read_offset;
>   		}
> -		i915_memcpy_from_wc(dst_data + read_offset,
> -				    src_data + read_offset, bytes_to_copy);
> +		if (!i915_memcpy_from_wc(dst_data + read_offset,
> +					 src_data + read_offset, bytes_to_copy))
> +			i915_unaligned_memcpy_from_wc(dst_data + read_offset,
> +						      src_data + read_offset, bytes_to_copy);
>   
>   		src_data += buffer_size;
>   		dst_data += buffer_size;
Alan Previn Dec. 6, 2022, 9:35 p.m. UTC | #2
will have to get back on this - but it will be tied to a specific GuC version as opposed to a platform.

On Tue, 2022-12-06 at 10:14 +0000, Tvrtko Ursulin wrote:
> On 06/12/2022 09:20, Alan Previn wrote:
> > Add usage of unaligned wc mempy in read_update_log_buffer
> > as newer formats of GuC debug-log-events are no longer
> > guaranteed to be exactly 4-dwords long per event.
> 
> If this "newer format" applies to DG2 and GuC log has been "productized" 
> there (as in we expect to tell users please collect and attach), pick a 
> fixes tag so this gets into 6.2.
> 
> 

Alan: [snip]
Alan Previn Dec. 7, 2022, 9:20 a.m. UTC | #3
On Tue, 2022-12-06 at 21:35 +0000, Teres Alexis, Alan Previn wrote:
> On Tue, 2022-12-06 at 10:14 +0000, Tvrtko Ursulin wrote:
> > On 06/12/2022 09:20, Alan Previn wrote:
> > > Add usage of unaligned wc mempy in read_update_log_buffer
> > > as newer formats of GuC debug-log-events are no longer
> > > guaranteed to be exactly 4-dwords long per event.
> > 
> > If this "newer format" applies to DG2 and GuC log has been "productized" 
> > there (as in we expect to tell users please collect and attach), pick a 
> > fixes tag so this gets into 6.2.
> 
> 

the jump to possible 5 dword log-event was at 77b6f79df66ed2919dedb834edea630f40079f12.
Will fix this on next rev.
Tvrtko Ursulin Dec. 7, 2022, 10:17 a.m. UTC | #4
On 07/12/2022 09:20, Teres Alexis, Alan Previn wrote:
> 
> 
> On Tue, 2022-12-06 at 21:35 +0000, Teres Alexis, Alan Previn wrote:
>> On Tue, 2022-12-06 at 10:14 +0000, Tvrtko Ursulin wrote:
>>> On 06/12/2022 09:20, Alan Previn wrote:
>>>> Add usage of unaligned wc mempy in read_update_log_buffer
>>>> as newer formats of GuC debug-log-events are no longer
>>>> guaranteed to be exactly 4-dwords long per event.
>>>
>>> If this "newer format" applies to DG2 and GuC log has been "productized"
>>> there (as in we expect to tell users please collect and attach), pick a
>>> fixes tag so this gets into 6.2.
>>
>>
> 
> the jump to possible 5 dword log-event was at 77b6f79df66ed2919dedb834edea630f40079f12.
> Will fix this on next rev.

Right, Fixes: and cc stable 5.18+ then (for ADL-P), *if* the upstream 
logger tool actually works and we expect to asks users to use it.

Regards,

Tvrtko
Alan Previn Dec. 7, 2022, 6:15 p.m. UTC | #5
On Wed, 2022-12-07 at 10:17 +0000, Tvrtko Ursulin wrote:
> Right, Fixes: and cc stable 5.18+ then (for ADL-P), *if* the upstream 
> logger tool actually works and we expect to asks users to use it.
Righ, in that case, will skip the fixes tag since the logger is completely broken today upstream anyway and can't be fixed properly with the other patches in this series.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
index c5a7aecd08ac..2fa952916120 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
@@ -459,13 +459,16 @@  static void _guc_log_copy_debuglogs_for_relay(struct intel_guc_log *log)
 
 		/* Just copy the newly written data */
 		if (read_offset > write_offset) {
-			i915_memcpy_from_wc(dst_data, src_data, write_offset);
+			if (!i915_memcpy_from_wc(dst_data, src_data, write_offset))
+				i915_unaligned_memcpy_from_wc(dst_data, src_data, write_offset);
 			bytes_to_copy = buffer_size - read_offset;
 		} else {
 			bytes_to_copy = write_offset - read_offset;
 		}
-		i915_memcpy_from_wc(dst_data + read_offset,
-				    src_data + read_offset, bytes_to_copy);
+		if (!i915_memcpy_from_wc(dst_data + read_offset,
+					 src_data + read_offset, bytes_to_copy))
+			i915_unaligned_memcpy_from_wc(dst_data + read_offset,
+						      src_data + read_offset, bytes_to_copy);
 
 		src_data += buffer_size;
 		dst_data += buffer_size;