summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-01-08drm/i915/eb: Don't support 4GiB of relocationsDaniel Vetter1-18/+7
The most relocation-affine userspace we have is SNA, which limits it's batches to roughly 256KB. Max relocation density is a relocation every 8 bytes (one dword instruction, one dword address), which means at most 32kb relocations. Which with 32 bytes per relocation entry means at most 1MiB. This uapi change was introduced in commit 2889caa9232109afc8881f29a2205abeb5709d0c Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Jun 16 15:05:19 2017 +0100 drm/i915: Eliminate lots of iterations over the execobjects array and the commit doesn't explain why this was done. The best fit explanation I could come up with is that as part of making relocations really, really fast, even for the cold relocation case an igt testcase was added with ridiculous amounts of relocations: commit 506d683da138a7b90f5e338d522012f00d3145e9 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Thu Jan 28 11:46:21 2016 +0000 tests: Add gem_exec_reloc Which I guess then motivated working on this and resulted in later igt work to limit the overflow checks, which have been quite a bit strictker than the above testcase. commit 2d2b61e1608433733de3d04a492d0d85a93933cd Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Mon Mar 7 15:34:02 2016 +0000 igt/gem_reloc_overflow: Fix errno tests for "overflow" Which also means that both of these igt commits introduced new tests which failed from the start, which I guess was then justified to push for this change (hidden away in a larger patch that did install a new kitchen sink, new kitchen, new house and new village because). Or something like that. Note that the main reloc optimization patches are commit 31a39207f04a37324d70ff5665fd19d3a75b39c1 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Thu Aug 18 17:16:46 2016 +0100 drm/i915: Cache kmap between relocations and commit d50415cc6c8395602052b39a1a39290fba3d313e Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Thu Aug 18 17:16:52 2016 +0100 drm/i915: Refactor execbuffer relocation writing so actually landed substantially after all the igt tests. Which means we have a pretty epic case of igt-driven uapi development here. Anyway, long story short: Burn it to the ground. Note that this doesn't fully go back to the old limit, because the old code had an overflow limit of UINT_MAX across all relocations of all buffers, due to how we only allocated a single array for all of them in the slow path. Since the main push of 2889caa92321 ("drm/i915: Eliminate lots of iterations over the execobjects array") is to lift iterations over the objects we don't absolutely have to do, keeping the per-object limit seems reasonable. But that means that we can't just revert the igt changes, but have to adapt the original old tests to the adjusted limitations. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Jon Bloomfield <jon.bloomfield@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Jason Ekstrand <jason@jlekstrand.net>
2024-01-08drm/i915/eb: Drop unmotivated cond_reschedDaniel Vetter1-10/+1
This was added in commit 2889caa9232109afc8881f29a2205abeb5709d0c Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Jun 16 15:05:19 2017 +0100 drm/i915: Eliminate lots of iterations over the execobjects array without any motivation. I suspect it was added to handle EAGAIN errors from userptr, but it's hard to guess with no breadcrumbs anywhere. Before this change there wasn't any dedicated EAGAIN handling, we just bounced completely to userspace. Userptr works differently now and does not just thrash the cpu until another worker has maybe acquired the pages, so we can go back to handling EAGAIN like beforehand. That also allows us to drop another funky repeat loop from a function with already very complicated control flow (which unforunately got more complex due to ww_mutex restarting). Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Jon Bloomfield <jon.bloomfield@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Jason Ekstrand <jason@jlekstrand.net>
2024-01-08drm/i915/eb: Report EFAULT when writing updated exec_obj offsetDaniel Vetter1-7/+5
This was thrown out in commit 2889caa9232109afc8881f29a2205abeb5709d0c Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Jun 16 15:05:19 2017 +0100 drm/i915: Eliminate lots of iterations over the execobjects array with the justification that we're already past the point of no return (in a comment, not in the commit message). That's true, but also if userspace is silly and hands us read-only memory, then we'll only notice that when we write to it. So reporting the error is still our duty, not that it's likely - at this point we're dealing with nasty userspace anyway. Also this is what we've been doing for around 8 years before this patch changed it. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Jon Bloomfield <jon.bloomfield@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Jason Ekstrand <jason@jlekstrand.net>
2024-01-08drm/i915/eb: Replace user_access_begin by user_write_access_beginDaniel Vetter1-2/+2
Similar to commit b44f687386875b714dae2afa768e73401e45c21c Author: Christophe Leroy <christophe.leroy@c-s.fr> Date: Fri Apr 3 07:20:52 2020 +0000 drm/i915/gem: Replace user_access_begin by user_write_access_begin We only do unsafe_put_user, so no read access needed. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Jon Bloomfield <jon.bloomfield@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Jason Ekstrand <jason@jlekstrand.net> Cc: Christophe Leroy <christophe.leroy@c-s.fr> Cc: Kees Cook <keescook@chromium.org> Cc: Michael Ellerman <mpe@ellerman.id.au>
2024-01-08drm/i915: Dont clear __EXEC_HAS_RELOC twiceDaniel Vetter1-12/+1
This was added in commit c43ce12328df0770ce899feabdf9c430c54c766a Author: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Date: Wed Aug 19 16:08:48 2020 +0200 drm/i915: Use per object locking in execbuf, v12. but even back then the caller of eb_relocate_parse() was clearing this flag already too. This is still the case, so just remove the duplicated clearing. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Jon Bloomfield <jon.bloomfield@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Jason Ekstrand <jason@jlekstrand.net>
2024-01-08drm/i915: delete reloc_cache.graphisc_verDaniel Vetter1-3/+1
Unused. There's a pile of other local caching which I'm not sure is worth it, but alas decided against rocking the boat too much and just focus on readability of the source code. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Jon Bloomfield <jon.bloomfield@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: "Thomas Hellstr�m" <thomas.hellstrom@linux.intel.com> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Jason Ekstrand <jason@jlekstrand.net>
2024-01-08dma-buf: Require VM_PFNMAP vma for mmapDaniel Vetter1-2/+13
tldr; DMA buffers aren't normal memory, expecting that you can use them like that (like calling get_user_pages works, or that they're accounting like any other normal memory) cannot be guaranteed. Since some userspace only runs on integrated devices, where all buffers are actually all resident system memory, there's a huge temptation to assume that a struct page is always present and useable like for any more pagecache backed mmap. This has the potential to result in a uapi nightmare. To stop this gap require that DMA buffer mmaps are VM_PFNMAP, which blocks get_user_pages and all the other struct page based infrastructure for everyone. In spirit this is the uapi counterpart to the kernel-internal CONFIG_DMABUF_DEBUG. Motivated by a recent patch which wanted to swich the system dma-buf heap to vm_insert_page instead of vm_insert_pfn. v2: Jason brought up that we also want to guarantee that all ptes have the pte_special flag set, to catch fast get_user_pages (on architectures that support this). Allowing VM_MIXEDMAP (like VM_SPECIAL does) would still allow vm_insert_page, but limiting to VM_PFNMAP will catch that. From auditing the various functions to insert pfn pte entires (vm_insert_pfn_prot, remap_pfn_range and all it's callers like dma_mmap_wc) it looks like VM_PFNMAP is already required anyway, so this should be the correct flag to check for. v3: Change to WARN_ON_ONCE (Thomas Zimmermann) References: https://lore.kernel.org/lkml/CAKMK7uHi+mG0z0HUmNt13QCCvutuRVjpcR0NjRL12k-WbWzkRg@mail.gmail.com/ Acked-by: Christian König <christian.koenig@amd.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: "Christian König" <christian.koenig@amd.com> Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org -- Ok I entirely forgot about this patch but stumbled over it and checked what's up with it no. I think it's ready now for merging: - shmem helper patches to fix up vgem landed - ttm has been fixed since a while - I don't think we've had any other open issues Time to lock down this uapi contract for real? -Daniel
2024-01-08drm/sched: Don't store self-dependenciesDaniel Vetter1-0/+7
This is essentially part of drm_sched_dependency_optimized(), which only amdgpu seems to make use of. Use it a bit more. This would mean that as-is amdgpu can't use the dependency helpers, at least not with the current approach amdgpu has for deciding whether a vm_flush is needed. Since amdgpu also has very special rules around implicit fencing it can't use those helpers either, and adding a drm_sched_job_await_fence_always or similar for amdgpu wouldn't be too onerous. That way the special case handling for amdgpu sticks even more out and we have higher chances that reviewers that go across all drivers wont miss it. Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: "Christian König" <christian.koenig@amd.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Luben Tuikov <luben.tuikov@amd.com> Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com>
2024-01-08drm/fb-helper: Try to protect cleanup against delayed setupDaniel Vetter2-0/+11
Some vague evidences suggests this can go wrong. Try to prevent it by holding the right mutex and clearing ->deferred_setup to make sure we later on don't accidentally try to re-register the fbdev when the driver thought it had it all cleaned up already. v2: I realized that this is fundamentally butchered, and CI complained about lockdep splats. So limit the critical section again and just add a few notes what the proper fix is. References: https://intel-gfx-ci.01.org/tree/linux-next/next-20201215/fi-byt-j1900/igt@i915_pm_rpm@module-reload.html Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch>
2024-01-08drm/pl1111: Sort formats by preference.Daniel Vetter1-10/+10
Per commit 9f8d4fe94eb4fb958fc92ee91a3ec54ab378339c Author: Linus Walleij <linus.walleij@linaro.org> Date: Fri Mar 2 10:09:45 2018 +0100 drm/pl111: Make the default BPP a per-variant variable these two really prefer the 16bpp formats everywhere. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Eric Anholt <eric@anholt.net>
2024-01-08drm/atmel: Sort formats by preferenceDaniel Vetter1-8/+8
Judging by the fbdev setup code it looks like we prefer XRGB8888. Because I'm fairly sure that the 24 bpp is a mistake, and the driver doesn't actually prefer RGB888, which is what it is currently getting. But maybe I'm mistaken. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Boris Brezillon <bbrezillon@kernel.org> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Ludovic Desroches <ludovic.desroches@microchip.com> Cc: linux-arm-kernel@lists.infradead.org
2024-01-08drm/fb-helper: Rename module option to avoid drm 2xDaniel Vetter1-2/+2
It's a bit too much. This might break some things, but I also think module options aren't too much stable uapi. Also while at it mark the dangerous option as unsafe, it leaks physical addresses and can't really be used in a safe way by userspace. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch>
2024-01-08drm/nouveau: Sort formats by preferenceDaniel Vetter2-5/+5
C8 doesn't sound great, neither does the 16bpp formats. So put them down a bit. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2024-01-08drm/armada: Sort primary plane formats in preferenceDaniel Vetter1-6/+6
I want to compute the preferred_depth from the primary plane formats (like atomic userspace would do), for that we need XRGB888 before ARGB888 or we'll get a preferred_depth of 32 instead of 24. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Russell King <linux@armlinux.org.uk>
2024-01-08Revert "drm/i915: Annotate dma_fence_work"Daniel Vetter1-4/+0
This reverts commit 7fbc6eca6f0db8244cddc39471d71471a2f30254. I need working lockdep back
2024-01-08drm/i915: Annotate dma_fence_workDaniel Vetter1-0/+4
i915 does tons of allocations from this worker, which lockdep catches. Also generic infrastructure like this with big potential for how dma_fence or other cross driver contracts work, really should be reviewed on dri-devel. Implementing custom wheels for everything within the driver is a classic case of "platform problem" [1]. Which in upstream we really shouldn't have. Since there's no quick way to solve these splats (dma_fence_work is used a bunch in basic buffer management and command submission) like for amdgpu, I'm giving up at this point here. Annotating i915 scheduler and gpu reset could would be interesting, but since lockdep is one-shot we can't see what surprises would lurk there. 1: https://lwn.net/Articles/443531/ Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org Cc: linux-rdma@vger.kernel.org Cc: amd-gfx@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Christian König <christian.koenig@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2024-01-08drm/rcar-du: Annotate dma-fence critical section in commit pathDaniel Vetter1-0/+2
Ends right after drm_atomic_helper_commit_hw_done(), absolutely nothing fancy going on here. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Cc: linux-renesas-soc@vger.kernel.org
2024-01-08drm/vblank: Annotate with dma-fence signalling sectionDaniel Vetter1-1/+7
This is rather overkill since currently all drivers call this from hardirq (or at least timers). But maybe in the future we're going to have thread irq handlers and what not, doesn't hurt to be prepared. Plus this is an easy start for sprinkling these fence annotations into shared code. Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org Cc: linux-rdma@vger.kernel.org Cc: amd-gfx@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Christian König <christian.koenig@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2024-01-08drm/atomic-helpers: remove legacy_cursor_update hacksDaniel Vetter3-13/+29
The stuff never really worked, and leads to lots of fun because it out-of-order frees atomic states. Which upsets KASAN, among other things. For async updates we now have a more solid solution with the ->atomic_async_check and ->atomic_async_commit hooks. Support for that for msm and vc4 landed. nouveau and i915 have their own commit routines, doing something similar. For everyone else it's probably better to remove the use-after-free bug, and encourage folks to use the async support instead. The affected drivers which register a legacy cursor plane and don't either use the new async stuff or their own commit routine are: amdgpu, atmel, mediatek, qxl, rockchip, sti, sun4i, tegra, virtio, and vmwgfx. Inspired by an amdgpu bug report. v2: Drop RFC, I think with amdgpu converted over to use atomic_async_check/commit done in commit 674e78acae0dfb4beb56132e41cbae5b60f7d662 Author: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Date: Wed Dec 5 14:59:07 2018 -0500 drm/amd/display: Add fast path for cursor plane updates we don't have any driver anymore where we have userspace expecting solid legacy cursor support _and_ they are using the atomic helpers in their fully glory. So we can retire this. v3: Paper over msm and i915 regression. The complete_all is the only thing missing afaict. v4: Fixup i915 fixup ... v5: Unallocate the crtc->event in msm to avoid hitting a WARN_ON in dpu_crtc_atomic_flush(). This is a bit a hack, but simplest way to untangle this all. Thanks to Abhinav Kumar for the debug help. Cc: Abhinav Kumar <quic_abhinavk@quicinc.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Maxime Ripard <maxime@cerno.tech> References: https://bugzilla.kernel.org/show_bug.cgi?id=199425 References: https://lore.kernel.org/all/20220221134155.125447-9-maxime@cerno.tech/ References: https://bugzilla.kernel.org/show_bug.cgi?id=199425 Cc: Maxime Ripard <maxime@cerno.tech> Tested-by: Maxime Ripard <maxime@cerno.tech> Cc: mikita.lipski@amd.com Cc: Michel Dänzer <michel@daenzer.net> Cc: harry.wentland@amd.com Cc: Rob Clark <robdclark@gmail.com> Cc: "Kazlauskas, Nicholas" <nicholas.kazlauskas@amd.com> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Cc: Sean Paul <sean@poorly.run> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com> Cc: Jani Nikula <jani.nikula@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: Imre Deak <imre.deak@intel.com> Cc: Manasi Navare <manasi.d.navare@intel.com> Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2024-01-08drm: Complain if drivers still use the ->load callbackDaniel Vetter2-0/+9
Kinda time to get this sorted. The locking around this really is not nice. Thomas mentioned in his review that the only drivers left unconverted are radeon and amdgpu. Cc: Harry Wentland <harry.wentland@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2024-01-08drm/tiny/st7735r: set drvdata before registeringDaniel Vetter1-2/+2
Otherwise things might go boom. Not a big chance of that happening since we don't implement suspend/resume support.
2024-01-08input/psmouse: Don't hold the mutex while calling ->disconnectDaniel Vetter1-0/+2
At least trackpoint_disconnect wants to remove some sysfs files, and we can't remove sysfs files while holding psmouse_mutex: ====================================================== WARNING: possible circular locking dependency detected 4.16.0-rc5-g613eb885b69e-drmtip_1+ #1 Tainted: G U ------------------------------------------------------ kworker/0:3/102 is trying to acquire lock: (kn->count#130){++++}, at: [<000000009679748b>] kernfs_remove_by_name_ns+0x3b/0x80 but task is already holding lock: (psmouse_mutex){+.+.}, at: [<0000000014f44bcc>] psmouse_disconnect+0x62/0x160 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (psmouse_mutex){+.+.}: psmouse_attr_set_helper+0x28/0x140 kernfs_fop_write+0xfe/0x180 __vfs_write+0x1e/0x130 vfs_write+0xbd/0x1b0 SyS_write+0x40/0xa0 do_syscall_64+0x65/0x1a0 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #0 (kn->count#130){++++}: __kernfs_remove+0x243/0x2b0 kernfs_remove_by_name_ns+0x3b/0x80 remove_files.isra.0+0x2b/0x60 sysfs_remove_group+0x38/0x80 sysfs_remove_groups+0x24/0x40 trackpoint_disconnect+0x2c/0x50 psmouse_disconnect+0x8f/0x160 serio_disconnect_driver+0x28/0x40 serio_driver_remove+0xc/0x10 device_release_driver_internal+0x15b/0x230 serio_handle_event+0x1c8/0x260 process_one_work+0x215/0x620 worker_thread+0x48/0x3a0 kthread+0xfb/0x130 ret_from_fork+0x3a/0x50 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(psmouse_mutex); lock(kn->count#130); lock(psmouse_mutex); lock(kn->count#130); *** DEADLOCK *** 6 locks held by kworker/0:3/102: #0: ((wq_completion)"events_long"){+.+.}, at: [<000000002e408bfa>] process_one_work+0x191/0x620 #1: (serio_event_work){+.+.}, at: [<000000002e408bfa>] process_one_work+0x191/0x620 #2: (serio_mutex){+.+.}, at: [<00000000c8a49847>] serio_handle_event+0x23/0x260 #3: (&dev->mutex){....}, at: [<00000000b55eee75>] device_release_driver_internal+0x2f/0x230 #4: (&serio->drv_mutex){+.+.}, at: [<000000009719f997>] serio_disconnect_driver+0x16/0x40 #5: (psmouse_mutex){+.+.}, at: [<0000000014f44bcc>] psmouse_disconnect+0x62/0x160 stack backtrace: CPU: 0 PID: 102 Comm: kworker/0:3 Tainted: G U 4.16.0-rc5-g613eb885b69e-drmtip_1+ #1 Hardware name: LENOVO 74591P0/74591P0, BIOS 6DET28WW (1.05 ) 07/30/2008 Workqueue: events_long serio_handle_event Call Trace: dump_stack+0x5f/0x86 print_circular_bug.isra.18+0x1d0/0x2c0 __lock_acquire+0x14ae/0x1b60 ? kernfs_remove_by_name_ns+0x20/0x80 ? lock_acquire+0xaf/0x200 lock_acquire+0xaf/0x200 ? kernfs_remove_by_name_ns+0x3b/0x80 __kernfs_remove+0x243/0x2b0 ? kernfs_remove_by_name_ns+0x3b/0x80 ? kernfs_name_hash+0xd/0x70 ? kernfs_find_ns+0x7e/0x100 kernfs_remove_by_name_ns+0x3b/0x80 remove_files.isra.0+0x2b/0x60 sysfs_remove_group+0x38/0x80 sysfs_remove_groups+0x24/0x40 trackpoint_disconnect+0x2c/0x50 psmouse_disconnect+0x8f/0x160 serio_disconnect_driver+0x28/0x40 serio_driver_remove+0xc/0x10 device_release_driver_internal+0x15b/0x230 serio_handle_event+0x1c8/0x260 process_one_work+0x215/0x620 worker_thread+0x48/0x3a0 ? _raw_spin_unlock_irqrestore+0x4c/0x60 kthread+0xfb/0x130 ? process_one_work+0x620/0x620 ? _kthread_create_on_node+0x30/0x30 ret_from_fork+0x3a/0x50 Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
2024-01-08softdog: Obey hardlockup_all_cpu_backtrace sysctlDaniel Vetter1-0/+2
This is used by the nmi watchdog, but also useful by the softdog when we're trying to figure out where exactly we're stuck. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Cc: Wim Van Sebroeck <wim@iguana.be> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-watchdog@vger.kernel.org References: https://bugs.freedesktop.org/show_bug.cgi?id=103160 Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> --- FIXME: Take the && 1 out once CI is configured to enable this. -Daniel
2024-01-08RFC: drm: Restrict vblank ioctl to masterDaniel Vetter1-3/+3
Somehow this escaped us, this is a KMS ioctl which should only be used by the master (which is the thing that's also in control of kms resources). Everything else is bound to result in fail. Clients shouldn't have a trouble coping with this, since a pile of drivers don't support vblank waits (or just randomly fall over when using them). Note that the big motivation for abusing this like mad seems to be that EGL doesn't have OML_sync, but somehow it didn't cross anyone's mind that adding OML_sync to EGL would be useful. This patch is meant to essentially start kicking that can from the back end. Update: Kodi maintainers removed this code on 7th August, to be released in Kodi v18 in Sept 2018. v2: Drop accidental hunk (Michel). v3: Also add the new crtc sequence ioctls that have been added meanwhile ... Cc: Michel Dänzer <michel@daenzer.net> Cc: fritsch@kodi.tv Cc: fernetmenta@kodi.tv Cc: Rainer Hochecker <fernetmenta@kodi.tv> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2024-01-08kernel/latencytop: Add non-scheduler interface for latency reportingDaniel Vetter2-0/+11
Some sources of significant amounts of latency aren't simple sleeps but instead busy-loops or a series of hundreds of small sleeps simply because the hardware can't do better. Unfortunately latencytop doesn't register these and so they slip under the radar. Hence expose a simplified interface to report additional latencies and export the underlying function so that modules can use this. The example I have in mind are edid reads. The drm subsystem exposes both interfaces to do full probes and to just get at the cached state from the last probe and often userspace developers don't know about the difference and incur unecessary big latencies. And usually the i2c transfer is done with busy-looping or if there is a hw engine it might only be able to transfer a few bytes per sleep/irq cycle. And edid reads take at least 12ms and with crappy hw can easily be a few hundred ms. v2: Simplify #ifdefs a bit (Chris). Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2024-01-08drm-tip: 2024y-01m-08d-08h-41m-48s UTC integration manifestDaniel Vetter1-0/+30
2024-01-08Merge remote-tracking branch 'drm-intel/topic/core-for-CI' into drm-tipDaniel Vetter20-65/+149
2024-01-08Merge remote-tracking branch 'drm-intel/drm-intel-gt-next' into drm-tipDaniel Vetter25-186/+177
2024-01-08Merge remote-tracking branch 'drm-intel/drm-intel-next' into drm-tipDaniel Vetter27-406/+387
2024-01-08Merge remote-tracking branch 'drm-misc/drm-misc-next' into drm-tipDaniel Vetter63-641/+2884
2024-01-08Merge remote-tracking branch 'drm-misc/drm-misc-next-fixes' into drm-tipDaniel Vetter1-3/+1
2024-01-08Merge remote-tracking branch 'drm/drm-next' into drm-tipDaniel Vetter1515-23042/+129715
# Conflicts: # drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c # drivers/gpu/drm/i915/display/intel_dmc.c
2024-01-08drm/i915/display: Use helper to select C20 MPLLA/BMika Kahola1-6/+11
We used to select between MPLLA/B with the following state->tx[0] & C20_PHY_USE_MPLLB Since this is used a few places within C20 PLL setting, let's introduce a helper function to clean up the code a bit. Signed-off-by: Mika Kahola <mika.kahola@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240105112243.224199-1-mika.kahola@intel.com
2024-01-07drm/sched: Return an error code only as a constant in drm_sched_init()Markus Elfring1-3/+3
Return an error code without storing it in an intermediate variable. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Link: https://patchwork.freedesktop.org/patch/msgid/85f8004e-f0c9-42d9-8c59-30f1b4e0b89e@web.de Reviewed-by: Luben Tuikov <ltuikov89@gmail.com> Signed-off-by: Luben Tuikov <ltuikov89@gmail.com>
2024-01-07drm/sched: One function call less in drm_sched_init() after error detectionMarkus Elfring1-2/+3
The kfree() function was called in one case by the drm_sched_init() function during error handling even if the passed data structure member contained a null pointer. This issue was detected by using the Coccinelle software. Thus adjust a jump target. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Link: https://patchwork.freedesktop.org/patch/msgid/85066512-983d-480c-a44d-32405ab1b80e@web.de Reviewed-by: Luben Tuikov <ltuikov89@gmail.com> Signed-off-by: Luben Tuikov <ltuikov89@gmail.com>
2024-01-05drm/i915/huc: Allow for very slow HuC loadingJohn Harrison2-11/+63
A failure to load the HuC is occasionally observed where the cause is believed to be a low GT frequency leading to very long load times. So a) increase the timeout so that the user still gets a working system even in the case of slow load. And b) report the frequency during the load to see if that is the cause of the slow down. Also update the similar code on the GuC load to not use uncore->gt when there is a local gt available. The two should match, but no need for unnecessary de-referencing. Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240102222202.310495-1-John.C.Harrison@Intel.com
2024-01-05drm/rockchip: vop2: Drop unused if_dclk_rate variableCristian Ciocaltea1-2/+1
Commit 5a028e8f062f ("drm/rockchip: vop2: Add support for rk3588") introduced a variable which ended up being unused: rockchip_drm_vop2.c:1688:23: warning: variable ‘if_dclk_rate’ set but not used [-Wunused-but-set-variable] This has been initially used as part of a formula to compute the clock dividers, but eventually it has been replaced by static values. Drop the variable declaration and move its assignment to the comment block, to serve as documentation of how the constants have been generated. Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20240105174007.98054-1-cristian.ciocaltea@collabora.com
2024-01-05drm: Move drm_set_preferred_mode() helper from drm_edid to drm_modesJavier Martinez Canillas4-24/+24
The helper is generic, it doesn't use the opaque EDID type struct drm_edid and is also used by drivers that only support non-probeable displays such as fixed panels. These drivers add a list of modes using drm_mode_probed_add() and then set a preferred mode using the drm_set_preferred_mode() helper. It seems more logical to have the helper definition in drm_modes.o instead of drm_edid.o, since the former contains modes helper while the latter has helpers to manage the EDID information. Since both drm_edid.o and drm_modes.o object files are built-in the drm.o object, there are no functional changes. But besides being a more logical place for this helper, it could also allow to eventually make drm_edid.o optional and not included in drm.o if only fixed panels must be supported in a given system. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240102122208.3103597-1-javierm@redhat.com
2024-01-05drm/i915/xelpg: Add workaround 14019877138Tejas Upadhyay1-0/+3
WA 14019877138 needed for Graphics 12.70/71 both V2(Jani): - Use drm/i915 Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240103053111.763172-1-tejas.upadhyay@intel.com
2024-01-05drm/i915: Disable DSB in Xe KMDJosé Roberto de Souza1-0/+4
Often getting DSB overflows when starting Xorg or Wayland compositors when running Xe KMD. Issue was reported but nothing was done, so disabling DSB as whole until properly fixed in Xe KMD. v2: - move check to HAS_DSB(Jani) v3: - use IS_ENABLED(I915) check in intel_dsb_prepare() Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/989 Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1031 Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1072 Cc: Animesh Manna <animesh.manna@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Jani Nikula <jani.nikula@intel.com> Cc: Francois Dugast <francois.dugast@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240104162411.56085-1-jose.souza@intel.com
2024-01-05drm/i915/tv: use DISPLAY_VER instead of GRAPHICS_VERJani Nikula1-1/+1
Display code should not care about graphics version. It's only comments here, but update anyway. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240104174350.823605-5-jani.nikula@intel.com
2024-01-05drm/i915/display: use IS_DISPLAY_VER instead of IS_GRAPHICS_VERJani Nikula1-1/+1
Display code should not care about graphics version. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240104174350.823605-4-jani.nikula@intel.com
2024-01-05drm/i915/hdcp: use DISPLAY_VER instead of GRAPHICS_VERJani Nikula1-13/+15
Display code should not care about graphics version. While at it, abstract the version check to a separate macro. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240104174350.823605-3-jani.nikula@intel.com
2024-01-05drm/i915/dmc: use DISPLAY_VER instead of GRAPHICS_VERJani Nikula1-1/+1
Display code should not care about graphics version. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240104174350.823605-2-jani.nikula@intel.com
2024-01-05drm/i915/irq: use DISPLAY_VER instead of GRAPHICS_VERJani Nikula1-1/+1
Display code should not care about graphics version. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240104174350.823605-1-jani.nikula@intel.com
2024-01-05drm/i915: don't make assumptions about intel_wakeref_t typeJani Nikula1-2/+2
intel_wakeref_t is supposed to be a mostly opaque cookie to its users. It should only be checked for being non-zero and set to zero. Debug logging its actual value is meaningless. Switch to just debug logging whether the async_put_wakeref is non-zero. The issue dates back to much earlier than commit b49e894c3fd8 ("drm/i915: Replace custom intel runtime_pm tracker with ref_tracker library"), but this is the one that brought about a build failure due to the printf format. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Closes: https://lore.kernel.org/r/20240102111222.2db11208@canb.auug.org.au Fixes: b49e894c3fd8 ("drm/i915: Replace custom intel runtime_pm tracker with ref_tracker library") Cc: Andrzej Hajda <andrzej.hajda@intel.com> Cc: Imre Deak <imre.deak@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240104164600.783371-1-jani.nikula@intel.com
2024-01-05drm/edid: prefer forward declarations over includes in drm_edid.hJani Nikula1-7/+5
There's no need to include either linux/hdmi.h or drm/drm_mode.h. They can be removed by using forward declarations. While at it, group the forward declarations together, and remove the unnecessary ones. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20240104211028.1129606-1-jani.nikula@intel.com
2024-01-05drm/nouveau/dp: Honor GSP link training retry timeoutsLyude Paul1-22/+42
Turns out that one of the ways that Nvidia's driver handles the pre-LT timeout for eDP panels is by providing a retry timeout in their link training callbacks that we're expected to wait for. Up until now we didn't pay any attention to this parameter. So, start honoring the timeout if link training fails - and retry up to 3 times. The "3 times" bit comes from OpenRM's link training code. [airlied: this fixes the panel on one of my laptops] Signed-off-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231222043308.3090089-12-airlied@gmail.com
2024-01-05nouveau: push event block/allowing out of the fence contextDave Airlie2-6/+27
There is a deadlock between the irq and fctx locks, the irq handling takes irq then fctx lock the fence signalling takes fctx then irq lock This splits the fence signalling path so the code that hits the irq lock is done in a separate work queue. This seems to fix crashes/hangs when using nouveau gsp with i915 primary GPU. Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231222043308.3090089-11-airlied@gmail.com
2024-01-05nouveau/gsp: always free the alloc messages on r535Dave Airlie1-2/+1
Fixes a memory leak seen with kmemleak. Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231222043308.3090089-10-airlied@gmail.com