Skip to contentSkip to conversation

drm/xe/exec: Fix minor bug related to xe_sync_entry_cleanup

PATCH In review Ashutosh Dixit 2 participants 2 messages Jul 11, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/xe/exec: Fix minor bug related to xe_sync_entry_cleanup

Increment num_syncs after xe_sync_entry_parse() is successful to ensure the xe_sync_entry_cleanup() logic under "err_syncs" label works correctly.

---
 drivers/gpu/drm/xe/xe_exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_exec.c +2 -2
index 2d72cdec3a0b..95c0b21096f0 100644
@@ -156,8 +156,8 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 
 	vm = q->vm;
 
-	for (i = 0; i < args->num_syncs; i++) {
-		err = xe_sync_entry_parse(xe, xef, &syncs[num_syncs++],
+	for (i = 0; i < args->num_syncs; i++, num_syncs++) {
+		err = xe_sync_entry_parse(xe, xef, &syncs[i],
 					  &syncs_user[i], SYNC_PARSE_FLAG_EXEC |
 					  (xe_vm_in_lr_mode(vm) ?
 					   SYNC_PARSE_FLAG_LR_MODE : 0));
Signature · 1 line
2.41.0
maintainer
#1 lore raw
Quoted 3 lines · Ashutosh Dixit

Increment num_syncs after xe_sync_entry_parse() is successful to ensure the xe_sync_entry_cleanup() logic under "err_syncs" label works correctly.

Patch LGTM. A couple of nits though.

Fixes tag?

Quoted 10 lines
---
 drivers/gpu/drm/xe/xe_exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_exec.c +0 -0
index 2d72cdec3a0b..95c0b21096f0 100644

drivers/gpu/drm/xe/xe_exec.c int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · line 159

Quoted 6 lines
drivers/gpu/drm/xe/xe_exec.c +1 -2
@@ -156,8 +156,8 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 
 	vm = q->vm;
 
-	for (i = 0; i < args->num_syncs; i++) {
-		err = xe_sync_entry_parse(xe, xef, &syncs[num_syncs++],
+	for (i = 0; i < args->num_syncs; i++, num_syncs++) {

How about?

'for (num_syncs = 0; num_syncs < args->num_syncs; num_syncs++) {'

This is what we do in xe_vm.c.

Matt

Quoted 7 lines
drivers/gpu/drm/xe/xe_exec.c +1 -0
+		err = xe_sync_entry_parse(xe, xef, &syncs[i],
 					  &syncs_user[i], SYNC_PARSE_FLAG_EXEC |
 					  (xe_vm_in_lr_mode(vm) ?
 					   SYNC_PARSE_FLAG_LR_MODE : 0));
Signature · 1 line
2.41.0