Skip to content

Instantly share code, notes, and snippets.

@denji
Last active October 13, 2025 05:01
Show Gist options
  • Save denji/52b9b0980ef3dadde0ff3d3ccf74a2a6 to your computer and use it in GitHub Desktop.
Save denji/52b9b0980ef3dadde0ff3d3ccf74a2a6 to your computer and use it in GitHub Desktop.
/etc/modprobe.d/nvidia.conf
# /etc/modprobe.d/nvidia.conf
# NVIDIA Linux modprobe.d Configuration
#
# Memory and Performance Enhancements:
#
# - NVreg_UsePageAttributeTable=1 (Default: 0)
# Activates the Page Attribute Table (PAT) for improved memory management.
# PAT creates a partition table at a fixed register-mapped address, potentially enhancing CPU performance.
#
# - NVreg_InitializeSystemMemoryAllocations=0 (Default: 1)
# Disables clearing system memory before GPU use to boost performance (at a potential security cost).
# Recommended for KDE 6 + Wayland users to prevent issues when waking from sleep.
# Symptoms of issues with the default setting (1):
# - Black screen or freeze after sleep resume
# - Flickering or graphical glitches
# - Unexpected session restarts
# To disable memory clearing, add the following to /etc/modprobe.d/nvidia.conf:
# options nvidia NVreg_InitializeSystemMemoryAllocations=0
#
# PCIe & Display:
#
# - NVreg_EnablePCIeGen3=1 (Default: 1 for new drivers, 0 for old drivers)
# Enables PCIe Gen 3 support for compatible graphics cards, unlocking high-speed 8 GT/s transfers.
# (The driver defaults to PCIe Gen 2.x for broader compatibility.)
#
# - nvidia_drm.modeset=1 (Default: 0)
# Enables modesetting support, which is critical for Wayland compatibility and proper PRIME Offload operation.
#
# GPUDirect & Advanced Operations:
#
# - NVreg_EnableResizableBar
# Activates Resizable BAR support, allowing the GPU to access larger contiguous regions of system memory,
# which can enhance GPUDirect RDMA performance.
#
# - NVreg_EnableStreamMemOPs=1 (Default: 0)
# Enables CUDA Stream Memory Operations in user-mode applications.
# Requires nvidia.ko version 510.40.3 or later and must be loaded with:
# NVreg_RegistryDwords="PeerMappingOverride=1;"
# More details: https://docs.nvidia.com/nvshmem/release-notes-install-guide/install-guide/abstract.html
#
# Device File Permission Settings:
#
# - NVreg_DeviceFileUID
# Specifies the user ID for NVIDIA device nodes (e.g., /dev/nvidia0) to control file ownership.
#
# - NVreg_DeviceFileGID
# Specifies the group ID for NVIDIA device nodes to facilitate group-based access control.
#
# - NVreg_DeviceFileMode
# Sets the permission bits (read/write/execute) for NVIDIA device nodes.
#
# Registry Overrides and Resource Manager Tweaks:
#
# - NVreg_RegistryDwords
# Allows internal driver settings to be overridden via a comma-separated list of key–value pairs.
# Usage: `options nvidia NVreg_RegistryDwords="<key1>=<value1>;<key2>=<value2>;..."`
# Common keys include:
# - RMIntrLockingMode=1 (Default: 0)
# Experimental option that adjusts interrupt locking to improve frame pacing on high-refresh-rate displays,
# especially in PRIME configurations where the discrete GPU drives an external monitor.
#
# - PeerMappingOverride=1
# Forces specific peer memory mapping behavior required for GPUDirect Async support.
#
# - NVreg_RMFailAllocCount (if available)
# Sets the number of retry attempts for memory allocation failures in the resource manager.
#
# - NVreg_RMFailAllocTimeout (if available)
# Specifies the timeout duration for resource manager memory allocation attempts.
#
# - RMUseSwI2c (if available)
# Enables software-based I2C implementation.
# Usage: `options nvidia NVreg_RegistryDwords="RMUseSwI2c=0x01"`
# Default: `0`
# Note: Useful for systems where hardware I2C support is unreliable
# Reference: https://www.ddcutil.com/nvidia/
#
# - RMI2cSpeed (if available)
# Sets the speed of the I2C bus in kHz.
# Usage: `options nvidia NVreg_RegistryDwords="RMI2cSpeed=100"`
# Default: Driver-determined
# Note: Adjusting this can help with monitor communication issues.
# Reference: https://www.ddcutil.com/nvidia/
#
# - OverrideMaxPerf (if available)
# Forces the GPU to operate at a specific performance level.
# Usage: `options nvidia NVreg_RegistryDwords="OverrideMaxPerf=0x1"`
# Default: `0`
# Note: Setting this to `0x1` can force maximum power-saving mode.
# Reference: https://forums.developer.nvidia.com/t/145573
#
# - PowerMizerEnable (if available)
# Controls the enabling of PowerMizer, NVIDIA's dynamic performance and power management technology.
# Usage: `options nvidia NVreg_RegistryDwords="PowerMizerEnable=0x1"`
# Default: `1`
# Note: As of driver version 530.41.03, this functionality may have been removed.
# Reference: https://forums.developer.nvidia.com/t/247610
#
# - PerfLevelSrc (if available)
# Determines the source of performance level decisions.
# Usage: `options nvidia NVreg_RegistryDwords="PerfLevelSrc=0x3333"`
# Default: Driver-determined
# Note: Often used in conjunction with `PowerMizerEnable` to control performance levels.
# Reference: https://forums.developer.nvidia.com/t/145573
#
# - RMIntrLockingMode (if available)
# An experimental setting to improve frame pacing on high-refresh-rate displays,
# particularly in PRIME configurations where the dGPU drives an external monitor.
# Usage: `options nvidia NVreg_RegistryDwords="RMIntrLockingMode=1"`
# Default: `0`
# Note: This setting is experimental and may not be suitable for all systems.
#
# Additional Power Management and Stability Options:
#
# - NVreg_DynamicPowerManagement (if available)
# Enables or disables dynamic power management (DPM), impacting overall power efficiency and performance.
#
# - NVreg_UseFBDefExclusionArea (if available)
# Reserves an exclusion area for the framebuffer to prevent conflicts with system memory mappings,
# thereby enhancing system stability.
#
# General Notes:
#
# - Some options are experimental or reserved for internal testing; defaults may vary between proprietary drivers
# (e.g., 570.124.04) and open kernel modules.
# - Changing these settings can improve performance or unlock additional features but may also introduce
# stability or security risks if misconfigured.
# - Always refer to the latest NVIDIA documentation and header files for up-to-date details:
# • Open NVIDIA nv-reg.h:
# https://github.com/NVIDIA/open-gpu-kernel-modules/blob/main/kernel-open/nvidia/nv-reg.h
# • Proprietary nv-reg.h (e.g., /usr/src/nvidia-570.124.04/nvidia/nv-reg.h)
# • Open NVIDIA nvrm_registry.h:
# https://github.com/NVIDIA/open-gpu-kernel-modules/blob/main/src/nvidia/interface/nvrm_registry.h
#
# Links:
#
# - https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks
# - https://forums.developer.nvidia.com/t/does-modprobe-d-nvidia-conf-nvreg-enablestreammemops-need-to-be-set-for-gpudirect-to-work/79511
# - https://github.com/NVIDIA/open-gpu-kernel-modules/blob/main/src/nvidia/interface/nvrm_registry.h
# - Requires nvidia.ko >= 510.40.3 loaded with PeerMappingOverride=1. https://docs.nvidia.com/nvshmem/install-guide/index.html
# - https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers/en
# - https://github.com/ventureoo/nvidia-tweaks
# - https://nvdam.widen.net/s/k8vrp9xkft/tech-overview-magnum-io-1790750-r5-web
# - https://developer.download.nvidia.com/devzone/devcenter/cuda/docs/GPUDirect_Technology_Overview.pdf
# - https://docs.nvidia.com/nvshmem/pdf/NVSHMEM-Installation-Guide.pdf
# - https://github.com/CachyOS/CachyOS-Settings/blob/master/usr/lib/modprobe.d/nvidia.conf
# modules verbose options:
# modinfo nvidia nvidia_drm nvidia_uvm nvidia_modeset nvidia_peermem typec_nvidia nvidia_wmi_ec_backlight i2c_nvidia_gpu
# sudo systool -m nvidia_drm -v
# sudo systool -m nvidia_uvm -v
# sudo systool -m nvidia_modeset -v
# sudo systool -m nvidia_peermem -v
#NVreg_EnableStreamMemOPs=1 NVreg_RegistryDwords="PeerMappingOverride=1;"
options nvidia \
NVreg_EnablePCIeGen3=1 \
NVreg_UsePageAttributeTable=1 \
NVreg_PreserveVideoMemoryAllocations=1 \
NVreg_OpenRmEnableUnsupportedGpus=1 \
NVreg_EnableResizableBar=1 \
NVreg_EnableGpuFirmware=1 \
NVreg_RegistryDwords="RMIntrLockingMode=1;"
options nvidia_drm modeset=1
blacklist i2c_nvidia_gpu
# /etc/environment
# KWIN_DRM_NO_AMS
# QT_XCB_NO_COMPOSITE
# QT_WAYLAND_DISABLE_WINDOWDECORATION
# __GL_VRR_ALLOWED
# __GL_SYNC_TO_VBLANK
# QT_ENABLE_HIGHDPI_SCALING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment