From 50f225dcfc58fa4a7faa1364846fb701fa03d6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=B1=EC=A7=80=EB=AA=85?= Date: Thu, 3 Sep 2026 22:15:14 +0900 Subject: [PATCH 1/3] nvidia-peer-memory: prefer in-tree nvidia_peermem over legacy nv_peer_mem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Driver R470.42.01 and later ship nvidia_peermem as part of the driver; the out-of-tree nv_peer_mem DKMS module does not exist there. The role unconditionally ran dkms autoinstall + modprobe nv_peer_mem on DGX systems and failed on current DGX OS. Probe for the in-tree module with modinfo and load it when present; fall back to the legacy nv_peer_mem path only when it is absent. Observed on DGX OS 7.5.0 / driver 580.126.20: modprobe: FATAL: Module nv_peer_mem not found in directory /lib/modules/6.8.0-106-generic Signed-off-by: 백지명 --- roles/nvidia-peer-memory/tasks/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/roles/nvidia-peer-memory/tasks/main.yml b/roles/nvidia-peer-memory/tasks/main.yml index 04025e7f0..c5f759a4e 100644 --- a/roles/nvidia-peer-memory/tasks/main.yml +++ b/roles/nvidia-peer-memory/tasks/main.yml @@ -4,11 +4,32 @@ path: /etc/dgx-release register: is_dgx +# Driver R470.42.01 and later ship nvidia_peermem in-tree. On those +# systems the out-of-tree nv_peer_mem DKMS module does not exist. +- name: Check for in-tree nvidia_peermem module + command: modinfo nvidia_peermem + register: nvidia_peermem_info + failed_when: false + changed_when: false + when: + - ansible_local['gpus']['count'] + - is_dgx.stat.exists + +- name: Load in-tree nvidia_peermem + modprobe: + name: nvidia_peermem + state: present + when: + - ansible_local['gpus']['count'] + - is_dgx.stat.exists + - nvidia_peermem_info.rc == 0 + - name: Autoinstall DKMS modules command: dkms autoinstall when: - ansible_local['gpus']['count'] - is_dgx.stat.exists + - nvidia_peermem_info.rc != 0 - name: Modprobe nv_peer_mem modprobe: @@ -17,6 +38,7 @@ when: - ansible_local['gpus']['count'] - is_dgx.stat.exists + - nvidia_peermem_info.rc != 0 - name: Start nv_peer_mem service service: @@ -25,3 +47,4 @@ when: - ansible_local['gpus']['count'] - is_dgx.stat.exists + - nvidia_peermem_info.rc != 0 From a64245a6b3e61ed93eb1ab4ca4ca89101ca384bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=B1=EC=A7=80=EB=AA=85?= Date: Fri, 4 Sep 2026 09:26:04 +0900 Subject: [PATCH 2/3] nvidia-peer-memory: default the modinfo rc when the probe is skipped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The probe task is guarded by the same GPU/DGX conditions as the tasks that consume its result, so nvidia_peermem_info.rc is only defined on hosts that reach it. Relying on when-list short-circuiting to avoid the undefined attribute is easy to break by reordering the conditions. Default the value to 1 (module absent) so each branch is safe to evaluate on its own. Behaviour is unchanged on every host. Signed-off-by: 백지명 --- roles/nvidia-peer-memory/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/nvidia-peer-memory/tasks/main.yml b/roles/nvidia-peer-memory/tasks/main.yml index c5f759a4e..cfab61b9f 100644 --- a/roles/nvidia-peer-memory/tasks/main.yml +++ b/roles/nvidia-peer-memory/tasks/main.yml @@ -22,14 +22,14 @@ when: - ansible_local['gpus']['count'] - is_dgx.stat.exists - - nvidia_peermem_info.rc == 0 + - nvidia_peermem_info.rc | default(1) == 0 - name: Autoinstall DKMS modules command: dkms autoinstall when: - ansible_local['gpus']['count'] - is_dgx.stat.exists - - nvidia_peermem_info.rc != 0 + - nvidia_peermem_info.rc | default(1) != 0 - name: Modprobe nv_peer_mem modprobe: @@ -38,7 +38,7 @@ when: - ansible_local['gpus']['count'] - is_dgx.stat.exists - - nvidia_peermem_info.rc != 0 + - nvidia_peermem_info.rc | default(1) != 0 - name: Start nv_peer_mem service service: @@ -47,4 +47,4 @@ when: - ansible_local['gpus']['count'] - is_dgx.stat.exists - - nvidia_peermem_info.rc != 0 + - nvidia_peermem_info.rc | default(1) != 0 From 45c03ba437f52aa562d51853507ac425aa2fcf4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=B1=EC=A7=80=EB=AA=85?= Date: Sun, 6 Sep 2026 12:30:45 +0900 Subject: [PATCH 3/3] nvidia-peer-memory: retire legacy nv_peer_mem before loading nvidia_peermem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A host upgraded from a pre-R470 driver can still have the nv_peer_mem service enabled and the module loaded when nvidia_peermem becomes available in-tree. Stop and disable the service when it exists, unload nv_peer_mem, then load nvidia_peermem so the two never coexist. Every step is idempotent: service_facts gates the service task and modprobe only acts when the module state differs, so a second run reports ok throughout. Signed-off-by: 백지명 --- roles/nvidia-peer-memory/tasks/main.yml | 28 +++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/roles/nvidia-peer-memory/tasks/main.yml b/roles/nvidia-peer-memory/tasks/main.yml index cfab61b9f..8dd239ce5 100644 --- a/roles/nvidia-peer-memory/tasks/main.yml +++ b/roles/nvidia-peer-memory/tasks/main.yml @@ -15,14 +15,34 @@ - ansible_local['gpus']['count'] - is_dgx.stat.exists -- name: Load in-tree nvidia_peermem - modprobe: - name: nvidia_peermem - state: present +# A host upgraded from a pre-R470 driver may still carry the legacy +# nv_peer_mem service and module. Retire them before loading the in-tree +# module so the two never coexist. Every step is a no-op once converged. +- name: Use in-tree nvidia_peermem when: - ansible_local['gpus']['count'] - is_dgx.stat.exists - nvidia_peermem_info.rc | default(1) == 0 + block: + - name: Populate service facts + service_facts: + + - name: Stop and disable legacy nv_peer_mem service + service: + name: nv_peer_mem + state: stopped + enabled: false + when: "'nv_peer_mem.service' in ansible_facts.services" + + - name: Unload legacy nv_peer_mem module + modprobe: + name: nv_peer_mem + state: absent + + - name: Load in-tree nvidia_peermem + modprobe: + name: nvidia_peermem + state: present - name: Autoinstall DKMS modules command: dkms autoinstall