Mailing List Archive

[PATCH v10 11/15] drm/atomic-helper: Set fence deadline for vblank
From: Rob Clark <robdclark@chromium.org>

For an atomic commit updating a single CRTC (ie. a pageflip) calculate
the next vblank time, and inform the fence(s) of that deadline.

v2: Comment typo fix (danvet)
v3: If there are multiple CRTCs, consider the time of the soonest vblank

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
drivers/gpu/drm/drm_atomic_helper.c | 37 +++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index d579fd8f7cb8..28e3f2c8917e 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1511,6 +1511,41 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_enables);

+/*
+ * For atomic updates which touch just a single CRTC, calculate the time of the
+ * next vblank, and inform all the fences of the deadline.
+ */
+static void set_fence_deadline(struct drm_device *dev,
+ struct drm_atomic_state *state)
+{
+ struct drm_crtc *crtc;
+ struct drm_crtc_state *new_crtc_state;
+ struct drm_plane *plane;
+ struct drm_plane_state *new_plane_state;
+ ktime_t vbltime = 0;
+ int i;
+
+ for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
+ ktime_t v;
+
+ if (drm_crtc_next_vblank_start(crtc, &v))
+ continue;
+
+ if (!vbltime || ktime_before(v, vbltime))
+ vbltime = v;
+ }
+
+ /* If no CRTCs updated, then nothing to do: */
+ if (!vbltime)
+ return;
+
+ for_each_new_plane_in_state (state, plane, new_plane_state, i) {
+ if (!new_plane_state->fence)
+ continue;
+ dma_fence_set_deadline(new_plane_state->fence, vbltime);
+ }
+}
+
/**
* drm_atomic_helper_wait_for_fences - wait for fences stashed in plane state
* @dev: DRM device
@@ -1540,6 +1575,8 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
struct drm_plane_state *new_plane_state;
int i, ret;

+ set_fence_deadline(dev, state);
+
for_each_new_plane_in_state(state, plane, new_plane_state, i) {
if (!new_plane_state->fence)
continue;
--
2.39.2
Re: [PATCH v10 11/15] drm/atomic-helper: Set fence deadline for vblank [ In reply to ]
Hi Rob,

On Wed, Mar 08, 2023 at 07:53:02AM -0800, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
>
> For an atomic commit updating a single CRTC (ie. a pageflip) calculate
> the next vblank time, and inform the fence(s) of that deadline.
>
> v2: Comment typo fix (danvet)
> v3: If there are multiple CRTCs, consider the time of the soonest vblank
>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Rob Clark <robdclark@chromium.org>

I apologize if this has already been reported or fixed, I searched lore
but did not find anything.

This change as commit d39e48ca80c0 ("drm/atomic-helper: Set fence
deadline for vblank") in -next causes a hang while running LTP's
read_all test on /proc on my Ampere Altra system (it seems it is hanging
on a pagemap file?). Additionally, I have this splat in dmesg, which
seems related based on the call stack.

[ 20.542591] fbcon: Taking over console
[ 20.550772] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000074
[ 20.550776] Mem abort info:
[ 20.550777] ESR = 0x0000000096000004
[ 20.550779] EC = 0x25: DABT (current EL), IL = 32 bits
[ 20.550781] SET = 0, FnV = 0
[ 20.550782] EA = 0, S1PTW = 0
[ 20.550784] FSC = 0x04: level 0 translation fault
[ 20.550785] Data abort info:
[ 20.550786] ISV = 0, ISS = 0x00000004
[ 20.550788] CM = 0, WnR = 0
[ 20.550789] user pgtable: 4k pages, 48-bit VAs, pgdp=0000080009d16000
[ 20.550791] [0000000000000074] pgd=0000000000000000, p4d=0000000000000000
[ 20.550796] Internal error: Oops: 0000000096000004 [#1] SMP
[ 20.550800] Modules linked in: ip6table_nat tun nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set nf_tables nfnetlink qrtr sunrpc binfmt_misc vfat fat xfs snd_usb_audio snd_hwdep snd_usbmidi_lib snd_seq snd_pcm snd_rawmidi snd_timer snd_seq_device snd soundcore joydev mc ipmi_ssif ipmi_devintf ipmi_msghandler arm_spe_pmu arm_cmn arm_dsu_pmu arm_dmc620_pmu cppc_cpufreq loop zram crct10dif_ce polyval_ce nvme polyval_generic ghash_ce sbsa_gwdt igb nvme_core ast nvme_common i2c_algo_bit xgene_hwmon gpio_dwapb scsi_dh_rdac scsi_dh_emc scsi_dh_alua ip6_tables ip_tables dm_multipath fuse
[ 20.550869] CPU: 12 PID: 469 Comm: kworker/12:1 Not tainted 6.3.0-rc2-00008-gd39e48ca80c0 #1
[ 20.550872] Hardware name: ADLINK AVA Developer Platform/AVA Developer Platform, BIOS TianoCore 2.04.100.07 (SYS: 2.06.20220308) 09/08/2022
[ 20.550875] Workqueue: events fbcon_register_existing_fbs
[ 20.550884] pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 20.550888] pc : drm_crtc_next_vblank_start+0x2c/0x98
[ 20.550894] lr : drm_atomic_helper_wait_for_fences+0x90/0x240
[ 20.550898] sp : ffff80000d583960
[ 20.550900] x29: ffff80000d583960 x28: ffff07ff8fc187b0 x27: 0000000000000000
[ 20.550904] x26: ffff07ff99c08c00 x25: 0000000000000038 x24: ffff07ff99c0c000
[ 20.550908] x23: 0000000000000001 x22: 0000000000000038 x21: 0000000000000000
[ 20.550912] x20: ffff07ff9640a280 x19: 0000000000000000 x18: ffffffffffffffff
[ 20.550915] x17: 0000000000000000 x16: ffffb24d2eece1c0 x15: 0000003038303178
[ 20.550919] x14: 3032393100000048 x13: 0000000000000000 x12: 0000000000000000
[ 20.550923] x11: 0000000000000000 x10: 0000000000000000 x9 : ffffb24d2eeeaca0
[ 20.550926] x8 : ffff80000d583628 x7 : 0000080077783000 x6 : 0000000000000000
[ 20.550930] x5 : ffff80000d584000 x4 : ffff07ff99c0c000 x3 : 0000000000000130
[ 20.550934] x2 : 0000000000000000 x1 : ffff80000d5839c0 x0 : ffff07ff99c0cc08
[ 20.550937] Call trace:
[ 20.550939] drm_crtc_next_vblank_start+0x2c/0x98
[ 20.550942] drm_atomic_helper_wait_for_fences+0x90/0x240
[ 20.550946] drm_atomic_helper_commit+0xb0/0x188
[ 20.550949] drm_atomic_commit+0xb0/0xf0
[ 20.550953] drm_client_modeset_commit_atomic+0x218/0x280
[ 20.550957] drm_client_modeset_commit_locked+0x64/0x1a0
[ 20.550961] drm_client_modeset_commit+0x38/0x68
[ 20.550965] __drm_fb_helper_restore_fbdev_mode_unlocked+0xb0/0xf8
[ 20.550970] drm_fb_helper_set_par+0x44/0x88
[ 20.550973] fbcon_init+0x1e0/0x4a8
[ 20.550976] visual_init+0xbc/0x118
[ 20.550981] do_bind_con_driver.isra.0+0x194/0x3a0
[ 20.550984] do_take_over_console+0x50/0x70
[ 20.550987] do_fbcon_takeover+0x74/0xf8
[ 20.550989] do_fb_registered+0x13c/0x158
[ 20.550992] fbcon_register_existing_fbs+0x78/0xc0
[ 20.550995] process_one_work+0x1ec/0x478
[ 20.551000] worker_thread+0x74/0x418
[ 20.551002] kthread+0xec/0x100
[ 20.551005] ret_from_fork+0x10/0x20
[ 20.551011] Code: f9400004 b9409013 f940a082 9ba30a73 (b9407662)
[ 20.551013] ---[ end trace 0000000000000000 ]---

If there is any additional information that I can provide or patches I
can test, I am more than happy to do so.

Cheers,
Nathan

# bad: [4b0f4525dc4fe8af17b3daefe585f0c2eb0fe0a5] Add linux-next specific files for 20230331
# good: [b2bc47e9b2011a183f9d3d3454a294a938082fb9] Merge tag 'net-6.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
git bisect start '4b0f4525dc4fe8af17b3daefe585f0c2eb0fe0a5' 'b2bc47e9b2011a183f9d3d3454a294a938082fb9'
# good: [ed5f95f3349003d74a4a11b27b0f05d6794c382a] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
git bisect good ed5f95f3349003d74a4a11b27b0f05d6794c382a
# bad: [85f7d1bfa30a05df2c9d8a0e9f6b1f23b4a6f13b] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-dt.git
git bisect bad 85f7d1bfa30a05df2c9d8a0e9f6b1f23b4a6f13b
# bad: [fbd0f79f200f8e5cb73fb3d7b788de09a8f33a6f] Merge branch 'msm-next' of https://gitlab.freedesktop.org/drm/msm.git
git bisect bad fbd0f79f200f8e5cb73fb3d7b788de09a8f33a6f
# good: [90031bc33f7525f0cc7a9ef0b1df62a1a4463382] Merge tag 'amd-drm-next-6.4-2023-03-17' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
git bisect good 90031bc33f7525f0cc7a9ef0b1df62a1a4463382
# good: [d4e04817db670083aed73de1fadd3b21758e69ba] drm/amdgpu: Return from switch early for EEPROM I2C address
git bisect good d4e04817db670083aed73de1fadd3b21758e69ba
# good: [70e360f9b548d99f959668d4f047d1363d42fe8e] drm: exynos: dsi: Consolidate component and bridge
git bisect good 70e360f9b548d99f959668d4f047d1363d42fe8e
# bad: [0b43595d0cbb06736d1e572e79e29a410a273573] Merge branch 'drm-next' of https://gitlab.freedesktop.org/agd5f/linux
git bisect bad 0b43595d0cbb06736d1e572e79e29a410a273573
# good: [fbb3b3500f76ec8b741bd2d0e761ca3e856ad924] dt-bindings: display: boe,tv101wum-nl6: document rotation
git bisect good fbb3b3500f76ec8b741bd2d0e761ca3e856ad924
# bad: [82bbec189ab34873688484cd14189a5392946fbb] Merge v6.3-rc4 into drm-next
git bisect bad 82bbec189ab34873688484cd14189a5392946fbb
# bad: [d39e48ca80c0960b039cb38633957f0040f63e1a] drm/atomic-helper: Set fence deadline for vblank
git bisect bad d39e48ca80c0960b039cb38633957f0040f63e1a
# good: [d7d5a21dd6b4706c04fbba5d25db8da5f25aab68] dma-buf/dma-resv: Add a way to set fence deadline
git bisect good d7d5a21dd6b4706c04fbba5d25db8da5f25aab68
# good: [f3823da7e4ba7d4781375c2bb786a8a78efc6591] drm/scheduler: Add fence deadline support
git bisect good f3823da7e4ba7d4781375c2bb786a8a78efc6591
# good: [b2c077d001b612b1f34f7e528b2dc6072bd6794e] drm/vblank: Add helper to get next vblank time
git bisect good b2c077d001b612b1f34f7e528b2dc6072bd6794e
# first bad commit: [d39e48ca80c0960b039cb38633957f0040f63e1a] drm/atomic-helper: Set fence deadline for vblank
Re: [PATCH v10 11/15] drm/atomic-helper: Set fence deadline for vblank [ In reply to ]
On Fri, Mar 31, 2023 at 1:44?PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Hi Rob,
>
> On Wed, Mar 08, 2023 at 07:53:02AM -0800, Rob Clark wrote:
> > From: Rob Clark <robdclark@chromium.org>
> >
> > For an atomic commit updating a single CRTC (ie. a pageflip) calculate
> > the next vblank time, and inform the fence(s) of that deadline.
> >
> > v2: Comment typo fix (danvet)
> > v3: If there are multiple CRTCs, consider the time of the soonest vblank
> >
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
>
> I apologize if this has already been reported or fixed, I searched lore
> but did not find anything.
>
> This change as commit d39e48ca80c0 ("drm/atomic-helper: Set fence
> deadline for vblank") in -next causes a hang while running LTP's
> read_all test on /proc on my Ampere Altra system (it seems it is hanging
> on a pagemap file?). Additionally, I have this splat in dmesg, which
> seems related based on the call stack.

Hi, I'm not familiar with this hardware.. do you know which drm driver
is used? I can't tell from the call-stack.

BR,
-R


> [ 20.542591] fbcon: Taking over console
> [ 20.550772] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000074
> [ 20.550776] Mem abort info:
> [ 20.550777] ESR = 0x0000000096000004
> [ 20.550779] EC = 0x25: DABT (current EL), IL = 32 bits
> [ 20.550781] SET = 0, FnV = 0
> [ 20.550782] EA = 0, S1PTW = 0
> [ 20.550784] FSC = 0x04: level 0 translation fault
> [ 20.550785] Data abort info:
> [ 20.550786] ISV = 0, ISS = 0x00000004
> [ 20.550788] CM = 0, WnR = 0
> [ 20.550789] user pgtable: 4k pages, 48-bit VAs, pgdp=0000080009d16000
> [ 20.550791] [0000000000000074] pgd=0000000000000000, p4d=0000000000000000
> [ 20.550796] Internal error: Oops: 0000000096000004 [#1] SMP
> [ 20.550800] Modules linked in: ip6table_nat tun nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set nf_tables nfnetlink qrtr sunrpc binfmt_misc vfat fat xfs snd_usb_audio snd_hwdep snd_usbmidi_lib snd_seq snd_pcm snd_rawmidi snd_timer snd_seq_device snd soundcore joydev mc ipmi_ssif ipmi_devintf ipmi_msghandler arm_spe_pmu arm_cmn arm_dsu_pmu arm_dmc620_pmu cppc_cpufreq loop zram crct10dif_ce polyval_ce nvme polyval_generic ghash_ce sbsa_gwdt igb nvme_core ast nvme_common i2c_algo_bit xgene_hwmon gpio_dwapb scsi_dh_rdac scsi_dh_emc scsi_dh_alua ip6_tables ip_tables dm_multipath fuse
> [ 20.550869] CPU: 12 PID: 469 Comm: kworker/12:1 Not tainted 6.3.0-rc2-00008-gd39e48ca80c0 #1
> [ 20.550872] Hardware name: ADLINK AVA Developer Platform/AVA Developer Platform, BIOS TianoCore 2.04.100.07 (SYS: 2.06.20220308) 09/08/2022
> [ 20.550875] Workqueue: events fbcon_register_existing_fbs
> [ 20.550884] pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [ 20.550888] pc : drm_crtc_next_vblank_start+0x2c/0x98
> [ 20.550894] lr : drm_atomic_helper_wait_for_fences+0x90/0x240
> [ 20.550898] sp : ffff80000d583960
> [ 20.550900] x29: ffff80000d583960 x28: ffff07ff8fc187b0 x27: 0000000000000000
> [ 20.550904] x26: ffff07ff99c08c00 x25: 0000000000000038 x24: ffff07ff99c0c000
> [ 20.550908] x23: 0000000000000001 x22: 0000000000000038 x21: 0000000000000000
> [ 20.550912] x20: ffff07ff9640a280 x19: 0000000000000000 x18: ffffffffffffffff
> [ 20.550915] x17: 0000000000000000 x16: ffffb24d2eece1c0 x15: 0000003038303178
> [ 20.550919] x14: 3032393100000048 x13: 0000000000000000 x12: 0000000000000000
> [ 20.550923] x11: 0000000000000000 x10: 0000000000000000 x9 : ffffb24d2eeeaca0
> [ 20.550926] x8 : ffff80000d583628 x7 : 0000080077783000 x6 : 0000000000000000
> [ 20.550930] x5 : ffff80000d584000 x4 : ffff07ff99c0c000 x3 : 0000000000000130
> [ 20.550934] x2 : 0000000000000000 x1 : ffff80000d5839c0 x0 : ffff07ff99c0cc08
> [ 20.550937] Call trace:
> [ 20.550939] drm_crtc_next_vblank_start+0x2c/0x98
> [ 20.550942] drm_atomic_helper_wait_for_fences+0x90/0x240
> [ 20.550946] drm_atomic_helper_commit+0xb0/0x188
> [ 20.550949] drm_atomic_commit+0xb0/0xf0
> [ 20.550953] drm_client_modeset_commit_atomic+0x218/0x280
> [ 20.550957] drm_client_modeset_commit_locked+0x64/0x1a0
> [ 20.550961] drm_client_modeset_commit+0x38/0x68
> [ 20.550965] __drm_fb_helper_restore_fbdev_mode_unlocked+0xb0/0xf8
> [ 20.550970] drm_fb_helper_set_par+0x44/0x88
> [ 20.550973] fbcon_init+0x1e0/0x4a8
> [ 20.550976] visual_init+0xbc/0x118
> [ 20.550981] do_bind_con_driver.isra.0+0x194/0x3a0
> [ 20.550984] do_take_over_console+0x50/0x70
> [ 20.550987] do_fbcon_takeover+0x74/0xf8
> [ 20.550989] do_fb_registered+0x13c/0x158
> [ 20.550992] fbcon_register_existing_fbs+0x78/0xc0
> [ 20.550995] process_one_work+0x1ec/0x478
> [ 20.551000] worker_thread+0x74/0x418
> [ 20.551002] kthread+0xec/0x100
> [ 20.551005] ret_from_fork+0x10/0x20
> [ 20.551011] Code: f9400004 b9409013 f940a082 9ba30a73 (b9407662)
> [ 20.551013] ---[ end trace 0000000000000000 ]---
>
> If there is any additional information that I can provide or patches I
> can test, I am more than happy to do so.
>
> Cheers,
> Nathan
>
> # bad: [4b0f4525dc4fe8af17b3daefe585f0c2eb0fe0a5] Add linux-next specific files for 20230331
> # good: [b2bc47e9b2011a183f9d3d3454a294a938082fb9] Merge tag 'net-6.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
> git bisect start '4b0f4525dc4fe8af17b3daefe585f0c2eb0fe0a5' 'b2bc47e9b2011a183f9d3d3454a294a938082fb9'
> # good: [ed5f95f3349003d74a4a11b27b0f05d6794c382a] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
> git bisect good ed5f95f3349003d74a4a11b27b0f05d6794c382a
> # bad: [85f7d1bfa30a05df2c9d8a0e9f6b1f23b4a6f13b] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-dt.git
> git bisect bad 85f7d1bfa30a05df2c9d8a0e9f6b1f23b4a6f13b
> # bad: [fbd0f79f200f8e5cb73fb3d7b788de09a8f33a6f] Merge branch 'msm-next' of https://gitlab.freedesktop.org/drm/msm.git
> git bisect bad fbd0f79f200f8e5cb73fb3d7b788de09a8f33a6f
> # good: [90031bc33f7525f0cc7a9ef0b1df62a1a4463382] Merge tag 'amd-drm-next-6.4-2023-03-17' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
> git bisect good 90031bc33f7525f0cc7a9ef0b1df62a1a4463382
> # good: [d4e04817db670083aed73de1fadd3b21758e69ba] drm/amdgpu: Return from switch early for EEPROM I2C address
> git bisect good d4e04817db670083aed73de1fadd3b21758e69ba
> # good: [70e360f9b548d99f959668d4f047d1363d42fe8e] drm: exynos: dsi: Consolidate component and bridge
> git bisect good 70e360f9b548d99f959668d4f047d1363d42fe8e
> # bad: [0b43595d0cbb06736d1e572e79e29a410a273573] Merge branch 'drm-next' of https://gitlab.freedesktop.org/agd5f/linux
> git bisect bad 0b43595d0cbb06736d1e572e79e29a410a273573
> # good: [fbb3b3500f76ec8b741bd2d0e761ca3e856ad924] dt-bindings: display: boe,tv101wum-nl6: document rotation
> git bisect good fbb3b3500f76ec8b741bd2d0e761ca3e856ad924
> # bad: [82bbec189ab34873688484cd14189a5392946fbb] Merge v6.3-rc4 into drm-next
> git bisect bad 82bbec189ab34873688484cd14189a5392946fbb
> # bad: [d39e48ca80c0960b039cb38633957f0040f63e1a] drm/atomic-helper: Set fence deadline for vblank
> git bisect bad d39e48ca80c0960b039cb38633957f0040f63e1a
> # good: [d7d5a21dd6b4706c04fbba5d25db8da5f25aab68] dma-buf/dma-resv: Add a way to set fence deadline
> git bisect good d7d5a21dd6b4706c04fbba5d25db8da5f25aab68
> # good: [f3823da7e4ba7d4781375c2bb786a8a78efc6591] drm/scheduler: Add fence deadline support
> git bisect good f3823da7e4ba7d4781375c2bb786a8a78efc6591
> # good: [b2c077d001b612b1f34f7e528b2dc6072bd6794e] drm/vblank: Add helper to get next vblank time
> git bisect good b2c077d001b612b1f34f7e528b2dc6072bd6794e
> # first bad commit: [d39e48ca80c0960b039cb38633957f0040f63e1a] drm/atomic-helper: Set fence deadline for vblank
Re: [PATCH v10 11/15] drm/atomic-helper: Set fence deadline for vblank [ In reply to ]
On Fri, Mar 31, 2023 at 03:14:30PM -0700, Rob Clark wrote:
> On Fri, Mar 31, 2023 at 1:44?PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > Hi Rob,
> >
> > On Wed, Mar 08, 2023 at 07:53:02AM -0800, Rob Clark wrote:
> > > From: Rob Clark <robdclark@chromium.org>
> > >
> > > For an atomic commit updating a single CRTC (ie. a pageflip) calculate
> > > the next vblank time, and inform the fence(s) of that deadline.
> > >
> > > v2: Comment typo fix (danvet)
> > > v3: If there are multiple CRTCs, consider the time of the soonest vblank
> > >
> > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> >
> > I apologize if this has already been reported or fixed, I searched lore
> > but did not find anything.
> >
> > This change as commit d39e48ca80c0 ("drm/atomic-helper: Set fence
> > deadline for vblank") in -next causes a hang while running LTP's
> > read_all test on /proc on my Ampere Altra system (it seems it is hanging
> > on a pagemap file?). Additionally, I have this splat in dmesg, which
> > seems related based on the call stack.
>
> Hi, I'm not familiar with this hardware.. do you know which drm driver
> is used? I can't tell from the call-stack.

I think it is drivers/gpu/drm/ast, as I see ast in lsmod?

> > [ 20.542591] fbcon: Taking over console
> > [ 20.550772] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000074
> > [ 20.550776] Mem abort info:
> > [ 20.550777] ESR = 0x0000000096000004
> > [ 20.550779] EC = 0x25: DABT (current EL), IL = 32 bits
> > [ 20.550781] SET = 0, FnV = 0
> > [ 20.550782] EA = 0, S1PTW = 0
> > [ 20.550784] FSC = 0x04: level 0 translation fault
> > [ 20.550785] Data abort info:
> > [ 20.550786] ISV = 0, ISS = 0x00000004
> > [ 20.550788] CM = 0, WnR = 0
> > [ 20.550789] user pgtable: 4k pages, 48-bit VAs, pgdp=0000080009d16000
> > [ 20.550791] [0000000000000074] pgd=0000000000000000, p4d=0000000000000000
> > [ 20.550796] Internal error: Oops: 0000000096000004 [#1] SMP
> > [ 20.550800] Modules linked in: ip6table_nat tun nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set nf_tables nfnetlink qrtr sunrpc binfmt_misc vfat fat xfs snd_usb_audio snd_hwdep snd_usbmidi_lib snd_seq snd_pcm snd_rawmidi snd_timer snd_seq_device snd soundcore joydev mc ipmi_ssif ipmi_devintf ipmi_msghandler arm_spe_pmu arm_cmn arm_dsu_pmu arm_dmc620_pmu cppc_cpufreq loop zram crct10dif_ce polyval_ce nvme polyval_generic ghash_ce sbsa_gwdt igb nvme_core ast nvme_common i2c_algo_bit xgene_hwmon gpio_dwapb scsi_dh_rdac scsi_dh_emc scsi_dh_alua ip6_tables ip_tables dm_multipath fuse
> > [ 20.550869] CPU: 12 PID: 469 Comm: kworker/12:1 Not tainted 6.3.0-rc2-00008-gd39e48ca80c0 #1
> > [ 20.550872] Hardware name: ADLINK AVA Developer Platform/AVA Developer Platform, BIOS TianoCore 2.04.100.07 (SYS: 2.06.20220308) 09/08/2022
> > [ 20.550875] Workqueue: events fbcon_register_existing_fbs
> > [ 20.550884] pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> > [ 20.550888] pc : drm_crtc_next_vblank_start+0x2c/0x98
> > [ 20.550894] lr : drm_atomic_helper_wait_for_fences+0x90/0x240
> > [ 20.550898] sp : ffff80000d583960
> > [ 20.550900] x29: ffff80000d583960 x28: ffff07ff8fc187b0 x27: 0000000000000000
> > [ 20.550904] x26: ffff07ff99c08c00 x25: 0000000000000038 x24: ffff07ff99c0c000
> > [ 20.550908] x23: 0000000000000001 x22: 0000000000000038 x21: 0000000000000000
> > [ 20.550912] x20: ffff07ff9640a280 x19: 0000000000000000 x18: ffffffffffffffff
> > [ 20.550915] x17: 0000000000000000 x16: ffffb24d2eece1c0 x15: 0000003038303178
> > [ 20.550919] x14: 3032393100000048 x13: 0000000000000000 x12: 0000000000000000
> > [ 20.550923] x11: 0000000000000000 x10: 0000000000000000 x9 : ffffb24d2eeeaca0
> > [ 20.550926] x8 : ffff80000d583628 x7 : 0000080077783000 x6 : 0000000000000000
> > [ 20.550930] x5 : ffff80000d584000 x4 : ffff07ff99c0c000 x3 : 0000000000000130
> > [ 20.550934] x2 : 0000000000000000 x1 : ffff80000d5839c0 x0 : ffff07ff99c0cc08
> > [ 20.550937] Call trace:
> > [ 20.550939] drm_crtc_next_vblank_start+0x2c/0x98
> > [ 20.550942] drm_atomic_helper_wait_for_fences+0x90/0x240
> > [ 20.550946] drm_atomic_helper_commit+0xb0/0x188
> > [ 20.550949] drm_atomic_commit+0xb0/0xf0
> > [ 20.550953] drm_client_modeset_commit_atomic+0x218/0x280
> > [ 20.550957] drm_client_modeset_commit_locked+0x64/0x1a0
> > [ 20.550961] drm_client_modeset_commit+0x38/0x68
> > [ 20.550965] __drm_fb_helper_restore_fbdev_mode_unlocked+0xb0/0xf8
> > [ 20.550970] drm_fb_helper_set_par+0x44/0x88
> > [ 20.550973] fbcon_init+0x1e0/0x4a8
> > [ 20.550976] visual_init+0xbc/0x118
> > [ 20.550981] do_bind_con_driver.isra.0+0x194/0x3a0
> > [ 20.550984] do_take_over_console+0x50/0x70
> > [ 20.550987] do_fbcon_takeover+0x74/0xf8
> > [ 20.550989] do_fb_registered+0x13c/0x158
> > [ 20.550992] fbcon_register_existing_fbs+0x78/0xc0
> > [ 20.550995] process_one_work+0x1ec/0x478
> > [ 20.551000] worker_thread+0x74/0x418
> > [ 20.551002] kthread+0xec/0x100
> > [ 20.551005] ret_from_fork+0x10/0x20
> > [ 20.551011] Code: f9400004 b9409013 f940a082 9ba30a73 (b9407662)
> > [ 20.551013] ---[ end trace 0000000000000000 ]---
> >
> > If there is any additional information that I can provide or patches I
> > can test, I am more than happy to do so.
> >
> > Cheers,
> > Nathan
> >
> > # bad: [4b0f4525dc4fe8af17b3daefe585f0c2eb0fe0a5] Add linux-next specific files for 20230331
> > # good: [b2bc47e9b2011a183f9d3d3454a294a938082fb9] Merge tag 'net-6.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
> > git bisect start '4b0f4525dc4fe8af17b3daefe585f0c2eb0fe0a5' 'b2bc47e9b2011a183f9d3d3454a294a938082fb9'
> > # good: [ed5f95f3349003d74a4a11b27b0f05d6794c382a] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
> > git bisect good ed5f95f3349003d74a4a11b27b0f05d6794c382a
> > # bad: [85f7d1bfa30a05df2c9d8a0e9f6b1f23b4a6f13b] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-dt.git
> > git bisect bad 85f7d1bfa30a05df2c9d8a0e9f6b1f23b4a6f13b
> > # bad: [fbd0f79f200f8e5cb73fb3d7b788de09a8f33a6f] Merge branch 'msm-next' of https://gitlab.freedesktop.org/drm/msm.git
> > git bisect bad fbd0f79f200f8e5cb73fb3d7b788de09a8f33a6f
> > # good: [90031bc33f7525f0cc7a9ef0b1df62a1a4463382] Merge tag 'amd-drm-next-6.4-2023-03-17' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
> > git bisect good 90031bc33f7525f0cc7a9ef0b1df62a1a4463382
> > # good: [d4e04817db670083aed73de1fadd3b21758e69ba] drm/amdgpu: Return from switch early for EEPROM I2C address
> > git bisect good d4e04817db670083aed73de1fadd3b21758e69ba
> > # good: [70e360f9b548d99f959668d4f047d1363d42fe8e] drm: exynos: dsi: Consolidate component and bridge
> > git bisect good 70e360f9b548d99f959668d4f047d1363d42fe8e
> > # bad: [0b43595d0cbb06736d1e572e79e29a410a273573] Merge branch 'drm-next' of https://gitlab.freedesktop.org/agd5f/linux
> > git bisect bad 0b43595d0cbb06736d1e572e79e29a410a273573
> > # good: [fbb3b3500f76ec8b741bd2d0e761ca3e856ad924] dt-bindings: display: boe,tv101wum-nl6: document rotation
> > git bisect good fbb3b3500f76ec8b741bd2d0e761ca3e856ad924
> > # bad: [82bbec189ab34873688484cd14189a5392946fbb] Merge v6.3-rc4 into drm-next
> > git bisect bad 82bbec189ab34873688484cd14189a5392946fbb
> > # bad: [d39e48ca80c0960b039cb38633957f0040f63e1a] drm/atomic-helper: Set fence deadline for vblank
> > git bisect bad d39e48ca80c0960b039cb38633957f0040f63e1a
> > # good: [d7d5a21dd6b4706c04fbba5d25db8da5f25aab68] dma-buf/dma-resv: Add a way to set fence deadline
> > git bisect good d7d5a21dd6b4706c04fbba5d25db8da5f25aab68
> > # good: [f3823da7e4ba7d4781375c2bb786a8a78efc6591] drm/scheduler: Add fence deadline support
> > git bisect good f3823da7e4ba7d4781375c2bb786a8a78efc6591
> > # good: [b2c077d001b612b1f34f7e528b2dc6072bd6794e] drm/vblank: Add helper to get next vblank time
> > git bisect good b2c077d001b612b1f34f7e528b2dc6072bd6794e
> > # first bad commit: [d39e48ca80c0960b039cb38633957f0040f63e1a] drm/atomic-helper: Set fence deadline for vblank
Re: [PATCH v10 11/15] drm/atomic-helper: Set fence deadline for vblank [ In reply to ]
On Fri, Mar 31, 2023 at 4:30?PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Fri, Mar 31, 2023 at 03:14:30PM -0700, Rob Clark wrote:
> > On Fri, Mar 31, 2023 at 1:44?PM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > Hi Rob,
> > >
> > > On Wed, Mar 08, 2023 at 07:53:02AM -0800, Rob Clark wrote:
> > > > From: Rob Clark <robdclark@chromium.org>
> > > >
> > > > For an atomic commit updating a single CRTC (ie. a pageflip) calculate
> > > > the next vblank time, and inform the fence(s) of that deadline.
> > > >
> > > > v2: Comment typo fix (danvet)
> > > > v3: If there are multiple CRTCs, consider the time of the soonest vblank
> > > >
> > > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > >
> > > I apologize if this has already been reported or fixed, I searched lore
> > > but did not find anything.
> > >
> > > This change as commit d39e48ca80c0 ("drm/atomic-helper: Set fence
> > > deadline for vblank") in -next causes a hang while running LTP's
> > > read_all test on /proc on my Ampere Altra system (it seems it is hanging
> > > on a pagemap file?). Additionally, I have this splat in dmesg, which
> > > seems related based on the call stack.
> >
> > Hi, I'm not familiar with this hardware.. do you know which drm driver
> > is used? I can't tell from the call-stack.
>
> I think it is drivers/gpu/drm/ast, as I see ast in lsmod?

Ok, assuming my theory is correct, this should fix it:

https://patchwork.freedesktop.org/series/115992/

BR,
-R

> > > [ 20.542591] fbcon: Taking over console
> > > [ 20.550772] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000074
> > > [ 20.550776] Mem abort info:
> > > [ 20.550777] ESR = 0x0000000096000004
> > > [ 20.550779] EC = 0x25: DABT (current EL), IL = 32 bits
> > > [ 20.550781] SET = 0, FnV = 0
> > > [ 20.550782] EA = 0, S1PTW = 0
> > > [ 20.550784] FSC = 0x04: level 0 translation fault
> > > [ 20.550785] Data abort info:
> > > [ 20.550786] ISV = 0, ISS = 0x00000004
> > > [ 20.550788] CM = 0, WnR = 0
> > > [ 20.550789] user pgtable: 4k pages, 48-bit VAs, pgdp=0000080009d16000
> > > [ 20.550791] [0000000000000074] pgd=0000000000000000, p4d=0000000000000000
> > > [ 20.550796] Internal error: Oops: 0000000096000004 [#1] SMP
> > > [ 20.550800] Modules linked in: ip6table_nat tun nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set nf_tables nfnetlink qrtr sunrpc binfmt_misc vfat fat xfs snd_usb_audio snd_hwdep snd_usbmidi_lib snd_seq snd_pcm snd_rawmidi snd_timer snd_seq_device snd soundcore joydev mc ipmi_ssif ipmi_devintf ipmi_msghandler arm_spe_pmu arm_cmn arm_dsu_pmu arm_dmc620_pmu cppc_cpufreq loop zram crct10dif_ce polyval_ce nvme polyval_generic ghash_ce sbsa_gwdt igb nvme_core ast nvme_common i2c_algo_bit xgene_hwmon gpio_dwapb scsi_dh_rdac scsi_dh_emc scsi_dh_alua ip6_tables ip_tables dm_multipath fuse
> > > [ 20.550869] CPU: 12 PID: 469 Comm: kworker/12:1 Not tainted 6.3.0-rc2-00008-gd39e48ca80c0 #1
> > > [ 20.550872] Hardware name: ADLINK AVA Developer Platform/AVA Developer Platform, BIOS TianoCore 2.04.100.07 (SYS: 2.06.20220308) 09/08/2022
> > > [ 20.550875] Workqueue: events fbcon_register_existing_fbs
> > > [ 20.550884] pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> > > [ 20.550888] pc : drm_crtc_next_vblank_start+0x2c/0x98
> > > [ 20.550894] lr : drm_atomic_helper_wait_for_fences+0x90/0x240
> > > [ 20.550898] sp : ffff80000d583960
> > > [ 20.550900] x29: ffff80000d583960 x28: ffff07ff8fc187b0 x27: 0000000000000000
> > > [ 20.550904] x26: ffff07ff99c08c00 x25: 0000000000000038 x24: ffff07ff99c0c000
> > > [ 20.550908] x23: 0000000000000001 x22: 0000000000000038 x21: 0000000000000000
> > > [ 20.550912] x20: ffff07ff9640a280 x19: 0000000000000000 x18: ffffffffffffffff
> > > [ 20.550915] x17: 0000000000000000 x16: ffffb24d2eece1c0 x15: 0000003038303178
> > > [ 20.550919] x14: 3032393100000048 x13: 0000000000000000 x12: 0000000000000000
> > > [ 20.550923] x11: 0000000000000000 x10: 0000000000000000 x9 : ffffb24d2eeeaca0
> > > [ 20.550926] x8 : ffff80000d583628 x7 : 0000080077783000 x6 : 0000000000000000
> > > [ 20.550930] x5 : ffff80000d584000 x4 : ffff07ff99c0c000 x3 : 0000000000000130
> > > [ 20.550934] x2 : 0000000000000000 x1 : ffff80000d5839c0 x0 : ffff07ff99c0cc08
> > > [ 20.550937] Call trace:
> > > [ 20.550939] drm_crtc_next_vblank_start+0x2c/0x98
> > > [ 20.550942] drm_atomic_helper_wait_for_fences+0x90/0x240
> > > [ 20.550946] drm_atomic_helper_commit+0xb0/0x188
> > > [ 20.550949] drm_atomic_commit+0xb0/0xf0
> > > [ 20.550953] drm_client_modeset_commit_atomic+0x218/0x280
> > > [ 20.550957] drm_client_modeset_commit_locked+0x64/0x1a0
> > > [ 20.550961] drm_client_modeset_commit+0x38/0x68
> > > [ 20.550965] __drm_fb_helper_restore_fbdev_mode_unlocked+0xb0/0xf8
> > > [ 20.550970] drm_fb_helper_set_par+0x44/0x88
> > > [ 20.550973] fbcon_init+0x1e0/0x4a8
> > > [ 20.550976] visual_init+0xbc/0x118
> > > [ 20.550981] do_bind_con_driver.isra.0+0x194/0x3a0
> > > [ 20.550984] do_take_over_console+0x50/0x70
> > > [ 20.550987] do_fbcon_takeover+0x74/0xf8
> > > [ 20.550989] do_fb_registered+0x13c/0x158
> > > [ 20.550992] fbcon_register_existing_fbs+0x78/0xc0
> > > [ 20.550995] process_one_work+0x1ec/0x478
> > > [ 20.551000] worker_thread+0x74/0x418
> > > [ 20.551002] kthread+0xec/0x100
> > > [ 20.551005] ret_from_fork+0x10/0x20
> > > [ 20.551011] Code: f9400004 b9409013 f940a082 9ba30a73 (b9407662)
> > > [ 20.551013] ---[ end trace 0000000000000000 ]---
> > >
> > > If there is any additional information that I can provide or patches I
> > > can test, I am more than happy to do so.
> > >
> > > Cheers,
> > > Nathan
> > >
> > > # bad: [4b0f4525dc4fe8af17b3daefe585f0c2eb0fe0a5] Add linux-next specific files for 20230331
> > > # good: [b2bc47e9b2011a183f9d3d3454a294a938082fb9] Merge tag 'net-6.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
> > > git bisect start '4b0f4525dc4fe8af17b3daefe585f0c2eb0fe0a5' 'b2bc47e9b2011a183f9d3d3454a294a938082fb9'
> > > # good: [ed5f95f3349003d74a4a11b27b0f05d6794c382a] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
> > > git bisect good ed5f95f3349003d74a4a11b27b0f05d6794c382a
> > > # bad: [85f7d1bfa30a05df2c9d8a0e9f6b1f23b4a6f13b] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-dt.git
> > > git bisect bad 85f7d1bfa30a05df2c9d8a0e9f6b1f23b4a6f13b
> > > # bad: [fbd0f79f200f8e5cb73fb3d7b788de09a8f33a6f] Merge branch 'msm-next' of https://gitlab.freedesktop.org/drm/msm.git
> > > git bisect bad fbd0f79f200f8e5cb73fb3d7b788de09a8f33a6f
> > > # good: [90031bc33f7525f0cc7a9ef0b1df62a1a4463382] Merge tag 'amd-drm-next-6.4-2023-03-17' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
> > > git bisect good 90031bc33f7525f0cc7a9ef0b1df62a1a4463382
> > > # good: [d4e04817db670083aed73de1fadd3b21758e69ba] drm/amdgpu: Return from switch early for EEPROM I2C address
> > > git bisect good d4e04817db670083aed73de1fadd3b21758e69ba
> > > # good: [70e360f9b548d99f959668d4f047d1363d42fe8e] drm: exynos: dsi: Consolidate component and bridge
> > > git bisect good 70e360f9b548d99f959668d4f047d1363d42fe8e
> > > # bad: [0b43595d0cbb06736d1e572e79e29a410a273573] Merge branch 'drm-next' of https://gitlab.freedesktop.org/agd5f/linux
> > > git bisect bad 0b43595d0cbb06736d1e572e79e29a410a273573
> > > # good: [fbb3b3500f76ec8b741bd2d0e761ca3e856ad924] dt-bindings: display: boe,tv101wum-nl6: document rotation
> > > git bisect good fbb3b3500f76ec8b741bd2d0e761ca3e856ad924
> > > # bad: [82bbec189ab34873688484cd14189a5392946fbb] Merge v6.3-rc4 into drm-next
> > > git bisect bad 82bbec189ab34873688484cd14189a5392946fbb
> > > # bad: [d39e48ca80c0960b039cb38633957f0040f63e1a] drm/atomic-helper: Set fence deadline for vblank
> > > git bisect bad d39e48ca80c0960b039cb38633957f0040f63e1a
> > > # good: [d7d5a21dd6b4706c04fbba5d25db8da5f25aab68] dma-buf/dma-resv: Add a way to set fence deadline
> > > git bisect good d7d5a21dd6b4706c04fbba5d25db8da5f25aab68
> > > # good: [f3823da7e4ba7d4781375c2bb786a8a78efc6591] drm/scheduler: Add fence deadline support
> > > git bisect good f3823da7e4ba7d4781375c2bb786a8a78efc6591
> > > # good: [b2c077d001b612b1f34f7e528b2dc6072bd6794e] drm/vblank: Add helper to get next vblank time
> > > git bisect good b2c077d001b612b1f34f7e528b2dc6072bd6794e
> > > # first bad commit: [d39e48ca80c0960b039cb38633957f0040f63e1a] drm/atomic-helper: Set fence deadline for vblank
Re: [PATCH v10 11/15] drm/atomic-helper: Set fence deadline for vblank [ In reply to ]
On 08/03/2023 17:53, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
>
> For an atomic commit updating a single CRTC (ie. a pageflip) calculate
> the next vblank time, and inform the fence(s) of that deadline.
>
> v2: Comment typo fix (danvet)
> v3: If there are multiple CRTCs, consider the time of the soonest vblank
>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 37 +++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)

As I started playing with hotplug on RB5 (sm8250, DSI-HDMI bridge), I
found that this patch introduces the following backtrace on HDMI
hotplug. Is there anything that I can do to debug/fix the issue? The
warning seems harmless, but it would be probably be good to still fix
it. With addresses decoded:

[ 31.151348] ------------[ cut here ]------------
[ 31.157043] msm_dpu ae01000.display-controller:
drm_WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev))
[ 31.157177] WARNING: CPU: 0 PID: 13 at
drivers/gpu/drm/drm_vblank.c:728
drm_crtc_vblank_helper_get_vblank_timestamp_internal
(drivers/gpu/drm/drm_vblank.c:728)
[ 31.180629] Modules linked in:
[ 31.184106] CPU: 0 PID: 13 Comm: kworker/0:1 Not tainted
6.3.0-rc2-00008-gd39e48ca80c0 #542
[ 31.193358] Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
[ 31.200796] Workqueue: events lt9611uxc_hpd_work
[ 31.205990] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS
BTYPE=--)
[ 31.213722] pc : drm_crtc_vblank_helper_get_vblank_timestamp_internal
(drivers/gpu/drm/drm_vblank.c:728)
[ 31.222032] lr : drm_crtc_vblank_helper_get_vblank_timestamp_internal
(drivers/gpu/drm/drm_vblank.c:728)
[ 31.230341] sp : ffff8000080bb8d0
[ 31.234061] x29: ffff8000080bb900 x28: 0000000000000038 x27:
ffff61a7956b8d60
[ 31.242051] x26: 0000000000000000 x25: 0000000000000000 x24:
ffff8000080bb9c4
[ 31.250038] x23: 0000000000000001 x22: ffffbf0033b94ef0 x21:
ffff61a7957901d0
[ 31.258029] x20: ffff61a795710000 x19: ffff61a78128b000 x18:
fffffffffffec278
[ 31.266014] x17: 0040000000000465 x16: 0000000000000020 x15:
0000000000000060
[ 31.274001] x14: 0000000000000001 x13: ffffbf00354550e0 x12:
0000000000000825
[ 31.281989] x11: 00000000000002b7 x10: ffffbf00354b1208 x9 :
ffffbf00354550e0
[ 31.289976] x8 : 00000000ffffefff x7 : ffffbf00354ad0e0 x6 :
00000000000002b7
[ 31.297963] x5 : ffff61a8feebbe48 x4 : 40000000fffff2b7 x3 :
ffffa2a8c9f64000
[ 31.305947] x2 : 0000000000000000 x1 : 0000000000000000 x0 :
ffff61a780283100
[ 31.313934] Call trace:
[ 31.316719] drm_crtc_vblank_helper_get_vblank_timestamp_internal
(drivers/gpu/drm/drm_vblank.c:728)
[ 31.324646] drm_crtc_vblank_helper_get_vblank_timestamp
(drivers/gpu/drm/drm_vblank.c:843)
[ 31.331528] drm_crtc_get_last_vbltimestamp
(drivers/gpu/drm/drm_vblank.c:884)
[ 31.337170] drm_crtc_next_vblank_start
(drivers/gpu/drm/drm_vblank.c:1006)
[ 31.342430] drm_atomic_helper_wait_for_fences
(drivers/gpu/drm/drm_atomic_helper.c:1531
drivers/gpu/drm/drm_atomic_helper.c:1578)
[ 31.348561] drm_atomic_helper_commit
(drivers/gpu/drm/drm_atomic_helper.c:2007)
[ 31.353724] drm_atomic_commit (drivers/gpu/drm/drm_atomic.c:1444)
[ 31.358127] drm_client_modeset_commit_atomic
(drivers/gpu/drm/drm_client_modeset.c:1045)
[ 31.364146] drm_client_modeset_commit_locked
(drivers/gpu/drm/drm_client_modeset.c:1148)
[ 31.370071] drm_client_modeset_commit
(drivers/gpu/drm/drm_client_modeset.c:1174)
[ 31.375233] drm_fb_helper_set_par
(drivers/gpu/drm/drm_fb_helper.c:254 drivers/gpu/drm/drm_fb_helper.c:229
drivers/gpu/drm/drm_fb_helper.c:1644)
[ 31.380108] drm_fb_helper_hotplug_event
(drivers/gpu/drm/drm_fb_helper.c:2302 (discriminator 4))
[ 31.385456] drm_fb_helper_output_poll_changed
(drivers/gpu/drm/drm_fb_helper.c:2331)
[ 31.391376] drm_kms_helper_hotplug_event
(drivers/gpu/drm/drm_probe_helper.c:697)
[ 31.396825] drm_bridge_connector_hpd_cb
(drivers/gpu/drm/drm_bridge_connector.c:129)
[ 31.402175] drm_bridge_hpd_notify (drivers/gpu/drm/drm_bridge.c:1315)
[ 31.406954] lt9611uxc_hpd_work
(drivers/gpu/drm/bridge/lontium-lt9611uxc.c:185)
[ 31.411450] process_one_work (kernel/workqueue.c:2395)
[ 31.415949] worker_thread (include/linux/list.h:292
kernel/workqueue.c:2538)
[ 31.426843] kthread (kernel/kthread.c:376)
[ 31.437182] ret_from_fork (arch/arm64/kernel/entry.S:871)
[ 31.447828] irq event stamp: 44642
[ 31.458284] hardirqs last enabled at (44641): __up_console_sem
(arch/arm64/include/asm/irqflags.h:182 (discriminator 1)
arch/arm64/include/asm/irqflags.h:202 (discriminator 1)
kernel/printk/printk.c:345 (discriminator 1))
[ 31.474540] hardirqs last disabled at (44642): el1_dbg
(arch/arm64/kernel/entry-common.c:335 arch/arm64/kernel/entry-common.c:406)
[ 31.489882] softirqs last enabled at (42912): _stext
(arch/arm64/include/asm/current.h:19 arch/arm64/include/asm/preempt.h:13
kernel/softirq.c:415 kernel/softirq.c:600)
[ 31.505256] softirqs last disabled at (42907): ____do_softirq
(arch/arm64/kernel/irq.c:81)
[ 31.521139] ---[ end trace 0000000000000000 ]---



--
With best wishes
Dmitry
Re: [PATCH v10 11/15] drm/atomic-helper: Set fence deadline for vblank [ In reply to ]
On Tue, Apr 04, 2023 at 08:22:05PM +0300, Dmitry Baryshkov wrote:
> On 08/03/2023 17:53, Rob Clark wrote:
> > From: Rob Clark <robdclark@chromium.org>
> >
> > For an atomic commit updating a single CRTC (ie. a pageflip) calculate
> > the next vblank time, and inform the fence(s) of that deadline.
> >
> > v2: Comment typo fix (danvet)
> > v3: If there are multiple CRTCs, consider the time of the soonest vblank
> >
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > ---
> > drivers/gpu/drm/drm_atomic_helper.c | 37 +++++++++++++++++++++++++++++
> > 1 file changed, 37 insertions(+)
>
> As I started playing with hotplug on RB5 (sm8250, DSI-HDMI bridge), I found
> that this patch introduces the following backtrace on HDMI hotplug. Is there
> anything that I can do to debug/fix the issue? The warning seems harmless,
> but it would be probably be good to still fix it. With addresses decoded:

Bit a shot in the dark, but does the below help?


diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index f21b5a74176c..6640d80d84f3 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1528,6 +1528,9 @@ static void set_fence_deadline(struct drm_device *dev,
for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
ktime_t v;

+ if (drm_atomic_crtc_needs_modeset(new_crtc_state))
+ continue;
+
if (drm_crtc_next_vblank_start(crtc, &v))
continue;

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 78a8c51a4abf..7ae38e8e27e8 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1001,6 +1001,9 @@ int drm_crtc_next_vblank_start(struct drm_crtc *crtc, ktime_t *vblanktime)
struct drm_display_mode *mode = &vblank->hwmode;
u64 vblank_start;

+ if (!drm_dev_has_vblank(crtc->dev))
+ return -EINVAL;
+
if (!vblank->framedur_ns || !vblank->linedur_ns)
return -EINVAL;


>
> [ 31.151348] ------------[ cut here ]------------
> [ 31.157043] msm_dpu ae01000.display-controller:
> drm_WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev))
> [ 31.157177] WARNING: CPU: 0 PID: 13 at drivers/gpu/drm/drm_vblank.c:728
> drm_crtc_vblank_helper_get_vblank_timestamp_internal
> (drivers/gpu/drm/drm_vblank.c:728)
> [ 31.180629] Modules linked in:
> [ 31.184106] CPU: 0 PID: 13 Comm: kworker/0:1 Not tainted
> 6.3.0-rc2-00008-gd39e48ca80c0 #542
> [ 31.193358] Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
> [ 31.200796] Workqueue: events lt9611uxc_hpd_work
> [ 31.205990] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS
> BTYPE=--)
> [ 31.213722] pc : drm_crtc_vblank_helper_get_vblank_timestamp_internal
> (drivers/gpu/drm/drm_vblank.c:728)
> [ 31.222032] lr : drm_crtc_vblank_helper_get_vblank_timestamp_internal
> (drivers/gpu/drm/drm_vblank.c:728)
> [ 31.230341] sp : ffff8000080bb8d0
> [ 31.234061] x29: ffff8000080bb900 x28: 0000000000000038 x27:
> ffff61a7956b8d60
> [ 31.242051] x26: 0000000000000000 x25: 0000000000000000 x24:
> ffff8000080bb9c4
> [ 31.250038] x23: 0000000000000001 x22: ffffbf0033b94ef0 x21:
> ffff61a7957901d0
> [ 31.258029] x20: ffff61a795710000 x19: ffff61a78128b000 x18:
> fffffffffffec278
> [ 31.266014] x17: 0040000000000465 x16: 0000000000000020 x15:
> 0000000000000060
> [ 31.274001] x14: 0000000000000001 x13: ffffbf00354550e0 x12:
> 0000000000000825
> [ 31.281989] x11: 00000000000002b7 x10: ffffbf00354b1208 x9 :
> ffffbf00354550e0
> [ 31.289976] x8 : 00000000ffffefff x7 : ffffbf00354ad0e0 x6 :
> 00000000000002b7
> [ 31.297963] x5 : ffff61a8feebbe48 x4 : 40000000fffff2b7 x3 :
> ffffa2a8c9f64000
> [ 31.305947] x2 : 0000000000000000 x1 : 0000000000000000 x0 :
> ffff61a780283100
> [ 31.313934] Call trace:
> [ 31.316719] drm_crtc_vblank_helper_get_vblank_timestamp_internal
> (drivers/gpu/drm/drm_vblank.c:728)
> [ 31.324646] drm_crtc_vblank_helper_get_vblank_timestamp
> (drivers/gpu/drm/drm_vblank.c:843)
> [ 31.331528] drm_crtc_get_last_vbltimestamp
> (drivers/gpu/drm/drm_vblank.c:884)
> [ 31.337170] drm_crtc_next_vblank_start
> (drivers/gpu/drm/drm_vblank.c:1006)
> [ 31.342430] drm_atomic_helper_wait_for_fences
> (drivers/gpu/drm/drm_atomic_helper.c:1531
> drivers/gpu/drm/drm_atomic_helper.c:1578)
> [ 31.348561] drm_atomic_helper_commit
> (drivers/gpu/drm/drm_atomic_helper.c:2007)
> [ 31.353724] drm_atomic_commit (drivers/gpu/drm/drm_atomic.c:1444)
> [ 31.358127] drm_client_modeset_commit_atomic
> (drivers/gpu/drm/drm_client_modeset.c:1045)
> [ 31.364146] drm_client_modeset_commit_locked
> (drivers/gpu/drm/drm_client_modeset.c:1148)
> [ 31.370071] drm_client_modeset_commit
> (drivers/gpu/drm/drm_client_modeset.c:1174)
> [ 31.375233] drm_fb_helper_set_par (drivers/gpu/drm/drm_fb_helper.c:254
> drivers/gpu/drm/drm_fb_helper.c:229 drivers/gpu/drm/drm_fb_helper.c:1644)
> [ 31.380108] drm_fb_helper_hotplug_event
> (drivers/gpu/drm/drm_fb_helper.c:2302 (discriminator 4))
> [ 31.385456] drm_fb_helper_output_poll_changed
> (drivers/gpu/drm/drm_fb_helper.c:2331)
> [ 31.391376] drm_kms_helper_hotplug_event
> (drivers/gpu/drm/drm_probe_helper.c:697)
> [ 31.396825] drm_bridge_connector_hpd_cb
> (drivers/gpu/drm/drm_bridge_connector.c:129)
> [ 31.402175] drm_bridge_hpd_notify (drivers/gpu/drm/drm_bridge.c:1315)
> [ 31.406954] lt9611uxc_hpd_work
> (drivers/gpu/drm/bridge/lontium-lt9611uxc.c:185)
> [ 31.411450] process_one_work (kernel/workqueue.c:2395)
> [ 31.415949] worker_thread (include/linux/list.h:292
> kernel/workqueue.c:2538)
> [ 31.426843] kthread (kernel/kthread.c:376)
> [ 31.437182] ret_from_fork (arch/arm64/kernel/entry.S:871)
> [ 31.447828] irq event stamp: 44642
> [ 31.458284] hardirqs last enabled at (44641): __up_console_sem
> (arch/arm64/include/asm/irqflags.h:182 (discriminator 1)
> arch/arm64/include/asm/irqflags.h:202 (discriminator 1)
> kernel/printk/printk.c:345 (discriminator 1))
> [ 31.474540] hardirqs last disabled at (44642): el1_dbg
> (arch/arm64/kernel/entry-common.c:335 arch/arm64/kernel/entry-common.c:406)
> [ 31.489882] softirqs last enabled at (42912): _stext
> (arch/arm64/include/asm/current.h:19 arch/arm64/include/asm/preempt.h:13
> kernel/softirq.c:415 kernel/softirq.c:600)
> [ 31.505256] softirqs last disabled at (42907): ____do_softirq
> (arch/arm64/kernel/irq.c:81)
> [ 31.521139] ---[ end trace 0000000000000000 ]---
>
>
>
> --
> With best wishes
> Dmitry
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Re: [PATCH v10 11/15] drm/atomic-helper: Set fence deadline for vblank [ In reply to ]
On 04/04/2023 22:16, Daniel Vetter wrote:
> On Tue, Apr 04, 2023 at 08:22:05PM +0300, Dmitry Baryshkov wrote:
>> On 08/03/2023 17:53, Rob Clark wrote:
>>> From: Rob Clark <robdclark@chromium.org>
>>>
>>> For an atomic commit updating a single CRTC (ie. a pageflip) calculate
>>> the next vblank time, and inform the fence(s) of that deadline.
>>>
>>> v2: Comment typo fix (danvet)
>>> v3: If there are multiple CRTCs, consider the time of the soonest vblank
>>>
>>> Signed-off-by: Rob Clark <robdclark@chromium.org>
>>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>> Signed-off-by: Rob Clark <robdclark@chromium.org>
>>> ---
>>> drivers/gpu/drm/drm_atomic_helper.c | 37 +++++++++++++++++++++++++++++
>>> 1 file changed, 37 insertions(+)
>>
>> As I started playing with hotplug on RB5 (sm8250, DSI-HDMI bridge), I found
>> that this patch introduces the following backtrace on HDMI hotplug. Is there
>> anything that I can do to debug/fix the issue? The warning seems harmless,
>> but it would be probably be good to still fix it. With addresses decoded:
>
> Bit a shot in the dark, but does the below help?

This indeed seems to fix the issue. I'm not sure about the possible side
effects, but, if you were to send the patch:

Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

>
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index f21b5a74176c..6640d80d84f3 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1528,6 +1528,9 @@ static void set_fence_deadline(struct drm_device *dev,
> for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
> ktime_t v;
>
> + if (drm_atomic_crtc_needs_modeset(new_crtc_state))
> + continue;
> +
> if (drm_crtc_next_vblank_start(crtc, &v))
> continue;
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 78a8c51a4abf..7ae38e8e27e8 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -1001,6 +1001,9 @@ int drm_crtc_next_vblank_start(struct drm_crtc *crtc, ktime_t *vblanktime)
> struct drm_display_mode *mode = &vblank->hwmode;
> u64 vblank_start;
>
> + if (!drm_dev_has_vblank(crtc->dev))
> + return -EINVAL;
> +
> if (!vblank->framedur_ns || !vblank->linedur_ns)
> return -EINVAL;
>
>
>>
>> [ 31.151348] ------------[ cut here ]------------
>> [ 31.157043] msm_dpu ae01000.display-controller:
>> drm_WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev))
>> [ 31.157177] WARNING: CPU: 0 PID: 13 at drivers/gpu/drm/drm_vblank.c:728
>> drm_crtc_vblank_helper_get_vblank_timestamp_internal
>> (drivers/gpu/drm/drm_vblank.c:728)
>> [ 31.180629] Modules linked in:
>> [ 31.184106] CPU: 0 PID: 13 Comm: kworker/0:1 Not tainted
>> 6.3.0-rc2-00008-gd39e48ca80c0 #542
>> [ 31.193358] Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
>> [ 31.200796] Workqueue: events lt9611uxc_hpd_work
>> [ 31.205990] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS
>> BTYPE=--)
>> [ 31.213722] pc : drm_crtc_vblank_helper_get_vblank_timestamp_internal
>> (drivers/gpu/drm/drm_vblank.c:728)
>> [ 31.222032] lr : drm_crtc_vblank_helper_get_vblank_timestamp_internal
>> (drivers/gpu/drm/drm_vblank.c:728)
>> [ 31.230341] sp : ffff8000080bb8d0
>> [ 31.234061] x29: ffff8000080bb900 x28: 0000000000000038 x27:
>> ffff61a7956b8d60
>> [ 31.242051] x26: 0000000000000000 x25: 0000000000000000 x24:
>> ffff8000080bb9c4
>> [ 31.250038] x23: 0000000000000001 x22: ffffbf0033b94ef0 x21:
>> ffff61a7957901d0
>> [ 31.258029] x20: ffff61a795710000 x19: ffff61a78128b000 x18:
>> fffffffffffec278
>> [ 31.266014] x17: 0040000000000465 x16: 0000000000000020 x15:
>> 0000000000000060
>> [ 31.274001] x14: 0000000000000001 x13: ffffbf00354550e0 x12:
>> 0000000000000825
>> [ 31.281989] x11: 00000000000002b7 x10: ffffbf00354b1208 x9 :
>> ffffbf00354550e0
>> [ 31.289976] x8 : 00000000ffffefff x7 : ffffbf00354ad0e0 x6 :
>> 00000000000002b7
>> [ 31.297963] x5 : ffff61a8feebbe48 x4 : 40000000fffff2b7 x3 :
>> ffffa2a8c9f64000
>> [ 31.305947] x2 : 0000000000000000 x1 : 0000000000000000 x0 :
>> ffff61a780283100
>> [ 31.313934] Call trace:
>> [ 31.316719] drm_crtc_vblank_helper_get_vblank_timestamp_internal
>> (drivers/gpu/drm/drm_vblank.c:728)
>> [ 31.324646] drm_crtc_vblank_helper_get_vblank_timestamp
>> (drivers/gpu/drm/drm_vblank.c:843)
>> [ 31.331528] drm_crtc_get_last_vbltimestamp
>> (drivers/gpu/drm/drm_vblank.c:884)
>> [ 31.337170] drm_crtc_next_vblank_start
>> (drivers/gpu/drm/drm_vblank.c:1006)
>> [ 31.342430] drm_atomic_helper_wait_for_fences
>> (drivers/gpu/drm/drm_atomic_helper.c:1531
>> drivers/gpu/drm/drm_atomic_helper.c:1578)
>> [ 31.348561] drm_atomic_helper_commit
>> (drivers/gpu/drm/drm_atomic_helper.c:2007)
>> [ 31.353724] drm_atomic_commit (drivers/gpu/drm/drm_atomic.c:1444)
>> [ 31.358127] drm_client_modeset_commit_atomic
>> (drivers/gpu/drm/drm_client_modeset.c:1045)
>> [ 31.364146] drm_client_modeset_commit_locked
>> (drivers/gpu/drm/drm_client_modeset.c:1148)
>> [ 31.370071] drm_client_modeset_commit
>> (drivers/gpu/drm/drm_client_modeset.c:1174)
>> [ 31.375233] drm_fb_helper_set_par (drivers/gpu/drm/drm_fb_helper.c:254
>> drivers/gpu/drm/drm_fb_helper.c:229 drivers/gpu/drm/drm_fb_helper.c:1644)
>> [ 31.380108] drm_fb_helper_hotplug_event
>> (drivers/gpu/drm/drm_fb_helper.c:2302 (discriminator 4))
>> [ 31.385456] drm_fb_helper_output_poll_changed
>> (drivers/gpu/drm/drm_fb_helper.c:2331)
>> [ 31.391376] drm_kms_helper_hotplug_event
>> (drivers/gpu/drm/drm_probe_helper.c:697)
>> [ 31.396825] drm_bridge_connector_hpd_cb
>> (drivers/gpu/drm/drm_bridge_connector.c:129)
>> [ 31.402175] drm_bridge_hpd_notify (drivers/gpu/drm/drm_bridge.c:1315)
>> [ 31.406954] lt9611uxc_hpd_work
>> (drivers/gpu/drm/bridge/lontium-lt9611uxc.c:185)
>> [ 31.411450] process_one_work (kernel/workqueue.c:2395)
>> [ 31.415949] worker_thread (include/linux/list.h:292
>> kernel/workqueue.c:2538)
>> [ 31.426843] kthread (kernel/kthread.c:376)
>> [ 31.437182] ret_from_fork (arch/arm64/kernel/entry.S:871)
>> [ 31.447828] irq event stamp: 44642
>> [ 31.458284] hardirqs last enabled at (44641): __up_console_sem
>> (arch/arm64/include/asm/irqflags.h:182 (discriminator 1)
>> arch/arm64/include/asm/irqflags.h:202 (discriminator 1)
>> kernel/printk/printk.c:345 (discriminator 1))
>> [ 31.474540] hardirqs last disabled at (44642): el1_dbg
>> (arch/arm64/kernel/entry-common.c:335 arch/arm64/kernel/entry-common.c:406)
>> [ 31.489882] softirqs last enabled at (42912): _stext
>> (arch/arm64/include/asm/current.h:19 arch/arm64/include/asm/preempt.h:13
>> kernel/softirq.c:415 kernel/softirq.c:600)
>> [ 31.505256] softirqs last disabled at (42907): ____do_softirq
>> (arch/arm64/kernel/irq.c:81)
>> [ 31.521139] ---[ end trace 0000000000000000 ]---
>>
>>
>>
>> --
>> With best wishes
>> Dmitry
>>
>

--
With best wishes
Dmitry
Re: [PATCH v10 11/15] drm/atomic-helper: Set fence deadline for vblank [ In reply to ]
On Wed, Apr 05, 2023 at 12:53:29AM +0300, Dmitry Baryshkov wrote:
> On 04/04/2023 22:16, Daniel Vetter wrote:
> > On Tue, Apr 04, 2023 at 08:22:05PM +0300, Dmitry Baryshkov wrote:
> > > On 08/03/2023 17:53, Rob Clark wrote:
> > > > From: Rob Clark <robdclark@chromium.org>
> > > >
> > > > For an atomic commit updating a single CRTC (ie. a pageflip) calculate
> > > > the next vblank time, and inform the fence(s) of that deadline.
> > > >
> > > > v2: Comment typo fix (danvet)
> > > > v3: If there are multiple CRTCs, consider the time of the soonest vblank
> > > >
> > > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > > > ---
> > > > drivers/gpu/drm/drm_atomic_helper.c | 37 +++++++++++++++++++++++++++++
> > > > 1 file changed, 37 insertions(+)
> > >
> > > As I started playing with hotplug on RB5 (sm8250, DSI-HDMI bridge), I found
> > > that this patch introduces the following backtrace on HDMI hotplug. Is there
> > > anything that I can do to debug/fix the issue? The warning seems harmless,
> > > but it would be probably be good to still fix it. With addresses decoded:
> >
> > Bit a shot in the dark, but does the below help?
>
> This indeed seems to fix the issue. I'm not sure about the possible side
> effects, but, if you were to send the patch:
>
> Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Thanks for the quick feedback, I already discussed this with Rob on irc
yesterday (and landed his more throughrough version of the drm_vblank.c
fix to drm-misc-next). I'll polish the drm_atomic_helper.c part asap and
will send it out. Would be great if you can then retest to make sure all
the pieces still work together for your case.
-Daniel

>
> >
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index f21b5a74176c..6640d80d84f3 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -1528,6 +1528,9 @@ static void set_fence_deadline(struct drm_device *dev,
> > for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
> > ktime_t v;
> > + if (drm_atomic_crtc_needs_modeset(new_crtc_state))
> > + continue;
> > +
> > if (drm_crtc_next_vblank_start(crtc, &v))
> > continue;
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index 78a8c51a4abf..7ae38e8e27e8 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -1001,6 +1001,9 @@ int drm_crtc_next_vblank_start(struct drm_crtc *crtc, ktime_t *vblanktime)
> > struct drm_display_mode *mode = &vblank->hwmode;
> > u64 vblank_start;
> > + if (!drm_dev_has_vblank(crtc->dev))
> > + return -EINVAL;
> > +
> > if (!vblank->framedur_ns || !vblank->linedur_ns)
> > return -EINVAL;
> >
> > >
> > > [ 31.151348] ------------[ cut here ]------------
> > > [ 31.157043] msm_dpu ae01000.display-controller:
> > > drm_WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev))
> > > [ 31.157177] WARNING: CPU: 0 PID: 13 at drivers/gpu/drm/drm_vblank.c:728
> > > drm_crtc_vblank_helper_get_vblank_timestamp_internal
> > > (drivers/gpu/drm/drm_vblank.c:728)
> > > [ 31.180629] Modules linked in:
> > > [ 31.184106] CPU: 0 PID: 13 Comm: kworker/0:1 Not tainted
> > > 6.3.0-rc2-00008-gd39e48ca80c0 #542
> > > [ 31.193358] Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
> > > [ 31.200796] Workqueue: events lt9611uxc_hpd_work
> > > [ 31.205990] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS
> > > BTYPE=--)
> > > [ 31.213722] pc : drm_crtc_vblank_helper_get_vblank_timestamp_internal
> > > (drivers/gpu/drm/drm_vblank.c:728)
> > > [ 31.222032] lr : drm_crtc_vblank_helper_get_vblank_timestamp_internal
> > > (drivers/gpu/drm/drm_vblank.c:728)
> > > [ 31.230341] sp : ffff8000080bb8d0
> > > [ 31.234061] x29: ffff8000080bb900 x28: 0000000000000038 x27:
> > > ffff61a7956b8d60
> > > [ 31.242051] x26: 0000000000000000 x25: 0000000000000000 x24:
> > > ffff8000080bb9c4
> > > [ 31.250038] x23: 0000000000000001 x22: ffffbf0033b94ef0 x21:
> > > ffff61a7957901d0
> > > [ 31.258029] x20: ffff61a795710000 x19: ffff61a78128b000 x18:
> > > fffffffffffec278
> > > [ 31.266014] x17: 0040000000000465 x16: 0000000000000020 x15:
> > > 0000000000000060
> > > [ 31.274001] x14: 0000000000000001 x13: ffffbf00354550e0 x12:
> > > 0000000000000825
> > > [ 31.281989] x11: 00000000000002b7 x10: ffffbf00354b1208 x9 :
> > > ffffbf00354550e0
> > > [ 31.289976] x8 : 00000000ffffefff x7 : ffffbf00354ad0e0 x6 :
> > > 00000000000002b7
> > > [ 31.297963] x5 : ffff61a8feebbe48 x4 : 40000000fffff2b7 x3 :
> > > ffffa2a8c9f64000
> > > [ 31.305947] x2 : 0000000000000000 x1 : 0000000000000000 x0 :
> > > ffff61a780283100
> > > [ 31.313934] Call trace:
> > > [ 31.316719] drm_crtc_vblank_helper_get_vblank_timestamp_internal
> > > (drivers/gpu/drm/drm_vblank.c:728)
> > > [ 31.324646] drm_crtc_vblank_helper_get_vblank_timestamp
> > > (drivers/gpu/drm/drm_vblank.c:843)
> > > [ 31.331528] drm_crtc_get_last_vbltimestamp
> > > (drivers/gpu/drm/drm_vblank.c:884)
> > > [ 31.337170] drm_crtc_next_vblank_start
> > > (drivers/gpu/drm/drm_vblank.c:1006)
> > > [ 31.342430] drm_atomic_helper_wait_for_fences
> > > (drivers/gpu/drm/drm_atomic_helper.c:1531
> > > drivers/gpu/drm/drm_atomic_helper.c:1578)
> > > [ 31.348561] drm_atomic_helper_commit
> > > (drivers/gpu/drm/drm_atomic_helper.c:2007)
> > > [ 31.353724] drm_atomic_commit (drivers/gpu/drm/drm_atomic.c:1444)
> > > [ 31.358127] drm_client_modeset_commit_atomic
> > > (drivers/gpu/drm/drm_client_modeset.c:1045)
> > > [ 31.364146] drm_client_modeset_commit_locked
> > > (drivers/gpu/drm/drm_client_modeset.c:1148)
> > > [ 31.370071] drm_client_modeset_commit
> > > (drivers/gpu/drm/drm_client_modeset.c:1174)
> > > [ 31.375233] drm_fb_helper_set_par (drivers/gpu/drm/drm_fb_helper.c:254
> > > drivers/gpu/drm/drm_fb_helper.c:229 drivers/gpu/drm/drm_fb_helper.c:1644)
> > > [ 31.380108] drm_fb_helper_hotplug_event
> > > (drivers/gpu/drm/drm_fb_helper.c:2302 (discriminator 4))
> > > [ 31.385456] drm_fb_helper_output_poll_changed
> > > (drivers/gpu/drm/drm_fb_helper.c:2331)
> > > [ 31.391376] drm_kms_helper_hotplug_event
> > > (drivers/gpu/drm/drm_probe_helper.c:697)
> > > [ 31.396825] drm_bridge_connector_hpd_cb
> > > (drivers/gpu/drm/drm_bridge_connector.c:129)
> > > [ 31.402175] drm_bridge_hpd_notify (drivers/gpu/drm/drm_bridge.c:1315)
> > > [ 31.406954] lt9611uxc_hpd_work
> > > (drivers/gpu/drm/bridge/lontium-lt9611uxc.c:185)
> > > [ 31.411450] process_one_work (kernel/workqueue.c:2395)
> > > [ 31.415949] worker_thread (include/linux/list.h:292
> > > kernel/workqueue.c:2538)
> > > [ 31.426843] kthread (kernel/kthread.c:376)
> > > [ 31.437182] ret_from_fork (arch/arm64/kernel/entry.S:871)
> > > [ 31.447828] irq event stamp: 44642
> > > [ 31.458284] hardirqs last enabled at (44641): __up_console_sem
> > > (arch/arm64/include/asm/irqflags.h:182 (discriminator 1)
> > > arch/arm64/include/asm/irqflags.h:202 (discriminator 1)
> > > kernel/printk/printk.c:345 (discriminator 1))
> > > [ 31.474540] hardirqs last disabled at (44642): el1_dbg
> > > (arch/arm64/kernel/entry-common.c:335 arch/arm64/kernel/entry-common.c:406)
> > > [ 31.489882] softirqs last enabled at (42912): _stext
> > > (arch/arm64/include/asm/current.h:19 arch/arm64/include/asm/preempt.h:13
> > > kernel/softirq.c:415 kernel/softirq.c:600)
> > > [ 31.505256] softirqs last disabled at (42907): ____do_softirq
> > > (arch/arm64/kernel/irq.c:81)
> > > [ 31.521139] ---[ end trace 0000000000000000 ]---
> > >
> > >
> > >
> > > --
> > > With best wishes
> > > Dmitry
> > >
> >
>
> --
> With best wishes
> Dmitry
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch