Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Manszewski, Christoph" <christoph.manszewski@intel.com>
To: "Dominik Karol Piątkowski" <dominik.karol.piatkowski@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	"Dominik Grzegorzek" <dominik.grzegorzek@intel.com>,
	"Pawel Sikora" <pawel.sikora@intel.com>,
	"Jonathan Cavitt" <jonathan.cavitt@intel.com>
Subject: Re: [PATCH v2 i-g-t 3/3] tests/intel/xe_eudebug: Add basic-vm-bind-ufence-sigint-client test
Date: Wed, 11 Dec 2024 22:26:44 +0100	[thread overview]
Message-ID: <862337aa-7a40-48f7-b77d-b0c5b2494892@intel.com> (raw)
In-Reply-To: <20241211135039.5853-4-dominik.karol.piatkowski@intel.com>

Hi Dominik

On 11.12.2024 14:50, Dominik Karol Piątkowski wrote:
> Add a test that gives user fence in application, holds it, sends SIGINT
> to client and checks if anything breaks.
> 
> Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@intel.com>
> ---
> v2:
> - Cleanup after the client in basic-vm-bind-ufence-sigint-client,
>    merge the test into test_basic_ufence
> ---
>   tests/intel/xe_eudebug.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/tests/intel/xe_eudebug.c b/tests/intel/xe_eudebug.c
> index 77ce905f0..c543eb064 100644
> --- a/tests/intel/xe_eudebug.c
> +++ b/tests/intel/xe_eudebug.c
> @@ -65,6 +65,7 @@ static void test_sysfs_toggle(int fd)
>   #define EXEC_QUEUES_PLACEMENTS		(1 << 8)
>   #define VM_BIND_DELAY_UFENCE_ACK	(1 << 9)
>   #define VM_BIND_UFENCE_RECONNECT	(1 << 10)
> +#define VM_BIND_UFENCE_SIGINT_CLIENT	(1 << 11)
>   #define TEST_DISCOVERY			(1 << 31)
>   
>   #define PAGE_SIZE SZ_4K
> @@ -2135,6 +2136,10 @@ static int wait_for_ufence_events(struct ufence_priv *priv, int timeout_ms)
>    * Description:
>    *	Give user fence in application, hold it, drop the debugger connection and check if anything
>    *	breaks. Expect that held acks are released when connection is dropped.
> + *
> + * SUBTEST: basic-vm-bind-ufence-sigint-client
> + * Description:
> + *	Give user fence in application, hold it, send SIGINT to client and check if anything breaks.
>    */
>   static void test_basic_ufence(int fd, unsigned int flags)
>   {
> @@ -2164,6 +2169,14 @@ static void test_basic_ufence(int fd, unsigned int flags)
>   	if (flags & VM_BIND_DELAY_UFENCE_ACK)
>   		sleep(XE_EUDEBUG_DEFAULT_TIMEOUT_SEC * 4 / 5);
>   
> +	if (flags & VM_BIND_UFENCE_SIGINT_CLIENT) {
> +		kill(c->pid, SIGINT);
> +		c->pid = 0;
> +		xe_eudebug_debugger_stop_worker(d, 1);
> +		xe_eudebug_event_log_print(d->log, true);
> +		goto end;
> +	}
> +
>   	if (flags & VM_BIND_UFENCE_RECONNECT) {
>   		filter = XE_EUDEBUG_FILTER_EVENT_VM_BIND | XE_EUDEBUG_FILTER_EVENT_VM |
>   				XE_EUDEBUG_FILTER_EVENT_OPEN;
> @@ -2181,6 +2194,7 @@ static void test_basic_ufence(int fd, unsigned int flags)
>   
>   	xe_eudebug_session_check(s, true, filter);
>   
> +end:

Well 'goto' has it's place, but I think we could do without it here. How 
about:

```
@@ -2149,7 +2166,28 @@ static void test_basic_ufence(int fd, unsigned 
int flags)
         xe_eudebug_debugger_wait_stage(s, 
STAGE_CLIENT_WAIT_ON_UFENCE_DONE);
         xe_eudebug_assert_f(d, wait_for_ufence_events(priv, 
XE_EUDEBUG_DEFAULT_TIMEOUT_SEC * MSEC_PER_SEC) == 0,
                             "missing ufence events\n");
-       ack_fences(d);
+
+       if (flags & VM_BIND_DELAY_UFENCE_ACK)
+               sleep(XE_EUDEBUG_DEFAULT_TIMEOUT_SEC * 4 / 5);
+
+       if (flags & VM_BIND_UFENCE_SIGINT_CLIENT) {
+               /* Killing client so client log will be empty */
+               filter = XE_EUDEBUG_FILTER_ALL;
+
+               kill(c->pid, SIGINT);
+               c->pid = 0;
+               c->done = 1;
+       } else if (flags & VM_BIND_UFENCE_RECONNECT) {
+               /* Reconnecting debugger after client is done, debugger 
log will be cut */
+               filter = XE_EUDEBUG_FILTER_EVENT_VM_BIND | 
XE_EUDEBUG_FILTER_EVENT_VM |
+                        XE_EUDEBUG_FILTER_EVENT_OPEN;
+
+               xe_eudebug_debugger_detach(d);
+               xe_eudebug_client_wait_done(c);
+               igt_assert_eq(xe_eudebug_debugger_attach(d, c), 0);
+       } else {
+               ack_fences(d);
+       }
```

We have one central place which determines the way we release the 
fences, the rest of the function is common.

Note: this code uses "XE_EUDEBUG_FILTER_ALL" which is currently broken - 
I've sent a fix here: https://patchwork.freedesktop.org/series/142438/

Thanks,
Christoph



>   	xe_eudebug_session_destroy(s);
>   	ufence_priv_destroy(priv);
>   }
> @@ -2842,6 +2856,9 @@ igt_main
>   	igt_subtest("basic-vm-bind-ufence-reconnect")
>   		test_basic_ufence(fd, VM_BIND_UFENCE_RECONNECT);
>   
> +	igt_subtest("basic-vm-bind-ufence-sigint-client")
> +		test_basic_ufence(fd, VM_BIND_UFENCE_SIGINT_CLIENT);
> +
>   	igt_subtest("vma-ufence")
>   		test_vma_ufence(fd, 0);
>   

  reply	other threads:[~2024-12-11 21:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 13:50 [PATCH v2 i-g-t 0/3] tests/intel/xe_eudebug: Introduce additional ufence testcases Dominik Karol Piątkowski
2024-12-11 13:50 ` [PATCH v2 i-g-t 1/3] tests/intel/xe_eudebug: Add basic-vm-bind-ufence-delay-ack test Dominik Karol Piątkowski
2024-12-11 13:50 ` [PATCH v2 i-g-t 2/3] tests/intel/xe_eudebug: Add basic-vm-bind-ufence-reconnect test Dominik Karol Piątkowski
2024-12-11 19:29   ` Manszewski, Christoph
2024-12-11 13:50 ` [PATCH v2 i-g-t 3/3] tests/intel/xe_eudebug: Add basic-vm-bind-ufence-sigint-client test Dominik Karol Piątkowski
2024-12-11 21:26   ` Manszewski, Christoph [this message]
2024-12-11 17:38 ` ✓ i915.CI.BAT: success for tests/intel/xe_eudebug: Introduce additional ufence testcases (rev2) Patchwork
2024-12-11 18:25 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-11 19:26 ` ✗ i915.CI.Full: failure " Patchwork
2024-12-11 20:58 ` ✗ Xe.CI.Full: " 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=862337aa-7a40-48f7-b77d-b0c5b2494892@intel.com \
    --to=christoph.manszewski@intel.com \
    --cc=dominik.grzegorzek@intel.com \
    --cc=dominik.karol.piatkowski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jonathan.cavitt@intel.com \
    --cc=pawel.sikora@intel.com \
    --cc=zbigniew.kempczynski@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