Build Failure 450.57 and 450.66 with kernel-5.8: implicit declaration mmu_notifier_register

Nvidia 450.57 and 450.66 build failure with kernel 5.8.x.

Log file shows two errors:

uvm8_va_space_mm.c:256:16: error: implicit declaration of function __mmu_notifier_register

uvm8_va_space_mm.c:261:9: error: implicit declaration of function __mmu_unnotifier_register

On Gentoo forums it is suggested to enable CONFIG_MMU_NOTIFIER in kernel configuration,
but this does not work with my system and other users have the same issue.

How can this be fixed?

Has nvidia suddenly introduced a dependency that was not previously present?

Currently I must run 440.100 (with patch) with kernel-5.8.x.

The groundwork for missing mmu notifiers seems to already be covered. They just need to add a check for the absence of the __mmu_notifier_register function.

In kernel/nvidia-uvm/uvm_linux.h, change the #define UVM_CAN_USE_MMU_NOTIFIERS() 1 line. Or, for a more “proper” check:

diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index a4ebf81..00d02d9 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -3647,10 +3647,20 @@ compile_test() {
             }"
 
             compile_check_conftest "$CODE" "NV_MMU_NOTIFIER_OPS_HAS_INVALIDATE_RANGE" "" "types"
         ;;
 
+        __mmu_notifier_register)
+            CODE="
+            #include <linux/mmu_notifier.h>
+            void conftest_mmu_notifier_register(void) {
+                __mmu_notifier_register();
+            }"
+
+            compile_check_conftest "$CODE" "NV_MMU_NOTIFIER_REGISTER" "" "functions"
+        ;;
+
         drm_format_num_planes)
             #
             # Determine if drm_format_num_planes() function is present.
             #
             # The drm_format_num_planes() function was added by commit
diff --git a/kernel/nvidia-uvm/nvidia-uvm.Kbuild b/kernel/nvidia-uvm/nvidia-uvm.Kbuild
index 0a1a4e9..f052391 100644
--- a/kernel/nvidia-uvm/nvidia-uvm.Kbuild
+++ b/kernel/nvidia-uvm/nvidia-uvm.Kbuild
@@ -97,10 +97,11 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += console_lock
 NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_bus_address
 NV_CONFTEST_FUNCTION_COMPILE_TESTS += set_memory_uc
 NV_CONFTEST_FUNCTION_COMPILE_TESTS += set_pages_uc
 NV_CONFTEST_FUNCTION_COMPILE_TESTS += acpi_walk_namespace
 NV_CONFTEST_FUNCTION_COMPILE_TESTS += ktime_get_raw_ts64
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += __mmu_notifier_register
 
 NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all
 NV_CONFTEST_TYPE_COMPILE_TESTS += file_operations
 NV_CONFTEST_TYPE_COMPILE_TESTS += kuid_t
 NV_CONFTEST_TYPE_COMPILE_TESTS += address_space
diff --git a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h
index ef7771d..41d7147 100644
--- a/kernel/nvidia-uvm/uvm_linux.h
+++ b/kernel/nvidia-uvm/uvm_linux.h
@@ -138,11 +138,11 @@ static inline const struct cpumask *uvm_cpumask_of_node(int node)
 // after all of the above issues were resolved, so we assume the fixes are
 // present if we see the callback.
 //
 // The callback was added in commit 0f0a327fa12cd55de5e7f8c05a70ac3d047f405e,
 // v3.19 (2014-11-13).
-#if defined(NV_MMU_NOTIFIER_OPS_HAS_INVALIDATE_RANGE)
+#if defined(NV_MMU_NOTIFIER_REGISTER) && defined(NV_MMU_NOTIFIER_OPS_HAS_INVALIDATE_RANGE)
     #define UVM_CAN_USE_MMU_NOTIFIERS() 1
 #else
     #define UVM_CAN_USE_MMU_NOTIFIERS() 0
 #endif

Thank you, sir.

Your patch has been applied and nvidia-550.66 builds successfully on my Gentoo system.

Nvidia-550.66 now builds and runs successfully.

Thanks again for yout very quick response.

1 Like