Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
e4f90a35
Commit
e4f90a35
authored
Dec 11, 2018
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/tmr: detect stalled gpu timer and break out of waits
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
a31e24a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
10 deletions
+54
-10
drivers/gpu/drm/nouveau/include/nvkm/subdev/timer.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/timer.h
+18
-10
drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c
+36
-0
No files found.
drivers/gpu/drm/nouveau/include/nvkm/subdev/timer.h
View file @
e4f90a35
...
@@ -28,6 +28,18 @@ struct nvkm_timer {
...
@@ -28,6 +28,18 @@ struct nvkm_timer {
u64
nvkm_timer_read
(
struct
nvkm_timer
*
);
u64
nvkm_timer_read
(
struct
nvkm_timer
*
);
void
nvkm_timer_alarm
(
struct
nvkm_timer
*
,
u32
nsec
,
struct
nvkm_alarm
*
);
void
nvkm_timer_alarm
(
struct
nvkm_timer
*
,
u32
nsec
,
struct
nvkm_alarm
*
);
struct
nvkm_timer_wait
{
struct
nvkm_timer
*
tmr
;
u64
limit
;
u64
time0
;
u64
time1
;
int
reads
;
};
void
nvkm_timer_wait_init
(
struct
nvkm_device
*
,
u64
nsec
,
struct
nvkm_timer_wait
*
);
s64
nvkm_timer_wait_test
(
struct
nvkm_timer_wait
*
);
/* Delay based on GPU time (ie. PTIMER).
/* Delay based on GPU time (ie. PTIMER).
*
*
* Will return -ETIMEDOUT unless the loop was terminated with 'break',
* Will return -ETIMEDOUT unless the loop was terminated with 'break',
...
@@ -38,21 +50,17 @@ void nvkm_timer_alarm(struct nvkm_timer *, u32 nsec, struct nvkm_alarm *);
...
@@ -38,21 +50,17 @@ void nvkm_timer_alarm(struct nvkm_timer *, u32 nsec, struct nvkm_alarm *);
*/
*/
#define NVKM_DELAY _warn = false;
#define NVKM_DELAY _warn = false;
#define nvkm_nsec(d,n,cond...) ({ \
#define nvkm_nsec(d,n,cond...) ({ \
struct nvkm_device *_device = (d); \
struct nvkm_timer_wait _wait; \
struct nvkm_timer *_tmr = _device->timer; \
u64 _nsecs = (n), _time0 = nvkm_timer_read(_tmr); \
s64 _taken = 0; \
bool _warn = true; \
bool _warn = true; \
s64 _taken = 0; \
\
\
nvkm_timer_wait_init((d), (n), &_wait); \
do { \
do { \
cond \
cond \
} while (
_taken = nvkm_timer_read(_tmr) - _time0, _taken < _nsecs);
\
} while (
(_taken = nvkm_timer_wait_test(&_wait)) >= 0);
\
\
\
if (_taken >= _nsecs) { \
if (_warn && _taken < 0) \
if (_warn) \
dev_WARN(_wait.tmr->subdev.device->dev, "timeout\n"); \
dev_WARN(_device->dev, "timeout\n"); \
_taken = -ETIMEDOUT; \
} \
_taken; \
_taken; \
})
})
#define nvkm_usec(d,u,cond...) nvkm_nsec((d), (u) * 1000, ##cond)
#define nvkm_usec(d,u,cond...) nvkm_nsec((d), (u) * 1000, ##cond)
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c
View file @
e4f90a35
...
@@ -23,6 +23,42 @@
...
@@ -23,6 +23,42 @@
*/
*/
#include "priv.h"
#include "priv.h"
s64
nvkm_timer_wait_test
(
struct
nvkm_timer_wait
*
wait
)
{
struct
nvkm_subdev
*
subdev
=
&
wait
->
tmr
->
subdev
;
u64
time
=
nvkm_timer_read
(
wait
->
tmr
);
if
(
wait
->
reads
==
0
)
{
wait
->
time0
=
time
;
wait
->
time1
=
time
;
}
if
(
wait
->
time1
==
time
)
{
if
(
wait
->
reads
++
==
16
)
{
nvkm_fatal
(
subdev
,
"stalled at %016llx
\n
"
,
time
);
return
-
ETIMEDOUT
;
}
}
else
{
wait
->
time1
=
time
;
wait
->
reads
=
1
;
}
if
(
wait
->
time1
-
wait
->
time0
>
wait
->
limit
)
return
-
ETIMEDOUT
;
return
wait
->
time1
-
wait
->
time0
;
}
void
nvkm_timer_wait_init
(
struct
nvkm_device
*
device
,
u64
nsec
,
struct
nvkm_timer_wait
*
wait
)
{
wait
->
tmr
=
device
->
timer
;
wait
->
limit
=
nsec
;
wait
->
reads
=
0
;
}
u64
u64
nvkm_timer_read
(
struct
nvkm_timer
*
tmr
)
nvkm_timer_read
(
struct
nvkm_timer
*
tmr
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment