Compilation error when CONFIG_HOTPLUG_CPU is set

Hello all,

not sure where to post it otherwise, so I’ll just report this way…

When building the latest Linux drivers 430.26 under a 4.19.50 vanilla kernel within a cloud virtual machine I faced following compilation error:

executing: 'cd ./kernel; /usr/bin/make -k -j8 NV_KERNEL_MODULES="nvidia" NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/opt/kernel-src" SYSOUT="/opt/kernel-src"'...
   make[1]: Entering directory '/opt/kernel-src'
     CC [M]  /NVIDIA/kernel/nvidia/nv-pat.o
   distcc[1189] (dcc_build_somewhere) Warning: failed to distribute, running locally instead
     CC [M]  /NVIDIA/kernel/nvidia/nv-pci-table.o
   distcc[1194] (dcc_build_somewhere) Warning: failed to distribute, running locally instead
     CC [M]  /NVIDIA/kernel/nvidia/nv-kthread-q.o
   distcc[1197] (dcc_build_somewhere) Warning: failed to distribute, running locally instead
   In file included from ././include/linux/compiler_types.h:64:0,
                    from <command-line>:0:
   /NVIDIA/kernel/nvidia/nv-pat.c: In function 'nvidia_cpu_teardown':
   ./include/linux/compiler-gcc.h:20:19: error: expected ';' before '__asm__'
    #define barrier() __asm__ __volatile__("": : :"memory")
                      ^
   ./include/linux/preempt.h:248:28: note: in expansion of macro 'barrier'
    #define preempt_enable()   barrier()
                               ^~~~~~~
   ./include/linux/smp.h:203:20: note: in expansion of macro 'preempt_enable'
    #define put_cpu()  preempt_enable()
                       ^~~~~~~~~~~~~~
   /NVIDIA/kernel/nvidia/nv-pat.c:147:5: note: in expansion of macro 'put_cpu'
        put_cpu();
        ^~~~~~~
   distcc[1189] ERROR: compile /NVIDIA/kernel/nvidia/nv-pat.c on localhost failed
   scripts/Makefile.build:303: recipe for target '/NVIDIA/kernel/nvidia/nv-pat.o' failed

A look at the code showed the problem:

136	static int
137	nvidia_cpu_teardown(unsigned int cpu)
138	{
139	#if defined(NV_ENABLE_HOTPLUG_CPU)
140	    unsigned int this_cpu = get_cpu();
141	
142	    if (this_cpu == cpu)
143	        nv_restore_pat_entries(NULL);
144	    else
145	        smp_call_function(nv_restore_pat_entries, &cpu, 1)
146	
147	    put_cpu();
148	#endif
149	    return 0;
150	}

Line 145 misses a trailing ‘;’. Adding it makes everything compile again just fine.
Funnily enough, the function ‘nvidia_cpu_online’ has similar code but does not have that error.

Hope it can get fixed, that would save us a sed-quickfix :)

Cheers from Germany,
Jonathan