From: Wolfgang Grandegger <wg@grandegger.com>
To: Michael Pellegrini <mikep86@gmail.com>
Cc: linux-can@vger.kernel.org
Subject: Re: pch_can: Data transmission stops after dropped packet
Date: Sun, 25 Nov 2012 17:17:31 +0100 [thread overview]
Message-ID: <50B2449B.8060708@grandegger.com> (raw)
In-Reply-To: <loom.20121123T184133-638@post.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1890 bytes --]
Hi Michael,
On 11/23/2012 06:52 PM, Michael Pellegrini wrote:
> Wolfgang Grandegger <wg <at> grandegger.com> writes:
>
>>> That's clear. Therefore please remove that printk for testing. For a
>>> quick test could you please add spin_locks to c_can_do_rx_poll() similar
>>> to c_can_do_tx(). My suspicion is that there is a race in accessing the
>>> message ram. There is this infamous c_can_msg_obj_is_busy() in
>>> c_can_object_get() and c_can_object_put().
>>
>> And please use:
>>
>> CONFIG_CAN_DEBUG_DEVICES=y CONFIG_CAN_C_CAN_PCI=m make -C
>> /usr/src/linux-headers-`uname -r` SUBDIRS=`pwd` modules
>>
>> otherwise we will not have debug messages.
>
> Ok, I've applied the following patch:
>
> *** ../c-can-pci-v5/c_can.c 2012-11-21 14:47:03.000000000 -0500
> --- ./c_can.c 2012-11-23 12:27:05.946016919 -0500
> *************** static int c_can_do_rx_poll(struct net_d
> *** 795,800 ****
> --- 795,803 ----
> unsigned int msg_obj, msg_ctrl_save;
> struct c_can_priv *priv = netdev_priv(dev);
> u32 val = c_can_read_reg32(priv, C_CAN_INTPND1_REG);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&priv->lock, flags);
>
> for (msg_obj = C_CAN_MSG_OBJ_RX_FIRST;
> msg_obj <= C_CAN_MSG_OBJ_RX_LAST && quota > 0;
> *************** static int c_can_do_rx_poll(struct net_d
> *** 843,848 ****
> --- 846,853 ----
> }
> }
>
> + spin_unlock_irqrestore(&priv->lock, flags);
> +
> return num_rx_pkts;
> }
There is a return in the critical section which must also be handled.
Hope you didn't hit it...
I have attached v7 fixing this issue. Furthermore I have added spinlock
protection to the PCH driver. It needs fixing, even if I want to get
ride of it as soon as possible. Could you please give this driver a try
as well? The README tells how to build the modules. I will also send my
current patch stack for the record (and feedback).
Wolfgang.
[-- Attachment #2: c-can-pci-v7.tar.bz2 --]
[-- Type: application/x-bzip, Size: 16825 bytes --]
next prev parent reply other threads:[~2012-11-25 16:17 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 [this message]
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
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=50B2449B.8060708@grandegger.com \
--to=wg@grandegger.com \
--cc=linux-can@vger.kernel.org \
--cc=mikep86@gmail.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.