Applied to drm-misc-fixes with stable cc. Dave.
On Wed, 18 Nov 2026 at 07:44, Mohamed Ahmed <[email protected]> wrote: > > After the instmem io_mapping commit, some people noticed that some VK CTS > tests became much, much slower, while others started running into apps > MMU faulting. This was because of two issues that combine together. > > A synchronous VM_BIND waits for its job with an interruptible wait and > ignores the result. On a signal, the ioctl returns 0 before the page > tables are written. Userspace can then use the new mappings, and the > channel takes an MMU fault. This was an old pre-existing bug. > > On the GSP path, the BAR code keeps an ioremap() of the first page of > BAR2 to flush BAR2 writes with a read while flushFBZero is not mapped. > The instmem io_mapping covers all of BAR2 and overlaps it. However, PAT > gives the new mapping the type of the older mapping it overlaps, > uncached-minus, so instmem was now uncached without write-combining and > bind jobs became much slower. This is what caused the slowdowns, and the > slowdowns in turn made it easier to hit the pre-existing VM_BIND bug. > > Patch 1 fixes the faults. A synchronous VM_BIND now waits uninterruptibly > for its job. > > Patch 2 takes the flush pointer from the io_mapping which allows us to > skip the ioremap entirely. Nothing maps BAR2 before instmem does, so the > io_mapping is write-combined again. > > Patch 3 sizes the io_mapping to the part of BAR2 that the driver uses. > This is technically not required, but this matches OpenRM and makes more > sense. It also guarantees that a similar issue can't happen again if > something changes in the upper half. > > Mohamed Ahmed (3): > drm/nouveau: do not return early from a synchronous VM_BIND > drm/nouveau/bar: take the GSP-RM flush pointer from the BAR2 > io_mapping > drm/nouveau/instmem: map only the part of BAR2 that is used > > drivers/gpu/drm/nouveau/nouveau_sched.c | 6 +++- > .../gpu/drm/nouveau/nvkm/subdev/bar/gf100.c | 6 ++++ > .../gpu/drm/nouveau/nvkm/subdev/bar/priv.h | 1 + > .../drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c | 32 ++++++++++++++----- > .../drm/nouveau/nvkm/subdev/instmem/nv50.c | 19 ++++++++--- > .../drm/nouveau/nvkm/subdev/instmem/priv.h | 3 ++ > 6 files changed, 53 insertions(+), 14 deletions(-) > > -- > 2.56.1 >
