Avoid opening the DRM file by default
PATCH 1/1 Avoid opening the DRM file by default
Opening the DRM file (/dev/dri/card%d) triggers all sorts of KMD work to happen which is not useful if the KMD is hung or not working.
Since --top is the only user of the file currently we simply defer opening it until --top is invoked.
--- src/app/top.c | 7 +++++++ src/lib/discover.c | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-)
src/app/top.c +7 -0
@@ -933,8 +933,15 @@ void umr_top(struct umr_asic *asic)time_t tt;uint64_t ts;char hostname[64 ] = {0 }; +char fname[64 ];pthread_t sensor_thread; +// open drm file if not already open +if (asic->fd.drm <0 ) { +snprintf (fname,sizeof (fname)-1 ,"/dev/dri/card%d" , asic->instance); + asic->fd.drm =open (fname,O_RDWR ); + } +if (getenv ("HOSTNAME" ))strcpy (hostname,getenv ("HOSTNAME" ));// init stats
src/lib/discover.c +1 -2
@@ -127,8 +127,7 @@ struct umr_asic *umr_discover_asic(struct umr_options *options) asic->fd.vram =open (fname,O_RDWR );snprintf (fname,sizeof (fname)-1 ,"/sys/kernel/debug/dri/%d/amdgpu_gpr" , asic->instance); asic->fd.gpr =open (fname,O_RDWR ); -snprintf (fname,sizeof (fname)-1 ,"/dev/dri/card%d" , asic->instance); - asic->fd.drm =open (fname,O_RDWR ); + asic->fd.drm =-1 ;// default to closed // if appending to the fd list remember to update close_asic() and discover_by_did()... if (options->use_pci) {
Signature · 6 lines
2.12.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Alex Deucher
Reviewed-byQuoted 7 lines · Tom St Denis
Opening the DRM file (/dev/dri/card%d) triggers all sorts of KMD work to happen which is not useful if the KMD is hung or not working.
Since --top is the only user of the file currently we simply defer opening it until --top is invoked.
Signed-off-by Tom St Denis <[email protected]>
Quoted 42 lines
--- src/app/top.c | 7 +++++++ src/lib/discover.c | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-)src/app/top.c +7
-0@@ -933,8 +933,15 @@ void umr_top(struct umr_asic *asic)time_t tt;uint64_t ts;char hostname[64 ] = {0 }; +char fname[64 ];pthread_t sensor_thread; +// open drm file if not already open +if (asic->fd.drm <0 ) { +snprintf (fname,sizeof (fname)-1 ,"/dev/dri/card%d" , asic->instance); + asic->fd.drm =open (fname,O_RDWR ); + } +if (getenv ("HOSTNAME" ))strcpy (hostname,getenv ("HOSTNAME" ));// init stats src/lib/discover.c +1
-3@@ -127,8 +127,7 @@ struct umr_asic *umr_discover_asic(struct umr_options *options) asic->fd.vram =open (fname,O_RDWR );snprintf (fname,sizeof (fname)-1 ,"/sys/kernel/debug/dri/%d/amdgpu_gpr" , asic->instance); asic->fd.gpr =open (fname,O_RDWR ); -snprintf (fname,sizeof (fname)-1 ,"/dev/dri/card%d" , asic->instance); - asic->fd.drm =open (fname,O_RDWR ); + asic->fd.drm =-1 ;// default to closed // if appending to the fd list remember to update close_asic() and discover_by_did()... if (options->use_pci) { --2.12.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx