Using nvidia drm/kms display kernel module failed with memory allocation error

Hello nvidia experts:
I am trying to use nvidia drm/kms for display application,
the hardware platform is orin p3663, driveOs 6.0.2.0, nvidisplay version NVIDIA-kernel-module-source-TempVersion.tar.xz.
follow this link driveOs nvdisplay, I sucessfully add device tree for SST mode,in this driveOs release, max_gmsl_dp_ser does not support MST. but when I insert the kernel modules, dmesg shows a lot memory allocation error, please attached log.
After insmod the display kernel modules, there is a drm interface /sys/class/drm/card0-DP-1 shows up, Then I cloned libdrm in Mesa / drm · GitLab and try to test the display card, but the modetest failed to get dumbbuffer.
Any suggests on how to test the display card/interface will be appreciated. Should I use a new version of display driver? currently I only have this one. Are those logs fatal or can be ignored?

Below is the key device tree for display and maxim serializer:

    display@13800000 {
          nvidia,window-head-mask = <0x00000000 0x00000001>;
          status = "okay";
          display-timings {
              display-connector-0 {
                  dcb-index = <0>;

                  stream-0 {
                          timings-phandle = <&mode0>;
                  };
                  
              };
          };

          mode0: 1920-1080-60Hz {
              clock-frequency-khz = <148500>;
              hactive = <1920>;
              vactive = <1080>;
              hfront-porch = <88>;
              hback-porch = <148>;
              hsync-len = <44>;
              vfront-porch = <4>;
              vback-porch = <36>;
              vsync-len = <5>;
              rrx1k = <60000>;
          };

      };

  i2c@31e0000 {
      status = "okay";
      maxim_ser: max_gmsl_dp_ser@40 {
          compatible = "maxim,max_gmsl_dp_ser";
          reg = <0x40>;
          status = "okay";
          max_gmsl_dp_ser-pwrdn = <&tegra_main_gpio
                          TEGRA234_MAIN_GPIO(G, 3)
                          GPIO_ACTIVE_HIGH>;
          ser-errb = <&tegra_main_gpio TEGRA234_MAIN_GPIO(G, 7) 0>;
          dprx-link-rate = <0x1e>;
          dprx-lane-count = <0x4>;
          gmsl-link-select = <0x0>;
      };
  };

Below is the logs when insmod the display kernel module:


  700.535056 nvidia: loading out-of-tree module taints kernel.
  700.545273 platform 13800000.display:nvdisplay-niso: Adding to iommu group 30
  700.546320 NVRM: loading NVIDIA UNIX Kernel Module for aarch64  515.00  Release Build  (user@ubuntu)  Fri 22 Jul 2022 12:58:55 PM CST
  700.680025 nvidia-modeset: Loading NVIDIA UNIX Kernel Mode Setting Driver for aarch64  515.00  Release Build  (user@ubuntu)  Fri 22 Jul 2022 12:58:55 PM CST
  700.680080 NVRM gpumgrGetSomeGpu: Failed to retrieve pGpu - Too early call!.
  700.680085 NVRM nvAssertFailedNoLog: Assertion failed: NV_FALSE @ gpu_mgr.c:295
  700.680090 CPU: 1 PID: 1587 Comm: modprobe Tainted: G           O      5.10.65-rt53-tegra #2
  700.680095 Hardware name: p3663-0001 (DT)
  700.680097 Call trace:
  700.680097  dump_backtrace+0x0/0x1d0
  700.680108  show_stack+0x2c/0x40
  700.680112  dump_stack+0xd8/0x138
  700.680116  os_dump_stack+0x14/0x1c nvidia
  700.680201  osAssertFailed+0xc/0x18 nvidia
  700.680266  nvAssertFailedBacktrace+0xb0/0x108 nvidia
  700.680328  nvAssertFailedNoLog+0x60/0x6c nvidia
  700.680388  gpumgrGetSomeGpu+0x7c/0xa4 nvidia
  700.680448  _rmGpuLockAcquire+0x178/0x3a0 nvidia
  700.680507  rmGpuLocksAcquire+0x24/0x2c nvidia
  700.680563  rmclientConstruct_IMPL+0x13c/0x2f4 nvidia
  700.680620  __nvoc_ctor_RmClient+0x58/0x94 nvidia
  700.680679  __nvoc_objCreate_RmClient+0xe0/0x11c nvidia
  700.680738  resservClientFactory+0x2c/0xbc nvidia
  700.680793  serverAllocClient+0xc4/0x224 nvidia
  700.680849  serverAllocResource+0x17c/0x460 nvidia
  700.680903  _rmAlloc+0x124/0x144 nvidia
  700.680958  rmapiAllocWithSecInfo+0x234/0x370 nvidia
  700.681013  rmapiAllocWithSecInfoTls+0x64/0x84 nvidia
  700.681067  _nv04Alloc+0x7c/0x98 nvidia
  700.681120  Nv04AllocKernel+0x18/0x24 nvidia
  700.681174  rm_kernel_rmapi_op+0x120/0x1e0 nvidia
  700.681229  nvkms_call_rm+0x5c/0x90 nvidia_modeset
  700.681321  nvRmApiAlloc+0x30/0x40 nvidia_modeset
  700.681397  do_one_initcall+0x4c/0x300
  700.681401  do_init_module+0x5c/0x210
  700.681404  load_module+0x2178/0x2550
  700.681406  __do_sys_finit_module+0xb8/0x120
  700.681408  __arm64_sys_finit_module+0x28/0x40
  700.681410  el0_svc_common.constprop.0+0x7c/0x1c0
  700.681414  do_el0_svc+0x34/0xa0
  700.681417  el0_svc+0x1c/0x30
  700.681421  el0_sync_handler+0xa8/0xb0
  700.681424  el0_sync+0x16c/0x180
  700.681431 NVRM gpumgrGetSomeGpu: Failed to retrieve pGpu - Too early call!.
  700.681434 NVRM nvAssertFailedNoLog: Assertion failed: NV_FALSE @ gpu_mgr.c:295
  700.708811 drm:nv_drm_probe_devices nvidia_drm Registering device for NVIDIA GPU ID 0x0820000
  700.708900 drm:drm_minor_register 
  700.709037 drm:drm_minor_register new minor registered 128
  700.709042 drm:drm_minor_register 
  700.709106 drm:drm_minor_register new minor registered 0
  700.709112 drm nvidia-drm GPU ID 0x00020000 Loading driver

  702.457839 NVRM rpcRmApiControl_dce: NVRM_RPC_DCE: Failed RM ctrl call result 0x56:
  702.458743 NVRM rpcRmApiControl_dce: NVRM_RPC_DCE: Failed RM ctrl call result 0x56:
  702.459734 NVRM rmapiAllocWithSecInfo: allocation failed; status: Given class-id not valid NV_ERR_INVALID_CLASS (0x00000022)
  702.459739 NVRM rmapiAllocWithSecInfo: client:0xc1d00001 parent:0xcaf00001 object:0x0 class:0x402c
  702.463542 NVRM rpcRmApiControl_dce: NVRM_RPC_DCE: Failed RM ctrl call result 0x56:
  702.512551 NVRM nvAssertFailed: Assertion failed: 0 @ g_mem_mgr_nvoc.h:1190
  702.512559 CPU: 0 PID: 1587 Comm: modprobe Tainted: G           O      5.10.65-rt53-tegra #2
  702.512563 Hardware name: p3663-0001 (DT)
  702.512565 Call trace:
  702.512566  dump_backtrace+0x0/0x1d0
  702.512574  show_stack+0x2c/0x40
  702.512578  dump_stack+0xd8/0x138
  702.512582  os_dump_stack+0x14/0x1c nvidia
  702.512668  osAssertFailed+0xc/0x18 nvidia
  702.512732  nvAssertFailedBacktrace+0xb0/0x108 nvidia
  702.512794  nvAssertFailed+0x60/0x6c nvidia
  702.512853  memmgrGetPteKindPitch_474d46+0x28/0x48 nvidia
  702.512912  _ctxdmaConstruct+0x3dc/0x43c nvidia
  702.512969  ctxdmaConstruct_IMPL+0x310/0x35c nvidia
  702.513027  __nvoc_ctor_ContextDma+0x78/0xc8 nvidia
  702.513086  __nvoc_objCreate_ContextDma+0xe0/0x11c nvidia
  702.513144  __nvoc_objCreateDynamic_ContextDma+0xe4/0xf8 nvidia
  702.513201  __nvoc_objCreateDynamic+0x84/0x94 nvidia
  702.513258  resservResourceFactory+0x118/0x174 nvidia
  702.513314  _clientAllocResourceHelper+0x174/0x418 nvidia
  702.513368  clientAllocResource_IMPL+0x30/0x38 nvidia
  702.513423  serverAllocResourceUnderLock+0x508/0x814 nvidia
  702.513477  serverAllocResource+0x2cc/0x460 nvidia
  702.513531  _rmAlloc+0x124/0x144 nvidia
  702.513585  rmapiAllocWithSecInfo+0x234/0x370 nvidia
  702.513639  rmapiAllocWithSecInfoTls+0x64/0x84 nvidia
  702.513694  _nv04Alloc+0x7c/0x98 nvidia
  702.513747  Nv04AllocKernel+0x18/0x24 nvidia
  702.513801  rm_kernel_rmapi_op+0x120/0x1e0 nvidia
  702.513856  nvkms_call_rm+0x5c/0x90 nvidia_modeset
  702.513930  nvRmApiAlloc+0x30/0x40 nvidia_modeset
  702.513994  nvkms_ioctl_from_kapi+0x54/0x80 nvidia_modeset
  702.514055  AllocateDevice+0x228/0x3e8 nvidia_modeset
  702.514114  drm_dev_register+0xe0/0x220
  702.514122  nv_drm_probe_devices+0xec/0x260 nvidia_drm
  702.514135  nv_drm_init+0x2c/0x58 nvidia_drm
  702.514142  nv_linux_drm_init+0x14/0x1000 nvidia_drm
  702.514149  do_one_initcall+0x4c/0x300
  702.514154  do_init_module+0x5c/0x210
  702.514157  load_module+0x2178/0x2550
  702.514159  __do_sys_finit_module+0xb8/0x120
  702.514161  __arm64_sys_finit_module+0x28/0x40
  702.514163  el0_svc_common.constprop.0+0x7c/0x1c0
  702.514166  do_el0_svc+0x34/0xa0
  702.514169  el0_svc+0x1c/0x30
  702.514173  el0_sync_handler+0xa8/0xb0
  702.514176  el0_sync+0x16c/0x180
  702.514509 NVRM nvAssertFailed: Assertion failed: 0 @ g_mem_mgr_nvoc.h:1190
  702.514798 NVRM nvAssertFailed: Assertion failed: 0 @ g_mem_mgr_nvoc.h:1190
  702.515098 NVRM nvAssertFailed: Assertion failed: 0 @ g_mem_mgr_nvoc.h:1190
  702.515372 NVRM nvAssertFailed: Assertion failed: 0 @ g_mem_mgr_nvoc.h:1190
  702.515650 NVRM nvAssertFailed: Assertion failed: 0 @ g_mem_mgr_nvoc.h:1190
  702.515923 NVRM nvAssertFailed: Assertion failed: 0 @ g_mem_mgr_nvoc.h:1190
  702.589612 NVRM rpcRmApiControl_dce: NVRM_RPC_DCE: Failed RM ctrl call result 0xffff:
  702.592047 NVRM rpcRmApiControl_dce: NVRM_RPC_DCE: Failed RM ctrl call result 0x56:
  702.592143 NVRM nvAssertFailed: Assertion failed: 0 @ g_mem_mgr_nvoc.h:1190
  702.592354 drm:drm_sysfs_connector_add adding "DP-1" to sysfs
  702.592392 drm:drm_sysfs_hotplug_event generating hotplug event
  702.592406 drm:drm_helper_hpd_irq_event CONNECTOR:61:DP-1 Old epoch counter 0
  702.595301 drm:drm_helper_hpd_irq_event CONNECTOR:61:DP-1 status updated from unknown to connected
  702.595309 drm:drm_helper_hpd_irq_event CONNECTOR:61:DP-1 New epoch counter 1
  702.595313 drm:drm_sysfs_hotplug_event generating hotplug event
  702.595329 drm:drm_helper_probe_single_connector_modes CONNECTOR:61:DP-1
  702.597720 drm:drm_add_display_info Supported Monitor Refresh rate range is 0 Hz - 0 Hz
  702.597725 drm:drm_add_display_info non_desktop set to 0
  702.639726 drm:drm_helper_probe_single_connector_modes CONNECTOR:61:DP-1 probed modes :
  702.639735 drm:drm_mode_debug_printmodeline Modeline "1920x1080": 60 148500 1920 2008 2052 2200 1080 1084 1089 1125 0x8 0x5
  702.639740 drm:drm_mode_debug_printmodeline Modeline "1680x1050": 60 146250 1680 1784 1960 2240 1050 1053 1059 1089 0x0 0x6
  702.639744 drm:drm_mode_debug_printmodeline Modeline "1280x1024": 75 135000 1280 1296 1440 1688 1024 1025 1028 1066 0x0 0x5
  702.639747 drm:drm_mode_debug_printmodeline Modeline "1280x1024": 60 108000 1280 1328 1440 1688 1024 1025 1028 1066 0x0 0x5
  702.639750 drm:drm_mode_debug_printmodeline Modeline "1440x900": 60 106500 1440 1520 1672 1904 900 903 909 934 0x0 0x6
  702.639753 drm:drm_mode_debug_printmodeline Modeline "1280x960": 60 108000 1280 1376 1488 1800 960 961 964 1000 0x0 0x5
  702.639756 drm:drm_mode_debug_printmodeline Modeline "1280x720": 60 74250 1280 1390 1430 1650 720 725 730 750 0x0 0x5
  702.639759 drm:drm_mode_debug_printmodeline Modeline "1024x768": 75 78750 1024 1040 1136 1312 768 769 772 800 0x0 0x5
  702.639761 drm:drm_mode_debug_printmodeline Modeline "1024x768": 70 75000 1024 1048 1184 1328 768 771 777 806 0x0 0xa
  702.639764 drm:drm_mode_debug_printmodeline Modeline "1024x768": 60 65000 1024 1048 1184 1344 768 771 777 806 0x0 0xa
  702.639767 drm:drm_mode_debug_printmodeline Modeline "800x600": 75 49500 800 816 896 1056 600 601 604 625 0x0 0x5
  702.639770 drm:drm_mode_debug_printmodeline Modeline "800x600": 72 50000 800 856 976 1040 600 637 643 666 0x0 0x5
  702.639773 drm:drm_mode_debug_printmodeline Modeline "800x600": 60 40000 800 840 968 1056 600 601 605 628 0x0 0x5
  702.639776 drm:drm_mode_debug_printmodeline Modeline "800x600": 56 36000 800 824 896 1024 600 601 603 625 0x0 0x5
  702.639779 drm:drm_mode_debug_printmodeline Modeline "640x480": 75 31500 640 656 720 840 480 481 484 500 0x0 0xa
  702.639781 drm:drm_mode_debug_printmodeline Modeline "640x480": 73 31500 640 656 696 832 480 481 484 520 0x0 0xa
  702.639784 drm:drm_mode_debug_printmodeline Modeline "640x480": 60 25175 640 656 752 800 480 490 492 525 0x0 0xa
  702.639789 drm:drm_helper_hpd_irq_event Sent hotplug event
  702.639809 drm Initialized nvidia-drm 0.0.0 20160202 for 13800000.display on minor 0

Dear @jing.ran,
You can ignore these messages. Do you see any functional issue?

Hello SivaRamaKrishnaNV
Thanks for reply. When I test the display card with modeset.c, the log shows that the driver can not allocate dumbbuffer:
root@tegra-ubuntu:/home/nvidia/drm/build/tests/modetest# ./modetest
using card ‘/dev/dri/card0’
mode for connector 61 is 1920x1080
cannot create dumb buffer (12): Cannot allocate memory
cannot create framebuffer for connector 61
cannot setup device for connector 0:61 (12): Cannot allocate memory
exiting

I test this application on my ubuntu 20.04 virtual machine, it works.
How to fix this issue?

Dear @jing.ran,
Unfortunately, We don’t support any dumb buffer allocations through the nvidia-drm device. For memory allocations, you can use GBM to allocate memory and then import this into nvidia-drm using PRIME.

1 Like

Dear SivaRamaKrishnaNV:
OK, I will try GBM memory allocation ,thanks!