Linux: one dma-buf import larger than udmabuf size_limit_mb (default 64) fails UDMABUF_CREATE #5329

Closed
opened 2026-10-13 17:18:40 +00:00 by darklinkworker · 11 comments
darklinkworker commented 2026-10-13 17:18:40 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by darklinkworker on 2026-10-13T17:18:40Z.


What

On Linux, importing one contiguous direct-memory run as a dma-buf fails when the run is larger than the kernel udmabuf module limit. The import then falls through to the address-copy path and aborts on the 64 MiB cap.

/sys/module/udmabuf/parameters/size_limit_mb was 64 on this machine. A single registered range failed:

[gpu] host import of 0x2041fd0000+0x93a0000 failed at UDMABUF_CREATE (-1000072003); falling back to copies
FATAL: an address-based build copies 147 MiB of 1 registered ranges, past 64 MiB (APS5_ADDRESS_COPY_MAX_MIB); the largest: 0x2041fd0000+0x93a0000 (147.6 MiB committed, outside the write-watched arena)

Raising that parameter to 2048 for the current boot made the same import succeed. The write does not survive a reboot. This is a host tweak, not a change in the emulator.

Open #4449 covers a scattered range as a UDMABUF_CREATE_LIST run list. A single run still uses one UDMABUF_CREATE, so a run bigger than size_limit_mb is still rejected by the kernel even with that PR.

Repro

Dragon Quest III HD-2D Remake (PPSA20612) on Linux, RADV, during boot after the window is up. The copy-cap abort is the one above: 147.6 MiB, one range. With size_limit_mb left at 64 it returns; with it raised, that abort did not return.

Environment

  • OS: Nobara Linux, kernel 7.2
  • CPU: AMD Ryzen 5 7640U
  • GPU: AMD Radeon 760M (Phoenix, PCI 1002:15bf), RADV
  • udmabuf size_limit_mb: 64 by default

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5834640558 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329). Originally posted by [darklinkworker](https://github.com/darklinkworker) on 2026-10-13T17:18:40Z. --- ## What On Linux, importing one contiguous direct-memory run as a dma-buf fails when the run is larger than the kernel `udmabuf` module limit. The import then falls through to the address-copy path and aborts on the 64 MiB cap. `/sys/module/udmabuf/parameters/size_limit_mb` was `64` on this machine. A single registered range failed: ```text [gpu] host import of 0x2041fd0000+0x93a0000 failed at UDMABUF_CREATE (-1000072003); falling back to copies FATAL: an address-based build copies 147 MiB of 1 registered ranges, past 64 MiB (APS5_ADDRESS_COPY_MAX_MIB); the largest: 0x2041fd0000+0x93a0000 (147.6 MiB committed, outside the write-watched arena) ``` Raising that parameter to `2048` for the current boot made the same import succeed. The write does not survive a reboot. This is a host tweak, not a change in the emulator. Open #4449 covers a scattered range as a `UDMABUF_CREATE_LIST` run list. A single run still uses one `UDMABUF_CREATE`, so a run bigger than `size_limit_mb` is still rejected by the kernel even with that PR. ## Repro Dragon Quest III HD-2D Remake (PPSA20612) on Linux, RADV, during boot after the window is up. The copy-cap abort is the one above: 147.6 MiB, one range. With `size_limit_mb` left at 64 it returns; with it raised, that abort did not return. ## Environment - OS: Nobara Linux, kernel 7.2 - CPU: AMD Ryzen 5 7640U - GPU: AMD Radeon 760M (Phoenix, PCI 1002:15bf), RADV - `udmabuf` `size_limit_mb`: 64 by default AI-assisted: yes
David-cmrg commented 2026-10-13 17:23:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by David-cmrg on 2026-10-13T17:23:20Z.


I'm working on this: when UDMABUF_CREATE fails because a range is larger than udmabuf's size_limit_mb, the import failure will say so and name /sys/module/udmabuf/parameters/size_limit_mb, and USAGE.md will describe raising the limit so that it survives a reboot.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6151223227 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6151223227). Originally posted by [David-cmrg](https://github.com/David-cmrg) on 2026-10-13T17:23:20Z. --- I'm working on this: when `UDMABUF_CREATE` fails because a range is larger than udmabuf's `size_limit_mb`, the import failure will say so and name `/sys/module/udmabuf/parameters/size_limit_mb`, and USAGE.md will describe raising the limit so that it survives a reboot.
MarcZX10 commented 2026-10-13 17:30:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T17:30:25Z.


I checked the current-main import path. The existing createChunkedDmaBufImport only accepts a range that fits wholly inside one 64 MiB chunk (within + entry.bytes <= ImportChunkBytes); a larger range falls back to one UDMABUF_CREATE. That explains why the reported 147.6 MiB run still hits the kernel limit. The kernel also applies size_limit_mb to the total page count when creating a list-backed dma-buf, so splitting the ioctl list alone would not bypass the limit (kernel implementation). A general fix looks like it would need to represent one guest range with multiple Vulkan buffers, or expand the address-copy path beyond its current cap. I have not found a safe focused change for that yet; the raised module limit remains the available workaround.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6151349389 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6151349389). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T17:30:25Z. --- I checked the current-main import path. The existing `createChunkedDmaBufImport` only accepts a range that fits wholly inside one 64 MiB chunk (`within + entry.bytes <= ImportChunkBytes`); a larger range falls back to one `UDMABUF_CREATE`. That explains why the reported 147.6 MiB run still hits the kernel limit. The kernel also applies `size_limit_mb` to the total page count when creating a list-backed dma-buf, so splitting the ioctl list alone would not bypass the limit ([kernel implementation](https://codebrowser.dev/linux/linux/drivers/dma-buf/udmabuf.c.html#L393)). A general fix looks like it would need to represent one guest range with multiple Vulkan buffers, or expand the address-copy path beyond its current cap. I have not found a safe focused change for that yet; the raised module limit remains the available workaround.
MarcZX10 commented 2026-10-13 17:31:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T17:31:52Z.


Correction to my earlier analysis: I missed open PR #5309. It implements sparse buffer imports backed by the existing 64 MiB udmabuf chunks, covering the large shared-range case described here. The earlier note about whole-range fallback does not account for that in-flight implementation. I will not propose a duplicate; any remaining size-limit diagnostic or documentation follow-up should be coordinated separately.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6151375462 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6151375462). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T17:31:52Z. --- Correction to my earlier analysis: I missed open PR #5309. It implements sparse buffer imports backed by the existing 64 MiB udmabuf chunks, covering the large shared-range case described here. The earlier note about whole-range fallback does not account for that in-flight implementation. I will not propose a duplicate; any remaining size-limit diagnostic or documentation follow-up should be coordinated separately.
hugodearaujo commented 2026-10-13 18:17:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-13T18:17:01Z.


This is the same limit I hit in ASTRO BOT (PPSA21567), and #5309 is the fix I opened for it. A memfd-backed range larger than 64 MiB is imported as one sparse VkBuffer, bound to the existing 64 MiB udmabuf chunks, so no single UDMABUF_CREATE asks the kernel for more than 64 MiB and size_limit_mb can stay at its default.

Measured today with size_limit_mb reset to 64 on an RX 9070 XT (RADV): ASTRO BOT reaches its title screen at about 19 FPS, and the "memory access" write-backs (2,109 / 21.4 GB every 10 s before) are gone. On main with the same limit it stalls on the opening at 0 FPS. simonbbby also verified the PR's test at the default limit on an RDNA2 iGPU in #5309.

I don't have Dragon Quest III HD-2D Remake, so I could not run your title. Your range 0x2041fd0000+0x93a0000 should take the new path if its offset in the backing file is 64 KiB aligned; a log from #5309 on that title would confirm it. Ranges whose offset is not 64 KiB aligned still fall back to copies, and I am working on that next.

@David-cmrg, #5309 also adds a line to docs/user/USAGE.md about this, so the two changes may overlap there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152179075 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6152179075). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-10-13T18:17:01Z. --- This is the same limit I hit in ASTRO BOT (PPSA21567), and #5309 is the fix I opened for it. A memfd-backed range larger than 64 MiB is imported as one sparse `VkBuffer`, bound to the existing 64 MiB udmabuf chunks, so no single `UDMABUF_CREATE` asks the kernel for more than 64 MiB and `size_limit_mb` can stay at its default. Measured today with `size_limit_mb` reset to 64 on an RX 9070 XT (RADV): ASTRO BOT reaches its title screen at about 19 FPS, and the "memory access" write-backs (2,109 / 21.4 GB every 10 s before) are gone. On main with the same limit it stalls on the opening at 0 FPS. simonbbby also verified the PR's test at the default limit on an RDNA2 iGPU in #5309. I don't have Dragon Quest III HD-2D Remake, so I could not run your title. Your range `0x2041fd0000+0x93a0000` should take the new path if its offset in the backing file is 64 KiB aligned; a log from #5309 on that title would confirm it. Ranges whose offset is not 64 KiB aligned still fall back to copies, and I am working on that next. @David-cmrg, #5309 also adds a line to `docs/user/USAGE.md` about this, so the two changes may overlap there.
darklinkworker commented 2026-10-13 18:38:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by darklinkworker on 2026-10-13T18:38:15Z.


Applied #5309 on current main (18c438b10). A clean launch still stops first on many small ranges (72 MiB across 1151 ranges, each outside the write-watched arena). Those are not one shared run larger than 64 MiB, so the sparse chunk path does not cover them. With the #4449 run list ported as well, boot reached the title. size_limit_mb was still 2048 from the earlier workaround, so this run does not show whether the 147.6 MiB range imports at the default of 64.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152560532 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6152560532). Originally posted by [darklinkworker](https://github.com/darklinkworker) on 2026-10-13T18:38:15Z. --- Applied #5309 on current `main` (`18c438b10`). A clean launch still stops first on many small ranges (72 MiB across 1151 ranges, each outside the write-watched arena). Those are not one shared run larger than 64 MiB, so the sparse chunk path does not cover them. With the #4449 run list ported as well, boot reached the title. `size_limit_mb` was still 2048 from the earlier workaround, so this run does not show whether the 147.6 MiB range imports at the default of 64. AI-assisted: yes
darklinkworker commented 2026-10-13 19:19:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by darklinkworker on 2026-10-13T19:19:43Z.


Direct answer to the request for a #5309 log of 0x2041fd0000+0x93a0000: I do not have that log. size_limit_mb was still 2048 during the boot that had #5309 applied, so that run does not show whether the 147.6 MiB range imports at the default of 64.

The other stop I mentioned is a different case. On clean main, before #5309, boot aborted with 72 MiB across 1151 ranges, each marked outside the write-watched arena. Those are small ranges, not the one 147.6 MiB run in this issue, so they do not test the sparse 64 MiB chunk path.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153316178 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6153316178). Originally posted by [darklinkworker](https://github.com/darklinkworker) on 2026-10-13T19:19:43Z. --- Direct answer to the request for a #5309 log of `0x2041fd0000+0x93a0000`: I do not have that log. `size_limit_mb` was still 2048 during the boot that had #5309 applied, so that run does not show whether the 147.6 MiB range imports at the default of 64. The other stop I mentioned is a different case. On clean `main`, before #5309, boot aborted with 72 MiB across 1151 ranges, each marked outside the write-watched arena. Those are small ranges, not the one 147.6 MiB run in this issue, so they do not test the sparse 64 MiB chunk path.
MarcZX10 commented 2026-10-13 19:28:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T19:28:59Z.


I checked the range values in the report: both the guest start (0x2041fd0000) and length (0x93a0000) are 64 KiB aligned. Current PR #5309 has independent RADV validation on its exact head with size_limit_mb=64 unchanged, including an oversized sparse-import test and a production-only negative control. That supports the fix for the reported shape, but it does not prove this title’s backing-file offset or that Dragon Quest III took the path; the PR author noted the backing offset must also be 64 KiB aligned. A run of #5309 on this title with the limit reset to 64 would close that remaining evidence gap.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153481255 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6153481255). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T19:28:59Z. --- I checked the range values in the report: both the guest start (`0x2041fd0000`) and length (`0x93a0000`) are 64 KiB aligned. Current PR #5309 has independent RADV validation on its exact head with `size_limit_mb=64` unchanged, including an oversized sparse-import test and a production-only negative control. That supports the fix for the reported shape, but it does not prove this title’s backing-file offset or that Dragon Quest III took the path; the PR author noted the backing offset must also be 64 KiB aligned. A run of #5309 on this title with the limit reset to 64 would close that remaining evidence gap.
David-cmrg commented 2026-10-13 20:02:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by David-cmrg on 2026-10-13T20:02:03Z.


Thanks, both. #5309 removes the cause, and its USAGE.md line covers what I meant to document, so I'm dropping my change for this issue to avoid overlapping with it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6154077078 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6154077078). Originally posted by [David-cmrg](https://github.com/David-cmrg) on 2026-10-13T20:02:03Z. --- Thanks, both. #5309 removes the cause, and its USAGE.md line covers what I meant to document, so I'm dropping my change for this issue to avoid overlapping with it.
MarcZX10 commented 2026-10-13 21:30:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T21:30:34Z.


The 72 MiB / 1,151-range stop is distinct from the oversized single dma-buf range. In current GuestBufferMemory::AcquireRegistered, each readable GPU range can take a host import, an image mirror, or the copy fallback; only the copy bytes feed AddressCopyOverflow (default 64 MiB). Could you share the exact FATAL: ... overflow line and a short summary of those 1,151 ranges split by gpu, writable, releasable, and whether APS5_NO_LEASE_MIRROR=1 was set? If available, one representative range plus its allocation type would help identify whether these should use imports, mirrors, or whether the 64 MiB aggregate copy cap is reached. I don’t have enough evidence yet to make a safe fix for this second case.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155619174 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6155619174). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T21:30:34Z. --- The 72 MiB / 1,151-range stop is distinct from the oversized single dma-buf range. In current `GuestBufferMemory::AcquireRegistered`, each readable GPU range can take a host import, an image mirror, or the copy fallback; only the copy bytes feed `AddressCopyOverflow` (default 64 MiB). Could you share the exact `FATAL: ...` overflow line and a short summary of those 1,151 ranges split by `gpu`, `writable`, `releasable`, and whether `APS5_NO_LEASE_MIRROR=1` was set? If available, one representative range plus its allocation type would help identify whether these should use imports, mirrors, or whether the 64 MiB aggregate copy cap is reached. I don’t have enough evidence yet to make a safe fix for this second case.
darklinkworker commented 2026-10-14 02:08:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by darklinkworker on 2026-10-14T02:08:34Z.


Retried on current main (016db923a), libraries rebuilt from that commit, no local patches. APS5_NO_LEASE_MIRROR was not set. Boot still aborts on the same line:

FATAL: an address-based build copies 72 MiB of 1151 registered ranges, past 64 MiB (APS5_ADDRESS_COPY_MAX_MIB); the largest: 0x2015c50000+0x20000 (0.1 MiB committed, outside the write-watched arena) 0x2015fd0000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016050000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016040000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016030000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016020000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016010000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016000000+0x10000 (0.1 MiB committed, outside the write-watched arena)

Those 1151 are the ranges that reached the copy fallback. Ranges that are not both gpu and readable are not in the count. Of the 1151:

  • writable 1151, read-only 0
  • releasable 1151, not releasable 0
  • reason outside the write-watched arena 1151
  • image mirror refused 0, unreadable pages 0, mirrors disabled 0

The largest is 0x2015c50000+0x20000 (128 KiB), writable, releasable, gpu. Its parent allocation is 0x1000000000, 0x8000000000 bytes. The range record has no separate allocation-type field, so that address and size is what the registry stores. The eight ranges in the FATAL line are the largest by committed bytes, and each is 0.1 MiB.

This boot does not reach the single 147.6 MiB import. That one still shows up only after the run-list import from #4449, and it has not been retried with size_limit_mb put back to 64.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159304393 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6159304393). Originally posted by [darklinkworker](https://github.com/darklinkworker) on 2026-10-14T02:08:34Z. --- Retried on current `main` (`016db923a`), libraries rebuilt from that commit, no local patches. `APS5_NO_LEASE_MIRROR` was not set. Boot still aborts on the same line: ``` FATAL: an address-based build copies 72 MiB of 1151 registered ranges, past 64 MiB (APS5_ADDRESS_COPY_MAX_MIB); the largest: 0x2015c50000+0x20000 (0.1 MiB committed, outside the write-watched arena) 0x2015fd0000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016050000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016040000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016030000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016020000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016010000+0x10000 (0.1 MiB committed, outside the write-watched arena) 0x2016000000+0x10000 (0.1 MiB committed, outside the write-watched arena) ``` Those 1151 are the ranges that reached the copy fallback. Ranges that are not both `gpu` and readable are not in the count. Of the 1151: - writable 1151, read-only 0 - releasable 1151, not releasable 0 - reason `outside the write-watched arena` 1151 - `image mirror refused` 0, `unreadable pages` 0, `mirrors disabled` 0 The largest is `0x2015c50000+0x20000` (128 KiB), writable, releasable, gpu. Its parent allocation is `0x1000000000`, `0x8000000000` bytes. The range record has no separate allocation-type field, so that address and size is what the registry stores. The eight ranges in the FATAL line are the largest by committed bytes, and each is 0.1 MiB. This boot does not reach the single 147.6 MiB import. That one still shows up only after the run-list import from #4449, and it has not been retried with `size_limit_mb` put back to 64. AI-assisted: yes
oneandonlydean commented 2026-10-14 09:23:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T09:23:44Z.


#5309 is on main: a run past the udmabuf limit is now imported as a sparse buffer, which is the case this issue covers. The 72 MiB / 1,151-range copy stop is a separate one (see the note above); please open it as its own issue with that FATAL line if it still happens on current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6165148493 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5329#issuecomment-6165148493). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T09:23:44Z. --- #5309 is on main: a run past the udmabuf limit is now imported as a sparse buffer, which is the case this issue covers. The 72 MiB / 1,151-range copy stop is a separate one (see the note above); please open it as its own issue with that FATAL line if it still happens on current main.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#5329
No description provided.