Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	<igt-dev@lists.freedesktop.org>,
	Alan Previn <alan.previn.teres.alexis@intel.com>
Subject: Re: [PATCH i-g-t v3 6/7] tests/intel/xe_pxp: Termination tests
Date: Thu, 20 Feb 2025 16:44:11 -0800	[thread overview]
Message-ID: <86720f95-f7fe-4a9f-bed8-8ba7b16866a6@intel.com> (raw)
In-Reply-To: <20250214200754.epzvsyei2oas4wei@kamilkon-desk.igk.intel.com>



On 2/14/2025 12:07 PM, Kamil Konieczny wrote:
> Hi Daniele,
> On 2025-02-12 at 16:39:00 -0800, Daniele Ceraolo Spurio wrote:
>> There are several events that can cause the PXP key to be invalidated
>> and trigger a PXP termination (suspend, PXP termination irq). After a
>> termination, we expect the key to be different and the raw encrypted
>> data to change for the same source data.
>> Additionally, all PXP objects are invalidated during a termination and
>> can no longer be used in submission or kept mapped to VMs; we therefore
>> need to test both the execution and bind ioctls to make sure they work
>> as expected after a termination.
>>
>> v2: move igt_require calls inside the subtest
>> v3: block rpm for tests trying a different type of termination, rework
>> invalid bind test to try a new vm as well (Alan)
> I have few nits, one is from our CI fail:
>
> ../tests/intel/xe_pxp.c:1065:53: error: ‘O_RDONLY’ undeclared (first use in this function); did you mean ‘STA_RONLY’?
> fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY);
>                                                    ^~~~~~~~
> 						 STA_RONLY
> ../tests/intel/xe_pxp.c:1065:53: note: each undeclared identifier is reported only once for each function it appears in
>
> Please include a proper lib header in a first patch which uses O_RDONLY.

This builds fine for me locally, I guess I'm getting O_RDONLY from some 
system include. I'll fix it.

>
> Rest nits below.
>
>> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>> Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
>> ---
>>   lib/intel_batchbuffer.c |   8 +-
>>   lib/intel_batchbuffer.h |   1 +
>>   lib/xe/xe_ioctl.c       |  12 +-
>>   lib/xe/xe_ioctl.h       |   2 +
>>   tests/intel/xe_pxp.c    | 455 +++++++++++++++++++++++++++++++++++++++-
>>   5 files changed, 465 insertions(+), 13 deletions(-)
>>
> [...]
>>   
>> +static void termination_tests(int fd, bool pxp_supported, uint32_t devid,
>> +			      enum termination_type type, const char *tag)
>> +{
>> +	int fw_handle;
>> +
>> +	if (type != PXP_TERMINATION_RPM) {
>> +		/* avoid rpm entry for non-rpm tests */
>> +		fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY);
> File or dir opens should happen in igt_fixture
>
>> +		igt_require(fw_handle >= 0);
> This should be in each subtest which needs this.
>
>> +	} else {
>> +		igt_setup_runtime_pm(fd);
> This should also be in fixture, consider creating xe_pxp_pm test.
>
>> +	}
>> +
>> +	igt_subtest_f("pxp-termination-key-update-post-%s", tag) {
>> +		require_pxp_render(pxp_supported, devid);
>> +		test_pxp_teardown_keychange(fd, type);
>> +	}
>> +	igt_subtest_f("pxp-stale-bo-bind-post-%s", tag) {
>> +		require_pxp(pxp_supported);
>> +		test_pxp_stale_bo_bind(fd, type);
>> +	}
>> +	igt_subtest_f("pxp-stale-bo-exec-post-%s", tag) {
>> +		require_pxp(pxp_supported);
>> +		test_pxp_stale_bo_exec(fd, type);
>> +	}
>> +
>> +	/* An active PXP queue holds an RPM ref, so we can't test RPM with it */
>> +	if (type != PXP_TERMINATION_RPM) {
>> +		igt_subtest_f("pxp-stale-queue-post-%s", tag) {
>> +			require_pxp(pxp_supported);
>> +			test_pxp_stale_queue_execution(fd, type);
>> +		}
>> +
>> +		close(fw_handle);
>> +	} else {
>> +		igt_restore_runtime_pm();
>> +	}
> Same here, both close() and ...restore...() should be done in
> igt_fixture { ... }
>
> To test if all is ok call your test with --show-testlist
> without sudo:
>
> ./xe_pxp --show-testlist

is it ok if I move everything inside igt_subtest, without using 
igt_fixture? it makes things much simpler in code and I'm getting no 
errors from --show-testlist when doing so.

Thanks,
Daniele

>
> Regards,
> Kamil
>
>> +}
>> +
>>   igt_main
>>   {
>>   	int xe_fd = -1;
>> @@ -470,6 +891,28 @@ igt_main
>>   		}
>>   	}
>>   
>> +	igt_subtest_group {
>> +		const struct mode {
>> +			enum termination_type type;
>> +			const char *tag;
>> +		} modes[] = {
>> +			{ PXP_TERMINATION_IRQ, "termination-irq" },
>> +			{ PXP_TERMINATION_SUSPEND, "suspend" },
>> +			{ PXP_TERMINATION_RPM, "rpm" },
>> +			{ 0, NULL }
>> +		};
>> +
>> +		igt_describe("Verify teardown management");
>> +
>> +		for (const struct mode *m = modes; m->tag; m++)
>> +			termination_tests(xe_fd, pxp_supported, devid, m->type, m->tag);
>> +
>> +		igt_subtest("pxp-optout") {
>> +			require_pxp(pxp_supported);
>> +			test_pxp_optout(xe_fd);
>> +		}
>> +	}
>> +
>>   	igt_fixture {
>>   		close(xe_fd);
>>   	}
>> -- 
>> 2.43.0
>>


  reply	other threads:[~2025-02-21  0:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13  0:38 [PATCH i-g-t v3 0/7] Xe: Add tests for PXP Daniele Ceraolo Spurio
2025-02-13  0:38 ` [PATCH i-g-t v3 1/7] drm-uapi/xe: Sync with PXP uapi updates Daniele Ceraolo Spurio
2025-02-13 22:38   ` Teres Alexis, Alan Previn
2025-02-13  0:38 ` [PATCH i-g-t v3 2/7] tests/intel/xe_vm: Update invalid flag subtest with valid PXP flag Daniele Ceraolo Spurio
2025-02-13  0:38 ` [PATCH i-g-t v3 3/7] tests/intel/xe_query: Add test for PXP status query Daniele Ceraolo Spurio
2025-02-13  0:38 ` [PATCH i-g-t v3 4/7] tests/intel/xe_pxp: Add PXP object and queue creation tests Daniele Ceraolo Spurio
2025-02-13  0:38 ` [PATCH i-g-t v3 5/7] tests/intel/xe_pxp: Test PXP submissions Daniele Ceraolo Spurio
2025-02-13 22:47   ` Teres Alexis, Alan Previn
2025-02-13  0:39 ` [PATCH i-g-t v3 6/7] tests/intel/xe_pxp: Termination tests Daniele Ceraolo Spurio
2025-02-13 23:30   ` Teres Alexis, Alan Previn
2025-02-14 20:07   ` Kamil Konieczny
2025-02-21  0:44     ` Daniele Ceraolo Spurio [this message]
2025-02-13  0:39 ` [PATCH i-g-t v3 7/7] tests/intel/xe_pxp: Test encrypted FBs Daniele Ceraolo Spurio
2025-02-13  2:58 ` ✗ GitLab.Pipeline: warning for Xe: Add tests for PXP (rev3) Patchwork

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=86720f95-f7fe-4a9f-bed8-8ba7b16866a6@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=alan.previn.teres.alexis@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.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