[igt-dev] [PATCH i-g-t 1/3] lib/drmtest : add function to call exit handler to unload i915 module

Gupta, Anshuman anshuman.gupta at intel.com
Mon Mar 28 05:42:46 UTC 2022



> -----Original Message-----
> From: Tauro, Riana <riana.tauro at intel.com>
> Sent: Monday, March 28, 2022 10:47 AM
> To: igt-dev at lists.freedesktop.org
> Cc: Tauro, Riana <riana.tauro at intel.com>; Gupta, Anshuman
> <anshuman.gupta at intel.com>; Ewins, Jon <jon.ewins at intel.com>; Dixit,
> Ashutosh <ashutosh.dixit at intel.com>
> Subject: [PATCH i-g-t 1/3] lib/drmtest : add function to call exit handler to
> unload i915 module
> 
> From: "Tauro, Riana" <riana.tauro at intel.com>
> 
> Unload of i915 module needs closing of  at_exit_drm_fd.
> Add a function that calls the exit handler of at_exit_drm_fd to unload module
We are not calling the exit handler directly, may be need to rephrase the commit log ?
> successfully
> 
> Signed-off-by: Tauro, Riana <riana.tauro at intel.com>
> ---
>  lib/drmtest.c | 17 +++++++++++++++++
>  lib/drmtest.h |  1 +
>  2 files changed, 18 insertions(+)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c index 09a9a229..e84e0360 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -588,6 +588,23 @@ int drm_open_driver(int chipset)
>  	return fd;
>  }
> 
> +/**
> + * drm_cancel_work_at_exit:
How about drmtest_cancel_work_prior_unload_i915  ?
> + *
> + * calls __cancel_work_at_exit and closes
> + * at_exit_drm_fd to allow unloading of the module.
> + */
> +void drm_cancel_work_at_exit(void)
> +{
> +	if (at_exit_drm_fd < 0)
> +		return;
> +
> +	__cancel_work_at_exit(at_exit_drm_fd);
> +
> +	close(at_exit_drm_fd);
> +	at_exit_drm_fd = -1;
> +}
> +
>  /**
>   * drm_open_driver_master:
>   * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL diff --git
> a/lib/drmtest.h b/lib/drmtest.h index b5debd44..df551873 100644
> --- a/lib/drmtest.h
> +++ b/lib/drmtest.h
> @@ -88,6 +88,7 @@ void __set_forced_driver(const char *name);
>   */
>  #define ALIGN_DOWN(x, a)	ALIGN((x) - ((a) - 1), (a))
> 
> +void drm_cancel_work_at_exit(void);
>  void drm_load_module(unsigned int chipset);  int drm_open_driver(int chipset);
> int drm_open_driver_master(int chipset);
> --
> 2.25.1



More information about the igt-dev mailing list