From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Mylene Josserand <Mylene.Josserand@navocap.com>
Cc: linux-can@vger.kernel.org
Subject: Re: [imx27 - mcp251x] MCP251x does not work in static ?
Date: Fri, 12 Apr 2013 11:49:08 +0200 [thread overview]
Message-ID: <5167D894.1020002@pengutronix.de> (raw)
In-Reply-To: <CA78C307B8F06747967D122FC656B15377446C@SERVEUR0.nvp.local>
[-- Attachment #1: Type: text/plain, Size: 4723 bytes --]
On 04/12/2013 11:24 AM, Mylene Josserand wrote:
>>> I have read 15 383 frames but after 15 834, it hangs. And after that, I
>>> can not act on the CAN anymore. A "ifconfig can0 down" hangs the kernel
>>> (even with ^C) and I have to restart the board to use the CAN again !
>>
>> Ohhh, not good.
>>
>> Activate "MAGIC_SYSRQ" in the kernel via "make menuconfog" (Kernel
>> hacking -> Magic SysRq key) and bring your system to hang again. Then
>> connect via serial line to your embedded system and send a "break". (See
>> documentation of your terminal program.). After the "break" send a
>> normal "?" to get the help. If I remember correctly, use "break" + "d"
>> to create a stackdump (see
>> http://lxr.linux.no/linux+v3.8.6/Documentation/sysrq.txt for more
>> documentation). You might want to try the magic sys request if your
>> system is still alive to test if your setup is working.
>>
>> With the stack trace you might figure out what the system is doing.
>
>
> Oouuhhhaaa ! Very useful ! It did not know the sysrq and it seems to be
> very powerful ! Thanks ! :D
You're welcome.
> About serious things, the "d" command did not work (it prints the help)
> but the "w" command ["dump tasks that are uninterruptable (blocked)
> state"] shows interesting things :
Maybe it was not 'd', but you've found the interesting information.
> ---- when not blocked (so nothing in there) :
> "
> SysRq : Show Blocked State
> task PC stack pid father
> Sched Debug Version: v0.10, 3.8.2-9-can-modules+ #1
> [...]
> "
>
> ---- when blocked :
> "
> SysRq : Show Blocked State
> task PC stack pid father
> kworker/u:0 D c03d6b20 0 6 2 0x00000000
> [<c03d6b20>] (__schedule+0x298/0x434) from [<c03d59c8>]
> (schedule_timeout+0x170/0x1c0)
> [<c03d59c8>] (schedule_timeout+0x170/0x1c0) from [<c03d70d4>]
> (wait_for_common+0x148/0x1a4)
> [<c03d70d4>] (wait_for_common+0x148/0x1a4) from [<c0287078>]
> (spi_imx_transfer+0x70/0x84)
> [<c0287078>] (spi_imx_transfer+0x70/0x84) from [<c0285284>]
> (bitbang_work+0x130/0x390)
The spi driver is waiting for a transfer to finish, it hangs in the
wait_for_completion():
http://lxr.linux.no/linux+v3.8.6/drivers/spi/spi-imx.c#L712
The corresponding function (i.e. complete()) is called from the
interrupt handler, once a transfer ins completed:
http://lxr.linux.no/linux+v3.8.6/drivers/spi/spi-imx.c#L649
> [<c0285284>] (bitbang_work+0x130/0x390) from [<c002ee44>]
> (process_one_work+0x28c/0x504)
> [<c002ee44>] (process_one_work+0x28c/0x504) from [<c002f688>]
> (worker_thread+0x1f0/0x648)
> [<c002f688>] (worker_thread+0x1f0/0x648) from [<c0036894>]
> (kthread+0xa0/0xac)
> [<c0036894>] (kthread+0xa0/0xac) from [<c00093b0>] (ret_from_fork+0x14/0x24)
> irq/201-mcp251x D c03d6b20 0 950 2 0x00000000
> [<c03d6b20>] (__schedule+0x298/0x434) from [<c03d59c8>]
> (schedule_timeout+0x170/0x1c0)
> [<c03d59c8>] (schedule_timeout+0x170/0x1c0) from [<c03d70d4>]
> (wait_for_common+0x148/0x1a4)
> [<c03d70d4>] (wait_for_common+0x148/0x1a4) from [<c02839b0>]
> (__spi_sync+0x58/0x9c)
> [<c02839b0>] (__spi_sync+0x58/0x9c) from [<bf08f138>]
> (mcp251x_spi_trans+0xa4/0xd0 [mcp251x])
> [<bf08f138>] (mcp251x_spi_trans+0xa4/0xd0 [mcp251x]) from [<bf090140>]
> (mcp251x_can_ist+0x60/0x348 [mcp251x])
> [<bf090140>] (mcp251x_can_ist+0x60/0x348 [mcp251x]) from [<c005bbf4>]
> (irq_thread_fn+0x1c/0x34)
> [<c005bbf4>] (irq_thread_fn+0x1c/0x34) from [<c005bce4>]
> (irq_thread+0xd8/0x148)
> [<c005bce4>] (irq_thread+0xd8/0x148) from [<c0036894>] (kthread+0xa0/0xac)
> [<c0036894>] (kthread+0xa0/0xac) from [<c00093b0>] (ret_from_fork+0x14/0x24)
> Sched Debug Version: v0.10, 3.8.2-9-can-modules+ #1
> [...]
> "
>
> We can see that the problem is during the spi transfer.
> Do you think it is a hardware problem ?
Maybe a hardware problem, a driver problem or a problem in the hardware
triggering a bug in the driver.
> What is the "kworker" task ?
> How fix it ?
The "kworker" is some infrastructure task in that parts of the imx spi
driver "live". Here the scenario is:
- The spi_imx_transfer() is waiting for a transfer to finish.
- The finish of the transfer is signaled via the
complete() <-> wait_for_completion()
- An Interrupt will call complete()
- Did we get an Interrupt? Did we miss the Interrupt?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
next prev parent reply other threads:[~2013-04-12 9:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 13:07 [imx27 - mcp251x] MCP251x does not work in static ? Mylene Josserand
2013-04-10 13:39 ` Marc Kleine-Budde
2013-04-10 14:11 ` Mylene Josserand
2013-04-10 15:30 ` Marc Kleine-Budde
2013-04-11 7:39 ` Mylene Josserand
2013-04-11 7:49 ` Marc Kleine-Budde
2013-04-11 8:04 ` Mylene Josserand
2013-04-11 8:39 ` Marc Kleine-Budde
2013-04-11 9:22 ` Mylene Josserand
2013-04-11 9:49 ` Marc Kleine-Budde
2013-04-11 14:39 ` Mylene Josserand
2013-04-11 15:09 ` Marc Kleine-Budde
2013-04-12 9:24 ` Mylene Josserand
2013-04-12 9:49 ` Marc Kleine-Budde [this message]
2013-04-12 9:36 ` Marc Kleine-Budde
2013-04-12 9:40 ` Mylene Josserand
2013-04-12 9:48 ` Marc Kleine-Budde
2013-04-11 8:36 ` RFC: [PATCH] can: mcp251x: add missing IRQF_ONESHOT to request_threaded_irq Marc Kleine-Budde
2013-04-12 11:16 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5167D894.1020002@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=Mylene.Josserand@navocap.com \
--cc=linux-can@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).