BUG: Bad page cache in process kswapd0" in panfrost_gem_shrinker_scan, Linux 5.10.10 on gru-kevin
Hi, thank you so much for your amazing work on panfrost!
I've been getting dmesg BUGs and associated brief (~1sec) freezes about once or twice a week on my rk3399-gru-kevin. The sky hasn't yet fallen nor have filesystems become corrupted, so I guess it's not a big deal yet. But I figured I ought to report this here for the record.
If this is something that has likely been fixed post-5.10.10 let me know and I can try to upgrade. Kernel upgrades on this laptop are a bit tricky since it requires coreboot rebuild and SPI reflash.
The kernel that produced the message below is a mostly-vanilla 5.10.10; the only patch I still carry that is remotely relevant to panfrost is a workaround for the GPU regulator not being detected properly (the patch is attached after the kernel message).
Thanks again for all your awesome work!
[94415.722114] BUG: Bad page cache in process kswapd0 pfn:91f38
[94415.728572] page:000000007048c2c1 refcount:4 mapcount:1 mapping:000000006e9f7691 index:0x0 pfn:0x91f38
[94415.738998] aops:0xffffffc010b93900 ino:19520 dentry name:"drm mm object"
[94415.746598] flags: 0x1ffc000000180017(locked|referenced|uptodate|lru|swapbacked|unevictable)
[94415.756061] raw: 1ffc000000180017 ffffffff0212f408 ffffffff02318148 ffffff80121664a8
[94415.764724] raw: 0000000000000000 0000000000000000 0000000400000000 ffffff80402cf000
[94415.773383] page dumped because: still mapped when deleted
[94415.779519] page->mem_cgroup:ffffff80402cf000
[94415.784397] CPU: 0 PID: 187 Comm: kswapd0 Not tainted 5.10.10-kevin+ #32
[94415.791901] Hardware name: Google Kevin (DT)
[94415.796673] Call trace:
[94415.799419] dump_backtrace+0x0/0x1c8
[94415.803519] show_stack+0x1c/0x38
[94415.807232] dump_stack+0xd4/0x10c
[94415.811044] unaccount_page_cache_page+0x21c/0x2a0
[94415.816407] __delete_from_page_cache+0x5c/0x1d0
[94415.821573] delete_from_page_cache+0x58/0xd8
[94415.826451] truncate_inode_page+0x30/0x48
[94415.831037] shmem_undo_range+0x2c8/0x668
[94415.835523] shmem_truncate_range+0x20/0x40
[94415.840203] drm_gem_shmem_purge_locked+0x9c/0x100
[94415.845563] panfrost_gem_shrinker_scan+0x17c/0x1d0 [panfrost]
[94415.852082] do_shrink_slab+0x174/0x408
[94415.856364] shrink_slab+0xc8/0x308
[94415.860257] shrink_node+0x2dc/0x758
[94415.864247] balance_pgdat+0x350/0x5a8
[94415.868432] kswapd+0x200/0x530
[94415.871939] kthread+0x16c/0x170
[94415.875542] ret_from_fork+0x10/0x18
commit 7030c01bb6acab21b4e6271e973dac5de137ca59
Author: Your Name <you@example.com>
Date: Tue Jan 26 16:59:42 2021 -0800
LOCAL: panfrost: tolerate missing regulator control (v5.10.10)
diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
index 8ab025d0035f..d3aea7a8ee6c 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
@@ -103,8 +103,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
ret = PTR_ERR(opp_table);
/* Continue if the optional regulator is missing */
if (ret != -ENODEV) {
- DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n");
- goto err_fini;
+ DRM_DEV_ERROR(dev, "Couldn't set OPP regulators, proceeding anyways\n");
+ //goto err_fini;
}
} else {
pfdevfreq->regulators_opp_table = opp_table;
diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c
index bf7c34cfb84c..26b50f43d8fe 100644
--- a/drivers/gpu/drm/panfrost/panfrost_device.c
+++ b/drivers/gpu/drm/panfrost/panfrost_device.c
@@ -104,9 +104,10 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev)
pfdev->regulators);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
- dev_err(pfdev->dev, "failed to get regulators: %d\n",
+ dev_err(pfdev->dev, "failed to get regulator(s), proceeding anyways: %d\n",
ret);
- return ret;
+ //return ret;
+ return 0;
}
ret = regulator_bulk_enable(pfdev->comp->num_supplies,