[495.44] [Linux 5.16-rc1] [DKMS] Build fails on Linux 5.16-rc1

The driver version 495.44’s build fails on the new mainline Linux 5.16-rc1 with the following message:

uvm_migrate_pageable.c:409:55: error: use of undeclared identifier 'MIGRATE_PFN_LOCKED'

I can provide the build scripts and kernel config I use as part of my distribution, if that can help.

1 Like

Relevant parts of the build scripts used ($1 is the destination path, $2 the version)

# Filename of the blob
export blob="NVIDIA-Linux-x86_64-${2}"

sh -e ${blob}.run --extract-only
cd ${blob}

bsdtar -xf nvidia-persistenced-init.tar.bz2

cd kernel

sed -i "s/__VERSION_STRING/${2}/" dkms.conf
sed -i 's/__JOBS/`nproc`/' dkms.conf
sed -i 's/__DKMS_MODULES//' dkms.conf
sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\
DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\
BUILT_MODULE_NAME[1]="nvidia-uvm"\
DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\
BUILT_MODULE_NAME[2]="nvidia-modeset"\
DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\
BUILT_MODULE_NAME[3]="nvidia-drm"\
DEST_MODULE_LOCATION[3]="/kernel/drivers/video"\
BUILT_MODULE_NAME[4]="nvidia-peermem"\
DEST_MODULE_LOCATION[4]="/kernel/drivers/video"' dkms.conf

sed -i 's/NV_EXCLUDE_BUILD_MODULES/IGNORE_PREEMPT_RT_PRESENCE=1 NV_EXCLUDE_BUILD_MODULES/' dkms.conf
cd ..

#{{{NVIDIA-DKMS
install -dm755 "${1}/usr/src"

cp -dr --no-preserve="ownership" kernel "$1"/usr/src/nvidia-${2}
#}}}

… after installing $1…

# Make dkms use the same CC and flags as kernel to avoid CC mismatch errors.
export CC=clang
export CXX=clang++
export LD='/usr/bin/ld.lld'

_kernver=$(</usr/src/linux/version)
mkdir -p nvidia/${2}/build
touch nvidia/${2}/build/make.log
dkms build --dkmstree "${PWD}" -m nvidia/${2} -k ${_kernver} 

install -Dt "$1/usr/lib/modules/${_kernver}/extramodules" -m644 \
    nvidia/${2}/${_kernver}/x86_64/module/*

echo "blacklist nouveau" > install -Dm644 /dev/stdin "$1"/etc/modprobe.d/nvidia.conf

find "$1" -name "*.ko" -exec xz -T1 {} +

The dkms build fails.

Just delete the two instances of the offending symbol (| MIGRATE_PFN_LOCKED) from /var/lib/dkms/nvidia/495.44/build/nvidia-uvm/uvm_migrate_pageable.c. Builds and works fine after that.

2 Likes

Here’s a patch for that:

--- a/kernel/nvidia-uvm/uvm_migrate_pageable.c	2022-01-08 21:51:32.672454683 +0100
+++ b/kernel/nvidia-uvm/uvm_migrate_pageable.c	2022-01-08 21:51:52.298644944 +0100
@@ -406,7 +406,7 @@
         uvm_push_set_flag(&push, UVM_PUSH_FLAG_CE_NEXT_MEMBAR_NONE);
         copying_gpu->parent->ce_hal->memset_8(&push, dst_address, 0, PAGE_SIZE);
 
-        dst[i] = migrate_pfn(page_to_pfn(dst_page)) | MIGRATE_PFN_LOCKED;
+        dst[i] = migrate_pfn(page_to_pfn(dst_page));
     }
 
     if (copying_gpu) {
@@ -490,7 +490,7 @@
         uvm_push_set_flag(&push, UVM_PUSH_FLAG_CE_NEXT_MEMBAR_NONE);
         copying_gpu->parent->ce_hal->memcopy(&push, dst_address, src_address, PAGE_SIZE);
 
-        dst[i] = migrate_pfn(page_to_pfn(dst_page)) | MIGRATE_PFN_LOCKED;
+        dst[i] = migrate_pfn(page_to_pfn(dst_page));
     }
 
     // TODO: Bug 1766424: If the destination is a GPU and the copy was done by

Note that it may build as-is with 5.16 depending on kernel configs.

MIGRATE_PFN_LOCKED code is not used if CONFIG_DEVICE_PRIVATE is not set in the kernel.