On Thu Mar 26, 2026 at 7:53 AM CET, Alvin Sun wrote:
> +/// Writes VM debug information for the "gpuvas" debugfs file.
> +fn show_vm(vm: &Vm, f: &mut impl Write) -> core::fmt::Result {
> +    writeln!(
> +        f,
> +        "DRM GPU VA space ({:?}) [0x{:016x};0x{:016x}]",
> +        vm.gpuvm.name(),
> +        vm.va_range.start,
> +        vm.va_range.end,
> +    )?;
> +
> +    let kva = vm.gpuvm.kernel_alloc_va();
> +    writeln!(
> +        f,
> +        "Kernel reserved node [0x{:016x};0x{:016x}]",
> +        kva.addr(),
> +        kva.addr() + kva.length(),
> +    )?;
> +
> +    writeln!(f, " VAs | start              | range              | end        
>         | object             | object offset")?;
> +    writeln!(f, 
> "-------------------------------------------------------------------------------------------------------------")?;
> +    for va in vm.gpuvm_core.lock().va_mappings() {
> +        f.write_fmt(fmt!(
> +            "     | 0x{:016x} | 0x{:016x} | 0x{:016x} | {:18p} | 
> 0x{:016x}\n",
> +            va.addr(),
> +            va.length(),
> +            va.addr() + va.length(),
> +            va.obj().as_raw(),
> +            va.gem_offset(),
> +        ))?;
> +    }
> +    Ok(())
> +}

Why is this code duplicated? The implementation already exists in [1].

[1] 
https://elixir.bootlin.com/linux/v7.0.8/source/drivers/gpu/drm/drm_debugfs.c#L209

Reply via email to