dma: the 4 MB cap was the refusal, not the arena
vgpud: wanted 7365 KB of DMA memory for a 1920x982 framebuffer
vgpud: not enough contiguous DMA memory
schinitd: restarting os.schos.vgpud (and again, and again, until
schinit: supervisor stopped answering schinit replaced schinitd)
Every number in that diagnostic was about the arena, and the arena had 61 MB
free. The refusal came from do_dma()'s per-request cap, which was 4 MB --
exactly one framebuffer at 1280x800, chosen when that was the only thing
anybody asked for.
virtio-gpu's display size is the size of the **host's window**. Drag it out and
the guest is asked for 1920x982x4 in one contiguous piece, and no amount of
free arena helps. 32 MB now, which is 2560x1600 with room over. The cap is not
there to ration memory -- the arena does that and says so properly -- it is
there so a wild size cannot ask for everything by accident.
DMA_ARENA_BYTES 16 -> 64 MB alongside, for the reason its own comment already
gave and then got the arithmetic wrong on: either side of the handover *both*
drivers hold a framebuffer, so the requirement is two at the largest mode, not
one. 16 MB is two at 1280x800 and nothing bigger. Verified booting at 256M and
512M as well as 1G.
And vgpud no longer dies when it cannot have what it asked for. It claims the
framebuffer before creating the resource, and if the full size cannot be had it
steps down by thirds to 640x480 before giving up -- and gives up with
SCHINIT_EXIT_NORESTART rather than die(), because a driver that will fail
identically on every restart should not be restarted. That loop is what made
schinit replace the supervisor mid-boot.
vgpud: the display is 1920x1080 but only 1280x720 of DMA could be had
is what it says when it steps down. With the cap raised it does not need to:
1920x1080 now allocates its full 8100 KB, 0 restarts.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQ7Qx8E1q1M1bbCq8QLHS2
This commit is contained in:
parent
ff7afa746e
commit
ca28978995
4 changed files with 121 additions and 34 deletions
|
|
@ -589,8 +589,25 @@ do_dma(uint64 argp)
|
|||
if (!req)
|
||||
return -EFAULT;
|
||||
|
||||
// The cap on one request, and it is the thing that actually said no.
|
||||
//
|
||||
// It was 4 MB, which is one framebuffer at 1280x800 and was chosen when that
|
||||
// was the only thing anybody asked for. virtio-gpu's display size is the size
|
||||
// of the host's *window*, though, and a user who drags that window out to
|
||||
// 1920x1080 is asking for 8100 KB in one piece. The refusal came from here
|
||||
// and not from the arena, which is why it kept happening on an arena with
|
||||
// 61 MB free:
|
||||
//
|
||||
// vgpud: wanted 7365 KB of DMA memory for a 1920x982 framebuffer
|
||||
// ...
|
||||
// 65536 KB total, 61847 KB free in 2 extent(s)
|
||||
//
|
||||
// 32 MB is a 2560x1600 framebuffer with room over. The cap is not there to
|
||||
// ration memory -- the arena does that, and says so properly when it runs
|
||||
// out -- it is there so that a wild `size` from a process cannot ask for the
|
||||
// whole arena by accident.
|
||||
uint64 size = PGROUNDUP(req->size);
|
||||
if (size == 0 || size > 4 * 1024 * 1024)
|
||||
if (size == 0 || size > 32 * 1024 * 1024)
|
||||
return -EINVAL;
|
||||
|
||||
struct proc *p = myproc();
|
||||
|
|
|
|||
Loading…
Reference in a new issue