Hello,
This patchset introduces memory shrinker for the VirtIO-GPU DRM driver.
During OOM, the shrinker will release BOs that are marked as "not needed"
by userspace using the new madvise IOCTL. The userspace in this case is
the Mesa VirGL driver, it will mark the cached BOs as "not needed",
allowing kernel driver to release memory of the cached shmem BOs on lowmem
situations, preventing OOM kills.
This patchset includes couple fixes for problems of VirtIO-GPU driver that
I found while was …
[View More]working on the shrinker, it also includes prerequisite
DMA API usage improvement needed by the shrinker.
The Mesa and IGT patches will be kept on hold until this kernel series
will be approved and applied.
This patchset was tested using Qemu and crosvm, including both cases of
IOMMU off/on.
Note that this patchset only enables initial shrinking of the guest memory,
shrinking of the host memory is unsupported yet.
Mesa: https://gitlab.freedesktop.org/digetx/mesa/-/commits/virgl-madvise
IGT: https://gitlab.freedesktop.org/digetx/igt-gpu-tools/-/tree/virtio-madvise
Changelog:
v2: - Improved shrinker by using a more fine-grained locking to reduce
contention during scan of objects and dropped locking from the
'counting' callback by tracking count of shrinkable pages. This
was suggested by Rob Clark in the comment to v1.
- Factored out common shrinker code into drm_gem_shmem_helper.c
and switched Panfrost driver to use the new common memory shrinker.
This was proposed by Thomas Zimmermann in his prototype series that
he shared with us in the comment to v1. Note that I only compile-tested
the Panfrost driver.
- Shrinker now takes object_name_lock during scan to prevent racing
with dma-buf exporting.
- Shrinker now takes vmap_lock during scan to prevent racing with shmem
vmap/unmap code.
- Added "Correct doc-comment of drm_gem_shmem_get_sg_table()" patch,
which I sent out previously as a standalone change, since the
drm_gem_shmem_helper.c is now touched by this patchset anyways and
it doesn't hurt to group all the patches together.
Dmitry Osipenko (8):
drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling
drm/virtio: Check whether transferred 2D BO is shmem
drm/virtio: Unlock GEM reservations in error code path
drm/virtio: Improve DMA API usage for shmem BOs
drm/shmem-helper: Correct doc-comment of drm_gem_shmem_get_sg_table()
drm/shmem-helper: Add generic memory shrinker
drm/virtio: Support memory shrinking
drm/panfrost: Switch to generic memory shrinker
drivers/gpu/drm/drm_gem_shmem_helper.c | 196 ++++++++++++++++++++-
drivers/gpu/drm/panfrost/Makefile | 1 -
drivers/gpu/drm/panfrost/panfrost_device.h | 4 -
drivers/gpu/drm/panfrost/panfrost_drv.c | 19 +-
drivers/gpu/drm/panfrost/panfrost_gem.c | 27 +--
drivers/gpu/drm/panfrost/panfrost_gem.h | 9 -
drivers/gpu/drm/panfrost/panfrost_job.c | 22 ++-
drivers/gpu/drm/virtio/virtgpu_drv.c | 22 ++-
drivers/gpu/drm/virtio/virtgpu_drv.h | 26 ++-
drivers/gpu/drm/virtio/virtgpu_gem.c | 96 ++++++++++
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 37 ++++
drivers/gpu/drm/virtio/virtgpu_kms.c | 17 +-
drivers/gpu/drm/virtio/virtgpu_object.c | 78 ++++----
drivers/gpu/drm/virtio/virtgpu_plane.c | 17 +-
drivers/gpu/drm/virtio/virtgpu_vq.c | 30 +++-
include/drm/drm_device.h | 4 +
include/drm/drm_gem.h | 11 ++
include/drm/drm_gem_shmem_helper.h | 25 +++
include/uapi/drm/virtgpu_drm.h | 14 ++
19 files changed, 544 insertions(+), 111 deletions(-)
--
2.35.1
[View Less]
While bridge/panel detection was initially relying on the usual
port/ports-based of graph detection, it was recently changed to
perform the lookup on any child node that is not port/ports
instead when such a node is available, with no fallback on the
usual way.
This results in breaking detection when a child node is present
but does not contain any panel or bridge node, even when the
usual port/ports-based of graph is there.
In order to support both situations properly, this commit reworks
…
[View More]the logic to try both options and not just one of the two: it will
only return -EPROBE_DEFER when both have failed.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski(a)bootlin.com>
Fixes: 80253168dbfd ("drm: of: Lookup if child node has panel or bridge")
---
drivers/gpu/drm/drm_of.c | 93 +++++++++++++++++++++-------------------
1 file changed, 49 insertions(+), 44 deletions(-)
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 9d90cd75c457..67f1b7dfc892 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -219,6 +219,35 @@ int drm_of_encoder_active_endpoint(struct device_node *node,
}
EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint);
+static int drm_of_find_remote_panel_or_bridge(struct device_node *remote,
+ struct drm_panel **panel,
+ struct drm_bridge **bridge)
+{
+ int ret = -EPROBE_DEFER;
+
+ if (panel) {
+ *panel = of_drm_find_panel(remote);
+ if (!IS_ERR(*panel))
+ ret = 0;
+ else
+ *panel = NULL;
+ }
+
+ /* No panel found yet, check for a bridge next. */
+ if (bridge) {
+ if (ret) {
+ *bridge = of_drm_find_bridge(remote);
+ if (*bridge)
+ ret = 0;
+ } else {
+ *bridge = NULL;
+ }
+
+ }
+
+ return ret;
+}
+
/**
* drm_of_find_panel_or_bridge - return connected panel or bridge device
* @np: device tree node containing encoder output ports
@@ -249,57 +278,33 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
if (panel)
*panel = NULL;
- /**
- * Devices can also be child nodes when we also control that device
- * through the upstream device (ie, MIPI-DCS for a MIPI-DSI device).
- *
- * Lookup for a child node of the given parent that isn't either port
- * or ports.
- */
- for_each_available_child_of_node(np, remote) {
- if (of_node_name_eq(remote, "port") ||
- of_node_name_eq(remote, "ports"))
- continue;
-
- goto of_find_panel_or_bridge;
+ /* Check for a graph on the device node first. */
+ if (of_graph_is_present(np)) {
+ remote = of_graph_get_remote_node(np, port, endpoint);
+ if (remote) {
+ ret = drm_of_find_remote_panel_or_bridge(remote, panel,
+ bridge);
+ of_node_put(remote);
+ }
}
- /*
- * of_graph_get_remote_node() produces a noisy error message if port
- * node isn't found and the absence of the port is a legit case here,
- * so at first we silently check whether graph presents in the
- * device-tree node.
- */
- if (!of_graph_is_present(np))
- return -ENODEV;
-
- remote = of_graph_get_remote_node(np, port, endpoint);
-
-of_find_panel_or_bridge:
- if (!remote)
- return -ENODEV;
+ /* Otherwise check for any child node other than port/ports. */
+ if (ret) {
+ for_each_available_child_of_node(np, remote) {
+ if (of_node_name_eq(remote, "port") ||
+ of_node_name_eq(remote, "ports"))
+ continue;
- if (panel) {
- *panel = of_drm_find_panel(remote);
- if (!IS_ERR(*panel))
- ret = 0;
- else
- *panel = NULL;
- }
+ ret = drm_of_find_remote_panel_or_bridge(remote, panel,
+ bridge);
+ of_node_put(remote);
- /* No panel found yet, check for a bridge next. */
- if (bridge) {
- if (ret) {
- *bridge = of_drm_find_bridge(remote);
- if (*bridge)
- ret = 0;
- } else {
- *bridge = NULL;
+ /* Stop at the first found occurrence. */
+ if (!ret)
+ break;
}
-
}
- of_node_put(remote);
return ret;
}
EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge);
--
2.35.1
[View Less]
From: Rob Clark <robdclark(a)chromium.org>
Add a way to override comm/cmdline per-drm_file. This is useful for
VM scenarios where the host process is just a proxy for the actual
guest process.
Rob Clark (3):
drm/msm: Add support for pointer params
drm/msm: Split out helper to get comm/cmdline
drm/msm: Add a way to override processes comm/cmdline
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 46 +++++++++++++++++++++++--
drivers/gpu/drm/msm/adreno/adreno_gpu.h | 4 +--
drivers/gpu/…
[View More]drm/msm/msm_drv.c | 8 ++---
drivers/gpu/drm/msm/msm_gpu.c | 39 ++++++++++++---------
drivers/gpu/drm/msm/msm_gpu.h | 10 ++++--
drivers/gpu/drm/msm/msm_rd.c | 5 +--
drivers/gpu/drm/msm/msm_submitqueue.c | 2 ++
include/uapi/drm/msm_drm.h | 4 +++
8 files changed, 90 insertions(+), 28 deletions(-)
--
2.35.1
[View Less]
Hi,
This is the second series that prepares i915 to host multitile
platforms. It introduces the for_each_gt() macro that loops over
the tiles to perform per gt actions.
This patch is a combination of two patches developed originally
by Abdiel, who introduced some refactoring during probe, and then
Tvrtko has added the necessary tools to start using the various
tiles.
The second patch re-organises the sysfs interface to expose the
API for each of the GTs. I decided to prioritise this patch
…
[View More]over others to unblock Sujaritha for further development.
A third series will still follow this.
Thanks Michal and Andrzej for the reviews and support!
Thanks,
Andi
Patchwork: https://patchwork.freedesktop.org/series/98741/
Changelog
=========
v5 -> v6
- address all Michal and Andrzej's reviews that consist mainly
in code refactoring.
v4 -> v5
- fixed Michal's reviews.
- the sysfs patches have been split in 3 parts to make reviews
easier.
- Sujaritha's patch on pm throttle has been queued.
- INTEL_REGION_LMEM has been renamed to INTEL_REGION_LMEM_0
- added the gt_is_root() helper
- the sysfs files will be called intel_gt_sysfs_* instead of
sysfs_gt_*
v3 -> v4
- fixed Tvrtko's review:
- remove the SYSFS_DEPRECATED_V2 mention from the commit log
- reworded the error message when accessing deprecated files
- errors in sysfs are printed as warnings as they are not
fatal
- the inline functions are moved to be out of line.
and some other minor refactoring.
v2 -> v3
- Added Matt and Sujaritha's r-b for patch 1 and 2.
- Reworded the commit of patch 2 to underline the fact that the
interface is useful also when used manually.
v1 -> v2
- fixed a couple of coding style issues in patch 2.
Andi Shyti (5):
drm/i915: Rename INTEL_REGION_LMEM with INTEL_REGION_LMEM_0
drm/i915/gt: add gt_is_root() helper
drm/i915/gt: create per-tile sysfs interface
drm/i915/gt: Create per-tile RC6 sysfs interface
drm/i915/gt: Create per-tile RPS sysfs interfaces
Sujaritha Sundaresan (1):
drm/i915/gt: Adding new sysfs frequency attributes
Tvrtko Ursulin (1):
drm/i915: Prepare for multiple GTs
drivers/gpu/drm/i915/Makefile | 2 +
drivers/gpu/drm/i915/display/intel_fb.c | 2 +-
drivers/gpu/drm/i915/display/intel_fb_pin.c | 2 +-
.../drm/i915/display/intel_plane_initial.c | 2 +-
drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 4 +-
.../drm/i915/gem/selftests/i915_gem_dmabuf.c | 6 +-
.../drm/i915/gem/selftests/i915_gem_migrate.c | 8 +-
drivers/gpu/drm/i915/gt/intel_gt.c | 135 +++-
drivers/gpu/drm/i915/gt/intel_gt.h | 22 +-
drivers/gpu/drm/i915/gt/intel_gt_pm.c | 9 +-
drivers/gpu/drm/i915/gt/intel_gt_sysfs.c | 122 ++++
drivers/gpu/drm/i915/gt/intel_gt_sysfs.h | 34 +
drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 601 ++++++++++++++++++
drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.h | 15 +
drivers/gpu/drm/i915/gt/intel_gt_types.h | 7 +
drivers/gpu/drm/i915/gt/intel_rps.c | 18 +
drivers/gpu/drm/i915/gt/intel_rps.h | 4 +
drivers/gpu/drm/i915/i915_driver.c | 28 +-
drivers/gpu/drm/i915/i915_drv.h | 8 +
drivers/gpu/drm/i915/i915_reg.h | 11 +
drivers/gpu/drm/i915/i915_sysfs.c | 310 +--------
drivers/gpu/drm/i915/i915_sysfs.h | 3 +
drivers/gpu/drm/i915/intel_memory_region.c | 2 +-
drivers/gpu/drm/i915/intel_memory_region.h | 7 +-
drivers/gpu/drm/i915/intel_uncore.c | 11 +-
drivers/gpu/drm/i915/intel_uncore.h | 3 +-
.../gpu/drm/i915/selftests/mock_gem_device.c | 7 +-
scripts/extract-cert | Bin 0 -> 17952 bytes
28 files changed, 1017 insertions(+), 366 deletions(-)
create mode 100644 drivers/gpu/drm/i915/gt/intel_gt_sysfs.c
create mode 100644 drivers/gpu/drm/i915/gt/intel_gt_sysfs.h
create mode 100644 drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
create mode 100644 drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.h
create mode 100755 scripts/extract-cert
--
2.35.1
[View Less]
The KFD API is quite inflexible in that it allows only mapping entire BOs
at the same virtual address on all GPUs. This is incompatible with newer
CUDA memory management APIs.
(see https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__VA.html)
Instead of inventing more KFD APIs to fix this, the goal of this patch
series is to enable ROCr to use the DRM render node API for more flexible
VA mappings. It builds on the DMABuf export API that is being proposed
for RDMA. DMABuf handles exported …
[View More]by KFD can be imported by libdrm-amdgpu
and then used with amdgpu_bo_va_op.
This is a first proof of concept and request for comment.
A complete solution will likely need minor tweaks to the KFD API to allow
memory allocation and import without a pre-determined virtual address.
Other options that were considered but rejected:
- Using GEM API to create BO in KFD VMs. This would require significant
plumbing to get those BOs registered with the KFD eviction fence
mechanism and "no overcommitment" memory limits
- Variation of the above using AMDGPU_GEM_CREATE_VM_ALWAYS_VALID to
simplify validation. Doesn't work because it doesn't allow DMABuf
exports
- Creating KFD BOs with GEM handles. Doesn't help because there is no
way to import GEM handles into libdrm-amdgpu
Felix Kuehling (4):
drm/amdkfd: Improve amdgpu_vm_handle_moved
drm/amdgpu: Attach eviction fence on alloc
drm/amdgpu: update mappings not managed by KFD
drm/amdgpu: Do bo_va ref counting for KFD BOs
.../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 99 ++++++++++++-------
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 18 +++-
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 +-
5 files changed, 86 insertions(+), 42 deletions(-)
--
2.32.0
[View Less]
The hardware path of vdosys1 with DPTx output need to go through by several modules, such as, OVL_ADAPTOR and MERGE.
Add DRM and these modules support by the patches below:
Changes in v15:
- fix ethdr uppercase hex number in dts
Changes in v14:
- remove MTK_MMSYS 64 bit dependency
- add ethdr.yaml back and fix dt_schema check fail
Resend v13
- add related maintainer in maillist
Changes in v13:
- fix reviewer comment in v12
- fix rdma dt-binding format
- fix dts node naming
- fix 32 bit …
[View More]build error
- modify 64bit dependency for mtk-mmsys
- rebase to vdosys0 series v16. (ref [5])
Changes in v12:
- fix reviewer comment in v11
- modify mbox index
- refine dma dev for ovl_adaptor sub driver
Changes in v11:
- remove ethdr vblank spin lock
- refine ovl_adaptor print message
Changes in v10:
- refine ethdr reset control using devm_reset_control_array_get_optional_exclusive
- fix ovl_adaptor mtk_ovl_adaptor_clk_enable error handle issue
Changes in v9:
- rebase on kernel-5.16-rc1
- rebase on vdosys0 series v13. (ref [5])
- fix ovl_adaptor sub driver is brought up unintentionally
- fix clang build test fail- duplicate ethdr/mdp_rdma init_module/cleanup_module symbol issue
Changes in v8:
- separate merge async reset to new patch.
- separate drm ovl_adaptor sub driver to new patch.
- fix reviewer comment in v7.
Changes in v7:
- rebase on vdosys0 series v12 (ref[5])
- add dma description in ethdr binding document.
- refine vdosys1 bit definition of mmsys routing table.
- separate merge modification into 3 pathces.
- separate mutex modification into 2 patches.
- add plane color coding for mdp_rdma csc.
- move mdp_rdma pm control to ovl_adaptor.
- fix reviewer comment in v6.
Changes in v6:
- rebase on kernel-5.15-rc1.
- change mbox label to gce0 for dts node of vdosys1.
- modify mmsys reset num for mt8195.
- rebase on vdosys0 series v10. (ref [5])
- use drm to bring up ovl_adaptor driver.
- move drm iommu/mutex check from kms init to drm bind.
- modify rdma binding doc location. (Documentation/devicetree/bindings/arm/)
- modify for reviewer's comment in v5.
Changes in v5:
- add mmsys reset controller reference.
Changes in v4:
- use merge common driver for merge1~4.
- refine ovl_adaptor rdma driver.
- use ovl_adaptor ddp_comp function instead of ethdr.
- modify for reviewer's comment in v3.
Changes in v3:
- modify for reviewer's comment in v2.
- add vdosys1 2 pixels align limit.
- add mixer odd offset support.
Changes in v2:
- Merge PSEUDO_OVL and ETHDR into one DRM component.
- Add mmsys config API for vdosys1 hardware setting.
- Add mmsys reset control using linux reset framework.
Signed-off-by: Nancy.Lin <nancy.lin(a)mediatek.com>
This series are based on the following patch:
[1] arm64: dts: Add mediatek SoC mt8195 and evaluation board
https://patchwork.kernel.org/project/linux-mediatek/patch/20220112114724.19…
[2] arm64: dts: mt8195: add IOMMU and smi nodes
https://patchwork.kernel.org/project/linux-mediatek/patch/20210615173233.26…
[3] arm64: dts: mt8195: add gce node
https://patchwork.kernel.org/project/linux-mediatek/patch/20220126090109.32…
[4] [v2] arm64: dts: mt8195: add display node for vdosys0
https://patchwork.kernel.org/project/linux-mediatek/patch/20220225021535.26…
[5] Add MediaTek SoC DRM (vdosys0) support for mt8195
https://patchwork.kernel.org/project/linux-mediatek/list/?series=620795
[6] dt-bindings: mediatek: mt8195: Add binding for MM IOMMU
https://patchwork.kernel.org/project/linux-mediatek/patch/20220217113453.13…
Nancy.Lin (22):
dt-bindings: mediatek: add vdosys1 RDMA definition for mt8195
dt-bindings: reset: mt8195: add vdosys1 reset control bit
dt-bindings: mediatek: add ethdr definition for mt8195
soc: mediatek: add mtk-mmsys support for mt8195 vdosys1
soc: mediatek: add mtk-mmsys config API for mt8195 vdosys1
soc: mediatek: add cmdq support of mtk-mmsys config API for mt8195
vdosys1
soc: mediatek: mmsys: modify reset controller for MT8195 vdosys1
soc: mediatek: change the mutex defines and the mutex_mod type
soc: mediatek: add mtk-mutex support for mt8195 vdosys1
drm/mediatek: add display MDP RDMA support for MT8195
drm/mediatek: add display merge advance config API for MT8195
drm/mediatek: add display merge start/stop API for cmdq support
drm/mediatek: add display merge mute/unmute support for MT8195
drm/mediatek: add display merge async reset control
drm/mediatek: add ETHDR support for MT8195
drm/mediatek: add mediatek-drm plane color encoding info
drm/mediatek: add ovl_adaptor support for MT8195
drm/mediatek: add dma dev get function
drm/mediatek: modify mediatek-drm for mt8195 multi mmsys support
drm/mediatek: add drm ovl_adaptor sub driver for MT8195
drm/mediatek: add mediatek-drm of vdosys1 support for MT8195
arm64: dts: mt8195: add display node for vdosys1
.../arm/mediatek/mediatek,mdp-rdma.yaml | 86 ++++
.../display/mediatek/mediatek,ethdr.yaml | 158 +++++++
arch/arm64/boot/dts/mediatek/mt8195.dtsi | 223 +++++++++
drivers/gpu/drm/mediatek/Makefile | 5 +-
drivers/gpu/drm/mediatek/mtk_disp_drv.h | 29 ++
drivers/gpu/drm/mediatek/mtk_disp_merge.c | 89 +++-
.../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 443 ++++++++++++++++++
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 55 ++-
drivers/gpu/drm/mediatek/mtk_drm_crtc.h | 4 +-
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 31 +-
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 9 +
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 329 +++++++++----
drivers/gpu/drm/mediatek/mtk_drm_drv.h | 13 +-
drivers/gpu/drm/mediatek/mtk_drm_plane.c | 1 +
drivers/gpu/drm/mediatek/mtk_drm_plane.h | 1 +
drivers/gpu/drm/mediatek/mtk_ethdr.c | 376 +++++++++++++++
drivers/gpu/drm/mediatek/mtk_ethdr.h | 23 +
drivers/gpu/drm/mediatek/mtk_mdp_rdma.c | 315 +++++++++++++
drivers/gpu/drm/mediatek/mtk_mdp_rdma.h | 20 +
drivers/soc/mediatek/mt8195-mmsys.h | 199 ++++++++
drivers/soc/mediatek/mtk-mmsys.c | 79 +++-
drivers/soc/mediatek/mtk-mmsys.h | 11 +
drivers/soc/mediatek/mtk-mutex.c | 318 +++++++------
include/dt-bindings/reset/mt8195-resets.h | 12 +
include/linux/soc/mediatek/mtk-mmsys.h | 22 +
25 files changed, 2596 insertions(+), 255 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,mdp-rdma.yaml
create mode 100644 Documentation/devicetree/bindings/display/mediatek/mediatek,ethdr.yaml
create mode 100644 drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
create mode 100644 drivers/gpu/drm/mediatek/mtk_ethdr.c
create mode 100644 drivers/gpu/drm/mediatek/mtk_ethdr.h
create mode 100644 drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
create mode 100644 drivers/gpu/drm/mediatek/mtk_mdp_rdma.h
--
2.18.0
[View Less]
Hi all,
I'm sending these patches to try to improve the current situation for a
particular corner case (DRM driver unbinding).
I could reproduce a specific race condition during the unbinding of the
mediatek-drm driver that caused an invalid memory address. The race
condition is triggered by a userspace event (gnome-shell requesting a
DRM GET_CONNECTOR ioctl) while the encoders and drivers are in the
process of being disabled.
While I tried to mitigate this by making a small change in the
…
[View More]parade-ps8640 driver (for the bridge I'm testing on) and by making a
couple of functions in drm_bridge.c more robust, this is only a symptom
of a larger problem that might not be getting enough attention,
understandably, because this is an unusual corner case.
The scenario looks like this:
<userspace>: unbind mediatek-drm --------------------+
| |
<kernel> |
| |
... |
| ...
mtk_dsi_unbind |
| |
`- drm_encoder_cleanup v
| | gnome-shell
... `- drm_bridge_detach *<------ ioctl (GET_CONNECTOR)
|
<kernel>
|
...
|
|
ps8640_bridge_get_edid
|
`drm_bridge_chain_post_disable
which causes drm_bridge_chain_post_disable() to walk the bridge chain
after the bridge has already been detached and removed from the list. I
guess a more radical and subsystem-wide solution would be to not allow
or to block certain ioctl calls once the driver has started to unbind,
but I'd like to hear your opinion on this.
This was tested on an Acer Chromebook R13 (Elm, MT8173) running Debian
Sid, the command that triggers the race condition is
echo mediatek-drm.12.auto > /sys/bus/platform/drivers/mediatek-drm/unbind
Cheers,
Ricardo
Ricardo Cañuelo (2):
drm/bridge: parade-ps8640: avoid race condition on driver unbinding
drm/bridge: Add extra checks in pre_enable and post_enable
drivers/gpu/drm/bridge/parade-ps8640.c | 6 +++---
drivers/gpu/drm/drm_bridge.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
--
2.25.1
[View Less]