From: "Karas, Anna" <anna.karas@intel.com>
To: <igt-dev@lists.freedesktop.org>
Cc: kunal1.joshi@intel.com, sai.gowtham.ch@intel.com,
ramadevi.gandi@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t 1/2] lib/xe: Add support to reset all GT's
Date: Wed, 26 Jul 2023 21:59:20 +0200 [thread overview]
Message-ID: <362513cf-48e6-7b98-6d57-e998f0d5fbd1@intel.com> (raw)
In-Reply-To: <20230725174410.nkztvtel5opmjjel@kamilkon-desk1>
Hi all,
I have a few minor remarks to add.
On 25.07.2023 19:44, Kamil Konieczny wrote:
> Hi Janga,
>
> On 2023-07-25 at 12:46:21 +0530, janga.rahul.kumar@intel.com wrote:
>> From: Janga Rahul Kumar <janga.rahul.kumar@intel.com>
>>
>> Add library support to check support for GT reset and
>> force reset all GT's.
>>
>> Cc: Sai Gowtham Ch <sai.gowtham.ch@intel.com>
>> Cc: Kunal Joshi <kunal1.joshi@intel.com>
>> Signed-off-by: Janga Rahul Kumar <janga.rahul.kumar@intel.com>
>> ---
>> lib/igt_gt.c | 7 +++++++
>> lib/xe/xe_ioctl.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
>> lib/xe/xe_ioctl.h | 2 ++
>> 3 files changed, 61 insertions(+)
>>
>> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
>> index d4a825e66..2ce464ba6 100644
>> --- a/lib/igt_gt.c
>> +++ b/lib/igt_gt.c
>> @@ -45,6 +45,7 @@
>> #include "intel_chipset.h"
>> #include "igt_dummyload.h"
>>
>> +#include "xe/xe_ioctl.h"
>
> Add newline here.
>
>> /**
>> * SECTION:igt_gt
>> * @short_description: GT support library
>> @@ -60,6 +61,9 @@ static int reset_query_once = -1;
>>
>> static bool has_gpu_reset(int fd)
>> {
>> + if (is_xe_device(fd))
>> + has_xe_gt_reset(fd);
>> +
>> if (reset_query_once < 0) {
>> reset_query_once = gem_gpu_reset_type(fd);
>>
>> @@ -395,6 +399,9 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
>> */
>> void igt_force_gpu_reset(int drm_fd)
>> {
>> + if (is_xe_device(drm_fd))
>> + xe_force_gt_reset_all(drm_fd);
>> +
>
> Move above code after igt_debug below.
>
>> int dir, wedged;
>>
>> igt_debug("Triggering GPU reset\n");
>> diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
>> index 1f9240cd9..488aa218e 100644
>> --- a/lib/xe/xe_ioctl.c
>> +++ b/lib/xe/xe_ioctl.c
>> @@ -41,6 +41,7 @@
>> #include "config.h"
>> #include "drmtest.h"
>> #include "igt_syncobj.h"
>> +#include "igt_sysfs.h"
>> #include "ioctl_wrappers.h"
>> #include "xe_ioctl.h"
>> #include "xe_query.h"
>> @@ -455,6 +456,57 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
>> return ts.tv_sec * 1e9 + ts.tv_nsec;
>> }
>>
>> +
>> +/**
>> + * has_xe_gt_reset:
>> + * @fd: open xe drm file descriptor
>> + *
>> + * Check gt force reset syfs entry is available or not
Typo: sysfs.
>> + *
>> + * Returns: reset sysfs entry available
>> + */
>> +bool has_xe_gt_reset(int fd)
>> +{
>> + char reset_sysfs_path[100];
>> + struct stat st;
>> + int gt;
>> + int reset_sysfs_fd = -1;
>> + int sysfs_fd = -1;
>
> Add newline here.
>
>> + igt_assert_eq(fstat(fd, &st), 0);
>> +
>> + sysfs_fd = igt_sysfs_open(fd);
>> + igt_assert(sysfs_fd != -1);
>> +
>> + xe_for_each_gt(fd, gt) {
>> + sprintf(reset_sysfs_path, "/sys/kernel/debug/dri/%d/gt%d/force_reset", minor(st.st_rdev), gt);
>> + reset_sysfs_fd = openat(sysfs_fd, reset_sysfs_path, O_RDONLY);
>> +
>> + if(reset_sysfs_fd == -1) {
Separate if and ( with space.
>> + close(sysfs_fd);
>> + return 0;
>> + }
>> +
>> + close(reset_sysfs_fd);
>> + }
>> +
>> + close(sysfs_fd);
>> + return 1;
>> +}
>> +
>> +/**
>> + * xe_force_gt_reset_all:
>> + *
>> + * Forces reset of all the GT's.
>> + *
This line is not necessary.
>> + */
>> +void xe_force_gt_reset_all(int xe_fd)
>> +{
>> + int gt;
>
> Add newline.
>
> Regards,
> Kamil
>
>> + xe_for_each_gt(xe_fd, gt)
>> + xe_force_gt_reset(xe_fd, gt);
>> +}
>> +
>> +
>> void xe_force_gt_reset(int fd, int gt)
>> {
>> char reset_string[128];
>> diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h
>> index 320e0f9f6..5a528b345 100644
>> --- a/lib/xe/xe_ioctl.h
>> +++ b/lib/xe/xe_ioctl.h
>> @@ -87,6 +87,8 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
>> struct drm_xe_engine_class_instance *eci,
>> int64_t timeout);
>> void xe_force_gt_reset(int fd, int gt);
>> +void xe_force_gt_reset_all(int fd);
>> +bool has_xe_gt_reset(int fd);
>> void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
>> uint32_t property, uint32_t value);
>>
>> --
>> 2.25.1
>>
Apart from my comments, please check your patch with checkpatch before
sending v2.
Regards,
Anna
next prev parent reply other threads:[~2023-07-26 19:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 7:16 [igt-dev] [PATCH i-g-t 0/2] Add Xe lib support for hang & GT reset janga.rahul.kumar
2023-07-25 7:16 ` [igt-dev] [PATCH i-g-t 1/2] lib/xe: Add support to reset all GT's janga.rahul.kumar
2023-07-25 17:44 ` Kamil Konieczny
2023-07-26 19:59 ` Karas, Anna [this message]
2023-07-25 7:16 ` [igt-dev] [PATCH i-g-t 2/2] lib/xe: Add hang library support janga.rahul.kumar
2023-07-25 18:04 ` Kamil Konieczny
2023-07-26 20:44 ` Karas, Anna
2023-08-07 4:06 ` Kumar, Janga Rahul
2023-08-07 4:02 ` Kumar, Janga Rahul
2023-07-25 8:17 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add Xe lib support for hang & GT reset Patchwork
2023-08-01 13:51 ` [igt-dev] [PATCH i-g-t 0/2] " Joshi, Kunal1
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=362513cf-48e6-7b98-6d57-e998f0d5fbd1@intel.com \
--to=anna.karas@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kunal1.joshi@intel.com \
--cc=ramadevi.gandi@intel.com \
--cc=sai.gowtham.ch@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