GB10 (DGX Spark): GR context creation fails with NV_ERR_NO_MEMORY (kgrctxAllocMainCtxBuffer) whenever no free order-9 block exists, with 50+ GiB free

Aberta
#1,561 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
c, linux

Direção de pesquisa

Start with kgraphicsShouldForceMainCtxContiguity in src/nvidia/generated/g_kernel_graphics_nvoc.h and the allocation path in src/nvidia/src/kernel/gpu/gr/kernel_graphics_context.c around lines 1115–1186. Trace how the main context buffer reaches __get_free_pages and inspect the related allocation helpers. Done means context creation succeeds when memory is available but no order-9 block exists, or reports that contiguous memory is unavailable distinctly from general out-of-memory.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug
NVIDIA Open GPU Kernel Modules Version

580.178.04 (NVIDIA UNIX Open Kernel Module for aarch64, release build as shipped with DGX OS 7.6.0)

Please confirm this issue does not happen with the proprietary driver (of the same version). This issue tracker is only for bugs specific to the open kernel driver.
  • I confirm that this does not happen with the proprietary driver package.
Operating System and Version

Ubuntu 24.04.5 LTS (NVIDIA DGX OS 7.6.0)

Kernel Release

Linux 7.0.0-1019-nvidia #19~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC aarch64 GNU/Linux (DGX OS kernel, not self-built), where it was first measured. It also reproduces on the newer DGX OS kernel 7.0.0-1025-nvidia with the same driver; the attached bundle is from a 7.0.0-1025 boot and contains 153 kgrctxAllocMainCtxBuffer failure lines.

Please confirm you are running a stable release kernel (e.g. not a -rc). We do not accept bug reports for unreleased kernels.
  • I am running on a stable kernel release.
Hardware: GPU

GPU 0: NVIDIA GB10 (DGX Spark)

Describe the bug

Creating a GR context fails with NV_ERR_NO_MEMORY while 50+ GiB of system memory are free. The first CUDA call in a process then fails with "CUDA error: out of memory", and a graphics context fails the same way, for example headless Chromium. It happens with no other GPU client present. It depends only on whether the Normal zone holds a free order-9 (2 MiB) block at that instant.

Kernel log at each failure (four lines per failed context; about 3,100 such groups in one boot):

NVRM: nvCheckOkFailedNoLog: Check failed: Out of memory [NV_ERR_NO_MEMORY] (0x00000051) returned from kgrctxAllocMainCtxBuffer(pGpu, pKernelGraphicsContext, pKernelGraphics, pKernelChannel) @ kernel_graphics_context.c:1387
NVRM: nvCheckOkFailedNoLog: Check failed: Out of memory [NV_ERR_NO_MEMORY] (0x00000051) returned from kgrctxAllocCtxBuffers(pGpu, pKernelGraphicsObject->pKernelGraphicsContext, pKernelGraphics, pKernelGraphicsObject) @ kernel_graphics_object.c:215
NVRM: nvCheckOkFailedNoLog: Check failed: Out of memory [NV_ERR_NO_MEMORY] (0x00000051) returned from _memdescAllocInternal(pMemDesc) @ mem_desc.c:1359
NVRM: nvAssertOkFailedNoLog: Assertion failed: Out of memory [NV_ERR_NO_MEMORY] (0x00000051) returned from status @ kernel_graphics_context.c:1178

Mechanism, from the 580.178.04 source:

  1. kgraphicsShouldForceMainCtxContiguity returns NV_TRUE unconditionally (src/nvidia/generated/g_kernel_graphics_nvoc.h). So the main context buffer is always allocated physically contiguous (src/nvidia/src/kernel/gpu/gr/kernel_graphics_context.c, 1115-1186).
  2. On this system the buffer is 1,409,024 bytes, which rounds up to one order-9 block.
  3. It comes from ordinary Linux memory: memdescAlloc → osAllocPages → nv_alloc_pages (contiguous) → nv_alloc_contig_pages → __get_free_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL ..., 9).
  4. There is no pool and no non-contiguous fallback. When the buddy allocator cannot supply an order-9 block, the context fails.

On this unified-memory system, ordinary workloads routinely consume every free order-9 block in the Normal zone: KVM/QEMU guests and model loading using transparent huge pages, and the page cache. Total free memory stays high throughout.

To Reproduce
  • Preconditions: DGX Spark, driver 580.178.04, transparent_hugepage=madvise (the default). Fragment the Normal zone's free order-9 blocks; running a few KVM/QEMU guests reaches 0 within minutes. Confirm with the count of free order-9+ blocks in /proc/buddyinfo (Normal zone, columns 9 and up).

  • With that count at 0, run a process that only creates a context:

    import torch
    
    def free_order9_plus():
        for line in open("/proc/buddyinfo"):
            f = line.split()
            if f[3] == "Normal":
                return sum(int(n) for n in f[4 + 9:])
    
    print("free order>=9 blocks before:", free_order9_plus())
    try:
        torch.zeros(1, device="cuda")
        torch.cuda.synchronize()
        print("OK")
    except Exception as e:
        print("FAIL", type(e).__name__, str(e).splitlines()[0])
    
  • Observed, with no other GPU user in either run:

    • 0 free order-9+ blocks (8,219 free order-8 blocks), 53 GiB free: FAIL in 0.7 s, "CUDA error: out of memory", and the four NVRM lines above are logged.
    • 5,554 free order-9+ blocks, 73 GiB free: OK in 0.4 s, nothing logged.
  • The failure rate tracks huge-page users: about 1.5 failed contexts an hour with no KVM guest running, and about 255 an hour with four guests running.

  • Dropping caches and compacting (sync; echo 3 > /proc/sys/vm/drop_caches; echo 1 > /proc/sys/vm/compact_memory) restores free order-9 blocks: from 3 to 2,233 in one test.

Bug Incidence

Sometimes

nvidia-bug-report.log.gz

nvidia-bug-report.log.gz

More Info

Expected: a context is created whenever enough memory is free, or the driver reports that no contiguous block is available, rather than "out of memory".

Request:

  • pre-allocate or pool the main context buffer, or allow a non-contiguous fallback for it on GB10;
  • return an error that distinguishes "no contiguous block" from "out of memory".

The proprietary kernel module does not support Blackwell (GB10), so this cannot be compared with it. The open module is the only kernel driver for this GPU.

Workarounds in use: transparent_hugepage=never host-wide, or periodic compaction.

Workaround trial: with transparent huge pages set to never for 7 h 22 min (up to four VMs running), context creation failed 41 times (5.6 an hour, 32 of them in one 20-minute window), against about 255 an hour with four VMs before; the failures no longer followed the number of VMs, and each burst came while free 2 MiB blocks were at or near zero, so never greatly reduces the failure but does not remove it: fragmentation from other memory users still starves the 2 MiB allocation.

Related: #1358 (GB10, NV_ERR_NO_MEMORY under memory pressure, with a different symptom: a host wedge).

Linguagem predominante
C
Estrelas
17.7k
Forks
2k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de NVIDIA/open-gpu-kernel-modules

Todas as issues de NVIDIA/open-gpu-kernel-modules

Issues semelhantes

Mais issues de C

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.