If more than two or more jobs end up timeout-ing concurrently, only one
of them (the one attached to the scheduler acquiring the lock) is fully
handled. The other one remains in a dangling state where it's no longer
part of the scheduling queue, but still blocks something in scheduler
thus leading to repetitive timeouts when new jobs are queued.
Let's make sure all bad jobs are properly handled by the thread acquiring
the lock.
Signed-off-by: Boris Brezillon <boris.brezillon(a)collabora.com>
Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver")
Cc: <stable(a)vger.kernel.org>
---
drivers/gpu/drm/panfrost/panfrost_job.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
index 30e7b7196dab..e87edca51d84 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -25,7 +25,7 @@
struct panfrost_queue_state {
struct drm_gpu_scheduler sched;
-
+ struct drm_sched_job *bad;
u64 fence_context;
u64 emit_seqno;
};
@@ -392,19 +392,29 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job)
job_read(pfdev, JS_TAIL_LO(js)),
sched_job);
+ /*
+ * Collect the bad job here so it can be processed by the thread
+ * acquiring the reset lock.
+ */
+ pfdev->js->queue[js].bad = sched_job;
+
if (!mutex_trylock(&pfdev->reset_lock))
return;
for (i = 0; i < NUM_JOB_SLOTS; i++) {
struct drm_gpu_scheduler *sched = &pfdev->js->queue[i].sched;
- drm_sched_stop(sched, sched_job);
if (js != i)
/* Ensure any timeouts on other slots have finished */
cancel_delayed_work_sync(&sched->work_tdr);
- }
- drm_sched_increase_karma(sched_job);
+ drm_sched_stop(sched, pfdev->js->queue[i].bad);
+
+ if (pfdev->js->queue[i].bad)
+ drm_sched_increase_karma(pfdev->js->queue[i].bad);
+
+ pfdev->js->queue[i].bad = NULL;
+ }
spin_lock_irqsave(&pfdev->js->job_lock, flags);
for (i = 0; i < NUM_JOB_SLOTS; i++) {
--
2.26.2
Hagen reported broken strings in python3 tracepoint scripts:
make PYTHON=python3
./perf record -e sched:sched_switch -a -- sleep 5
./perf script --gen-script py
./perf script -s ./perf-script.py
[..]
sched__sched_switch 7 563231.759525792 0 swapper \
prev_comm=bytearray(b'swapper/7\x00\x00\x00\x00\x00\x00\x00'), \
prev_pid=0, prev_prio=120, prev_state=, next_comm=bytearray(b'mutex-thread-co\x00'),
The problem is in is_printable_array function that does not take
zero byte into account and claim such string as not printable,
so the code will create byte array instead of string.
Cc: stable(a)vger.kernel.org
Fixes: 249de6e07458 ("perf script python: Fix string vs byte array resolving")
Tested-by: Hagen Paul Pfeifer <hagen(a)jauu.net>
Signed-off-by: Jiri Olsa <jolsa(a)kernel.org>
---
tools/perf/util/print_binary.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/print_binary.c b/tools/perf/util/print_binary.c
index 599a1543871d..13fdc51c61d9 100644
--- a/tools/perf/util/print_binary.c
+++ b/tools/perf/util/print_binary.c
@@ -50,7 +50,7 @@ int is_printable_array(char *p, unsigned int len)
len--;
- for (i = 0; i < len; i++) {
+ for (i = 0; i < len && p[i]; i++) {
if (!isprint(p[i]) && !isspace(p[i]))
return 0;
}
--
2.26.2