[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55043A7E.7040001@pengutronix.de>
Date: Sat, 14 Mar 2015 14:41:18 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: "Ahmed S. Darwish" <darwish.07@...il.com>,
Olivier Sobrie <olivier@...rie.be>,
Oliver Hartkopp <socketcan@...tkopp.net>,
Wolfgang Grandegger <wg@...ndegger.com>,
Andri Yngvason <andri.yngvason@...el.com>
CC: Linux-CAN <linux-can@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, netdev@...r.kernel.org
Subject: Re: [PATCH v4 1/3] can: kvaser_usb: Fix tx queue start/stop
race conditions
On 03/14/2015 02:02 PM, Ahmed S. Darwish wrote:
> From: Ahmed S. Darwish <ahmed.darwish@...eo.com>
>
> A number of tx queue wake-up events went missing due to the
> outlined scenario below. Start state is a pool of 16 tx URBs,
> active tx_urbs count = 15, with the netdev tx queue open.
>
> CPU #1 [softirq] CPU #2 [softirq]
> start_xmit() tx_acknowledge()
> ................ ................
>
> atomic_inc(&tx_urbs);
> if (atomic_read(&tx_urbs) >= 16) {
> -->
> atomic_dec(&tx_urbs);
> netif_wake_queue();
> return;
> <--
> netif_stop_queue();
> }
>
> At the end, the correct state expected is a 15 tx_urbs count
> value with the tx queue state _open_. Due to the race, we get
> the same tx_urbs value but with the tx queue state _stopped_.
> The wake-up event is completely lost.
>
> Thus avoid hand-rolled concurrency mechanisms and use a proper
> lock for contexts and tx queue protection.
>
> Signed-off-by: Ahmed S. Darwish <ahmed.darwish@...eo.com>
Applied to can. This will go into David's net tree and finally into
net-next. Then I'll apply patches 2+3. Nag me, if I forget about them ;)
Thanks,
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 |
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists