Hi,

I am seeing some strange behavior while accessing buffers through User Space 
(mapped using mmap call)

Background :- 
------------
Platform - TI AM3517
CPU - ARM Cortex A8

r...@am3517-evm:~#
r...@am3517-evm:~# cat /proc/cpuinfo
Processor       : ARMv7 Processor rev 7 (v7l)
BogoMIPS        : 499.92
Features        : swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x1
CPU part        : 0xc08
CPU revision    : 7
Hardware        : OMAP3517/AM3517 EVM
Revision        : 0020
Serial          : 0000000000000000
r...@omap3517-evm:~#


Issue/Usage :- 
-------------
The V4l2-Capture driver captures the data from video decoder into buffer and 
the application does some processing on this buffer. The mmap implementation 
can be found at drivers/media/video/videobuf-dma-contig.c, 
function__videobuf_mmap_mapper().

Observation - 
The CPU consumption goes as high as 95% on read buffer operation, please note 
that write operation on these buffers also gives 60-70% CPU consumption. (Using 
memcpy/memset API's for read and write operation).

Some more inputs :- 
------------------
- If I specify PAGE_READONLY or PAGE_SHARED (actual flag is L_PTE_USER) while 
mapping the buffer to UserSpace in mmap system call, the CPU consumption goes 
down to expected value (20-27%). 
Then I reached till the function cpu_v7_set_pte_ext, where we are configuring 
level 2 translation table entries, which makes use of these flags.

- Below is the value of r0, r1 and r2 register (ptep, pteval, ext) in both the 
cases -


Without PAGE_READONLY/PAGE_SHARED

ptep - cfb5de10, pte - 8d200383, ext - 800
ptep - cfb5de14, pte - 8d201383, ext - 800

Important bits are [0-9] - 0x383

With PAGE_READONLY/PAGE_SHARED set

ptep - cfb30e10, pte - 8d10038f, ext - 800
ptep - cfb30e14, pte - 8d10138f, ext - 800

Important bits are [0-9] - 0x38F

The lines inside function "cpu_v7_set_pte_ext", is using the flag as shown 
below -

   tst     r1, #L_PTE_USER
   orrne   r3, r3, #PTE_EXT_AP1
   tstne   r3, #PTE_EXT_APX
   bicne   r3, r3, #PTE_EXT_APX | PTE_EXT_AP0

Without PAGE_READONLY/PAGE_SHARED               With flags set

Access perm = reserved                          Access Perm = Read Only

- I tried the same thing with another platform (ARM9) and it works fine there.

Can somebody help me to understand the flag PAGE_SHARED/PAGE_READONLY and 
access permissions? Am I debugging this into right path? Does anybody have 
seen/observed similar issue before?


Thanks in advance.

Thanks,
Vaibhav Hiremath

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to