Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/amdgpu: Fix compilation warnings for USERQ
@ 2025-06-11 14:04 Kamil Konieczny
  2025-06-11 15:21 ` Khatri, Sunil
  0 siblings, 1 reply; 3+ messages in thread
From: Kamil Konieczny @ 2025-06-11 14:04 UTC (permalink / raw)
  To: igt-dev; +Cc: Kamil Konieczny, Sunil Khatri, Vitaly Prosyak

Recent change bringed compilation warnings, for example:

../tests/amdgpu/amd_security.c: In function '__igt_unique____real_main311':
../tests/amdgpu/amd_security.c:319:14: warning: variable 'enable_test' set but not used [-Wunused-but-set-variable]
  319 |         bool enable_test = false;

Fix this and move setting var into igt_fixture.
Also while at this, print if AMDGPU_USERQ_ENABLED was defined.

Cc: Sunil Khatri <sunil.khatri@amd.com>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>
Fixes: dad4b2bb9e5a ("tests/amdgpu: add environment variable to enable tests")
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/amdgpu/amd_cs_nop.c   | 10 ++++++++--
 tests/amdgpu/amd_deadlock.c | 11 +++++++++--
 tests/amdgpu/amd_security.c | 10 ++++++++--
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/tests/amdgpu/amd_cs_nop.c b/tests/amdgpu/amd_cs_nop.c
index 644016d5d..24fae3635 100644
--- a/tests/amdgpu/amd_cs_nop.c
+++ b/tests/amdgpu/amd_cs_nop.c
@@ -173,8 +173,11 @@ igt_main
 	bool userq_arr_cap[AMD_IP_MAX] = {0};
 	bool enable_test;
 	const char *env = getenv("AMDGPU_DISABLE_USERQTEST");
-
-	enable_test = env && atoi(env);
+#ifdef AMDGPU_USERQ_ENABLED
+	const char *enable_str = "USERQTEST enabled";
+#else
+	const char *enable_str = "USERQTEST not enabled";
+#endif
 
 	igt_fixture {
 		uint32_t major, minor;
@@ -189,6 +192,9 @@ igt_main
 		igt_assert_eq(err, 0);
 		asic_rings_readness(device, 1, arr_cap);
 		asic_userq_readiness(device, userq_arr_cap);
+		enable_test = env && atoi(env);
+		if (enable_test)
+			igt_info("%s\n", enable_str);
 	}
 
 	for (p = phase; p->name; p++) {
diff --git a/tests/amdgpu/amd_deadlock.c b/tests/amdgpu/amd_deadlock.c
index 45a864feb..d416b4909 100644
--- a/tests/amdgpu/amd_deadlock.c
+++ b/tests/amdgpu/amd_deadlock.c
@@ -45,8 +45,11 @@ igt_main
 	struct pci_addr pci;
 	bool enable_test = false;
 	const char *env = getenv("AMDGPU_DISABLE_USERQTEST");
-
-	enable_test = env && atoi(env);
+#ifdef AMDGPU_USERQ_ENABLED
+	const char *enable_str = "USERQTEST enabled";
+#else
+	const char *enable_str = "USERQTEST not enabled";
+#endif
 
 	igt_fixture {
 		uint32_t major, minor;
@@ -71,6 +74,10 @@ igt_main
 		igt_skip_on(get_pci_addr_from_fd(fd, &pci));
 		igt_info("PCI Address: domain %04x, bus %02x, device %02x, function %02x\n",
 				pci.domain, pci.bus, pci.device, pci.function);
+		enable_test = env && atoi(env);
+		if (enable_test)
+			igt_info("%s\n", enable_str);
+
 	}
 	igt_describe("Test-GPU-reset-by-flooding-sdma-ring-with-jobs");
 	igt_subtest_with_dynamic("amdgpu-deadlock-sdma") {
diff --git a/tests/amdgpu/amd_security.c b/tests/amdgpu/amd_security.c
index 45bd7e771..891d8f577 100644
--- a/tests/amdgpu/amd_security.c
+++ b/tests/amdgpu/amd_security.c
@@ -318,8 +318,11 @@ igt_main
 	bool userq_arr_cap[AMD_IP_MAX] = {0};
 	bool enable_test = false;
 	const char *env = getenv("AMDGPU_DISABLE_USERQTEST");
-
-	enable_test = env && atoi(env);
+#ifdef AMDGPU_USERQ_ENABLED
+	const char *enable_str = "USERQTEST enabled";
+#else
+	const char *enable_str = "USERQTEST not enabled";
+#endif
 
 	igt_fixture {
 		uint32_t major, minor;
@@ -338,6 +341,9 @@ igt_main
 		igt_assert_eq(r, 0);
 		asic_userq_readiness(device, userq_arr_cap);
 		igt_skip_on(!is_security_tests_enable(device, &gpu_info, major, minor));
+		enable_test = env && atoi(env);
+		if (enable_test)
+			igt_info("%s\n", enable_str);
 	}
 
 	igt_describe("amdgpu security alloc buf test");
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH i-g-t] tests/amdgpu: Fix compilation warnings for USERQ
  2025-06-11 14:04 [PATCH i-g-t] tests/amdgpu: Fix compilation warnings for USERQ Kamil Konieczny
@ 2025-06-11 15:21 ` Khatri, Sunil
  2025-06-11 17:12   ` Kamil Konieczny
  0 siblings, 1 reply; 3+ messages in thread
From: Khatri, Sunil @ 2025-06-11 15:21 UTC (permalink / raw)
  To: Kamil Konieczny, igt-dev; +Cc: Sunil Khatri, Vitaly Prosyak

[-- Attachment #1: Type: text/plain, Size: 4252 bytes --]


On 6/11/2025 7:34 PM, Kamil Konieczny wrote:
> Recent change bringed compilation warnings, for example:
>
> ../tests/amdgpu/amd_security.c: In function '__igt_unique____real_main311':
> ../tests/amdgpu/amd_security.c:319:14: warning: variable 'enable_test' set but not used [-Wunused-but-set-variable]
>    319 |         bool enable_test = false;
>
> Fix this and move setting var into igt_fixture.
> Also while at this, print if AMDGPU_USERQ_ENABLED was defined.
>
> Cc: Sunil Khatri<sunil.khatri@amd.com>
> Cc: Vitaly Prosyak<vitaly.prosyak@amd.com>
> Fixes: dad4b2bb9e5a ("tests/amdgpu: add environment variable to enable tests")
> Signed-off-by: Kamil Konieczny<kamil.konieczny@linux.intel.com>
> ---
>   tests/amdgpu/amd_cs_nop.c   | 10 ++++++++--
>   tests/amdgpu/amd_deadlock.c | 11 +++++++++--
>   tests/amdgpu/amd_security.c | 10 ++++++++--
>   3 files changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/tests/amdgpu/amd_cs_nop.c b/tests/amdgpu/amd_cs_nop.c
> index 644016d5d..24fae3635 100644
> --- a/tests/amdgpu/amd_cs_nop.c
> +++ b/tests/amdgpu/amd_cs_nop.c
> @@ -173,8 +173,11 @@ igt_main
>   	bool userq_arr_cap[AMD_IP_MAX] = {0};
>   	bool enable_test;
>   	const char *env = getenv("AMDGPU_DISABLE_USERQTEST");
> -
> -	enable_test = env && atoi(env);
> +#ifdef AMDGPU_USERQ_ENABLED
> +	const char *enable_str = "USERQTEST enabled";
> +#else
> +	const char *enable_str = "USERQTEST not enabled";
> +#endif
>   
>   	igt_fixture {
>   		uint32_t major, minor;
> @@ -189,6 +192,9 @@ igt_main
>   		igt_assert_eq(err, 0);
>   		asic_rings_readness(device, 1, arr_cap);
>   		asic_userq_readiness(device, userq_arr_cap);
> +		enable_test = env && atoi(env);
> +		if (enable_test)
> +			igt_info("%s\n", enable_str);
>   	}
>   
>   	for (p = phase; p->name; p++) {
> diff --git a/tests/amdgpu/amd_deadlock.c b/tests/amdgpu/amd_deadlock.c
> index 45a864feb..d416b4909 100644
> --- a/tests/amdgpu/amd_deadlock.c
> +++ b/tests/amdgpu/amd_deadlock.c
> @@ -45,8 +45,11 @@ igt_main
>   	struct pci_addr pci;
>   	bool enable_test = false;
>   	const char *env = getenv("AMDGPU_DISABLE_USERQTEST");
> -
> -	enable_test = env && atoi(env);
> +#ifdef AMDGPU_USERQ_ENABLED
> +	const char *enable_str = "USERQTEST enabled";
> +#else
> +	const char *enable_str = "USERQTEST not enabled";
> +#endif
>   
>   	igt_fixture {
>   		uint32_t major, minor;
> @@ -71,6 +74,10 @@ igt_main
>   		igt_skip_on(get_pci_addr_from_fd(fd, &pci));
>   		igt_info("PCI Address: domain %04x, bus %02x, device %02x, function %02x\n",
>   				pci.domain, pci.bus, pci.device, pci.function);
> +		enable_test = env && atoi(env);
> +		if (enable_test)
> +			igt_info("%s\n", enable_str);

enable_test is for test specific which arent supported by user queues in 
kernel driver yet but the enable_str only says user queues is supported 
and not test specific. So both are for different purposes

all together. I see the warning is coming when AMDGPU_USERQ_ENABLED is 
not set and in that case the variable enable_test is unused.

> +
>   	}
>   	igt_describe("Test-GPU-reset-by-flooding-sdma-ring-with-jobs");
>   	igt_subtest_with_dynamic("amdgpu-deadlock-sdma") {
> diff --git a/tests/amdgpu/amd_security.c b/tests/amdgpu/amd_security.c
> index 45bd7e771..891d8f577 100644
> --- a/tests/amdgpu/amd_security.c
> +++ b/tests/amdgpu/amd_security.c
> @@ -318,8 +318,11 @@ igt_main
>   	bool userq_arr_cap[AMD_IP_MAX] = {0};
>   	bool enable_test = false;
>   	const char *env = getenv("AMDGPU_DISABLE_USERQTEST");
> -
> -	enable_test = env && atoi(env);
> +#ifdef AMDGPU_USERQ_ENABLED
> +	const char *enable_str = "USERQTEST enabled";
> +#else
> +	const char *enable_str = "USERQTEST not enabled";
> +#endif
>   
>   	igt_fixture {
>   		uint32_t major, minor;
> @@ -338,6 +341,9 @@ igt_main
>   		igt_assert_eq(r, 0);
>   		asic_userq_readiness(device, userq_arr_cap);
>   		igt_skip_on(!is_security_tests_enable(device, &gpu_info, major, minor));
> +		enable_test = env && atoi(env);
> +		if (enable_test)
> +			igt_info("%s\n", enable_str);

We dont want this based on enable_test as its for a different purpose 
all together. Without that the enable_test will again be unused.

Regards
Sunil Khatri

>   	}
>   
>   	igt_describe("amdgpu security alloc buf test");

[-- Attachment #2: Type: text/html, Size: 5350 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH i-g-t] tests/amdgpu: Fix compilation warnings for USERQ
  2025-06-11 15:21 ` Khatri, Sunil
@ 2025-06-11 17:12   ` Kamil Konieczny
  0 siblings, 0 replies; 3+ messages in thread
From: Kamil Konieczny @ 2025-06-11 17:12 UTC (permalink / raw)
  To: Khatri, Sunil; +Cc: igt-dev, Sunil Khatri, Vitaly Prosyak

Hi Khatri,,
On 2025-06-11 at 20:51:46 +0530, Khatri, Sunil wrote:
> 
> On 6/11/2025 7:34 PM, Kamil Konieczny wrote:
> > Recent change bringed compilation warnings, for example:
> > 
> > ../tests/amdgpu/amd_security.c: In function '__igt_unique____real_main311':
> > ../tests/amdgpu/amd_security.c:319:14: warning: variable 'enable_test' set but not used [-Wunused-but-set-variable]
> >    319 |         bool enable_test = false;
> > 
> > Fix this and move setting var into igt_fixture.
> > Also while at this, print if AMDGPU_USERQ_ENABLED was defined.
> > 
> > Cc: Sunil Khatri<sunil.khatri@amd.com>
> > Cc: Vitaly Prosyak<vitaly.prosyak@amd.com>
> > Fixes: dad4b2bb9e5a ("tests/amdgpu: add environment variable to enable tests")
> > Signed-off-by: Kamil Konieczny<kamil.konieczny@linux.intel.com>
> > ---
> >   tests/amdgpu/amd_cs_nop.c   | 10 ++++++++--
> >   tests/amdgpu/amd_deadlock.c | 11 +++++++++--
> >   tests/amdgpu/amd_security.c | 10 ++++++++--
> >   3 files changed, 25 insertions(+), 6 deletions(-)
> > 
> > diff --git a/tests/amdgpu/amd_cs_nop.c b/tests/amdgpu/amd_cs_nop.c
> > index 644016d5d..24fae3635 100644
> > --- a/tests/amdgpu/amd_cs_nop.c
> > +++ b/tests/amdgpu/amd_cs_nop.c
> > @@ -173,8 +173,11 @@ igt_main
> >   	bool userq_arr_cap[AMD_IP_MAX] = {0};
> >   	bool enable_test;
> >   	const char *env = getenv("AMDGPU_DISABLE_USERQTEST");
> > -
> > -	enable_test = env && atoi(env);
> > +#ifdef AMDGPU_USERQ_ENABLED
> > +	const char *enable_str = "USERQTEST enabled";
> > +#else
> > +	const char *enable_str = "USERQTEST not enabled";
> > +#endif
> >   	igt_fixture {
> >   		uint32_t major, minor;
> > @@ -189,6 +192,9 @@ igt_main
> >   		igt_assert_eq(err, 0);
> >   		asic_rings_readness(device, 1, arr_cap);
> >   		asic_userq_readiness(device, userq_arr_cap);
> > +		enable_test = env && atoi(env);
> > +		if (enable_test)
> > +			igt_info("%s\n", enable_str);
> >   	}
> >   	for (p = phase; p->name; p++) {
> > diff --git a/tests/amdgpu/amd_deadlock.c b/tests/amdgpu/amd_deadlock.c
> > index 45a864feb..d416b4909 100644
> > --- a/tests/amdgpu/amd_deadlock.c
> > +++ b/tests/amdgpu/amd_deadlock.c
> > @@ -45,8 +45,11 @@ igt_main
> >   	struct pci_addr pci;
> >   	bool enable_test = false;
> >   	const char *env = getenv("AMDGPU_DISABLE_USERQTEST");
> > -
> > -	enable_test = env && atoi(env);
> > +#ifdef AMDGPU_USERQ_ENABLED
> > +	const char *enable_str = "USERQTEST enabled";
> > +#else
> > +	const char *enable_str = "USERQTEST not enabled";
> > +#endif
> >   	igt_fixture {
> >   		uint32_t major, minor;
> > @@ -71,6 +74,10 @@ igt_main
> >   		igt_skip_on(get_pci_addr_from_fd(fd, &pci));
> >   		igt_info("PCI Address: domain %04x, bus %02x, device %02x, function %02x\n",
> >   				pci.domain, pci.bus, pci.device, pci.function);
> > +		enable_test = env && atoi(env);
> > +		if (enable_test)
> > +			igt_info("%s\n", enable_str);
> 
> enable_test is for test specific which arent supported by user queues in
> kernel driver yet but the enable_str only says user queues is supported and
> not test specific. So both are for different purposes
> 
> all together. I see the warning is coming when AMDGPU_USERQ_ENABLED is not
> set and in that case the variable enable_test is unused.
> 

What about:

#ifdef AMDGPU_USERQ_ENABLED
  	bool enable_test = false;
#endif

and later on, whenever it is set or used:

#ifdef AMDGPU_USERQ_ENABLED
	enable_test = env && atoi(env);
#endif

without any prints.

Is it better? If not feel free take it over and fix it asap
however you like it.

Regards,
Kamil

> > +
> >   	}
> >   	igt_describe("Test-GPU-reset-by-flooding-sdma-ring-with-jobs");
> >   	igt_subtest_with_dynamic("amdgpu-deadlock-sdma") {
> > diff --git a/tests/amdgpu/amd_security.c b/tests/amdgpu/amd_security.c
> > index 45bd7e771..891d8f577 100644
> > --- a/tests/amdgpu/amd_security.c
> > +++ b/tests/amdgpu/amd_security.c
> > @@ -318,8 +318,11 @@ igt_main
> >   	bool userq_arr_cap[AMD_IP_MAX] = {0};
> >   	bool enable_test = false;
> >   	const char *env = getenv("AMDGPU_DISABLE_USERQTEST");
> > -
> > -	enable_test = env && atoi(env);
> > +#ifdef AMDGPU_USERQ_ENABLED
> > +	const char *enable_str = "USERQTEST enabled";
> > +#else
> > +	const char *enable_str = "USERQTEST not enabled";
> > +#endif
> >   	igt_fixture {
> >   		uint32_t major, minor;
> > @@ -338,6 +341,9 @@ igt_main
> >   		igt_assert_eq(r, 0);
> >   		asic_userq_readiness(device, userq_arr_cap);
> >   		igt_skip_on(!is_security_tests_enable(device, &gpu_info, major, minor));
> > +		enable_test = env && atoi(env);
> > +		if (enable_test)
> > +			igt_info("%s\n", enable_str);
> 
> We dont want this based on enable_test as its for a different purpose all
> together. Without that the enable_test will again be unused.
> 
> Regards
> Sunil Khatri
> 
> >   	}
> >   	igt_describe("amdgpu security alloc buf test");

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-11 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 14:04 [PATCH i-g-t] tests/amdgpu: Fix compilation warnings for USERQ Kamil Konieczny
2025-06-11 15:21 ` Khatri, Sunil
2025-06-11 17:12   ` Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox