All of lore.kernel.org
 help / color / mirror / Atom feed
From: Casper Mogensen <casper.mogensen@gmail.com>
To: Wolfgang Grandegger <wg@grandegger.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Michael Pellegrini <mikep86@gmail.com>,
	linux-can@vger.kernel.org, tomoya.rohm@gmail.com,
	Bhupesh SHARMA <bhupesh.sharma@st.com>,
	Alexander Stein <alexander.stein@systec-electronic.com>,
	federico.vaga@gmail.com,
	Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
Subject: Re: pch_can: Data transmission stops after dropped packet
Date: Thu, 15 Nov 2012 17:32:43 +0100	[thread overview]
Message-ID: <CABgkGoGYGpefppHUCnBZQQRX8Nn5_AnVdDPQ-gHs4H7vyVOVXQ@mail.gmail.com> (raw)
In-Reply-To: <50A4EA87.9020206@grandegger.com>

Hi all

I have been working with the eg20t chipset and the pch_can driver a
lot up until January this year, where the project i was working on
unfortunately was shut down. There is a bug in the implementation,
which causes the transmit buffers to fill up and all become
unavailable. It happens randomly, but is easily triggered with a high
load. I experienced the same problems as Michael.

I have not been working on it for a long time, so i don't recall the
problem precisely, but as i remember there is two memory areas which
is used for communication between the processor and the can core. One
is used for receive, and one is used for transmit in the pch_can
driver. When initiating a transmit, a flag is indicating that an
interrupt must be generated upon transmit receive, if a transmit
interrupt is handled during an ongoing transmit, then problems can
occur.

From pch_xmit in pch_can
on line 940 in pch_can.c: can_put_echo_skb is called, which occupies
the skb(which to my best knowledge, is the reason that you get a
buffer overflow)
on line 943 in pch_can.c: The transmit complete interrupt flag is
written to the internal register (but not writing to the can core yet)
on line 946 in pch_can.c: pch_can_rw_msg_obj is issued, which writes
the internal registers to can core.

If the transmit completed handler has been running between lines 943
or 946, the pch_tx_complete routine will clear the transmit interupt
enable flag in priv->regs->ifregs[1] (same register is used in both),
then you end up writing something the message to the core without
transmit completed interrupt enabled, and with an occupied skb, then
you eventually runs out of transmit buffers, as the skb's are free'd
in pch_tx_complete, which is triggered by a transmit completed
interrupt

I am a little rusty in this issue, as it is quite a long time ago i
was working with it, but i hope the description is understandable :-)

Regards

Casper Mogensen

On Thu, Nov 15, 2012 at 2:13 PM, Wolfgang Grandegger <wg@grandegger.com> wrote:
> On 11/15/2012 08:18 AM, Oliver Hartkopp wrote:
>> On 14.11.2012 16:39, Michael Pellegrini wrote:
>>
>>
>>> I am trying to use the pch_can driver to interface with a CANopen system.
>>> I am encountering a serious issue where, at random intervals, the CAN interface
>>> will lock up and stop transmitting data.  Data reception continues normally.
>>> The only way I've found to resolve the issue so far is to issue an
>>> "ifconfig canx down" command followed by an "ifconfig canx up" command.
>>> After the interface is reset through these commands, the TX packet dropped count
>>> and the TX packet carrier count increment by 1.
>>>
>>> I am running Ubuntu 12.04 with kernel version 3.2.0-23.
>>>
>>> Has anyone else seen this problem or have a fix for it?
>>
>>
>> Hello Mike,
>>
>> i put the relevant people into CC that probably know better than me.
>>
>> Btw. using the pch_can driver:
>>
>> 1. Can you please provide the output of
>>
>>       ip -details link show can0
>>
>> (if can0 is your device with the problem)
>> at start time and when the problem happened?
>>
>> 2. Can you send the output of
>>
>>       candump can0,0~0,#FFFFFFFF -e
>>
>> from start time until the problem happens?
>>
>> 3. It turned out that the pch_can controller is created upon the C_CAN
>> CAN controller IP-core. Therefore Wolfgang posted an idea to replace the
>> pch_can driver with a PCI-attached C_CAN driver:
>>
>> http://thread.gmane.org/gmane.linux.can/815
>>
>> I don't know the current state of the tests/replacement.
>
> As you can see from this thread, the replacement patch did not yet
> succesfully run on such a platform. But I definitively would like to get
> rid of the obsolete pch_can driver. Testers are welcome! Michael, would
> you be able/willing to test a patch, even with a recent kernel version?
>
>> But a general C_CAN PCI driver has been contributed by Frederico Vaga which
>> became a mainline driver in June
>>
>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=5b92da0443c2585e31b64e86c2e1b8e22845d4bb
>>
>> Don't know if this driver can be used out of the box, when the PCI IDs of the
>> PCH_CAN board are added ...
>>
>> But maybe the guys in CC know ;-)
>
> You need a PCI driver first.
>
> Wolfgang.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Regards / Med venlig hilsen

Casper Mogensen

  parent reply	other threads:[~2012-11-15 16:32 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 15:39 pch_can: Data transmission stops after dropped packet Michael Pellegrini
2012-11-14 21:40 ` Michael Pellegrini
2012-11-15  7:18 ` Oliver Hartkopp
2012-11-15 13:13   ` Wolfgang Grandegger
2012-11-15 16:23     ` Michael Pellegrini
2012-11-15 21:19       ` Wolfgang Grandegger
2012-11-15 21:34         ` Michael Pellegrini
2012-11-15 21:51           ` Wolfgang Grandegger
2012-11-18 22:22           ` Wolfgang Grandegger
2012-11-19 15:10             ` Michael Pellegrini
2012-11-19 15:26               ` Wolfgang Grandegger
2012-11-19 16:20                 ` Michael Pellegrini
2012-11-19 16:31                   ` Wolfgang Grandegger
2012-11-19 17:39                     ` Michael Pellegrini
2012-11-19 19:22                       ` Wolfgang Grandegger
2012-11-19 20:19                         ` Michael Pellegrini
2012-11-19 21:46                           ` Wolfgang Grandegger
2012-11-20 14:25                             ` Michael Pellegrini
2012-11-20 16:12                               ` Wolfgang Grandegger
2012-11-20 19:12                                 ` Michael Pellegrini
2012-11-20 21:05                                   ` Wolfgang Grandegger
2012-11-21 10:24                                     ` Wolfgang Grandegger
     [not found]                                       ` <loom.20121121T160744-278@post.gmane.or  g>
2012-11-21 15:15                                       ` Michael Pellegrini
     [not found]                                       ` <loom.20121121T160744-278@post.gmane.or g>
2012-11-21 15:25                                         ` Michael Pellegrini
2012-11-21 15:32                                           ` Marc Kleine-Budde
2012-11-21 16:11                                             ` Michael Pellegrini
2012-11-21 15:41                                           ` Michael Pellegrini
2012-11-21 15:56                                           ` Wolfgang Grandegger
2012-11-21 16:09                                             ` Michael Pellegrini
2012-11-21 16:41                                               ` Wolfgang Grandegger
2012-11-21 16:58                                                 ` Casper Mogensen
2012-11-21 19:48                                                   ` Wolfgang Grandegger
2012-11-21 17:43                                                 ` Michael Pellegrini
2012-11-21 19:55                                                   ` Wolfgang Grandegger
2012-11-21 21:00                                                     ` Michael Pellegrini
2012-11-23 14:27                                                       ` Michael Pellegrini
2012-11-23 14:45                                                         ` Wolfgang Grandegger
2012-11-23 14:47                                                           ` Wolfgang Grandegger
2012-11-23 15:14                                                             ` Michael Pellegrini
2012-11-23 15:04                                                           ` Michael Pellegrini
2012-11-23 17:00                                                             ` Wolfgang Grandegger
2012-11-23 17:18                                                               ` Wolfgang Grandegger
2012-11-23 17:52                                                                 ` Michael Pellegrini
2012-11-25 16:17                                                                   ` Wolfgang Grandegger
2012-11-26 14:54                                                                     ` Michael Pellegrini
2012-11-26 15:30                                                                       ` Wolfgang Grandegger
2012-11-26 17:30                                                                         ` Michael Pellegrini
2012-11-26 18:13                                                                           ` Wolfgang Grandegger
2012-11-29 12:15                                                                             ` Wolfgang Grandegger
2012-11-29 14:15                                                                               ` Michael Pellegrini
2012-12-06 14:20                                                                                 ` Michael Pellegrini
2012-12-06 14:23                                                                                   ` Marc Kleine-Budde
2012-12-06 14:41                                                                                     ` Wolfgang Grandegger
2012-12-06 14:42                                                                                       ` Marc Kleine-Budde
2012-12-06 14:42                                                                                     ` Michael Pellegrini
2012-12-06 14:49                                                                                   ` Wolfgang Grandegger
2012-12-06 17:05                                                                                     ` Alexander Stein
2012-12-06 22:02                                                                                       ` Wolfgang Grandegger
2012-12-06 23:24                                                                                         ` Marc Kleine-Budde
2012-12-10  8:21                                                                                         ` Alexander Stein
2012-12-11 20:24                                                                                           ` Wolfgang Grandegger
2012-12-13 14:04                                                                                             ` Alexander Stein
2012-12-11 14:46                                                                                         ` Michael Pellegrini
2012-12-11 20:21                                                                                           ` Wolfgang Grandegger
2012-12-12 13:35                                                                                           ` Alexander Stein
2012-12-06 22:11                                                                                     ` Michael Pellegrini
2012-12-06 23:23                                                                                       ` Michael Pellegrini
2012-11-24  7:16                                                               ` Wolfgang Grandegger
2012-11-26  3:33                                                                 ` Bhupesh SHARMA
2012-11-21 14:52                                     ` Michael Pellegrini
2012-11-21 15:02                                       ` Wolfgang Grandegger
2012-11-15 16:32     ` Casper Mogensen [this message]
2012-11-15 21:16       ` Wolfgang Grandegger
2012-11-16 19:39     ` Wolfgang Grandegger
2012-11-15 16:12   ` Michael Pellegrini
2012-11-20 18:59     ` Wolfgang Grandegger
2012-11-15 12:35 ` Steffen Rose
2012-11-15 18:26   ` Michael Pellegrini
2012-11-16  8:24     ` Steffen Rose

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=CABgkGoGYGpefppHUCnBZQQRX8Nn5_AnVdDPQ-gHs4H7vyVOVXQ@mail.gmail.com \
    --to=casper.mogensen@gmail.com \
    --cc=alexander.stein@systec-electronic.com \
    --cc=bhupesh.sharma@st.com \
    --cc=federico.vaga@gmail.com \
    --cc=giancarlo.asnaghi@st.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mikep86@gmail.com \
    --cc=socketcan@hartkopp.net \
    --cc=tomoya.rohm@gmail.com \
    --cc=wg@grandegger.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.