1
0
Fork 0

MA-17341-2 [#imx-2211] Fix kernel panic when do stop on android

There is kernel panic when stop android or kill surfaceflinger
after enable framebuffer tile compression on 8mq board.
The root cause of the issue is dcss driver not api to receive
ts fd, gpu driver will set the ts_dma_buf in _SetVidMemMetadata(),
dcss driver get the ts buffer physical address from ts_dma_buf,
when stop android framebuffer and matched ts buffer will free,
previous ts_dma_buf get from ts_fd will be invalid, when dcss
driver use this ts_dma_buf will cause problem. It is a common
issue, if Linux Weston do the similar stop should also meet
the same panic issue.

Keep a reference for ts_dma_buf in _SetVidMemMetadata(),
decrease the reference in _dmabuf_release() can avoid the
panic issue.

Kernel panic log:
[   41.007431] kernel BUG at drivers/gpu/drm/drm_gem.c:154!
[   41.139375] Call trace:
[   41.141824]  drm_gem_object_init+0xb8/0xbc
[   41.145920]  drm_gem_cma_prime_import_sg_table+0x84/0xdc
[   41.151233]  drm_gem_prime_import_dev+0xe8/0x194
[   41.160036]  dcss_plane_atomic_set_base+0x31c/0x3d0
[   41.164915]  dcss_plane_atomic_update+0x450/0x46c
[   41.164923]  drm_atomic_helper_commit_planes+0x130/0x31c
[   41.182255]  dcss_drm_atomic_commit_tail+0xcc/0x150
[   41.187139]  dcss_commit_work+0x10/0x1c
[   41.197322]  process_one_work+0x2d8/0x580
[   41.201333]  worker_thread+0x28c/0x518
[   41.205085]  kthread+0x14c/0x15c
[   41.208316]  ret_from_fork+0x10/0x18

Change-Id: I385851b436d1fead1131ce25f496bdd5d3d14264
Signed-off-by: Richard Liu <xuegang.liu@nxp.com>
(cherry picked from commit 9ef46bda523088bfba51b7432acd2c1e21e547d5)
5.4-rM2-2.2.x-imx-squashed
Richard Liu 2020-09-01 17:04:56 +00:00 committed by Xianzhong
parent da8160ec36
commit 8c5e7b55ac
2 changed files with 11 additions and 2 deletions

View File

@ -2044,6 +2044,11 @@ _SetVidMemMetadata(
}
else
{
if ((nodeObj->metadata.ts_fd >= 0) && (nodeObj->metadata.ts_dma_buf != NULL)
&& !(IS_ERR(nodeObj->metadata.ts_dma_buf))) {
dma_buf_put(nodeObj->metadata.ts_dma_buf);
}
nodeObj->metadata.ts_fd = Interface->u.SetVidMemMetadata.ts_fd;
if (nodeObj->metadata.ts_fd >= 0)
@ -2054,8 +2059,6 @@ _SetVidMemMetadata(
{
gcmkONERROR(gcvSTATUS_NOT_FOUND);
}
dma_buf_put(nodeObj->metadata.ts_dma_buf);
}
else
{

View File

@ -4095,6 +4095,12 @@ static void _dmabuf_release(struct dma_buf *dmabuf)
{
gckVIDMEM_NODE nodeObject = dmabuf->priv;
if (nodeObject->metadata.ts_dma_buf)
{
dma_buf_put(nodeObject->metadata.ts_dma_buf);
nodeObject->metadata.ts_dma_buf = NULL;
}
gcmkVERIFY_OK(gckVIDMEM_NODE_Dereference(nodeObject->kernel, nodeObject));
}