Closed jpilet closed 8 years ago
I noticed that after the bug, the CPU usage is quite high. I profiled the kernel using perf
, and I got the following results:
# Overhead Command Shared Object Symbol
# ........ ............... ................. ..................................
#
48.77% kworker/u4:2 [kernel.kallsyms] [k] u8_writer
|
--- u8_writer
|
|--99.01%-- poll_writer
| process_one_work
| worker_thread
| kthread
| ret_from_kernel_thread
|
--0.99%-- process_one_work
worker_thread
kthread
ret_from_kernel_thread
47.15% kworker/u4:1 [kernel.kallsyms] [k] u8_reader
|
--- u8_reader
|
|--96.54%-- handle_message
| pump_messages
| process_one_work
| worker_thread
| kthread
| ret_from_kernel_thread
|
--3.46%-- pump_messages
process_one_work
worker_thread
kthread
ret_from_kernel_thread
2.61% kworker/u4:1 [kernel.kallsyms] [k] handle_message
u8_writer and u8_reader are part of spi-pxa2xx (https://github.com/01org/edison-linux/blob/8cd9234c64c584432f6992fe944ca9e46ca8ea76/drivers/spi/spi-pxa2xx.c#L338) It seems that one thread is polling trying to write while the other one is polling trying to read. Without success. @westeri @jhnikula @andy-shev @broonie do you have any idea of what could put the SPI logic is such a locked state?
On Mon, Jan 11, 2016 at 12:27:58AM -0800, Julien Pilet wrote:
It seems that one thread is polling trying to write while the other one is polling trying to read. Without success. @westeri @jhnikula @andy-shev @broonie do you have any idea of what could put the SPI logic is such a locked state?
Please report any upstream issues via the mailing list (CCing relevant maintainers).
which mailing list?
On Mon, Jan 11, 2016 at 06:50:19AM -0800, Julien Pilet wrote:
which mailing list?
SPI SUBSYSTEM M: Mark Brown broonie@kernel.org L: linux-spi@vger.kernel.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git Q: http://patchwork.kernel.org/project/spi-devel-general/list/ S: Maintained F: Documentation/spi/ F: drivers/spi/ F: include/linux/spi/ F: include/uapi/linux/spi/
Thanks. My mistake. The problem is most probably not in pxa2xx.c but in drivers/spi/intel_mid_ssp_spi.c, which is not upstream.
@jpilet, I would suggest to try my https://github.com/andy-shev/linux/tree/eds branch and continue with upstream.
https://github.com/01org/edison-linux/commits/edison-3.10.17
New patch has fixed SPI issue, please refer to commit above.
In Yocto release 2, SPI transfer method is polling, and now it has switched to DMA method, and SPI transfer speed could improve a lot. If Clock Frequency lower than 1MHZ(MAX support up to 24MHZ), data transferring will be failed. (Actually, data transferring will be failed if set frequence lower than 800KHZ).
If increase working frequency to 1MHZ, the issue will be gone. //mraa_spi_frequency(spi,10000); mraa_spi_frequency(spi,1000000);
@chenchux In upstream kernel it's fixed. I guess you may transfer even with lower speeds if you want to.
Hi,
I am using an Intel Edison with a MCP2515 can controller. (my fork: https://github.com/jpilet/edison-linux/tree/edison-3.10.17-anemobox-mcp2515)
I configured the mcp251x driver to use the edison spi cs0. It works: I can "candump" the interface can0 for a while, and properly read and write from and to the bus.
However, after a few hours, the can interface stops working and dmesg tells me:
It seems "spi_sync" never returns. The bug occurs randomly after a few hours of correct behavior. Could it be a locking problem? Any idea?
I have seen @zhoushix's commits about SPI+DMA. However, if I enable dma for mcp151x or for spidev, the mcp151x driver can't access the controller (here https://github.com/jpilet/edison-linux/blob/9318ddd00bdc01a11f73ec6e7daeeb92aa241292/arch/x86/platform/intel-mid/device_libs/platform_mcp2515.c#L38 or here https://github.com/jpilet/edison-linux/blob/9318ddd00bdc01a11f73ec6e7daeeb92aa241292/arch/x86/platform/intel-mid/device_libs/platform_spidev.c#L29). Am I missing something, or is it simply that the SPI+DMA code is not yet ready?
Thanks in advance for your help