From: Jiawei Gu <Jiawei.Gu@amd.com>
To: <amd-gfx@lists.freedesktop.org>, <christian.koenig@amd.com>,
<monk.liu@amd.com>, <emily.deng@amd.com>, <horace.chen@amd.com>
Cc: Jiawei Gu <Jiawei.Gu@amd.com>
Subject: [PATCH] drm/sched: Add device pointer to drm_gpu_scheduler
Date: Tue, 15 Feb 2022 19:29:50 +0800 [thread overview]
Message-ID: <20220215112950.13898-1-Jiawei.Gu@amd.com> (raw)
Add device pointer so scheduler's printing can use
DRM_DEV_ERROR() instead, which makes life easier under multiple GPU
scenario.
Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
---
drivers/gpu/drm/scheduler/sched_main.c | 9 +++++----
include/drm/gpu_scheduler.h | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 3e0bbc797eaa..4404af323321 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -489,7 +489,7 @@ void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery)
if (r == -ENOENT)
drm_sched_job_done(s_job);
else if (r)
- DRM_ERROR("fence add callback failed (%d)\n",
+ DRM_DEV_ERROR(sched->dev, "fence add callback failed (%d)\n",
r);
} else
drm_sched_job_done(s_job);
@@ -815,7 +815,7 @@ static int drm_sched_main(void *param)
if (r == -ENOENT)
drm_sched_job_done(sched_job);
else if (r)
- DRM_ERROR("fence add callback failed (%d)\n",
+ DRM_DEV_ERROR(sched->dev, "fence add callback failed (%d)\n",
r);
dma_fence_put(fence);
} else {
@@ -846,7 +846,7 @@ static int drm_sched_main(void *param)
int drm_sched_init(struct drm_gpu_scheduler *sched,
const struct drm_sched_backend_ops *ops,
unsigned hw_submission, unsigned hang_limit, long timeout,
- atomic_t *score, const char *name)
+ atomic_t *score, const char *name, struct device *dev)
{
int i, ret;
sched->ops = ops;
@@ -855,6 +855,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
sched->timeout = timeout;
sched->hang_limit = hang_limit;
sched->score = score ? score : &sched->_score;
+ sched->dev = dev;
for (i = DRM_SCHED_PRIORITY_MIN; i < DRM_SCHED_PRIORITY_COUNT; i++)
drm_sched_rq_init(sched, &sched->sched_rq[i]);
@@ -872,7 +873,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
if (IS_ERR(sched->thread)) {
ret = PTR_ERR(sched->thread);
sched->thread = NULL;
- DRM_ERROR("Failed to create scheduler for %s.\n", name);
+ DRM_DEV_ERROR(sched->dev, "Failed to create scheduler for %s.\n", name);
return ret;
}
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index d18af49fd009..38a479879fdb 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -302,12 +302,13 @@ struct drm_gpu_scheduler {
atomic_t _score;
bool ready;
bool free_guilty;
+ struct device *dev;
};
int drm_sched_init(struct drm_gpu_scheduler *sched,
const struct drm_sched_backend_ops *ops,
uint32_t hw_submission, unsigned hang_limit, long timeout,
- atomic_t *score, const char *name);
+ atomic_t *score, const char *name, struct device *dev);
void drm_sched_fini(struct drm_gpu_scheduler *sched);
int drm_sched_job_init(struct drm_sched_job *job,
--
2.17.1
next reply other threads:[~2022-02-15 11:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 11:29 Jiawei Gu [this message]
2022-02-15 12:26 ` [PATCH] drm/sched: Add device pointer to drm_gpu_scheduler Christian König
2022-02-15 13:04 ` Andrey Grodzovsky
-- strict thread matches above, loose matches on Subject: below --
2022-02-17 10:38 Jiawei Gu
2022-02-17 10:40 ` Christian König
2022-02-17 10:43 Jiawei Gu
2022-02-21 3:32 ` Gu, JiaWei (Will)
2022-02-21 5:22 ` Andrey Grodzovsky
2022-02-21 9:57 Jiawei Gu
2022-02-21 10:17 ` Christian König
2022-02-21 15:51 ` kernel test robot
2022-02-23 7:11 ` Christian König
2022-02-23 7:15 ` Gu, JiaWei (Will)
2022-02-23 7:41 ` Christian König
2022-02-23 14:35 ` Alex Deucher
2022-02-21 16:32 ` kernel test robot
2022-02-21 17:12 ` kernel test robot
2022-02-22 10:29 Jiawei Gu
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=20220215112950.13898-1-Jiawei.Gu@amd.com \
--to=jiawei.gu@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=emily.deng@amd.com \
--cc=horace.chen@amd.com \
--cc=monk.liu@amd.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