[Accel-config] Re: [PATCH 1/1] accel-config: Fix idxd modprobe issue with idxd_mdev for user test

Thomas, Ramesh <ramesh.thomas at intel.com>
Newsgroups dev.linux.lists.accel-config
Message-ID <BYAPR11MB25355E0DADED7D3BA0BAC9F4ED979@BYAPR11MB2535.namprd11.prod.outlook.com>
On Wed, Mar 03, 2021 at 04:12:05PM -0500, Tony Zhu <tony.zhu(a)intel.com> wrote:
> User test will clean the idxd module in the memory moving tests. As
> idxd_mdev is supported and it depends on idxd, should change the clean
> as idxd_mdev. To improve the robust and compatibility to old kernel,
> we add the condition to check if the module is loaded and keep idxd reset.
> 
> Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
> ---
>  test/common | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/test/common b/test/common
> index a60bec2..d4041e3 100644
> --- a/test/common
> +++ b/test/common
> @@ -99,8 +99,16 @@ check_prereq()
>  #
>  _cleanup()
>  {
> -	modprobe -r idxd
> -	modprobe idxd
> +	lsmod | grep -q "idxd_mdev" && {
> +		modprobe -r idxd_mdev
> +		sleep 1
> +		modprobe idxd_mdev
> +	}
> +	lsmod | grep -q "idxd" && {
> +		modprobe -r idxd

loading idxd_mdev loads idxd. Unloading idxd here will fail complaining
it is in use by idxd_mdev.

Maybe follow these steps
1. If idxd_mdev is loaded, unload idxd_mdev and wait
2. If idxd is still loaded, unload idxd and wait (In case idxd_mdev was
not present at #1 or due to some instability)
3. Load idxd (This loads all dependent kernel modules)

lsmod | grep -q "idxd_mdev" && {
        modprobe -r idxd_mdev
        sleep 1
}
lsmod | grep -q "idxd" && {
        modprobe -r idxd
        sleep 1
}
modprobe idxd

-Ramesh

> +		sleep 1
> +		modprobe idxd
> +	}
>  }
> 
>  # json2var
> @@ -158,4 +166,4 @@ wq_mode2name()
>  		echo "UNKNOWN"
>  		;;
>  	esac
> -}
> \ No newline at end of file
> +}
> --
> 2.27.0
> _______________________________________________
> Accel-config mailing list -- accel-config(a)lists.01.org
> To unsubscribe send an email to accel-config-leave(a)lists.01.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.