mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 12:07:12 +00:00 
			
		
		
		
	igt/drv_module_reload: Check more carefully for a live driver
As drm_open_any() now quietly fails if there is no driver, this
nullifies the effectiviness of using gem_exec_nop as the test for a good
reload. Combine with gem_alive (and guarantee that gem_alive can detect
a dead driver, putting lie to
commit 032f30cb38bb03562ee7fde19cd278b1d8ac31a9
Author: Thomas Wood <thomas.wood@intel.com>
Date:   Tue Jan 13 13:33:57 2015 +0000
    lib: remove unnecessary checks on the drm_open_any return value
) first.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88573
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
			
			
This commit is contained in:
		
							parent
							
								
									20d6e0f41b
								
							
						
					
					
						commit
						a29f28eba9
					
				@ -224,7 +224,7 @@ int drm_get_card(void)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Open the first DRM device we can find, searching up to 16 device nodes */
 | 
					/** Open the first DRM device we can find, searching up to 16 device nodes */
 | 
				
			||||||
static int __drm_open_any(void)
 | 
					int __drm_open_any(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	for (int i = 0; i < 16; i++) {
 | 
						for (int i = 0; i < 16; i++) {
 | 
				
			||||||
		char name[80];
 | 
							char name[80];
 | 
				
			||||||
 | 
				
			|||||||
@ -71,6 +71,7 @@ static inline void *igt_mmap64(void *addr, size_t length, int prot, int flags,
 | 
				
			|||||||
#define ALIGN(v, a) (((v) + (a)-1) & ~((a)-1))
 | 
					#define ALIGN(v, a) (((v) + (a)-1) & ~((a)-1))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int drm_get_card(void);
 | 
					int drm_get_card(void);
 | 
				
			||||||
 | 
					int __drm_open_any(void);
 | 
				
			||||||
int drm_open_any(void);
 | 
					int drm_open_any(void);
 | 
				
			||||||
int drm_open_any_master(void);
 | 
					int drm_open_any_master(void);
 | 
				
			||||||
int drm_open_any_render(void);
 | 
					int drm_open_any_render(void);
 | 
				
			||||||
 | 
				
			|||||||
@ -43,7 +43,18 @@ echo 1 > /sys/class/vtconsole/vtcon1/bind
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
modprobe snd_hda_intel
 | 
					modprobe snd_hda_intel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# try to run something
 | 
					# does the device exist?
 | 
				
			||||||
$SOURCE_DIR/gem_exec_nop > /dev/null && echo "module successfully loaded again"
 | 
					if $SOURCE_DIR/gem_alive > /dev/null ; then
 | 
				
			||||||
 | 
						echo "module successfully loaded again"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						echo "failed to reload module successfully"
 | 
				
			||||||
 | 
						exit 2
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# then try to run something
 | 
				
			||||||
 | 
					if ! $SOURCE_DIR/gem_exec_nop > /dev/null ; then
 | 
				
			||||||
 | 
						echo "failed to execute a simple batch after reload"
 | 
				
			||||||
 | 
						exit 3
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,9 @@ int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	signal(SIGALRM, SIG_IGN);
 | 
						signal(SIGALRM, SIG_IGN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fd = drm_open_any();
 | 
						fd = __drm_open_any();
 | 
				
			||||||
 | 
						if (fd < 0)
 | 
				
			||||||
 | 
							return IGT_EXIT_SKIP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	alarm(1);
 | 
						alarm(1);
 | 
				
			||||||
	if (ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &arg) == 0)
 | 
						if (ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &arg) == 0)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user