Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Welty, Brian" <brian.welty@intel.com>
To: "Chang, Yu bruce" <yu.bruce.chang@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Zeng, Oak" <oak.zeng@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] tests/xe add invalid va access tests
Date: Wed, 30 Aug 2023 18:11:26 -0700	[thread overview]
Message-ID: <72482193-465f-f64e-d629-689d4c3dc753@intel.com> (raw)
In-Reply-To: <CY8PR11MB6940CD509FC3777E87B245A2C3E5A@CY8PR11MB6940.namprd11.prod.outlook.com>



On 8/30/2023 5:26 PM, Chang, Yu bruce wrote:
> 
> 
...
>>
>> Do we need some verification here that driver did proper thing when
>> encountering invalid va.  Meaning there was some different behavior with
>> scratch page we can observe?
>> Without DRM_XE_VM_CREATE_SCRATCH_PAGE, program is terminated?  Are
>> we
>> banning the context like i915 was doing?
>>
> 
> Good point, now is a manual check for the log for a reset message, I can look into
> To automate it.
> 

Isn't the xe_wait_ufence() supposed to somehow inform that something 
actually failed with the xe_exec?
I notice you are using _xe_wait_ufence instead of xe_wait_ufence().
It gives an error?

You mentioned that the engine was reset....  was is the effect of that?
Maybe a subsequent xe_exec() will fail?   Just grasping at some 
user-space visible things you can try easily.  I don't know myself, new 
code...

-Brian


> Thanks,
> Bruce
> 
>>> +
>>> +	if ((flags & DRM_XE_VM_CREATE_FAULT_MODE) &&
>>> +	    (flags & DRM_XE_VM_CREATE_SCRATCH_PAGE)) {
>>> +		/* bind inv_addr after scratch page was created */
>>> +		sync.addr = to_user_pointer(&data->vm_sync);
>>> +		xe_vm_bind_async_flags(fd, vm, 0, bo, 0,
>>> +				inv_addr, bo_size, &sync, 1,
>>> +				XE_VM_BIND_FLAG_IMMEDIATE);
>>> +		xe_wait_ufence(fd, &data->vm_sync, USER_FENCE_VALUE,
>> NULL, ONE_SEC);
>>> +		data->vm_sync = 0;
>>> +		data->data = 0;
>>> +		sync.addr = addr + offsetof(struct _data, sync);
>>> +		xe_exec(fd, &exec);
>>> +		xe_wait_ufence(fd, &data->sync, USER_FENCE_VALUE, NULL,
>> ONE_SEC);
>>> +		igt_assert_eq(data->data, STORE_DATA);
>>> +	}
>>> +
>>> +	sync.addr = to_user_pointer(&data->vm_sync);
>>> +	xe_vm_unbind_async(fd, vm, 0, 0, addr, bo_size, &sync, 1);
>>> +	xe_wait_ufence(fd, &data->vm_sync, USER_FENCE_VALUE, NULL,
>> ONE_SEC);
>>> +	data->vm_sync = 0;
>>> +	xe_vm_unbind_async(fd, vm, 0, 0, inv_addr, bo_size, &sync, 1);
>>> +	xe_wait_ufence(fd, &data->vm_sync, USER_FENCE_VALUE, NULL,
>> ONE_SEC);
>>> +	xe_exec_queue_destroy(fd, exec.exec_queue_id);
>>> +	munmap(data, bo_size);
>>> +	gem_close(fd, bo);
>>> +	xe_vm_destroy(fd, vm);
>>> +}
>>> +
>>> +igt_main
>>> +{
>>> +	const struct section {
>>> +		const char *name;
>>> +		unsigned int flags;
>>> +	} sections[] = {
>>> +		{ "invalid-va", 0 },
>>> +		{ "invalid-va-scratch", DRM_XE_VM_CREATE_SCRATCH_PAGE
>> },
>>> +		{ "invalid-va-fault", DRM_XE_VM_CREATE_FAULT_MODE },
>>> +		{ "invalid-va-fault-scratch",
>> DRM_XE_VM_CREATE_FAULT_MODE |
>>> +
>> DRM_XE_VM_CREATE_SCRATCH_PAGE },
>>> +		{ NULL },
>>> +	};
>>> +	int fd;
>>> +
>>> +	igt_fixture {
>>> +		fd = drm_open_driver(DRIVER_XE);
>>> +		igt_require(xe_supports_faults(fd));
>>> +	}
>>> +
>>> +	for (const struct section *s = sections; s->name; s++) {
>>> +		igt_subtest_f("%s", s->name)
>>> +			test_exec(fd, s->flags);
>>> +	}
>>> +
>>> +	igt_fixture
>>> +		drm_close_driver(fd);
>>> +}
>>> +

  reply	other threads:[~2023-08-31  1:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 23:05 [igt-dev] [PATCH i-g-t] tests/xe add invalid va access tests Chang, Bruce
2023-08-29 23:32 ` [igt-dev] ✗ GitLab.Pipeline: warning for tests/xe add invalid va access tests (rev2) Patchwork
2023-08-30  0:03 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
2023-08-30  0:07 ` [igt-dev] ✓ Fi.CI.BAT: " Patchwork
2023-08-30  9:53 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-08-30 22:56 ` [igt-dev] [PATCH i-g-t] tests/xe add invalid va access tests Welty, Brian
2023-08-31  0:26   ` Chang, Yu bruce
2023-08-31  1:11     ` Welty, Brian [this message]
2023-09-01  0:09       ` Chang, Yu bruce
  -- strict thread matches above, loose matches on Subject: below --
2023-08-31 23:46 Chang, Bruce
2023-09-01  0:25 ` Welty, Brian
2023-09-01 12:16 ` Kamil Konieczny
2023-09-01 23:56   ` Chang, Yu bruce
2023-08-28 18:53 Chang, Bruce

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=72482193-465f-f64e-d629-689d4c3dc753@intel.com \
    --to=brian.welty@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=oak.zeng@intel.com \
    --cc=yu.bruce.chang@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