* [Intel-gfx] [PATCH i-g-t] tools/intel_gpu_top: Restore user friendly error message
@ 2023-09-29 11:09 Tvrtko Ursulin
2023-09-29 15:40 ` Umesh Nerlige Ramappa
0 siblings, 1 reply; 3+ messages in thread
From: Tvrtko Ursulin @ 2023-09-29 11:09 UTC (permalink / raw)
To: igt-dev, Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
We have a nice error message displayed when an user with insufficient
permissions tries to run the tool, but that got lost while Meteorlake
support was added. Bring it back in.
v2:
* Propagate unexpected errno on multi-tile systems too. (Umesh)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
tools/intel_gpu_top.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 87e9681e53b4..10601e66b18e 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -554,9 +554,9 @@ static int get_num_gts(uint64_t type)
close(fd);
}
- assert(!errno || errno == ENOENT);
- assert(cnt > 0);
- errno = 0;
+
+ if (!cnt || (errno && errno != ENOENT))
+ cnt = -errno;
return cnt;
}
@@ -590,6 +590,8 @@ static int pmu_init(struct engines *engines)
engines->fd = -1;
engines->num_counters = 0;
engines->num_gts = get_num_gts(type);
+ if (engines->num_gts <= 0)
+ return -1;
engines->irq.config = I915_PMU_INTERRUPTS;
fd = _open_pmu(type, engines->num_counters, &engines->irq, engines->fd);
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Intel-gfx] [PATCH i-g-t] tools/intel_gpu_top: Restore user friendly error message
2023-09-29 11:09 [Intel-gfx] [PATCH i-g-t] tools/intel_gpu_top: Restore user friendly error message Tvrtko Ursulin
@ 2023-09-29 15:40 ` Umesh Nerlige Ramappa
2023-10-02 8:31 ` Tvrtko Ursulin
0 siblings, 1 reply; 3+ messages in thread
From: Umesh Nerlige Ramappa @ 2023-09-29 15:40 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: igt-dev, Intel-gfx
On Fri, Sep 29, 2023 at 12:09:49PM +0100, Tvrtko Ursulin wrote:
>From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
>We have a nice error message displayed when an user with insufficient
>permissions tries to run the tool, but that got lost while Meteorlake
>support was added. Bring it back in.
>
>v2:
> * Propagate unexpected errno on multi-tile systems too. (Umesh)
>
>Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>---
> tools/intel_gpu_top.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>index 87e9681e53b4..10601e66b18e 100644
>--- a/tools/intel_gpu_top.c
>+++ b/tools/intel_gpu_top.c
>@@ -554,9 +554,9 @@ static int get_num_gts(uint64_t type)
>
> close(fd);
> }
>- assert(!errno || errno == ENOENT);
>- assert(cnt > 0);
>- errno = 0;
>+
>+ if (!cnt || (errno && errno != ENOENT))
>+ cnt = -errno;
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Thanks,
Umesh
>
> return cnt;
> }
>@@ -590,6 +590,8 @@ static int pmu_init(struct engines *engines)
> engines->fd = -1;
> engines->num_counters = 0;
> engines->num_gts = get_num_gts(type);
>+ if (engines->num_gts <= 0)
>+ return -1;
>
> engines->irq.config = I915_PMU_INTERRUPTS;
> fd = _open_pmu(type, engines->num_counters, &engines->irq, engines->fd);
>--
>2.39.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Intel-gfx] [PATCH i-g-t] tools/intel_gpu_top: Restore user friendly error message
2023-09-29 15:40 ` Umesh Nerlige Ramappa
@ 2023-10-02 8:31 ` Tvrtko Ursulin
0 siblings, 0 replies; 3+ messages in thread
From: Tvrtko Ursulin @ 2023-10-02 8:31 UTC (permalink / raw)
To: Umesh Nerlige Ramappa; +Cc: igt-dev, Intel-gfx
On 29/09/2023 16:40, Umesh Nerlige Ramappa wrote:
> On Fri, Sep 29, 2023 at 12:09:49PM +0100, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> We have a nice error message displayed when an user with insufficient
>> permissions tries to run the tool, but that got lost while Meteorlake
>> support was added. Bring it back in.
>>
>> v2:
>> * Propagate unexpected errno on multi-tile systems too. (Umesh)
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>> ---
>> tools/intel_gpu_top.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>> index 87e9681e53b4..10601e66b18e 100644
>> --- a/tools/intel_gpu_top.c
>> +++ b/tools/intel_gpu_top.c
>> @@ -554,9 +554,9 @@ static int get_num_gts(uint64_t type)
>>
>> close(fd);
>> }
>> - assert(!errno || errno == ENOENT);
>> - assert(cnt > 0);
>> - errno = 0;
>> +
>> + if (!cnt || (errno && errno != ENOENT))
>> + cnt = -errno;
>
> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Pushed, thanks!
Regards,
Tvrtko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-02 8:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-29 11:09 [Intel-gfx] [PATCH i-g-t] tools/intel_gpu_top: Restore user friendly error message Tvrtko Ursulin
2023-09-29 15:40 ` Umesh Nerlige Ramappa
2023-10-02 8:31 ` Tvrtko Ursulin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox