Skip to content

Fixes for IGT crashes - #5022

Merged
pelwell merged 14 commits into
raspberrypi:rpi-5.15.yfrom
mripard:rpi/5.15-igt-fixes-cleanup
May 11, 2022
Merged

pelwell merged 14 commits into
raspberrypi:rpi-5.15.yfrom
mripard:rpi/5.15-igt-fixes-cleanup

Conversation

@mripard

@mripard mripard commented May 6, 2022

Copy link
Copy Markdown
Contributor

Hi,

Here's a collection of fixes related to the IGT crashes @popcornmix reported. It turns out many of them were actually due to the fact that even though the BCM2711 doesn't have the v3d handled by the vc4 driver anymore, we were still using some of the code backed by the v3d.

This PR properly splits everything away, and adds a warning to all the v3d-related entrypoints so that we notice if that it ever happens again.

mripard added 2 commits May 6, 2022 12:25
clk_get_rate_range() is missing the proper locks, making lockdep
complain.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The vc4 planes are setup in hardware by creating a hardware descriptor
in a dedicated RAM. As part of the process to setup a plane in KMS, we
thus need to allocate some part of that dedicated RAM to store our
descriptor there.

The async update path will just reuse the descriptor already allocated
for that plane and will modify it directly in RAM to match whatever has
been asked for.

In order to do that, it will compare the descriptor for the old plane
state and the new plane state, will make sure they fit in the same size,
and check that only the position or buffer address have changed.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Comment thread drivers/gpu/drm/vc4/vc4_kms.c Resolved
Comment thread drivers/gpu/drm/vc4/vc4_kms.c Resolved
@popcornmix

Copy link
Copy Markdown
Collaborator

I've been running with this on Pi4 with kms over weekend without issue.
fkms threw up a couple a null pointer dereferences (annoying this always occurs in the dead time after uart output stops but before you can log in to see dmesg), but I've suggested fixes for them.
Booted with kms and fkms on PI2.
No issues spotted reading commits.

@6by9

6by9 commented May 9, 2022

Copy link
Copy Markdown
Contributor

(annoying this always occurs in the dead time after uart output stops but before you can log in to see dmesg),

Blacklist vc4. Reboot. Wait for the system to come up. SSH in and run sudo modprobe vc4. You may need a second SSH session to be able to view the logs.

@mripard

mripard commented May 9, 2022

Copy link
Copy Markdown
Contributor Author

Thanks for your comments, I'll address them.

(annoying this always occurs in the dead time after uart output stops but before you can log in to see dmesg),

Blacklist vc4. Reboot. Wait for the system to come up. SSH in and run sudo modprobe vc4. You may need a second SSH session to be able to view the logs.

Alternatively, we can disable the fbdev emulation in Kconfig (CONFIG_DRM_FBDEV_EMULATION), and then try to set a mode by hand.

@popcornmix

Copy link
Copy Markdown
Collaborator

Blacklist vc4. Reboot. Wait for the system to come up. SSH in and run sudo modprobe vc4

Excellent. That works for finding this hang.

Alternatively, we can disable the fbdev emulation in Kconfig (CONFIG_DRM_FBDEV_EMULATION), and then try to set a mode by hand.

Yes, this also works.

My scheme was adding a v7_flush_kern_dcache_area after prb_final_commit then using VideoCore debugger to dump memory from address of __log_buf (found from System.map). But both of these are simpler.

@6by9

6by9 commented May 9, 2022

Copy link
Copy Markdown
Contributor

Spot those of us who have also been hunting this style of NULL deref or lockup in the past :-)

@pelwell

pelwell commented May 11, 2022

Copy link
Copy Markdown
Contributor

I think this is just waiting for the fkms-proofing changes that @popcornmix suggested.

mripard added 12 commits May 11, 2022 16:58
A new generation of controller has been introduced with the
BCM2711/RaspberryPi4. This generation needs a bunch of quirks, and over
time we've piled on a number of checks in most parts of the drivers.

All these checks are performed several times, and are not always
consistent. Let's create a single, global, variable to hold it and use
it everywhere.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
We're going to add a new variant of the dumb BO allocation function, so
let's rename vc4_dumb_create() to something a bit more specific.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The vc4_bo_dumb_create() both fixes up the allocation arguments to match
the hardware constraints and actually performs the allocation.

Since we're going to introduce a new function that uses a different
allocator, let's split the arguments fixup to a separate function we
will be able to reuse.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Prior to the BCM2711/RaspberryPi4, the GPU was a part of the display
components of the SoC. It was thus a part of the vc4 driver.

However, with the BCM2711, it got split out and thus the v3d driver was
created. The vc4 driver now only handles the display part.

We didn't properly split out the code when doing the BCM2711 support
though, and most of the code around buffer allocations is still
involved, even though it doesn't have the backing hardware anymore.

Let's start the split out by creating a new drm_driver that only reports
and uses what we support on the BCM2711. The ioctl were properly
filtered already, but we were still exposing a .gem_create_object hook,
as well as having an .open and .postclose hooks which are only relevant
on older generations.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
On the BCM2711, our current definition of drm_mode_config_funcs uses the
custom vc4_fb_create().

However, that function relies on the buffer allocation path that was
relying on the GPU, and is no longer relevant.

Let's create another drm_mode_config_funcs structure that we will
register on the BCM2711.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
On the BCM2711, our current definition of drm_plane_helper_funcs uses
the custom vc4_prepare_fb() and vc4_cleanup_fb().

Those functions rely on the buffer allocation path that was relying on
the GPU, and is no longer relevant.

Let's create another drm_plane_helper_funcs structure that we will
register on the BCM2711.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
On the BCM2711, we currently call the vc4_bo_cache_init() and
vc4_gem_init() functions. These functions initialize the BO and GEM
backends.

However, this code was initially created to accomodate the requirements
of the GPU on the older SoCs, while the BCM2711 has a separate driver
for it. So let's just skip these calls when we're on a newer hardware.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
We'll need to extend the vc4_async_flip_state structure to rely on
another callback implementation, so let's move the current one into a
union.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
We'll soon introduce another completion callback source that won't need
to use the BO reference counting, so let's move it around to create a
function we will be able to share between both callbacks.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The function vc4_async_page_flip() handles asynchronous page-flips in
the vc4 driver.

However, it mixes some generic code with code that should only be run on
older generations that have the GPU handled by the vc4 driver.

Let's split the generic part out of vc4_async_page_flip() and into a
common function that we be reusable by an handler made for the BCM2711.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
…2711

The BCM2711 doesn't have a v3d GPU so we don't want to call into its BO
management code. Let's create an asynchronous page-flip handler for the
BCM2711 that just calls into the common code.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The BCM2711 has a separate driver for the v3d, and thus we can't call
into any of the driver entrypoints that rely on the v3d being there.

Let's add a bunch of checks and complain loudly if that ever happen.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
@mripard
mripard force-pushed the rpi/5.15-igt-fixes-cleanup branch from 6176fea to 21c5de5 Compare May 11, 2022 14:58
@mripard

mripard commented May 11, 2022

Copy link
Copy Markdown
Contributor Author

I just pushed a new version with the changes @popcornmix requested

@pelwell
pelwell merged commit 83f1a9c into raspberrypi:rpi-5.15.y May 11, 2022
@pelwell

pelwell commented May 11, 2022

Copy link
Copy Markdown
Contributor

Thanks!

popcornmix added a commit to raspberrypi/firmware that referenced this pull request May 12, 2022
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request May 12, 2022
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.

4 participants