File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ DRIVER_RESET_RETRIES=10
88DELAY_BEFORE_VF_CREATION=${DELAY_BEFORE_VF_CREATION:- 15}
99RUN_DIR=/run/nvidia
1010NVIDIA_MODULE_PARAMS=()
11+ MODPROBE_CONFIG_DIR=" /etc/modprobe.d"
1112
1213# Mount the driver rootfs into the run directory with the exception of sysfs.
1314_mount_rootfs () {
@@ -80,6 +81,16 @@ _install_driver() {
8081 sh NVIDIA-Linux-${DRIVER_ARCH} -${DRIVER_VERSION} -vgpu-kvm.run --ui=none --no-questions --tmpdir ${tmp_dir} --no-systemd
8182}
8283
84+ _create_module_params_conf () {
85+ echo " Parsing kernel module parameters..."
86+ _get_module_params
87+
88+ if [ ${# NVIDIA_MODULE_PARAMS[@]} -gt 0 ]; then
89+ echo " Configuring nvidia module parameters in ${MODPROBE_CONFIG_DIR} /nvidia.conf"
90+ echo " options nvidia ${NVIDIA_MODULE_PARAMS[@]} " > ${MODPROBE_CONFIG_DIR} /nvidia.conf
91+ fi
92+ }
93+
8394# Load NVIDIA driver kernel modules with custom parameters and start vGPU daemons
8495_load_driver () {
8596 # Unload modules if they're already loaded so we can reload with custom parameters
@@ -89,12 +100,11 @@ _load_driver() {
89100 rmmod nvidia 2> /dev/null || true
90101 fi
91102
92- echo " Parsing kernel module parameters..."
93- _get_module_params
103+ _create_module_params_conf
94104
95105 echo " Loading NVIDIA driver kernel modules..."
96106 set -o xtrace +o nounset
97- modprobe nvidia " ${NVIDIA_MODULE_PARAMS[@]} "
107+ modprobe nvidia
98108 modprobe nvidia_vgpu_vfio
99109 set +o xtrace -o nounset
100110
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ DRIVER_RESET_RETRIES=10
2020DELAY_BEFORE_VF_CREATION=${DELAY_BEFORE_VF_CREATION:- 15}
2121RUN_DIR=/run/nvidia
2222NVIDIA_MODULE_PARAMS=()
23+ MODPROBE_CONFIG_DIR=" /etc/modprobe.d"
2324
2425# Mount the driver rootfs into the run directory with the exception of sysfs.
2526_mount_rootfs () {
@@ -92,6 +93,16 @@ _install_driver() {
9293 sh NVIDIA-Linux-${DRIVER_ARCH} -${DRIVER_VERSION} -vgpu-kvm.run --ui=none --no-questions --tmpdir ${tmp_dir} --no-systemd
9394}
9495
96+ _create_module_params_conf () {
97+ echo " Parsing kernel module parameters..."
98+ _get_module_params
99+
100+ if [ ${# NVIDIA_MODULE_PARAMS[@]} -gt 0 ]; then
101+ echo " Configuring nvidia module parameters in ${MODPROBE_CONFIG_DIR} /nvidia.conf"
102+ echo " options nvidia ${NVIDIA_MODULE_PARAMS[@]} " > ${MODPROBE_CONFIG_DIR} /nvidia.conf
103+ fi
104+ }
105+
95106# Load NVIDIA driver kernel modules with custom parameters and start vGPU daemons
96107_load_driver () {
97108 # Unload modules if they're already loaded so we can reload with custom parameters
@@ -101,12 +112,11 @@ _load_driver() {
101112 rmmod nvidia 2> /dev/null || true
102113 fi
103114
104- echo " Parsing kernel module parameters..."
105- _get_module_params
115+ _create_module_params_conf
106116
107117 echo " Loading NVIDIA driver kernel modules..."
108118 set -o xtrace +o nounset
109- modprobe nvidia " ${NVIDIA_MODULE_PARAMS[@]} "
119+ modprobe nvidia
110120 modprobe nvidia_vgpu_vfio
111121 set +o xtrace -o nounset
112122
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ DELAY_BEFORE_VF_CREATION=${DELAY_BEFORE_VF_CREATION:-15}
99KERNEL_VERSION=$( uname -r)
1010RUN_DIR=/run/nvidia
1111NVIDIA_MODULE_PARAMS=()
12+ MODPROBE_CONFIG_DIR=" /etc/modprobe.d"
1213
1314export DEBIAN_FRONTEND=noninteractive
1415
@@ -155,6 +156,16 @@ _get_module_params() {
155156 fi
156157}
157158
159+ _create_module_params_conf () {
160+ echo " Parsing kernel module parameters..."
161+ _get_module_params
162+
163+ if [ ${# NVIDIA_MODULE_PARAMS[@]} -gt 0 ]; then
164+ echo " Configuring nvidia module parameters in ${MODPROBE_CONFIG_DIR} /nvidia.conf"
165+ echo " options nvidia ${NVIDIA_MODULE_PARAMS[@]} " > ${MODPROBE_CONFIG_DIR} /nvidia.conf
166+ fi
167+ }
168+
158169# Load NVIDIA driver kernel modules with custom parameters and start vGPU daemons
159170_load_driver () {
160171 # Unload modules if they're already loaded so we can reload with custom parameters
@@ -163,13 +174,12 @@ _load_driver() {
163174 rmmod nvidia_vgpu_vfio 2> /dev/null || true
164175 rmmod nvidia 2> /dev/null || true
165176 fi
166-
167- echo " Parsing kernel module parameters..."
168- _get_module_params
177+
178+ _create_module_params_conf
169179
170180 echo " Loading NVIDIA driver kernel modules..."
171181 set -o xtrace +o nounset
172- modprobe nvidia " ${NVIDIA_MODULE_PARAMS[@]} "
182+ modprobe nvidia
173183 modprobe nvidia_vgpu_vfio
174184 set +o xtrace -o nounset
175185
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ DELAY_BEFORE_VF_CREATION=${DELAY_BEFORE_VF_CREATION:-15}
99KERNEL_VERSION=$( uname -r)
1010RUN_DIR=/run/nvidia
1111NVIDIA_MODULE_PARAMS=()
12+ MODPROBE_CONFIG_DIR=" /etc/modprobe.d"
1213
1314export DEBIAN_FRONTEND=noninteractive
1415
@@ -155,6 +156,16 @@ _get_module_params() {
155156 fi
156157}
157158
159+ _create_module_params_conf () {
160+ echo " Parsing kernel module parameters..."
161+ _get_module_params
162+
163+ if [ ${# NVIDIA_MODULE_PARAMS[@]} -gt 0 ]; then
164+ echo " Configuring nvidia module parameters in ${MODPROBE_CONFIG_DIR} /nvidia.conf"
165+ echo " options nvidia ${NVIDIA_MODULE_PARAMS[@]} " > ${MODPROBE_CONFIG_DIR} /nvidia.conf
166+ fi
167+ }
168+
158169# Load NVIDIA driver kernel modules with custom parameters and start vGPU daemons
159170_load_driver () {
160171 # Unload modules if they're already loaded so we can reload with custom parameters
@@ -163,13 +174,12 @@ _load_driver() {
163174 rmmod nvidia_vgpu_vfio 2> /dev/null || true
164175 rmmod nvidia 2> /dev/null || true
165176 fi
166-
167- echo " Parsing kernel module parameters..."
168- _get_module_params
177+
178+ _create_module_params_conf
169179
170180 echo " Loading NVIDIA driver kernel modules..."
171181 set -o xtrace +o nounset
172- modprobe nvidia " ${NVIDIA_MODULE_PARAMS[@]} "
182+ modprobe nvidia
173183 modprobe nvidia_vgpu_vfio
174184 set +o xtrace -o nounset
175185
You can’t perform that action at this time.
0 commit comments