Skip to content

vc4 unbalanced irq fix #2618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

mirzak
Copy link
Contributor

@mirzak mirzak commented Jul 13, 2018

Fixes the following warning:

[  414.810574] WARNING: CPU: 1 PID: 394 at /kernel-source//kernel/irq/manage.c:527 __enable_irq+0x54/0x80
[  414.820018] Unbalanced enable for IRQ 40
[  414.823993] Modules linked in: rfcomm bnep hci_uart btbcm ecryptfs bluetooth panel_raspberrypi_touchscreen brcmfmac brcmutil cfg80211 rfkill vc4 snd_soc_core snd_compress i2c_gpio snd_pcm_dmaengine bcm2835_gpi
omem uio_pdrv_genirq uio fixed evdev joydev sch_fq_codel snd_bcm2835 snd_pcm snd_timer snd hid_multitouch fuse ipv6
[  414.853179] CPU: 1 PID: 394 Comm: QSGRenderThread Tainted: G        W       4.9.80 #1
[  414.861123] Hardware name: BCM2835
[  414.864592] [<8011102c>] (unwind_backtrace) from [<8010c8f0>] (show_stack+0x20/0x24)
[  414.872458] [<8010c8f0>] (show_stack) from [<8045af48>] (dump_stack+0xcc/0x110)
[  414.879886] [<8045af48>] (dump_stack) from [<8011e7fc>] (__warn+0xf8/0x110)
[  414.886956] [<8011e7fc>] (__warn) from [<8011e85c>] (warn_slowpath_fmt+0x48/0x50)
[  414.894556] [<8011e85c>] (warn_slowpath_fmt) from [<8017752c>] (__enable_irq+0x54/0x80)
[  414.902685] [<8017752c>] (__enable_irq) from [<8017759c>] (enable_irq+0x44/0x7c)
[  414.910283] [<8017759c>] (enable_irq) from [<7f1c2b64>] (vc4_irq_postinstall+0x24/0x40 [vc4])
[  414.919062] [<7f1c2b64>] (vc4_irq_postinstall [vc4]) from [<7f1c5858>] (vc4_v3d_runtime_resume+0x58/0x60 [vc4])
[  414.929368] [<7f1c5858>] (vc4_v3d_runtime_resume [vc4]) from [<8053eb74>] (pm_generic_runtime_resume+0x3c/0x48)
[  414.939617] [<8053eb74>] (pm_generic_runtime_resume) from [<80542a28>] (__genpd_runtime_resume+0x3c/0xc0)
[  414.949334] [<80542a28>] (__genpd_runtime_resume) from [<80544638>] (genpd_runtime_resume+0x84/0x198)
[  414.958699] [<80544638>] (genpd_runtime_resume) from [<80540140>] (__rpm_callback+0x48/0x98)
[  414.967271] [<80540140>] (__rpm_callback) from [<805401c0>] (rpm_callback+0x30/0x90)
[  414.975138] [<805401c0>] (rpm_callback) from [<805415ec>] (rpm_resume+0x500/0x7c0)
[  414.982827] [<805415ec>] (rpm_resume) from [<8054191c>] (__pm_runtime_resume+0x70/0x9c)
[  414.991025] [<8054191c>] (__pm_runtime_resume) from [<7f1bf6c4>] (vc4_submit_cl_ioctl+0x2e4/0x9cc [vc4])
[  415.000716] [<7f1bf6c4>] (vc4_submit_cl_ioctl [vc4]) from [<80511dfc>] (drm_ioctl+0x1f0/0x3f8)
[  415.009466] [<80511dfc>] (drm_ioctl) from [<802867a4>] (do_vfs_ioctl+0xb0/0x814)
[  415.016981] [<802867a4>] (do_vfs_ioctl) from [<80286f4c>] (SyS_ioctl+0x44/0x68)
[  415.024410] [<80286f4c>] (SyS_ioctl) from [<801082a0>] (ret_fast_syscall+0x0/0x1c)
[  415.032092] ---[ end trace 3f3b9a47efa1f1f8 ]---

[ Upstream commit ce9caf2 ]

We were calling enable_irq on bind, where it was already enabled previously
by the IRQ helper. Additionally, dev->irq is not set correctly until after
postinstall and so was always zero here, triggering a warning in 4.15.
Fix both by moving the enable to the power management resume path, where we
know there was a previous disable invocation during suspend.

Fixes: 253696c ("drm/vc4: Account for interrupts in flight")
Signed-off-by: Stefan Schake <[email protected]>
Signed-off-by: Eric Anholt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Tested-by: Stefan Wahren <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Backported from rpi-14.4.y (fixed merge conflict)

Signed-off-by: Mirza Krak <[email protected]>
@pelwell
Copy link
Contributor

pelwell commented Jul 13, 2018

It looks like a pair of commits have been cherry-picked to 4.9:

253696ccd613 ("drm/vc4: Account for interrupts in flight")
ce9caf2f79a5 ("drm/vc4: Move IRQ enable to PM path")

The second commit is a partial reversion and modification of the second.
Then the first commit was cherry-picked again, and this is a re-cherry-pick of the second.

@stschake Does this fix look right to you?

@stschake
Copy link
Contributor

I guess this is a result from patches trickling down from the stable kernel that the RPi one already got through some other pathway, causing conflicts and wrong resolutions. Been there :)

That said, yeah, the enable_irq in postinstall should not be there, so this is correct. The rpi 4.9 branch currently has the one in vc4_v3d_runtime_resume (where it is correct) and also the one in postinstall, which causes the unbalance warning since we then enable the IRQ twice when coming back from PM suspend (and the VC4 DRM driver is pretty eager to suspend itself, so this happens often).

@pelwell
Copy link
Contributor

pelwell commented Jul 13, 2018

Thanks.

@pelwell pelwell merged commit 7f9c648 into raspberrypi:rpi-4.9.y Jul 13, 2018
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 18, 2018
kernel: vc4 unbalanced irq fix
See: raspberrypi/linux#2618

kernel: net: lan78xx: fix rx handling before first packet is send
kernel: lan78xx: Fix link status notifications
See: raspberrypi/linux#2620

firmware: isp: IL compatibility and alignment tweaks
firmware: IL ISP: Use vc_image instead of reworking own stride checking
firmware: isp: Minor clean ups
firmware: dispmanx: Complete the format strings for dispmanx_parse_list
firmware: IL ISP: Use vc_image instead of reworking own stride checking
firmware: MMAL/IL: Add support for components to report alignment requirements
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Jul 18, 2018
kernel: vc4 unbalanced irq fix
See: raspberrypi/linux#2618

kernel: net: lan78xx: fix rx handling before first packet is send
kernel: lan78xx: Fix link status notifications
See: raspberrypi/linux#2620

firmware: isp: IL compatibility and alignment tweaks
firmware: IL ISP: Use vc_image instead of reworking own stride checking
firmware: isp: Minor clean ups
firmware: dispmanx: Complete the format strings for dispmanx_parse_list
firmware: IL ISP: Use vc_image instead of reworking own stride checking
firmware: MMAL/IL: Add support for components to report alignment requirements
@mirzak mirzak deleted the rpi-4.9.y-vc4-unbalanced-irq-fix branch July 19, 2018 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants