* [PATCH libdrm] amdgpu: Provide more specific error message if non-privileged user runs amdgpu_test
@ 2017-01-12 21:14 Alex Xie
[not found] ` <1484255655-14848-1-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Alex Xie @ 2017-01-12 21:14 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Xie
Before this change, the error message is:
"WARNING - Suite initialization failed..."
People might think this is a driver problem.
Tested with non-privileged user. Now the error message is like:
...
Error:Permission denied. Hint:Try to run this test program as root.
WARNING - Suite initialization failed for 'Basic Tests'.
...
Tested as root with no regression.
amdgpu_test uses CUnit. CUnit outputs warning message to stdout.
To be consistent, this commit outputs error message to stdout.
v2: Use strerror instead of %m. %m is a GNU C Library extension.
v3: Limit code and commit message within 80 characters per line.
Update commit message.
Remove a space before starting parenthesis in function call.
Change-Id: Ib891c40ec812053f49ce5a99909455ac3137e32c
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
---
tests/amdgpu/basic_tests.c | 7 ++++++-
tests/amdgpu/bo_tests.c | 8 +++++++-
tests/amdgpu/cs_tests.c | 8 +++++++-
tests/amdgpu/vce_tests.c | 8 +++++++-
4 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index 11f6a63..bfda21b 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -206,8 +206,13 @@ int suite_basic_tests_init(void)
if (r == 0)
return CUE_SUCCESS;
- else
+ else {
+ if ((r == -EACCES) && (errno == EACCES))
+ printf("\n\nError:%s. "
+ "Hint:Try to run this test program as root.",
+ strerror(errno));
return CUE_SINIT_FAILED;
+ }
}
int suite_basic_tests_clean(void)
diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c
index 993895d..25df767 100644
--- a/tests/amdgpu/bo_tests.c
+++ b/tests/amdgpu/bo_tests.c
@@ -65,8 +65,14 @@ int suite_bo_tests_init(void)
r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
&minor_version, &device_handle);
- if (r)
+ if (r) {
+ if ((r == -EACCES) && (errno == EACCES))
+ printf("\n\nError:%s. "
+ "Hint:Try to run this test program as root.",
+ strerror(errno));
+
return CUE_SINIT_FAILED;
+ }
req.alloc_size = BUFFER_SIZE;
req.phys_alignment = BUFFER_ALIGN;
diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
index a01ee48..82c55aa 100644
--- a/tests/amdgpu/cs_tests.c
+++ b/tests/amdgpu/cs_tests.c
@@ -76,8 +76,14 @@ int suite_cs_tests_init(void)
r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
&minor_version, &device_handle);
- if (r)
+ if (r) {
+ if ((r == -EACCES) && (errno == EACCES))
+ printf("\n\nError:%s. "
+ "Hint:Try to run this test program as root.",
+ strerror(errno));
+
return CUE_SINIT_FAILED;
+ }
family_id = device_handle->info.family_id;
/* VI asic POLARIS10/11 have specific external_rev_id */
diff --git a/tests/amdgpu/vce_tests.c b/tests/amdgpu/vce_tests.c
index 4915170..de63aa1 100644
--- a/tests/amdgpu/vce_tests.c
+++ b/tests/amdgpu/vce_tests.c
@@ -94,8 +94,14 @@ int suite_vce_tests_init(void)
r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
&minor_version, &device_handle);
- if (r)
+ if (r) {
+ if ((r == -EACCES) && (errno == EACCES))
+ printf("\n\nError:%s. "
+ "Hint:Try to run this test program as root.",
+ strerror(errno));
+
return CUE_SINIT_FAILED;
+ }
family_id = device_handle->info.family_id;
vce_harvest_config = device_handle->info.vce_harvest_config;
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH libdrm] amdgpu: Provide more specific error message if non-privileged user runs amdgpu_test
[not found] ` <1484255655-14848-1-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
@ 2017-01-13 9:20 ` Christian König
[not found] ` <5e8dba7f-d96f-77b1-ef9e-3e358d3edc11-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2017-01-13 9:20 UTC (permalink / raw)
To: Alex Xie, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Am 12.01.2017 um 22:14 schrieb Alex Xie:
> Before this change, the error message is:
> "WARNING - Suite initialization failed..."
> People might think this is a driver problem.
>
> Tested with non-privileged user. Now the error message is like:
> ...
> Error:Permission denied. Hint:Try to run this test program as root.
> WARNING - Suite initialization failed for 'Basic Tests'.
> ...
>
> Tested as root with no regression.
>
> amdgpu_test uses CUnit. CUnit outputs warning message to stdout.
> To be consistent, this commit outputs error message to stdout.
>
> v2: Use strerror instead of %m. %m is a GNU C Library extension.
> v3: Limit code and commit message within 80 characters per line.
> Update commit message.
> Remove a space before starting parenthesis in function call.
>
> Change-Id: Ib891c40ec812053f49ce5a99909455ac3137e32c
> Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Works for me, patch is Reviewed-by: Christian König
<christian.koenig@amd.com>.
IIRC I still don't have commit access to libdrm either, so Michel or
Alex can anybody push this?
Regards,
Christian.
> ---
> tests/amdgpu/basic_tests.c | 7 ++++++-
> tests/amdgpu/bo_tests.c | 8 +++++++-
> tests/amdgpu/cs_tests.c | 8 +++++++-
> tests/amdgpu/vce_tests.c | 8 +++++++-
> 4 files changed, 27 insertions(+), 4 deletions(-)
>
> diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
> index 11f6a63..bfda21b 100644
> --- a/tests/amdgpu/basic_tests.c
> +++ b/tests/amdgpu/basic_tests.c
> @@ -206,8 +206,13 @@ int suite_basic_tests_init(void)
>
> if (r == 0)
> return CUE_SUCCESS;
> - else
> + else {
> + if ((r == -EACCES) && (errno == EACCES))
> + printf("\n\nError:%s. "
> + "Hint:Try to run this test program as root.",
> + strerror(errno));
> return CUE_SINIT_FAILED;
> + }
> }
>
> int suite_basic_tests_clean(void)
> diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c
> index 993895d..25df767 100644
> --- a/tests/amdgpu/bo_tests.c
> +++ b/tests/amdgpu/bo_tests.c
> @@ -65,8 +65,14 @@ int suite_bo_tests_init(void)
>
> r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
> &minor_version, &device_handle);
> - if (r)
> + if (r) {
> + if ((r == -EACCES) && (errno == EACCES))
> + printf("\n\nError:%s. "
> + "Hint:Try to run this test program as root.",
> + strerror(errno));
> +
> return CUE_SINIT_FAILED;
> + }
>
> req.alloc_size = BUFFER_SIZE;
> req.phys_alignment = BUFFER_ALIGN;
> diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
> index a01ee48..82c55aa 100644
> --- a/tests/amdgpu/cs_tests.c
> +++ b/tests/amdgpu/cs_tests.c
> @@ -76,8 +76,14 @@ int suite_cs_tests_init(void)
>
> r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
> &minor_version, &device_handle);
> - if (r)
> + if (r) {
> + if ((r == -EACCES) && (errno == EACCES))
> + printf("\n\nError:%s. "
> + "Hint:Try to run this test program as root.",
> + strerror(errno));
> +
> return CUE_SINIT_FAILED;
> + }
>
> family_id = device_handle->info.family_id;
> /* VI asic POLARIS10/11 have specific external_rev_id */
> diff --git a/tests/amdgpu/vce_tests.c b/tests/amdgpu/vce_tests.c
> index 4915170..de63aa1 100644
> --- a/tests/amdgpu/vce_tests.c
> +++ b/tests/amdgpu/vce_tests.c
> @@ -94,8 +94,14 @@ int suite_vce_tests_init(void)
>
> r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
> &minor_version, &device_handle);
> - if (r)
> + if (r) {
> + if ((r == -EACCES) && (errno == EACCES))
> + printf("\n\nError:%s. "
> + "Hint:Try to run this test program as root.",
> + strerror(errno));
> +
> return CUE_SINIT_FAILED;
> + }
>
> family_id = device_handle->info.family_id;
> vce_harvest_config = device_handle->info.vce_harvest_config;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH libdrm] amdgpu: Provide more specific error message if non-privileged user runs amdgpu_test
[not found] ` <5e8dba7f-d96f-77b1-ef9e-3e358d3edc11-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2017-01-13 15:38 ` Alex Deucher
0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2017-01-13 15:38 UTC (permalink / raw)
To: Christian König; +Cc: amd-gfx list, Alex Xie
On Fri, Jan 13, 2017 at 4:20 AM, Christian König
<deathsimple@vodafone.de> wrote:
> Am 12.01.2017 um 22:14 schrieb Alex Xie:
>>
>> Before this change, the error message is:
>> "WARNING - Suite initialization failed..."
>> People might think this is a driver problem.
>>
>> Tested with non-privileged user. Now the error message is like:
>> ...
>> Error:Permission denied. Hint:Try to run this test program as root.
>> WARNING - Suite initialization failed for 'Basic Tests'.
>> ...
>>
>> Tested as root with no regression.
>>
>> amdgpu_test uses CUnit. CUnit outputs warning message to stdout.
>> To be consistent, this commit outputs error message to stdout.
>>
>> v2: Use strerror instead of %m. %m is a GNU C Library extension.
>> v3: Limit code and commit message within 80 characters per line.
>> Update commit message.
>> Remove a space before starting parenthesis in function call.
>>
>> Change-Id: Ib891c40ec812053f49ce5a99909455ac3137e32c
>> Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
>
>
> Works for me, patch is Reviewed-by: Christian König
> <christian.koenig@amd.com>.
>
> IIRC I still don't have commit access to libdrm either, so Michel or Alex
> can anybody push this?
Done. Thanks!
Alex
>
> Regards,
> Christian.
>
>
>> ---
>> tests/amdgpu/basic_tests.c | 7 ++++++-
>> tests/amdgpu/bo_tests.c | 8 +++++++-
>> tests/amdgpu/cs_tests.c | 8 +++++++-
>> tests/amdgpu/vce_tests.c | 8 +++++++-
>> 4 files changed, 27 insertions(+), 4 deletions(-)
>>
>> diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
>> index 11f6a63..bfda21b 100644
>> --- a/tests/amdgpu/basic_tests.c
>> +++ b/tests/amdgpu/basic_tests.c
>> @@ -206,8 +206,13 @@ int suite_basic_tests_init(void)
>> if (r == 0)
>> return CUE_SUCCESS;
>> - else
>> + else {
>> + if ((r == -EACCES) && (errno == EACCES))
>> + printf("\n\nError:%s. "
>> + "Hint:Try to run this test program as
>> root.",
>> + strerror(errno));
>> return CUE_SINIT_FAILED;
>> + }
>> }
>> int suite_basic_tests_clean(void)
>> diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c
>> index 993895d..25df767 100644
>> --- a/tests/amdgpu/bo_tests.c
>> +++ b/tests/amdgpu/bo_tests.c
>> @@ -65,8 +65,14 @@ int suite_bo_tests_init(void)
>> r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
>> &minor_version, &device_handle);
>> - if (r)
>> + if (r) {
>> + if ((r == -EACCES) && (errno == EACCES))
>> + printf("\n\nError:%s. "
>> + "Hint:Try to run this test program as
>> root.",
>> + strerror(errno));
>> +
>> return CUE_SINIT_FAILED;
>> + }
>> req.alloc_size = BUFFER_SIZE;
>> req.phys_alignment = BUFFER_ALIGN;
>> diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
>> index a01ee48..82c55aa 100644
>> --- a/tests/amdgpu/cs_tests.c
>> +++ b/tests/amdgpu/cs_tests.c
>> @@ -76,8 +76,14 @@ int suite_cs_tests_init(void)
>> r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
>> &minor_version, &device_handle);
>> - if (r)
>> + if (r) {
>> + if ((r == -EACCES) && (errno == EACCES))
>> + printf("\n\nError:%s. "
>> + "Hint:Try to run this test program as
>> root.",
>> + strerror(errno));
>> +
>> return CUE_SINIT_FAILED;
>> + }
>> family_id = device_handle->info.family_id;
>> /* VI asic POLARIS10/11 have specific external_rev_id */
>> diff --git a/tests/amdgpu/vce_tests.c b/tests/amdgpu/vce_tests.c
>> index 4915170..de63aa1 100644
>> --- a/tests/amdgpu/vce_tests.c
>> +++ b/tests/amdgpu/vce_tests.c
>> @@ -94,8 +94,14 @@ int suite_vce_tests_init(void)
>> r = amdgpu_device_initialize(drm_amdgpu[0], &major_version,
>> &minor_version, &device_handle);
>> - if (r)
>> + if (r) {
>> + if ((r == -EACCES) && (errno == EACCES))
>> + printf("\n\nError:%s. "
>> + "Hint:Try to run this test program as
>> root.",
>> + strerror(errno));
>> +
>> return CUE_SINIT_FAILED;
>> + }
>> family_id = device_handle->info.family_id;
>> vce_harvest_config = device_handle->info.vce_harvest_config;
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-13 15:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12 21:14 [PATCH libdrm] amdgpu: Provide more specific error message if non-privileged user runs amdgpu_test Alex Xie
[not found] ` <1484255655-14848-1-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
2017-01-13 9:20 ` Christian König
[not found] ` <5e8dba7f-d96f-77b1-ef9e-3e358d3edc11-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-01-13 15:38 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.