Userspace GPIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

not sure if this is the correct kernel mailing list, but it's related
to real-time applications.

I'm performing some tests with GPIO in Linux (with PREEMPT_RT patch,
but it's not currently important) and I noticed that user-space GPIO
via sysfs is very slow compared to kernel-space and this is obviously
expected, due to system calls overhead.

Then, i tried to map with ioremap() in the kernel and mmap() in the
user space the address of the memory-mapped GPIO register and I
noticed that on my platform (ARM, freescale imx6q) the kernel square
wave max frequency is ~5MHz compared to ~1.6MHz of user-space. In
theory, since both write in a virtual address mapped to a physical
address it should be the same (I verified the assembly of the kernel
module and of the user-space application and they have the same
instructions in the tested loop).

I concluded that the mmap() - since MAP_SHARED is required - sets the
VM_SHARED flag and the MMU of the ARM processor performs cache
coherency protocols that impact on GPIO switching performance, due to
the sharing flag in the page table.

I'm not sure if my analysis is correct, but, in that case, do you have
any other possible solution? Or a special flag for the mmap could be
proposed? In real-time application the performance of GPIO is often
important, and a 4x degradation from kernel-space to user-space can be
significant.


Cheers,
Federico Reghenzani
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux