[RPI4] Kernel panic when booting with Sensehat

Open
#3,300 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, linux, raspberry-pi

Research direction

Start with drivers/video/fbdev/core/fbcon.c and the rpisense-fb module, then reproduce the boot with an RPi4 and Sense HAT connected but no HDMI cable. Trace the panic reported in sys_imageblit() and compare it with the supplied fbcon workaround. Done means the kernel boots reliably in this configuration without suppressing framebuffer console events as a workaround.

Written by the indexing model from the issue text.

Description

Checked on the last Raspbian release as of now - 2019-09-26 - and there's this kernel panic if the RPI4 is booted with RPI Sensehat connected, and no HDMI cable is attached. Also, hdmi_force_hotplug=1 will prevent the crash by creating /dev/fb0 before rpisense-fb.

Kernel panic happens when the rpisense-fb module is being loaded, but the crash point is actually in sys_imageblit(). Issue is reproducible with any rpi4 with a sensehat on it an Raspbian.

I can mitigate this by stopping fbcon from binding a console to the framebuffer created by rpisense-fb:

drivers/video/fbdev/core/fbcon.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index f7ac64d692b2..ff480d4d7144 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3338,6 +3338,15 @@ static int fbcon_event_notify(struct notifier_block *self,
 				  action == FB_EVENT_FB_UNREGISTERED))
 		goto done;

+	/* If no other framebuffer is availabe, then sensehat's
+	 * will be used. It's an 8x8 pixels display, not meant for this.
+	 * Ignore all events for rpi-sense fb and don't attach a console to it.
+	 */
+	if (info && !strncmp(info->fix.id, "RPi-Sense FB", 12))
+	{
+		goto done;
+	}
+

This is just a workaround, the issue would need a proper fix.

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.