sun4i_drm_hdmi kernel panic after 15 mins of screen inactivity

Started by kimfaint, June 28, 2023, 10:57:33 AM

Previous topic - Next topic

kimfaint

Using an A20 LIME2 Rev.E and Rev.L with the latest minimal olinuxino OS kernel version 5.10.105-olimex we have a graphical app running using the HDMI display.  We do not use X11 and use the framebuffer directly.  When the app stops and the system goes into low power mode, the HDMI falls back to a text console with the login prompt and a blinking cursor.  Exactly 15 mins after this occurs there is kernel oops on the sun4i_drm_hdmi modules

Jun 28 17:01:14 dss30010 kernel: [ 1053.685730] 8<--- cut here ---
Jun 28 17:01:14 dss30010 kernel: [ 1053.685781] Unable to handle kernel NULL pointer dereference at virtual address 00000194
Jun 28 17:01:14 dss30010 kernel: [ 1053.685826] pgd = eb536faf
Jun 28 17:01:14 dss30010 kernel: [ 1053.685854] [00000194] *pgd=00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.685935] Internal error: Oops: 17 [#1] SMP ARM
Jun 28 17:01:14 dss30010 kernel: [ 1053.685962] Modules linked in: tun rfkill evdev axp20x_battery axp20x_ac_power axp20x_adc industrialio lima gpu_sched at24 sun4i_codec sunxi_cedrus(C) v4l2_mem2mem videobuf2_dma_contig sun4i_drm_hdmi videobuf2_memops videobuf2_v4l2 sun4i_ss videobuf2_common videodev libdes mc uio_pdrv_genirq uio cpufreq_dt sun4i_ts hwmon usb_f_acm u_serial g_serial libcomposite fuse ip_tables x_tables pinctrl_axp209 realtek
Jun 28 17:01:14 dss30010 kernel: [ 1053.686695] CPU: 1 PID: 940 Comm: kworker/1:2 Tainted: G         C        5.10.105-olimex #140134
Jun 28 17:01:14 dss30010 kernel: [ 1053.686718] Hardware name: Allwinner sun7i (A20) Family
Jun 28 17:01:14 dss30010 kernel: [ 1053.686797] Workqueue: events console_callback
Jun 28 17:01:14 dss30010 kernel: [ 1053.686899] PC is at sun4i_hdmi_audio_destroy+0x20/0x44 [sun4i_drm_hdmi]
Jun 28 17:01:14 dss30010 kernel: [ 1053.686956] LR is at sun4i_hdmi_disable+0x30/0x68 [sun4i_drm_hdmi]
Jun 28 17:01:14 dss30010 kernel: [ 1053.686990] pc : [<bf0dc700>]    lr : [<bf0dcc74>]    psr: 60000013
Jun 28 17:01:14 dss30010 kernel: [ 1053.687020] sp : c1e4fbb8  ip : c1e4fbd0  fp : c1e4fbcc
Jun 28 17:01:14 dss30010 kernel: [ 1053.687048] r10: c30f3d00  r9 : c355cbc0  r8 : bf0df3d8
Jun 28 17:01:14 dss30010 kernel: [ 1053.687081] r7 : 00000000  r6 : 00000000  r5 : 00000000  r4 : c2988040
Jun 28 17:01:14 dss30010 kernel: [ 1053.687114] r3 : 00000000  r2 : 7d3f203f  r1 : bf0dfd00  r0 : 00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.687155] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Jun 28 17:01:14 dss30010 kernel: [ 1053.687192] Control: 10c5387d  Table: 4317406a  DAC: 00000051
Jun 28 17:01:14 dss30010 kernel: [ 1053.687231] Process kworker/1:2 (pid: 940, stack limit = 0xb3980725)
Jun 28 17:01:14 dss30010 kernel: [ 1053.687265] Stack: (0xc1e4fbb8 to 0xc1e50000)
Jun 28 17:01:14 dss30010 kernel: [ 1053.687309] fba0:                                                       c29883d0 00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.687376] fbc0: c1e4fbe4 c1e4fbd0 bf0dcc74 bf0dc6ec c29883d0 00000000 c1e4fc24 c1e4fbe8
Jun 28 17:01:14 dss30010 kernel: [ 1053.687443] fbe0: c0645dcc bf0dcc50 00000007 c0ca5d20 c0ca63bc c2498400 c0ca626c c355cbc0
Jun 28 17:01:14 dss30010 kernel: [ 1053.687509] fc00: c2498400 c0b6798c 00000001 00000000 c3014bb8 000000f5 c1e4fc3c c1e4fc28
Jun 28 17:01:14 dss30010 kernel: [ 1053.687575] fc20: c0646af4 c06459d0 c355cbc0 00000000 c1e4fc7c c1e4fc40 c06470e0 c0646ad8
Jun 28 17:01:14 dss30010 kernel: [ 1053.687641] fc40: c0644ee0 531609b5 c355cbc0 c0ca5d20 c1e4fc7c c355cbc0 00000000 c2498400
Jun 28 17:01:14 dss30010 kernel: [ 1053.687706] fc60: 00000000 00000000 c3014bb8 c2498400 c1e4fc9c c1e4fc80 c0647f6c c064703c
Jun 28 17:01:14 dss30010 kernel: [ 1053.687772] fc80: 00000000 c355cbc0 c2498400 c3024840 c1e4fcbc c1e4fca0 c06652fc c0647e34
Jun 28 17:01:14 dss30010 kernel: [ 1053.687838] fca0: c355cbc0 c24985c0 00000001 c3024840 c1e4fd24 c1e4fcc0 c067be74 c06652b4
Jun 28 17:01:14 dss30010 kernel: [ 1053.687903] fcc0: 00000010 c0f04fc8 00000000 c3012000 00000001 c36d0000 0000007b 0000000b
Jun 28 17:01:14 dss30010 kernel: [ 1053.687968] fce0: 00000000 00000000 c302746c c2499068 00000000 7d3f203f c05b2fe8 c3012000
Jun 28 17:01:14 dss30010 kernel: [ 1053.688033] fd00: c2498400 00000001 c240fa00 c3012018 00000001 00000000 c1e4fd5c c1e4fd28
Jun 28 17:01:14 dss30010 kernel: [ 1053.688098] fd20: c067c19c c067bc78 00000000 00000080 00000030 c30120b4 c3012000 00000001
Jun 28 17:01:14 dss30010 kernel: [ 1053.688163] fd40: c240fa00 00000001 00000000 00000000 c1e4fd7c c1e4fd60 c064bfec c067c124
Jun 28 17:01:14 dss30010 kernel: [ 1053.688229] fd60: 00000000 c0f04fc8 c14e3800 c240fa00 c1e4fd94 c1e4fd80 c064c05c c064bfc4
Jun 28 17:01:14 dss30010 kernel: [ 1053.688294] fd80: c0f04fc8 c0f04fc8 c1e4fdc4 c1e4fd98 c05a57d4 c064c004 00000000 00000001
Jun 28 17:01:14 dss30010 kernel: [ 1053.688361] fda0: c9fae800 c9fae800 c1e4fd9c 7d3f203f c9fae800 c0f04fc8 c1e4fea4 c1e4fdc8
Jun 28 17:01:14 dss30010 kernel: [ 1053.688425] fdc0: c05b1588 c05a5780 c1e4fe1c c1e4fdd8 00000002 00000002 00000720 00000007
Jun 28 17:01:14 dss30010 kernel: [ 1053.688491] fde0: 4d6b434a 00000000 4ff30001 c362c380 00000000 00000080 00000030 00000008
Jun 28 17:01:14 dss30010 kernel: [ 1053.688556] fe00: 00000010 00000007 00000000 c1e4fe01 c0b356ec c019e064 c0161574 c05a652c
Jun 28 17:01:14 dss30010 kernel: [ 1053.688622] fe20: c1e4fe3c c01ab5c8 c1e4fe64 c1e4fe38 c01ab5c8 c0ab2da0 7d3f203f c0f04fc8
Jun 28 17:01:14 dss30010 kernel: [ 1053.688688] fe40: c14e3800 c01ab640 c0f04fc8 ef6a5540 c0fef1b0 c01ab650 c1e4fe8c c1e4fe68
Jun 28 17:01:14 dss30010 kernel: [ 1053.688755] fe60: c01ab650 c0ab27dc 40000013 7d3f203f 00000000 7d3f203f c14e3800 c106ea3c
Jun 28 17:01:14 dss30010 kernel: [ 1053.688819] fe80: c14e3800 00000000 00000000 00000040 00000000 00000000 c1e4fec4 c1e4fea8
Jun 28 17:01:14 dss30010 kernel: [ 1053.688885] fea0: c060c8bc c05b13fc c106ea3c c0f04fc8 c0fef190 ef6af800 c1e4fef4 c1e4fec8
Jun 28 17:01:14 dss30010 kernel: [ 1053.688951] fec0: c0610398 c060c80c c06102c0 c0fef194 c3636900 7d3f203f c0fef194 c3636900
Jun 28 17:01:14 dss30010 kernel: [ 1053.689017] fee0: ef6ac540 ef6af800 c1e4ff34 c1e4fef8 c01431d4 c06102cc ffffe000 c36d0000
Jun 28 17:01:14 dss30010 kernel: [ 1053.689083] ff00: c1e4ff1c c1e4ff10 c0143f44 c3636900 c3636914 ef6ac540 00000008 ef6ac558
Jun 28 17:01:14 dss30010 kernel: [ 1053.689149] ff20: c0f03d00 ef6ac540 c1e4ff74 c1e4ff38 c0143588 c0142f94 c3636900 c0c5c4a0
Jun 28 17:01:14 dss30010 kernel: [ 1053.689215] ff40: c1023000 ffffe000 c1e4ff74 c32da8c0 c32da3c0 00000000 c1e4e000 c0143528
Jun 28 17:01:14 dss30010 kernel: [ 1053.689282] ff60: c3636900 c162be74 c1e4ffac c1e4ff78 c014a738 c0143534 c32da8e4 c32da8e4
Jun 28 17:01:14 dss30010 kernel: [ 1053.689345] ff80: c1e4ffac c32da3c0 c014a5c8 00000000 00000000 00000000 00000000 00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.689407] ffa0: 00000000 c1e4ffb0 c0100148 c014a5d4 00000000 00000000 00000000 00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.689466] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.689528] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.689547] Backtrace:
Jun 28 17:01:14 dss30010 kernel: [ 1053.689673] [<bf0dc6e0>] (sun4i_hdmi_audio_destroy [sun4i_drm_hdmi]) from [<bf0dcc74>] (sun4i_hdmi_disable+0x30/0x68 [sun4i_drm_hdmi])
Jun 28 17:01:14 dss30010 kernel: [ 1053.689721]  r5:00000000 r4:c29883d0
Jun 28 17:01:14 dss30010 kernel: [ 1053.689828] [<bf0dcc44>] (sun4i_hdmi_disable [sun4i_drm_hdmi]) from [<c0645dcc>] (drm_atomic_helper_commit_modeset_disables+0x408/0x4c0)
Jun 28 17:01:14 dss30010 kernel: [ 1053.689870]  r5:00000000 r4:c29883d0
Jun 28 17:01:14 dss30010 kernel: [ 1053.689957] [<c06459c4>] (drm_atomic_helper_commit_modeset_disables) from [<c0646af4>] (drm_atomic_helper_commit_tail_rpm+0x28/0x7c)
Jun 28 17:01:14 dss30010 kernel: [ 1053.690028]  r10:000000f5 r9:c3014bb8 r8:00000000 r7:00000001 r6:c0b6798c r5:c2498400
Jun 28 17:01:14 dss30010 kernel: [ 1053.690058]  r4:c355cbc0
Jun 28 17:01:14 dss30010 kernel: [ 1053.690137] [<c0646acc>] (drm_atomic_helper_commit_tail_rpm) from [<c06470e0>] (commit_tail+0xb0/0x1d0)
Jun 28 17:01:14 dss30010 kernel: [ 1053.690179]  r5:00000000 r4:c355cbc0
Jun 28 17:01:14 dss30010 kernel: [ 1053.690259] [<c0647030>] (commit_tail) from [<c0647f6c>] (drm_atomic_helper_commit+0x144/0x168)
Jun 28 17:01:14 dss30010 kernel: [ 1053.690330]  r10:c2498400 r9:c3014bb8 r8:00000000 r7:00000000 r6:c2498400 r5:00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.690359]  r4:c355cbc0
Jun 28 17:01:14 dss30010 kernel: [ 1053.690447] [<c0647e28>] (drm_atomic_helper_commit) from [<c06652fc>] (drm_atomic_commit+0x54/0x60)
Jun 28 17:01:14 dss30010 kernel: [ 1053.690504]  r7:c3024840 r6:c2498400 r5:c355cbc0 r4:00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.690589] [<c06652a8>] (drm_atomic_commit) from [<c067be74>] (drm_client_modeset_commit_atomic+0x208/0x248)
Jun 28 17:01:14 dss30010 kernel: [ 1053.690645]  r7:c3024840 r6:00000001 r5:c24985c0 r4:c355cbc0
Jun 28 17:01:14 dss30010 kernel: [ 1053.690719] [<c067bc6c>] (drm_client_modeset_commit_atomic) from [<c067c19c>] (drm_client_modeset_dpms+0x84/0x160)
Jun 28 17:01:14 dss30010 kernel: [ 1053.690788]  r10:00000000 r9:00000001 r8:c3012018 r7:c240fa00 r6:00000001 r5:c2498400
Jun 28 17:01:14 dss30010 kernel: [ 1053.690818]  r4:c3012000
Jun 28 17:01:14 dss30010 kernel: [ 1053.690891] [<c067c118>] (drm_client_modeset_dpms) from [<c064bfec>] (drm_fb_helper_dpms+0x34/0x40)
Jun 28 17:01:14 dss30010 kernel: [ 1053.690959]  r10:00000000 r9:00000000 r8:00000001 r7:c240fa00 r6:00000001 r5:c3012000
Jun 28 17:01:14 dss30010 kernel: [ 1053.690988]  r4:c30120b4
Jun 28 17:01:14 dss30010 kernel: [ 1053.691057] [<c064bfb8>] (drm_fb_helper_dpms) from [<c064c05c>] (drm_fb_helper_blank+0x64/0xac)
Jun 28 17:01:14 dss30010 kernel: [ 1053.691112]  r7:c240fa00 r6:c14e3800 r5:c0f04fc8 r4:00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.691193] [<c064bff8>] (drm_fb_helper_blank) from [<c05a57d4>] (fb_blank+0x60/0xa0)
Jun 28 17:01:14 dss30010 kernel: [ 1053.691234]  r5:c0f04fc8 r4:c0f04fc8
Jun 28 17:01:14 dss30010 kernel: [ 1053.691314] [<c05a5774>] (fb_blank) from [<c05b1588>] (fbcon_blank+0x198/0x228)
Jun 28 17:01:14 dss30010 kernel: [ 1053.691355]  r5:c0f04fc8 r4:c9fae800
Jun 28 17:01:14 dss30010 kernel: [ 1053.691425] [<c05b13f0>] (fbcon_blank) from [<c060c8bc>] (do_blank_screen+0xbc/0x1f4)
Jun 28 17:01:14 dss30010 kernel: [ 1053.691493]  r10:00000000 r9:00000000 r8:00000040 r7:00000000 r6:00000000 r5:c14e3800
Jun 28 17:01:14 dss30010 kernel: [ 1053.691523]  r4:c106ea3c
Jun 28 17:01:14 dss30010 kernel: [ 1053.691591] [<c060c800>] (do_blank_screen) from [<c0610398>] (console_callback+0xd8/0x178)
Jun 28 17:01:14 dss30010 kernel: [ 1053.691648]  r7:ef6af800 r6:c0fef190 r5:c0f04fc8 r4:c106ea3c
Jun 28 17:01:14 dss30010 kernel: [ 1053.691719] [<c06102c0>] (console_callback) from [<c01431d4>] (process_one_work+0x24c/0x5a0)
Jun 28 17:01:14 dss30010 kernel: [ 1053.691775]  r7:ef6af800 r6:ef6ac540 r5:c3636900 r4:c0fef194
Jun 28 17:01:14 dss30010 kernel: [ 1053.691837] [<c0142f88>] (process_one_work) from [<c0143588>] (worker_thread+0x60/0x5b8)
Jun 28 17:01:14 dss30010 kernel: [ 1053.691907]  r10:ef6ac540 r9:c0f03d00 r8:ef6ac558 r7:00000008 r6:ef6ac540 r5:c3636914
Jun 28 17:01:14 dss30010 kernel: [ 1053.691936]  r4:c3636900
Jun 28 17:01:14 dss30010 kernel: [ 1053.692008] [<c0143528>] (worker_thread) from [<c014a738>] (kthread+0x170/0x174)
Jun 28 17:01:14 dss30010 kernel: [ 1053.692080]  r10:c162be74 r9:c3636900 r8:c0143528 r7:c1e4e000 r6:00000000 r5:c32da3c0
Jun 28 17:01:14 dss30010 kernel: [ 1053.692109]  r4:c32da8c0
Jun 28 17:01:14 dss30010 kernel: [ 1053.692180] [<c014a5c8>] (kthread) from [<c0100148>] (ret_from_fork+0x14/0x2c)
Jun 28 17:01:14 dss30010 kernel: [ 1053.692212] Exception stack(0xc1e4ffb0 to 0xc1e4fff8)
Jun 28 17:01:14 dss30010 kernel: [ 1053.692260] ffa0:                                     00000000 00000000 00000000 00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.692320] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.692373] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000
Jun 28 17:01:14 dss30010 kernel: [ 1053.692440]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c014a5c8
Jun 28 17:01:14 dss30010 kernel: [ 1053.692469]  r4:c32da3c0
Jun 28 17:01:14 dss30010 kernel: [ 1053.692531] Code: e8bd4000 e590344c e1a04000 e1a00003 (e5935194)
Jun 28 17:01:14 dss30010 kernel: [ 1053.693145] ---[ end trace 350c60e364e223ad ]---

After this occurs the cursor stops blinking on the HDMI text console.  The display can not longer be used to run any graphical apps, if it does the app hangs on a system call to the /dev/fb0 device.  Also the device cannot be rebooted, only power cycle can save it.

As a workaround we have tried to ensure the app only enters low power mode for 10 mins of less, thus keeping the display active and avoiding the 15 min kernel oops which renders the device useless.

I noticed that when the graphical app is running I get the following:
root@dss30010:~# cat /sys/module/kernel/parameters/consoleblank
0

But when the app stops and the HDMI drops back to text console I get:
root@dss30010:~# cat /sys/module/kernel/parameters/consoleblank
900

The HDMI console is tty1.  If I try from a ssh session of from a script to do the following I get an error:
root@dss30007:/boot# setterm -blank 0 >> /dev/tty1
setterm: terminal xterm-256color does not support --blank

However if I plug in a USB keyboard to interact with the HDMI text console, loggin and run
root@dss30007:/boot# setterm -blank 0

There is no error, and after 15 mins the display remains on, cursor remain blinking and the kernel oops does not occur.  This is ideally what we require, but without needing to type it in on a keyboard.

I discovered that by adding the following line to /boot/uEnv.txt
optargs=consoleblank=0

After a reboot I get:
root@dss30010:~# cat /proc/cmdline
root=PARTUUID=374ea765-01 rootwait console=ttyS0,115200 panic=10 loglevel=4 consoleblank=0

I stop the graphical app and I get:
root@dss30010:~# cat /sys/module/kernel/parameters/consoleblank
0

Despite this after 15 mins the /sys/module/kernel/parameters/consoleblank is set back to 900 and the kernel oops occurs.

I have also noticed the following, but am not sure how to turn it off:
root@dss30010:~# cat /sys/devices/platform/display-engine/drm/card0/card0-HDMI-A-1/dpms
On