[PATCH i-g-t] lib/xe_gt: Assertion related to xe_gt_stats_get_count
Sharma, Nishit
nishit.sharma at intel.com
Wed Jul 30 06:58:00 UTC 2025
On 7/29/2025 11:17 AM, priyanka.dandamudi at intel.com wrote:
> From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
>
> Currently, when the specific gt stats file is not found, it fails with
> an assertion. Due to this the test using this function also fails.
> In general, this lib function is just to count the stats count, test
> using this need not fail.So, now the function will warn the failure
> when file not found and return -1 as count.
>
> Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> ---
> lib/xe/xe_gt.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/xe/xe_gt.c b/lib/xe/xe_gt.c
> index afb757bfa..ed19bec74 100644
> --- a/lib/xe/xe_gt.c
> +++ b/lib/xe/xe_gt.c
> @@ -185,8 +185,11 @@ int xe_gt_stats_get_count(int fd, int gt, const char *stat)
> minor(st.st_rdev), gt);
> f = fopen(path, "r");
>
> - igt_assert_f(f, "Failed to open /sys/kernel/debug/dri/%d/gt%d/stats",
> - minor(st.st_rdev), gt);
> + if (!f) {
> + igt_warn("Failed to open /sys/kernel/debug/dri/%d/gt%d/stats",
> + minor(st.st_rdev), gt);
> + return -1;
> + }
Looks fine!
>
> while (fgets(tlb_path, sizeof(tlb_path), f)) {
> if (strstr(tlb_path, stat) != NULL) {
More information about the igt-dev
mailing list