]> git.baikalelectronics.ru Git - kernel.git/commit
can: bcm: use call_rcu() instead of costly synchronize_rcu()
authorOliver Hartkopp <socketcan@hartkopp.net>
Fri, 20 May 2022 18:32:39 +0000 (20:32 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 4 Jul 2022 08:33:39 +0000 (10:33 +0200)
commit1d5069b162a7b1b135f24c0afe09bfb7e45f0b11
tree0f694194df3c23161ed53d97fb2a8b40436e9a6a
parent1ed79d3104288e1eabd382ad41da890556acc0f0
can: bcm: use call_rcu() instead of costly synchronize_rcu()

In commit 6030cadc5cc6 ("can: bcm: delay release of struct bcm_op
after synchronize_rcu()") Thadeu Lima de Souza Cascardo introduced two
synchronize_rcu() calls in bcm_release() (only once at socket close)
and in bcm_delete_rx_op() (called on removal of each single bcm_op).

Unfortunately this slow removal of the bcm_op's affects user space
applications like cansniffer where the modification of a filter
removes 2048 bcm_op's which blocks the cansniffer application for
40(!) seconds.

In commit 15ce8f3833d3 ("can: gw: use call_rcu() instead of costly
synchronize_rcu()") Eric Dumazet replaced the synchronize_rcu() calls
with several call_rcu()'s to safely remove the data structures after
the removal of CAN ID subscriptions with can_rx_unregister() calls.

This patch adopts Erics approach for the can-bcm which should be
applicable since the removal of tasklet_kill() in bcm_remove_op() and
the introduction of the HRTIMER_MODE_SOFT timer handling in Linux 5.4.

Fixes: 6030cadc5cc6 ("can: bcm: delay release of struct bcm_op after synchronize_rcu()") # >= 5.4
Link: https://lore.kernel.org/all/20220520183239.19111-1-socketcan@hartkopp.net
Cc: stable@vger.kernel.org
Cc: Eric Dumazet <edumazet@google.com>
Cc: Norbert Slusarek <nslusarek@gmx.net>
Cc: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
net/can/bcm.c