[meta-freescale] [meta-fsl-arm] [linux-2.6.35-r45] amd-gpu : patch proposal / discussion (imx53 + Qt 5.3 + EGLFS)
Gianluca Cinci
gianluca.cinci at giuneco.it
Tue Nov 11 16:17:06 PST 2014
From 768a9f37734a9c6acb02ac1a832127af9f15da1b Mon Sep 17 00:00:00 2001
From: Gianluca Cinci <gianluca.cinci at giuneco.it>
Date: Tue, 11 Nov 2014 22:25:17 +0100
Subject: [PATCH] avoid shared memory free issue on application exit
---
drivers/mxc/amd-gpu/common/gsl_sharedmem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mxc/amd-gpu/common/gsl_sharedmem.c
b/drivers/mxc/amd-gpu/common/gsl_sharedmem.c
index 51e66f9..2529267 100644
--- a/drivers/mxc/amd-gpu/common/gsl_sharedmem.c
+++ b/drivers/mxc/amd-gpu/common/gsl_sharedmem.c
@@ -430,6 +430,9 @@ kgsl_sharedmem_free0(gsl_memdesc_t *memdesc,
unsigned int pid)
}
else
{
+ kgsl_hal_freephysical(memdesc->gpuaddr, NULL, NULL); // free the
previously allocated memory if
+ //
gpuaddress is present in gsl_linux_map_list
+
status = GSL_FAILURE;
}
--
1.9.1
Hi all,
i finally reached to run an Qt 5.3 application on imx53(loco) board
(linux 2.6.35-r45)
My problem come out when i try to execute a previously killed application:
------------------------------------------------------------------------------------------------------------------------------------
Unable to handle kernel paging request at virtual address 8e011800
pgd = cf550000
[8e011800] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT
last sysfs file: /sys/devices/system/cpu/online
Modules linked in:
CPU: 0 Not tainted (2.6.35.3-aep-imx53+gb3912bb #42)
PC is at vmalloc_to_page+0x38/0x70
LR is at kgsl_hal_allocphysical+0x38/0x74
pc : [<8010ddfc>] lr : [<80376620>] psr: 20070013
sp : cf5a1e28 ip : 0000cafe fp : 00000000
r10: 8069bf88 r9 : 80620a90 r8 : 8068760c
r7 : d0fd6000 r6 : cf6b7200 r5 : 00000044 r4 : 0000002a
r3 : 7e011000 r2 : 70000000 r1 : 10000800 r0 : 10000800
Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 10c5387d Table: bf550019 DAC: 00000015
Process QSGRenderThread (pid: 1600, stack limit = 0xcf5a02e8)
Stack: (0xcf5a1e28 to 0xcf5a2000)
1e20: cf6b7400 cf5a1edc 00000100 000c0000 8069bcf8
00000000
1e40: 00000001 80373568 0000063c 000004fa 00000000 28866154 00044000
800db6ec
1e60: 2888cf65 00000000 00000044 cf6b7200 8063dfa8 8069bcf8 00000001
cf5a1edc
1e80: 00044000 000c0000 cf5a0000 0000005c 2fbd4464 8037362c cf7b9700
cf7b9700
1ea0: cf5a0030 c010f931 8008ffc4 80375c48 00000181 cf550bf0 00000604
29209080
1ec0: 00000a28 cf64fd68 cf738300 00000001 000c0000 00044000 00561cc8
00c16000
1ee0: 00c16000 00044000 00000100 00000000 0000081f 80620d18 cf7b9700
00000000
1f00: 2fbd4464 80128e88 00002000 cf7b9700 cf7b9700 c010f931 00000005
801297dc
1f20: cf645b18 00000000 cf7b9700 00000bf0 00000000 cf7b9700 00000026
00026000
1f40: cf5a0020 00000001 0000000a cf64fb58 cf75dc34 cf5a0010 cf7b9700
000844fb
1f60: cf5a1f50 2fbd4464 cf7b9700 c010f931 00000005 8008ffc4 cf5a0000
0000005c
1f80: 00000000 801298fc 00000005 00000001 2fbd4464 00561cc8 423c7168
00044000
1fa0: 00000036 8008fe40 00561cc8 423c7168 00000005 c010f931 2fbd4464
00000134
1fc0: 00561cc8 423c7168 00044000 00000036 00000001 00000000 0000005c
00000000
1fe0: 423c7084 2fbd4454 423bd2d4 4f9218bc 00070010 00000005 fe023a18
fe023a18
[<8010ddfc>] (vmalloc_to_page+0x38/0x70) from [<80376620>]
(kgsl_hal_allocphysical+0x38/0x74)
[<80376620>] (kgsl_hal_allocphysical+0x38/0x74) from [<80373568>]
(kgsl_sharedmem_alloc0+0x290/0x320)
[<80373568>] (kgsl_sharedmem_alloc0+0x290/0x320) from [<8037362c>]
(kgsl_sharedmem_alloc+0x34/0x4c)
[<8037362c>] (kgsl_sharedmem_alloc+0x34/0x4c) from [<80375c48>]
(gsl_kmod_ioctl+0x880/0xe4c)
[<80375c48>] (gsl_kmod_ioctl+0x880/0xe4c) from [<80128e88>]
(vfs_ioctl+0x7c/0xac)
[<80128e88>] (vfs_ioctl+0x7c/0xac) from [<801297dc>]
(do_vfs_ioctl+0x484/0x574)
[<801297dc>] (do_vfs_ioctl+0x484/0x574) from [<801298fc>]
(sys_ioctl+0x30/0x5c)
[<801298fc>] (sys_ioctl+0x30/0x5c) from [<8008fe40>]
(ret_fast_syscall+0x0/0x30)
Code: e5922000 e2621102 e2811b02 e0810100 (e7903003)
---[ end trace b52db45d97dbc59c ]---
------------------------------------------------------------------------------------------------------------------------------------
Sometimes the system freeze without a kernel dump , and probably this
affect also another kind of kernel panic (case of study , posted at the
end of this mail)
As you can see in the kernel log , the problem come out when a
vmalloc_to_page void is invoked.
This is because the function try to allocate "numpages" memory pages of
size "PAGE_SIZE" based on gpuaddres X.
During the for iteration , the void fails and a kernel panic occur.
Exploring the driver sources i found this condition inside the
kgsl_sharedmem_free0 function:
gsl_sharedmem.c:
"if (shmem->flags & GSL_FLAGS_INITIALIZED)"
That means "if the state of the shared memory is GSL_FLAGS_INIZIALED ,
a new free memory operation can be executed".
This seems to work well during normal running but , when an application
is terminated, the state of shared memory changes from
GSL_FLAGS_INITIALIZED to GSL_FLAGS_NORMALMODE.
This prevent the all unmappping operations to be executed during other
states , but also exclude the previously allocated memory to be freed.
On application exit the driver invoke the function kgsl_sharedmem_free0
n times as many uncleaned memory blocks are present on list:
gsl_kmod_cleanup,c:
int del_all_memblocks_from_allocated_list(struct file *fd) (see notes
at end (*1) )
But "at this state" , the void kgsl_sharedmem_free0 can't invoke
kgsl_hal_freephysical (because the shared memory flags) and returns a
GSL_ERROR status without free the memory.
The patch avoid this problem by calling the kgsl_hal_freephysical in the
else condition.
Invoke the kgsl_hal_freephysical is safe , because exploring it , the
subroutine:
gsl_linux_map.c:
void gsl_linux_map_free(unsigned int gpu_addr)
cleans the memory only if the gpuaddrr is present inside the
gsl_linux_map_list.
I think that some consideration can be made about this (and probably
this solution can be considered on a better look way...)
Finally the step to run a Qt 5.3 application on imx53 if someone has
this problem (tested on a framebuffer system)
1) add to local.conf or wherever you want the packages:
---cinematicexperience
---amd-gpu-bin-mx51 (this is usefull because inside the recipe
there is the PACKAGES variable that is just setted to include the all
libraries needed.
The package contains only some
test binary of GPU acceleration
NOTE :if the egl libraries were
not included the Qt 5 application failed to start with EGL Error : Could
not create the egl surface: error = 0x3003)
2)apply the patch to kernel
3) build a new image
3) run Qt5_CinematicExperience -platform eglfs
During this analysys I didn't find any that conduce to think about some
non cleaned blocks during normal execution and also the gsl_sanity_app
reach the end with success every time.
Best Regards
Gianluca Cinci
Notes:
(*1) : here a kgsl_sharedmem_free (without 0) is called , inside that
there is a subcall to kgsl_sharedmem_free0
(*2) :
the other kernel message mentioned above:
--------------------------------------------------------------
Unhandled fault: external abort on non-linefetch (0x1008) at 0xd0ac0edc
Internal error: : 1008 [#1] PREEMPT last sysfs file:
/sys/devices/system/cpu/online Modules linked in:
CPU: 0 Not tainted (2.6.35.3-11.09.01+yocto+ged51f22 #1)
PC is at kgsl_yamato_regread+0xc/0x24
LR is at kgsl_yamato_isr+0x18/0x80
pc : [<80376c2c>] lr : [<80377450>] psr: 60070193
sp : c81dff58 ip : ffffab5e fp : 00000000
r10: 00000000 r9 : c81de000 r8 : 00000000
r7 : 0000000c r6 : 00000000 r5 : 00000000 r4 : 806a0b28
r3 : d0ac0000 r2 : c81dff5c r1 : 000003b7 r0 : 806a0b28
Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
Control: 10c5387d Table: ba6e4019 DAC: 00000015 Process
QSGRenderThread (pid: 1700, stack limit = 0xc81de2e8)
Stack: (0xc81dff58 to 0xc81e0000)
ff40: 806a0b28
cff48780
ff60: 806a0b28 80373b5c cf263f40 803792dc 803792d0 800e9e50 00000000
80641e3c
ff80: 0000000c cf263f40 00000001 800eb8b4 0000000c 00000000 00000001
80090068
ffa0: 20070010 ffffffff d0800000 80090bc8 32681000 01aae330 00003910
00000000
ffc0: 01aac450 4c298b80 002f0498 01aac450 00001850 002f8420 00000000
00000000
ffe0: 32682ec0 3216d934 4bef37e4 4bc6a0b0 20070010 ffffffff 8e38d48b
59ebdc88
[<80376c2c>] (kgsl_yamato_regread+0xc/0x24) from [<80377450>]
(kgsl_yamato_isr+)
[<80377450>] (kgsl_yamato_isr+0x18/0x80) from [<80373b5c>]
(kgsl_intr_isr+0x24/)
[<80373b5c>] (kgsl_intr_isr+0x24/0x28) from [<803792dc>]
(z430_irq_handler+0xc/)
[<803792dc>] (z430_irq_handler+0xc/0x18) from [<800e9e50>]
(handle_IRQ_event+0x)
[<800e9e50>] (handle_IRQ_event+0x24/0xdc) from [<800eb8b4>]
(handle_level_irq+0)
[<800eb8b4>] (handle_level_irq+0xd8/0x184) from [<80090068>]
(asm_do_IRQ+0x68/0)
[<80090068>] (asm_do_IRQ+0x68/0x88) from [<80090bc8>]
(__irq_usr+0x48/0xc0) Exception stack(0xc81dffb0 to 0xc81dfff8)
ffa0: 32681000 01aae330 00003910
00000000
ffc0: 01aac450 4c298b80 002f0498 01aac450 00001850 002f8420 00000000
00000000
ffe0: 32682ec0 3216d934 4bef37e4 4bc6a0b0 20070010 ffffffff
Code: e12fff1e e5903088 f57ff04f f57ff04f (e7933101) ---[ end trace
0efc6cf93f26278e ]---
Kernel panic - not syncing: Fatal exception in interrupt [<80095144>]
(unwind_backtrace+0x0/0xe0) from [<804aacfc>]
(panic+0x68/0xdc)
[<804aacfc>] (panic+0x68/0xdc) from [<80094158>] (die+0x2a8/0x2f8)
[<80094158>] (die+0x2a8/0x2f8)
from [<8009026c>] (do_DataAbort+0x84/0x98) [<8009026c>]
(do_DataAbort+0x84/0x98) from [<8009092c>]
(__dabt_svc+0x4c/0x60)
Exception stack(0xc81dff10 to 0xc81dff58)
ff00: 806a0b28 000003b7 c81dff5c
d0ac0000
ff20: 806a0b28 00000000 00000000 0000000c 00000000 c81de000 00000000
00000000
ff40: ffffab5e c81dff58 80377450 80376c2c 60070193 ffffffff [<8009092c>]
(__dabt_svc+0x4c/0x60) from [<80376c2c>]
(kgsl_yamato_regread+0xc/)
[<80376c2c>] (kgsl_yamato_regread+0xc/0x24) from [<80377450>]
(kgsl_yamato_isr+)
[<80377450>] (kgsl_yamato_isr+0x18/0x80) from [<80373b5c>]
(kgsl_intr_isr+0x24/)
[<80373b5c>] (kgsl_intr_isr+0x24/0x28) from [<803792dc>]
(z430_irq_handler+0xc/)
[<803792dc>] (z430_irq_handler+0xc/0x18) from [<800e9e50>]
(handle_IRQ_event+0x)
[<800e9e50>] (handle_IRQ_event+0x24/0xdc) from [<800eb8b4>]
(handle_level_irq+0)
[<800eb8b4>] (handle_level_irq+0xd8/0x184) from [<80090068>]
(asm_do_IRQ+0x68/0)
[<80090068>] (asm_do_IRQ+0x68/0x88) from [<80090bc8>]
(__irq_usr+0x48/0xc0) Exception stack(0xc81dffb0 to 0xc81dfff8)
ffa0: 32681000 01aae330 00003910
00000000
ffc0: 01aac450 4c298b80 002f0498 01aac450 00001850 002f8420 00000000
00000000
ffe0: 32682ec0 3216d934 4bef37e4 4bc6a0b0 20070010 ffffffff
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/meta-freescale/attachments/20141112/e81fc74f/attachment-0001.html>
More information about the meta-freescale
mailing list