From: Torin Cooper-Bennun <torin@maxiluxsystems.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org
Subject: Re: [PATCH RFC] can: m_can: m_can_tx_work_queue(): fix tx_skb race condition
Date: Wed, 5 May 2021 13:06:59 +0100 [thread overview]
Message-ID: <20210505120659.bconnblkp5lhd52t@bigthink> (raw)
In-Reply-To: <20210505114302.1241971-1-mkl@pengutronix.de>
On Wed, May 05, 2021 at 01:43:02PM +0200, Marc Kleine-Budde wrote:
> The m_can_start_xmit() function checks if the cdev->tx_skb is NULL and
> returns with NETDEV_TX_BUSY in case tx_sbk is not NULL.
>
> There is a race condition in the m_can_tx_work_queue(), where first
> the skb is send to the driver and then the case tx_sbk is set to NULL.
> A TX complete IRQ might come in between and wake the queue, which
> results in tx_skb not being cleared yet.
>
> Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework")
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> Hello,
>
> compile time tested only.
>
> Marc
Thanks a lot for spotting this Marc, after initial testing this is
working very well. I don't see that error message at all now, even at
very high transmit rates, and dropped frames are reduced considerably.
(Test setup: RPi CM4, TCAN4550, 500 kbit/s CAN-FD.)
--
Regards,
Torin Cooper-Bennun
Software Engineer | maxiluxsystems.com
next prev parent reply other threads:[~2021-05-05 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 11:43 [PATCH RFC] can: m_can: m_can_tx_work_queue(): fix tx_skb race condition Marc Kleine-Budde
2021-05-05 12:06 ` Torin Cooper-Bennun [this message]
2021-05-05 12:35 ` Marc Kleine-Budde
2021-05-05 12:46 ` Torin Cooper-Bennun
2021-05-05 12:50 ` 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=20210505120659.bconnblkp5lhd52t@bigthink \
--to=torin@maxiluxsystems.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
/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