Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
	Matthew Auld <matthew.auld@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 3/3] drm/xe: Warn on NULL job when user fence used in xe_sync_entry_signal
Date: Mon, 18 Mar 2024 10:27:06 +0100	[thread overview]
Message-ID: <125c0aad-2dbf-4b80-a68f-08ba0d05003f@intel.com> (raw)
In-Reply-To: <ZfT1zdhMaNhvCZZa@DUT025-TGLU.fm.intel.com>


On 3/16/2024 2:28 AM, Matthew Brost wrote:
> On Thu, Mar 14, 2024 at 10:53:20AM +0000, Matthew Auld wrote:
>> On 14/03/2024 09:54, Nirmoy Das wrote:
>>> Added a check and warn for NULL job when sync->type is
>>> DRM_XE_SYNC_TYPE_USER_FENCE to prevent potential crashes
>>> and aid in debugging
>>>
>>> Cc: Matthew Auld <matthew.auld@intel.com>
>>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>>> ---
>>>    drivers/gpu/drm/xe/xe_sync.c | 10 +++++++---
>>>    1 file changed, 7 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
>>> index 02c9577fe418..fae466ba8e75 100644
>>> --- a/drivers/gpu/drm/xe/xe_sync.c
>>> +++ b/drivers/gpu/drm/xe/xe_sync.c
>>> @@ -255,9 +255,13 @@ void xe_sync_entry_signal(struct xe_sync_entry *sync, struct xe_sched_job *job,
>>>    			dma_fence_put(fence);
>>>    		}
>>>    	} else if (sync->type == DRM_XE_SYNC_TYPE_USER_FENCE) {
>>> -		job->user_fence.used = true;
>>> -		job->user_fence.addr = sync->addr;
>>> -		job->user_fence.value = sync->timeline_value;
>>> +		if (job) {
>>> +			job->user_fence.used = true;
>>> +			job->user_fence.addr = sync->addr;
>>> +			job->user_fence.value = sync->timeline_value;
>>> +		} else {
>>> +			XE_WARN_ON("NULL job passed with DRM_XE_SYNC_TYPE_USER_FENCE");
>> Just wondering if it might be better to just let it crash if that ever
>> happens? Assumption is that it's impossible and would be programmer error.
>>
>> Matt, any thoughts here?
>>
> The usage is probably add an xe_assert(xe, job) and then let the kernel crash.

xe_assert() would require passing xe device struct which is probably bit too much. How about a XE_WARN_ON(job) ?

Regards,
Nirmoy

>
> Matt
>
>>> +		}
>>>    	}
>>>    }

  reply	other threads:[~2024-03-18  9:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  9:54 [PATCH 1/3] drm/xe: Fix out-of-bounds warning in vm_bind_ioctl_check_args Nirmoy Das
2024-03-14  9:54 ` [PATCH 2/3] drm/xe: Fix potential integer overflow in page size calculation Nirmoy Das
2024-03-14 10:24   ` Matthew Auld
2024-03-14  9:54 ` [PATCH 3/3] drm/xe: Warn on NULL job when user fence used in xe_sync_entry_signal Nirmoy Das
2024-03-14 10:53   ` Matthew Auld
2024-03-16  1:28     ` Matthew Brost
2024-03-18  9:27       ` Nirmoy Das [this message]
2024-03-14 10:15 ` ✓ CI.Patch_applied: success for series starting with [1/3] drm/xe: Fix out-of-bounds warning in vm_bind_ioctl_check_args Patchwork
2024-03-14 10:15 ` ✓ CI.checkpatch: " Patchwork
2024-03-14 10:20 ` ✓ CI.KUnit: " Patchwork
2024-03-14 10:30 ` ✓ CI.Build: " Patchwork
2024-03-14 10:36 ` ✓ CI.Hooks: " Patchwork
2024-03-14 10:37 ` ✓ CI.checksparse: " Patchwork
2024-03-14 10:55 ` [PATCH 1/3] " Matthew Auld
2024-03-16  1:29   ` Matthew Brost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=125c0aad-2dbf-4b80-a68f-08ba0d05003f@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox