The NVIDIA Linux driver supports the retpoline Spectre V2 mitigation technique as identified by: https://software.intel.com/security-software-guidance/api-app/sites/default/files/Retpoline-A-Branch-Target-Injection-Mitigation.pdf
For Linux systems that define CONFIG_RETPOLINE or CONFIG_MITIGATION_RETPOLINE, the NVIDIA driver yields to the kernel's implementation of Spectre V2 mitigation. When CONFIG_RETPOLINE or CONFIG_MITIGATION_RETPOLINE is not defined, the NVIDIA Linux driver implements the retpoline thunk without the Spectre V2 mitigation.
Linux kernels that implement retpoline based Spectre V2 mitigation provide a kernel boot flag to enable or disable the feature. When enabled, users may notice a performance degradation. In order to recover performance, the user can disable the feature using the spectre_v2 boot flag (unsafe).
spectre_v2=off
Please note that CONFIG_RETPOLINE has been renamed to
CONFIG_MITIGATION_RETPOLINE by commit aefb2f2e619b
("x86/bugs: Rename
CONFIG_RETPOLINE => CONFIG_MITIGATION_RETPOLINE") in Linux
kernel v6.9.