All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
@ 2023-03-15 18:18 Joel Fernandes (Google)
  2023-03-15 18:18 ` [PATCH v2 02/14] misc: vmw_vmci: " Joel Fernandes (Google)
                   ` (13 more replies)
  0 siblings, 14 replies; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Philipp Reisner, Lars Ellenberg, Christoph Böhmwalder, Jens Axboe
  Cc: Uladzislau Rezki (Sony),
	Paul E . McKenney, Joel Fernandes, drbd-dev, linux-block,
	linux-kernel

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
switch to the new kvfree_rcu_mightsleep() variant. The goal is to
avoid accidental use of the single-argument forms, which can introduce
functionality bugs in atomic contexts and latency bugs in non-atomic
contexts.

Cc: Jens Axboe <axboe@kernel.dk>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 drivers/block/drbd/drbd_nl.c       | 6 +++---
 drivers/block/drbd/drbd_receiver.c | 4 ++--
 drivers/block/drbd/drbd_state.c    | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 60757ac31701..f49f2a5282e1 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1615,7 +1615,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)
 			drbd_send_sync_param(peer_device);
 	}
 
-	kvfree_rcu(old_disk_conf);
+	kvfree_rcu_mightsleep(old_disk_conf);
 	kfree(old_plan);
 	mod_timer(&device->request_timer, jiffies + HZ);
 	goto success;
@@ -2446,7 +2446,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
 
 	mutex_unlock(&connection->resource->conf_update);
 	mutex_unlock(&connection->data.mutex);
-	kvfree_rcu(old_net_conf);
+	kvfree_rcu_mightsleep(old_net_conf);
 
 	if (connection->cstate >= C_WF_REPORT_PARAMS) {
 		struct drbd_peer_device *peer_device;
@@ -2860,7 +2860,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info)
 		new_disk_conf->disk_size = (sector_t)rs.resize_size;
 		rcu_assign_pointer(device->ldev->disk_conf, new_disk_conf);
 		mutex_unlock(&device->resource->conf_update);
-		kvfree_rcu(old_disk_conf);
+		kvfree_rcu_mightsleep(old_disk_conf);
 		new_disk_conf = NULL;
 	}
 
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 757f4692b5bd..e197b2a465d2 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3759,7 +3759,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
 		drbd_info(connection, "peer data-integrity-alg: %s\n",
 			  integrity_alg[0] ? integrity_alg : "(none)");
 
-	kvfree_rcu(old_net_conf);
+	kvfree_rcu_mightsleep(old_net_conf);
 	return 0;
 
 disconnect_rcu_unlock:
@@ -4127,7 +4127,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
 
 			rcu_assign_pointer(device->ldev->disk_conf, new_disk_conf);
 			mutex_unlock(&connection->resource->conf_update);
-			kvfree_rcu(old_disk_conf);
+			kvfree_rcu_mightsleep(old_disk_conf);
 
 			drbd_info(device, "Peer sets u_size to %lu sectors (old: %lu)\n",
 				 (unsigned long)p_usize, (unsigned long)my_usize);
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c
index 75d13ea0024f..2aeea295fa28 100644
--- a/drivers/block/drbd/drbd_state.c
+++ b/drivers/block/drbd/drbd_state.c
@@ -2071,7 +2071,7 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)
 		conn_free_crypto(connection);
 		mutex_unlock(&connection->resource->conf_update);
 
-		kvfree_rcu(old_conf);
+		kvfree_rcu_mightsleep(old_conf);
 	}
 
 	if (ns_max.susp_fen) {
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 02/14] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-16  6:50   ` Greg Kroah-Hartman
  2023-03-15 18:18 ` [PATCH v2 03/14] tracing: " Joel Fernandes (Google)
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Bryan Tan, Vishnu Dasa, VMware PV-Drivers Reviewers,
	Arnd Bergmann, Greg Kroah-Hartman
  Cc: Uladzislau Rezki (Sony), Paul E . McKenney, Joel Fernandes, linux-kernel

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
switch to the new kvfree_rcu_mightsleep() variant. The goal is to
avoid accidental use of the single-argument forms, which can introduce
functionality bugs in atomic contexts and latency bugs in non-atomic
contexts.

Cc: Bryan Tan <bryantan@vmware.com>
Cc: Vishnu Dasa <vdasa@vmware.com>
Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 drivers/misc/vmw_vmci/vmci_context.c | 2 +-
 drivers/misc/vmw_vmci/vmci_event.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c
index 172696abce31..f22b44827e92 100644
--- a/drivers/misc/vmw_vmci/vmci_context.c
+++ b/drivers/misc/vmw_vmci/vmci_context.c
@@ -687,7 +687,7 @@ int vmci_ctx_remove_notification(u32 context_id, u32 remote_cid)
 	spin_unlock(&context->lock);
 
 	if (notifier)
-		kvfree_rcu(notifier);
+		kvfree_rcu_mightsleep(notifier);
 
 	vmci_ctx_put(context);
 
diff --git a/drivers/misc/vmw_vmci/vmci_event.c b/drivers/misc/vmw_vmci/vmci_event.c
index 2100297c94ad..5d7ac07623c2 100644
--- a/drivers/misc/vmw_vmci/vmci_event.c
+++ b/drivers/misc/vmw_vmci/vmci_event.c
@@ -209,7 +209,7 @@ int vmci_event_unsubscribe(u32 sub_id)
 	if (!s)
 		return VMCI_ERROR_NOT_FOUND;
 
-	kvfree_rcu(s);
+	kvfree_rcu_mightsleep(s);
 
 	return VMCI_SUCCESS;
 }
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 03/14] tracing: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
  2023-03-15 18:18 ` [PATCH v2 02/14] misc: vmw_vmci: " Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-16  7:38   ` Daniel Bristot de Oliveira
  2023-03-15 18:18 ` [PATCH v2 04/14] lib/test_vmalloc.c: " Joel Fernandes (Google)
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Steven Rostedt, Daniel Bristot de Oliveira, Masami Hiramatsu
  Cc: Uladzislau Rezki (Sony),
	Paul E . McKenney, Joel Fernandes, linux-kernel,
	linux-trace-kernel

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
switch to the new kvfree_rcu_mightsleep() variant. The goal is to
avoid accidental use of the single-argument forms, which can introduce
functionality bugs in atomic contexts and latency bugs in non-atomic
contexts.

Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 kernel/trace/trace_osnoise.c | 2 +-
 kernel/trace/trace_probe.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 04f0fdae19a1..f68ca1e6460f 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -159,7 +159,7 @@ static void osnoise_unregister_instance(struct trace_array *tr)
 	if (!found)
 		return;
 
-	kvfree_rcu(inst);
+	kvfree_rcu_mightsleep(inst);
 }
 
 /*
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 20d0c4a97633..2d2616678295 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -1172,7 +1172,7 @@ int trace_probe_remove_file(struct trace_probe *tp,
 		return -ENOENT;
 
 	list_del_rcu(&link->list);
-	kvfree_rcu(link);
+	kvfree_rcu_mightsleep(link);
 
 	if (list_empty(&tp->event->files))
 		trace_probe_clear_flag(tp, TP_FLAG_TRACE);
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 04/14] lib/test_vmalloc.c: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
  2023-03-15 18:18 ` [PATCH v2 02/14] misc: vmw_vmci: " Joel Fernandes (Google)
  2023-03-15 18:18 ` [PATCH v2 03/14] tracing: " Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-15 18:18 ` [PATCH v2 05/14] net/sysctl: " Joel Fernandes (Google)
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  Cc: Uladzislau Rezki (Sony), Paul E . McKenney, Joel Fernandes, linux-kernel

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
switch to the new kvfree_rcu_mightsleep() variant. The goal is to
avoid accidental use of the single-argument forms, which can introduce
functionality bugs in atomic contexts and latency bugs in non-atomic
contexts.

Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 lib/test_vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c
index de4ee0d50906..cd2bdba6d3ed 100644
--- a/lib/test_vmalloc.c
+++ b/lib/test_vmalloc.c
@@ -334,7 +334,7 @@ kvfree_rcu_1_arg_vmalloc_test(void)
 			return -1;
 
 		p->array[0] = 'a';
-		kvfree_rcu(p);
+		kvfree_rcu_mightsleep(p);
 	}
 
 	return 0;
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 05/14] net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (2 preceding siblings ...)
  2023-03-15 18:18 ` [PATCH v2 04/14] lib/test_vmalloc.c: " Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-26 12:28   ` Joel Fernandes
  2023-03-15 18:18 ` [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Uladzislau Rezki (Sony),
	Paul E . McKenney, Joel Fernandes, netdev, linux-kernel

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
of the single-argument forms, which can introduce functionality bugs in
atomic contexts and latency bugs in non-atomic contexts.

Cc: Eric Dumazet <edumazet@google.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 net/core/sysctl_net_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 74842b453407..782273bb93c2 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -177,7 +177,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
 			if (orig_sock_table) {
 				static_branch_dec(&rps_needed);
 				static_branch_dec(&rfs_needed);
-				kvfree_rcu(orig_sock_table);
+				kvfree_rcu_mightsleep(orig_sock_table);
 			}
 		}
 	}
@@ -215,7 +215,7 @@ static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
 				     lockdep_is_held(&flow_limit_update_mutex));
 			if (cur && !cpumask_test_cpu(i, mask)) {
 				RCU_INIT_POINTER(sd->flow_limit, NULL);
-				kfree_rcu(cur);
+				kfree_rcu_mightsleep(cur);
 			} else if (!cur && cpumask_test_cpu(i, mask)) {
 				cur = kzalloc_node(len, GFP_KERNEL,
 						   cpu_to_node(i));
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (3 preceding siblings ...)
  2023-03-15 18:18 ` [PATCH v2 05/14] net/sysctl: " Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-26 12:34   ` Joel Fernandes
  2023-03-15 18:18 ` [PATCH v2 07/14] ext4/super: " Joel Fernandes (Google)
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Boris Pismenny
  Cc: Uladzislau Rezki (Sony),
	Ariel Levkovich, Vlad Buslov, Paul E . McKenney, Joel Fernandes,
	netdev, linux-rdma, linux-kernel

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
of the single-argument forms, which can introduce functionality bugs in
atomic contexts and latency bugs in non-atomic contexts.

Cc: Ariel Levkovich <lariel@nvidia.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>
Cc: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c  | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c
index ca834bbcb44f..8afcec0c5d3c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c
@@ -242,7 +242,7 @@ mlx5e_int_port_remove(struct mlx5e_tc_int_port_priv *priv,
 		mlx5_del_flow_rules(int_port->rx_rule);
 	mapping_remove(ctx, int_port->mapping);
 	mlx5e_int_port_metadata_free(priv, int_port->match_metadata);
-	kfree_rcu(int_port);
+	kfree_rcu_mightsleep(int_port);
 	priv->num_ports--;
 }
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
index 08d0929e8260..b811dad7370a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
@@ -670,7 +670,7 @@ static int mlx5e_macsec_del_txsa(struct macsec_context *ctx)
 
 	mlx5e_macsec_cleanup_sa(macsec, tx_sa, true);
 	mlx5_destroy_encryption_key(macsec->mdev, tx_sa->enc_key_id);
-	kfree_rcu(tx_sa);
+	kfree_rcu_mightsleep(tx_sa);
 	macsec_device->tx_sa[assoc_num] = NULL;
 
 out:
@@ -849,7 +849,7 @@ static void macsec_del_rxsc_ctx(struct mlx5e_macsec *macsec, struct mlx5e_macsec
 	xa_erase(&macsec->sc_xarray, rx_sc->sc_xarray_element->fs_id);
 	metadata_dst_free(rx_sc->md_dst);
 	kfree(rx_sc->sc_xarray_element);
-	kfree_rcu(rx_sc);
+	kfree_rcu_mightsleep(rx_sc);
 }
 
 static int mlx5e_macsec_del_rxsc(struct macsec_context *ctx)
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 07/14] ext4/super: Rename kfree_rcu() to kfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (4 preceding siblings ...)
  2023-03-15 18:18 ` [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep() Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-15 19:07   ` Theodore Ts'o
  2023-03-15 18:18 ` [PATCH v2 08/14] rcuscale: " Joel Fernandes (Google)
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger
  Cc: Uladzislau Rezki (Sony),
	Lukas Czerner, Paul E . McKenney, Joel Fernandes, linux-ext4,
	linux-kernel

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
of the single-argument forms, which can introduce functionality bugs in
atomic contexts and latency bugs in non-atomic contexts.

Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 fs/ext4/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 88f7b8a88c76..405a66b47311 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2500,7 +2500,7 @@ static void ext4_apply_quota_options(struct fs_context *fc,
 			qname = rcu_replace_pointer(sbi->s_qf_names[i], qname,
 						lockdep_is_held(&sb->s_umount));
 			if (qname)
-				kfree_rcu(qname);
+				kfree_rcu_mightsleep(qname);
 		}
 	}
 
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 08/14] rcuscale: Rename kfree_rcu() to kfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (5 preceding siblings ...)
  2023-03-15 18:18 ` [PATCH v2 07/14] ext4/super: " Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-15 18:18 ` [PATCH v2 09/14] torture: Enable clocksource watchdog with "tsc=watchdog" Joel Fernandes (Google)
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Davidlohr Bueso, Paul E. McKenney, Josh Triplett,
	Frederic Weisbecker, Neeraj Upadhyay, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes
  Cc: Uladzislau Rezki (Sony), linux-kernel, rcu

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
of the single-argument forms, which can introduce functionality bugs in
atomic contexts and latency bugs in non-atomic contexts.

Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 kernel/rcu/rcuscale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index 91fb5905a008..98b75995b680 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -716,7 +716,7 @@ kfree_scale_thread(void *arg)
 			// is tested.
 			if ((kfree_rcu_test_single && !kfree_rcu_test_double) ||
 					(kfree_rcu_test_both && torture_random(&tr) & 0x800))
-				kfree_rcu(alloc_ptr);
+				kfree_rcu_mightsleep(alloc_ptr);
 			else
 				kfree_rcu(alloc_ptr, rh);
 		}
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 09/14] torture: Enable clocksource watchdog with "tsc=watchdog"
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (6 preceding siblings ...)
  2023-03-15 18:18 ` [PATCH v2 08/14] rcuscale: " Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-15 18:18 ` [PATCH v2 10/14] rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels Joel Fernandes (Google)
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Shuah Khan
  Cc: Joel Fernandes, rcu, linux-kselftest, linux-kernel

From: "Paul E. McKenney" <paulmck@kernel.org>

This commit tests the "tsc=watchdog" kernel boot parameter when running
the clocksourcewd torture tests.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index 130d0de4c3bb..5a2ae2264403 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -497,16 +497,16 @@ fi
 
 if test "$do_clocksourcewd" = "yes"
 then
-	torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000"
+	torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000 tsc=watchdog"
 	torture_set "clocksourcewd-1" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 45s --configs TREE03 --kconfig "CONFIG_TEST_CLOCKSOURCE_WATCHDOG=y" --trust-make
 
-	torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000 clocksource.max_cswd_read_retries=1"
+	torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000 clocksource.max_cswd_read_retries=1 tsc=watchdog"
 	torture_set "clocksourcewd-2" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 45s --configs TREE03 --kconfig "CONFIG_TEST_CLOCKSOURCE_WATCHDOG=y" --trust-make
 
 	# In case our work is already done...
 	if test "$do_rcutorture" != "yes"
 	then
-		torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000"
+		torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000 tsc=watchdog"
 		torture_set "clocksourcewd-3" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 45s --configs TREE03 --trust-make
 	fi
 fi
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 10/14] rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (7 preceding siblings ...)
  2023-03-15 18:18 ` [PATCH v2 09/14] torture: Enable clocksource watchdog with "tsc=watchdog" Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-15 18:18 ` [PATCH v2 11/14] rcu/kvfree: Eliminate k[v]free_rcu() single argument macro Joel Fernandes (Google)
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Davidlohr Bueso, Paul E. McKenney, Josh Triplett,
	Frederic Weisbecker, Neeraj Upadhyay, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes
  Cc: Zqiang, linux-kernel, rcu

From: Zqiang <qiang1.zhang@intel.com>

Given a non-zero rcutorture.nocbs_nthreads module parameter, the specified
number of nocb kthreads will be created, regardless of whether or not
the RCU implementation under test is capable of offloading callbacks.
Please note that even vanilla RCU is incapable of offloading in kernels
built with CONFIG_RCU_NOCB_CPU=n.  And when the RCU implementation is
incapable of offloading callbacks, there is no point in creating those
kthreads.

This commit therefore checks the cur_ops.torture_type module parameter and
CONFIG_RCU_NOCB_CPU Kconfig option in order to avoid creating unnecessary
nocb tasks.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 kernel/rcu/rcutorture.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 8e6c023212cb..83870c4ae1b8 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -3501,6 +3501,12 @@ rcu_torture_init(void)
 		pr_alert("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n");
 		fqs_duration = 0;
 	}
+	if (nocbs_nthreads != 0 && (cur_ops != &rcu_ops ||
+					!IS_ENABLED(CONFIG_RCU_NOCB_CPU))) {
+		pr_alert("rcu-torture types: %s and CONFIG_RCU_NOCB_CPU=%d, nocb toggle disabled.\n",
+				cur_ops->name, IS_ENABLED(CONFIG_RCU_NOCB_CPU));
+		nocbs_nthreads = 0;
+	}
 	if (cur_ops->init)
 		cur_ops->init();
 
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 11/14] rcu/kvfree: Eliminate k[v]free_rcu() single argument macro
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (8 preceding siblings ...)
  2023-03-15 18:18 ` [PATCH v2 10/14] rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-15 18:18 ` [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Paul E. McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Joel Fernandes
  Cc: Uladzislau Rezki (Sony), rcu, linux-kernel

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

The kvfree_rcu() and kfree_rcu() APIs are hazardous in that if you forget
the second argument, it works, but might sleep.  This sleeping can be a
correctness bug from atomic contexts, and even in non-atomic contexts it
might introduce unacceptable latencies.  This commit therefore removes the
single-argument kvfree_rcu() and kfree_rcu() macros.  Code that would have
previously used these single-argument kvfree_rcu() and kfree_rcu() macros
should instead use kvfree_rcu_mightsleep() or kfree_rcu_mightsleep().

[ paulmck: Apply Joel Fernandes feedback. ]

Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 include/linux/rcupdate.h | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 094321c17e48..7571dbfecb18 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -957,9 +957,8 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
 
 /**
  * kfree_rcu() - kfree an object after a grace period.
- * @ptr: pointer to kfree for both single- and double-argument invocations.
- * @rhf: the name of the struct rcu_head within the type of @ptr,
- *       but only for double-argument invocations.
+ * @ptr: pointer to kfree for double-argument invocations.
+ * @rhf: the name of the struct rcu_head within the type of @ptr.
  *
  * Many rcu callbacks functions just call kfree() on the base structure.
  * These functions are trivial, but their size adds up, and furthermore
@@ -982,26 +981,18 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
  * The BUILD_BUG_ON check must not involve any function calls, hence the
  * checks are done in macros here.
  */
-#define kfree_rcu(ptr, rhf...) kvfree_rcu(ptr, ## rhf)
+#define kfree_rcu(ptr, rhf) kvfree_rcu_arg_2(ptr, rhf)
+#define kvfree_rcu(ptr, rhf) kvfree_rcu_arg_2(ptr, rhf)
 
 /**
- * kvfree_rcu() - kvfree an object after a grace period.
- *
- * This macro consists of one or two arguments and it is
- * based on whether an object is head-less or not. If it
- * has a head then a semantic stays the same as it used
- * to be before:
- *
- *     kvfree_rcu(ptr, rhf);
- *
- * where @ptr is a pointer to kvfree(), @rhf is the name
- * of the rcu_head structure within the type of @ptr.
+ * kfree_rcu_mightsleep() - kfree an object after a grace period.
+ * @ptr: pointer to kfree for single-argument invocations.
  *
  * When it comes to head-less variant, only one argument
  * is passed and that is just a pointer which has to be
  * freed after a grace period. Therefore the semantic is
  *
- *     kvfree_rcu(ptr);
+ *     kfree_rcu_mightsleep(ptr);
  *
  * where @ptr is the pointer to be freed by kvfree().
  *
@@ -1010,13 +1001,9 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
  * annotation. Otherwise, please switch and embed the
  * rcu_head structure within the type of @ptr.
  */
-#define kvfree_rcu(...) KVFREE_GET_MACRO(__VA_ARGS__,		\
-	kvfree_rcu_arg_2, kvfree_rcu_arg_1)(__VA_ARGS__)
-
+#define kfree_rcu_mightsleep(ptr) kvfree_rcu_arg_1(ptr)
 #define kvfree_rcu_mightsleep(ptr) kvfree_rcu_arg_1(ptr)
-#define kfree_rcu_mightsleep(ptr) kvfree_rcu_mightsleep(ptr)
 
-#define KVFREE_GET_MACRO(_1, _2, NAME, ...) NAME
 #define kvfree_rcu_arg_2(ptr, rhf)					\
 do {									\
 	typeof (ptr) ___p = (ptr);					\
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (9 preceding siblings ...)
  2023-03-15 18:18 ` [PATCH v2 11/14] rcu/kvfree: Eliminate k[v]free_rcu() single argument macro Joel Fernandes (Google)
@ 2023-03-15 18:18 ` Joel Fernandes (Google)
  2023-03-16 16:41   ` Stefan Schmidt
  2023-03-15 18:19 ` [PATCH v2 13/14] RDMA/rxe: " Joel Fernandes (Google)
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:18 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, Miquel Raynal, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Girault
  Cc: Joel Fernandes (Google),
	Paul E . McKenney, Alexander Aring, linux-wpan, netdev,
	linux-kernel

The k[v]free_rcu() macro's single-argument form is deprecated.
Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
is to avoid accidental use of the single-argument forms, which can
introduce functionality bugs in atomic contexts and latency bugs in
non-atomic contexts.

The callers are holding a mutex so the context allows blocking. Hence
using the API with a single argument will be fine, but use its new name.

There is no functionality change with this patch.

Fixes: 57588c71177f ("mac802154: Handle passive scanning")
Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 net/mac802154/scan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac802154/scan.c b/net/mac802154/scan.c
index 9b0933a185eb..5c191bedd72c 100644
--- a/net/mac802154/scan.c
+++ b/net/mac802154/scan.c
@@ -52,7 +52,7 @@ static int mac802154_scan_cleanup_locked(struct ieee802154_local *local,
 	request = rcu_replace_pointer(local->scan_req, NULL, 1);
 	if (!request)
 		return 0;
-	kfree_rcu(request);
+	kvfree_rcu_mightsleep(request);
 
 	/* Advertize first, while we know the devices cannot be removed */
 	if (aborted)
@@ -403,7 +403,7 @@ int mac802154_stop_beacons_locked(struct ieee802154_local *local,
 	request = rcu_replace_pointer(local->beacon_req, NULL, 1);
 	if (!request)
 		return 0;
-	kfree_rcu(request);
+	kvfree_rcu_mightsleep(request);
 
 	nl802154_beaconing_done(wpan_dev);
 
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (10 preceding siblings ...)
  2023-03-15 18:18 ` [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
@ 2023-03-15 18:19 ` Joel Fernandes (Google)
  2023-03-15 18:38   ` Bob Pearson
  2023-03-15 18:19 ` [PATCH v2 14/14] checkpatch: Error out if deprecated RCU API used Joel Fernandes (Google)
  2023-03-26 12:27 ` [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes
  13 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:19 UTC (permalink / raw)
  To: Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky, Devesh Sharma, Bob Pearson
  Cc: Joel Fernandes (Google),
	Paul E . McKenney, Zhu Yanjun, linux-rdma, linux-kernel

The k[v]free_rcu() macro's single-argument form is deprecated.
Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
is to avoid accidental use of the single-argument forms, which can
introduce functionality bugs in atomic contexts and latency bugs in
non-atomic contexts.

There is no functionality change with this patch.

Link: https://lore.kernel.org/rcu/20230201150815.409582-1-urezki@gmail.com
Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com>
Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Fixes: 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
index b10aa1580a64..ae3a100e18fb 100644
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
 		return -EINVAL;
 
 	rxe_cleanup(mr);
-	kfree_rcu(mr);
+	kfree_rcu_mightsleep(mr);
 	return 0;
 }
 
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v2 14/14] checkpatch: Error out if deprecated RCU API used
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (11 preceding siblings ...)
  2023-03-15 18:19 ` [PATCH v2 13/14] RDMA/rxe: " Joel Fernandes (Google)
@ 2023-03-15 18:19 ` Joel Fernandes (Google)
  2023-03-16  3:49   ` Paul E. McKenney
  2023-03-26 12:27 ` [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes
  13 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-15 18:19 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn
  Cc: Joel Fernandes (Google), linux-kernel

Single-argument kvfree_rcu() usage is being deprecated [1] [2]. However,
till all users are converted, we would like to introduce checkpatch
errors for new patches submitted.

This patch adds support for the same. Tested with a trial patch.

For now, we are only considering usages that don't have compound
nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name).
This is sufficient as such usages are unlikely.

Once all users are converted and we remove the old API, we can also revert this
checkpatch patch then.

[1] https://lore.kernel.org/rcu/CAEXW_YRhHaVuq+5f+VgCZM=SF+9xO+QXaxe0yE7oA9iCXK-XPg@mail.gmail.com/
[2] https://lore.kernel.org/rcu/CAEXW_YSY=q2_uaE2qo4XSGjzs4+C102YMVJ7kWwuT5LGmJGGew@mail.gmail.com/

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 scripts/checkpatch.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bd44d12965c9..9da0a3cb1615 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6388,6 +6388,15 @@ sub process {
 			}
 		}
 
+# check for soon-to-be-deprecated single-argument k[v]free_rcu() API
+		if ($line =~ /\bk[v]?free_rcu\s*\([^(]+\)/) {
+			if ($line =~ /\bk[v]?free_rcu\s*\([^,]+\)/) {
+				ERROR("DEPRECATED_API",
+				      "Single-argument k[v]free_rcu() API is deprecated, please call the API with an rcu_head object passed, like: k[v]free_rcu(object_ptr, rcu_head_name);  " . $herecurr);
+			}
+		}
+
+
 # check for unnecessary "Out of Memory" messages
 		if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
 		    $prevline =~ /^[ \+]\s*if\s*\(\s*(\!\s*|NULL\s*==\s*)?($Lval)(\s*==\s*NULL\s*)?\s*\)/ &&
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:19 ` [PATCH v2 13/14] RDMA/rxe: " Joel Fernandes (Google)
@ 2023-03-15 18:38   ` Bob Pearson
  2023-03-15 18:41     ` Joel Fernandes
  0 siblings, 1 reply; 35+ messages in thread
From: Bob Pearson @ 2023-03-15 18:38 UTC (permalink / raw)
  To: Joel Fernandes (Google),
	Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky, Devesh Sharma
  Cc: Paul E . McKenney, Zhu Yanjun, linux-rdma, linux-kernel

On 3/15/23 13:19, Joel Fernandes (Google) wrote:
> The k[v]free_rcu() macro's single-argument form is deprecated.
> Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
> is to avoid accidental use of the single-argument forms, which can
> introduce functionality bugs in atomic contexts and latency bugs in
> non-atomic contexts.
> 
> There is no functionality change with this patch.
> 
> Link: https://lore.kernel.org/rcu/20230201150815.409582-1-urezki@gmail.com
> Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com>
> Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> Fixes: 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
> index b10aa1580a64..ae3a100e18fb 100644
> --- a/drivers/infiniband/sw/rxe/rxe_mr.c
> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
> @@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
>  		return -EINVAL;
>  
>  	rxe_cleanup(mr);
> -	kfree_rcu(mr);
> +	kfree_rcu_mightsleep(mr);
>  	return 0;
>  }
>  
Please replace kfree_rcu_mightsleep() by kfree(). There is no need to delay the kfree(mr).

Bob

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:38   ` Bob Pearson
@ 2023-03-15 18:41     ` Joel Fernandes
  2023-03-15 19:05       ` Bob Pearson
  0 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes @ 2023-03-15 18:41 UTC (permalink / raw)
  To: Bob Pearson
  Cc: Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky, Devesh Sharma,
	Paul E . McKenney, Zhu Yanjun, linux-rdma, linux-kernel

On Wed, Mar 15, 2023 at 2:38 PM Bob Pearson <rpearsonhpe@gmail.com> wrote:
>
> On 3/15/23 13:19, Joel Fernandes (Google) wrote:
> > The k[v]free_rcu() macro's single-argument form is deprecated.
> > Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
> > is to avoid accidental use of the single-argument forms, which can
> > introduce functionality bugs in atomic contexts and latency bugs in
> > non-atomic contexts.
> >
> > There is no functionality change with this patch.
> >
> > Link: https://lore.kernel.org/rcu/20230201150815.409582-1-urezki@gmail.com
> > Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com>
> > Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
> > Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> > Fixes: 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")
> > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> > ---
> >  drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
> > index b10aa1580a64..ae3a100e18fb 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_mr.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
> > @@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
> >               return -EINVAL;
> >
> >       rxe_cleanup(mr);
> > -     kfree_rcu(mr);
> > +     kfree_rcu_mightsleep(mr);
> >       return 0;
> >  }
> >
> Please replace kfree_rcu_mightsleep() by kfree(). There is no need to delay the kfree(mr).

I thought you said either was Ok, but yeah that's fine with me. I was
trying to play it safe ;-). An extra GP may not hurt, but not having
one when it is needed might. I will update it to just be kfree.

<quote>
>   rxe_cleanup(mr);
> - kfree_rcu(mr);
> + kfree_rcu_mightsleep(mr);
>   return 0;
>  }
>

I would prefer just
- kfree_rcu(mr);
+ kfree(mr);

but either one will work.
Bob
</quote>

 - Joel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:41     ` Joel Fernandes
@ 2023-03-15 19:05       ` Bob Pearson
  2023-03-15 19:59         ` Joel Fernandes
  0 siblings, 1 reply; 35+ messages in thread
From: Bob Pearson @ 2023-03-15 19:05 UTC (permalink / raw)
  To: Joel Fernandes
  Cc: Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky, Devesh Sharma,
	Paul E . McKenney, Zhu Yanjun, linux-rdma, linux-kernel

On 3/15/23 13:41, Joel Fernandes wrote:
> On Wed, Mar 15, 2023 at 2:38 PM Bob Pearson <rpearsonhpe@gmail.com> wrote:
>>
>> On 3/15/23 13:19, Joel Fernandes (Google) wrote:
>>> The k[v]free_rcu() macro's single-argument form is deprecated.
>>> Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
>>> is to avoid accidental use of the single-argument forms, which can
>>> introduce functionality bugs in atomic contexts and latency bugs in
>>> non-atomic contexts.
>>>
>>> There is no functionality change with this patch.
>>>
>>> Link: https://lore.kernel.org/rcu/20230201150815.409582-1-urezki@gmail.com
>>> Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com>
>>> Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
>>> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
>>> Fixes: 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")
>>> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
>>> ---
>>>  drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
>>> index b10aa1580a64..ae3a100e18fb 100644
>>> --- a/drivers/infiniband/sw/rxe/rxe_mr.c
>>> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
>>> @@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
>>>               return -EINVAL;
>>>
>>>       rxe_cleanup(mr);
>>> -     kfree_rcu(mr);
>>> +     kfree_rcu_mightsleep(mr);
>>>       return 0;
>>>  }
>>>
>> Please replace kfree_rcu_mightsleep() by kfree(). There is no need to delay the kfree(mr).
> 
> I thought you said either was Ok, but yeah that's fine with me. I was
> trying to play it safe ;-). An extra GP may not hurt, but not having
> one when it is needed might. I will update it to just be kfree.

Thanks. The reason to not add the pause is that it really isn't required and will just make
people think that it is. With the current state of the driver the mr cleanup code will disable
looking up the mr from its rkey or lkey and then wait until all the references to the mr are dropped
before calling kfree. This will always work (unless a new bug is introduced) so no reason to
add the rcu delay.

Bob
> 
> <quote>
>>   rxe_cleanup(mr);
>> - kfree_rcu(mr);
>> + kfree_rcu_mightsleep(mr);
>>   return 0;
>>  }
>>
> 
> I would prefer just
> - kfree_rcu(mr);
> + kfree(mr);
> 
> but either one will work.
> Bob
> </quote>
> 
>  - Joel


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 07/14] ext4/super: Rename kfree_rcu() to kfree_rcu_mightsleep()
  2023-03-15 18:18 ` [PATCH v2 07/14] ext4/super: " Joel Fernandes (Google)
@ 2023-03-15 19:07   ` Theodore Ts'o
  2023-03-16 15:23     ` Joel Fernandes
  0 siblings, 1 reply; 35+ messages in thread
From: Theodore Ts'o @ 2023-03-15 19:07 UTC (permalink / raw)
  To: Joel Fernandes (Google)
  Cc: Andreas Dilger, Uladzislau Rezki (Sony),
	Lukas Czerner, Paul E . McKenney, linux-ext4, linux-kernel

On Wed, Mar 15, 2023 at 06:18:54PM +0000, Joel Fernandes (Google) wrote:
> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
> 
> The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
> deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
> kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
> of the single-argument forms, which can introduce functionality bugs in
> atomic contexts and latency bugs in non-atomic contexts.
> 
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Lukas Czerner <lczerner@redhat.com>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>

Acked-by: Theodore Ts'o <tytso@mit.edu>


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 19:05       ` Bob Pearson
@ 2023-03-15 19:59         ` Joel Fernandes
  0 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes @ 2023-03-15 19:59 UTC (permalink / raw)
  To: Bob Pearson
  Cc: Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky, Devesh Sharma,
	Paul E . McKenney, Zhu Yanjun, linux-rdma, linux-kernel

On Wed, Mar 15, 2023 at 3:05 PM Bob Pearson <rpearsonhpe@gmail.com> wrote:
>
> On 3/15/23 13:41, Joel Fernandes wrote:
> > On Wed, Mar 15, 2023 at 2:38 PM Bob Pearson <rpearsonhpe@gmail.com> wrote:
> >>
> >> On 3/15/23 13:19, Joel Fernandes (Google) wrote:
> >>> The k[v]free_rcu() macro's single-argument form is deprecated.
> >>> Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
> >>> is to avoid accidental use of the single-argument forms, which can
> >>> introduce functionality bugs in atomic contexts and latency bugs in
> >>> non-atomic contexts.
> >>>
> >>> There is no functionality change with this patch.
> >>>
> >>> Link: https://lore.kernel.org/rcu/20230201150815.409582-1-urezki@gmail.com
> >>> Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com>
> >>> Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
> >>> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> >>> Fixes: 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")
> >>> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> >>> ---
> >>>  drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
> >>> index b10aa1580a64..ae3a100e18fb 100644
> >>> --- a/drivers/infiniband/sw/rxe/rxe_mr.c
> >>> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
> >>> @@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
> >>>               return -EINVAL;
> >>>
> >>>       rxe_cleanup(mr);
> >>> -     kfree_rcu(mr);
> >>> +     kfree_rcu_mightsleep(mr);
> >>>       return 0;
> >>>  }
> >>>
> >> Please replace kfree_rcu_mightsleep() by kfree(). There is no need to delay the kfree(mr).
> >
> > I thought you said either was Ok, but yeah that's fine with me. I was
> > trying to play it safe ;-). An extra GP may not hurt, but not having
> > one when it is needed might. I will update it to just be kfree.
>
> Thanks. The reason to not add the pause is that it really isn't required and will just make
> people think that it is. With the current state of the driver the mr cleanup code will disable
> looking up the mr from its rkey or lkey and then wait until all the references to the mr are dropped
> before calling kfree. This will always work (unless a new bug is introduced) so no reason to
> add the rcu delay.
>

Sounds good! I updated it in my queue, and I will repost it in the
future pending test results and other comments.

thanks,

 - Joel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 14/14] checkpatch: Error out if deprecated RCU API used
  2023-03-15 18:19 ` [PATCH v2 14/14] checkpatch: Error out if deprecated RCU API used Joel Fernandes (Google)
@ 2023-03-16  3:49   ` Paul E. McKenney
  0 siblings, 0 replies; 35+ messages in thread
From: Paul E. McKenney @ 2023-03-16  3:49 UTC (permalink / raw)
  To: Joel Fernandes (Google)
  Cc: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn, linux-kernel

On Wed, Mar 15, 2023 at 06:19:01PM +0000, Joel Fernandes (Google) wrote:
> Single-argument kvfree_rcu() usage is being deprecated [1] [2]. However,
> till all users are converted, we would like to introduce checkpatch
> errors for new patches submitted.
> 
> This patch adds support for the same. Tested with a trial patch.
> 
> For now, we are only considering usages that don't have compound
> nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name).
> This is sufficient as such usages are unlikely.
> 
> Once all users are converted and we remove the old API, we can also revert this
> checkpatch patch then.
> 
> [1] https://lore.kernel.org/rcu/CAEXW_YRhHaVuq+5f+VgCZM=SF+9xO+QXaxe0yE7oA9iCXK-XPg@mail.gmail.com/
> [2] https://lore.kernel.org/rcu/CAEXW_YSY=q2_uaE2qo4XSGjzs4+C102YMVJ7kWwuT5LGmJGGew@mail.gmail.com/
> 
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>

With or without the change suggested below:

Acked-by: Paul E. McKenney <paulmck@kernel.org>

> ---
>  scripts/checkpatch.pl | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index bd44d12965c9..9da0a3cb1615 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6388,6 +6388,15 @@ sub process {
>  			}
>  		}
>  
> +# check for soon-to-be-deprecated single-argument k[v]free_rcu() API
> +		if ($line =~ /\bk[v]?free_rcu\s*\([^(]+\)/) {
> +			if ($line =~ /\bk[v]?free_rcu\s*\([^,]+\)/) {
> +				ERROR("DEPRECATED_API",
> +				      "Single-argument k[v]free_rcu() API is deprecated, please call the API with an rcu_head object passed, like: k[v]free_rcu(object_ptr, rcu_head_name);  " . $herecurr);

Perhaps also point them at kvfree_rcu_mightsleep()?

							Thanx, Paul

> +			}
> +		}
> +
> +
>  # check for unnecessary "Out of Memory" messages
>  		if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
>  		    $prevline =~ /^[ \+]\s*if\s*\(\s*(\!\s*|NULL\s*==\s*)?($Lval)(\s*==\s*NULL\s*)?\s*\)/ &&
> -- 
> 2.40.0.rc1.284.g88254d51c5-goog
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 02/14] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 ` [PATCH v2 02/14] misc: vmw_vmci: " Joel Fernandes (Google)
@ 2023-03-16  6:50   ` Greg Kroah-Hartman
  2023-03-16 15:21     ` Joel Fernandes
  0 siblings, 1 reply; 35+ messages in thread
From: Greg Kroah-Hartman @ 2023-03-16  6:50 UTC (permalink / raw)
  To: Joel Fernandes (Google)
  Cc: Bryan Tan, Vishnu Dasa, VMware PV-Drivers Reviewers,
	Arnd Bergmann, Uladzislau Rezki (Sony),
	Paul E . McKenney, linux-kernel

On Wed, Mar 15, 2023 at 06:18:49PM +0000, Joel Fernandes (Google) wrote:
> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
> 
> The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
> switch to the new kvfree_rcu_mightsleep() variant. The goal is to
> avoid accidental use of the single-argument forms, which can introduce
> functionality bugs in atomic contexts and latency bugs in non-atomic
> contexts.
> 
> Cc: Bryan Tan <bryantan@vmware.com>
> Cc: Vishnu Dasa <vdasa@vmware.com>
> Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  drivers/misc/vmw_vmci/vmci_context.c | 2 +-
>  drivers/misc/vmw_vmci/vmci_event.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 03/14] tracing: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 ` [PATCH v2 03/14] tracing: " Joel Fernandes (Google)
@ 2023-03-16  7:38   ` Daniel Bristot de Oliveira
  2023-03-16 15:11     ` Joel Fernandes
  0 siblings, 1 reply; 35+ messages in thread
From: Daniel Bristot de Oliveira @ 2023-03-16  7:38 UTC (permalink / raw)
  To: Joel Fernandes (Google), Steven Rostedt, Masami Hiramatsu
  Cc: Uladzislau Rezki (Sony),
	Paul E . McKenney, linux-kernel, linux-trace-kernel

On 3/15/23 19:18, Joel Fernandes (Google) wrote:
> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
> 
> The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
> switch to the new kvfree_rcu_mightsleep() variant. The goal is to
> avoid accidental use of the single-argument forms, which can introduce
> functionality bugs in atomic contexts and latency bugs in non-atomic
> contexts.
> 
> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  kernel/trace/trace_osnoise.c | 2 +-
>  kernel/trace/trace_probe.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> index 04f0fdae19a1..f68ca1e6460f 100644
> --- a/kernel/trace/trace_osnoise.c
> +++ b/kernel/trace/trace_osnoise.c
> @@ -159,7 +159,7 @@ static void osnoise_unregister_instance(struct trace_array *tr)
>  	if (!found)
>  		return;
>  
> -	kvfree_rcu(inst);
> +	kvfree_rcu_mightsleep(inst);
>  }
>  
>  /*

Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>

Thanks!
-- Daniel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 03/14] tracing: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-16  7:38   ` Daniel Bristot de Oliveira
@ 2023-03-16 15:11     ` Joel Fernandes
  0 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes @ 2023-03-16 15:11 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira
  Cc: Steven Rostedt, Masami Hiramatsu, Uladzislau Rezki (Sony),
	Paul E . McKenney, linux-kernel, linux-trace-kernel

On Thu, Mar 16, 2023 at 3:38 AM Daniel Bristot de Oliveira
<bristot@kernel.org> wrote:
>
> On 3/15/23 19:18, Joel Fernandes (Google) wrote:
> > From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
> >
> > The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
> > switch to the new kvfree_rcu_mightsleep() variant. The goal is to
> > avoid accidental use of the single-argument forms, which can introduce
> > functionality bugs in atomic contexts and latency bugs in non-atomic
> > contexts.
> >
> > Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> > ---
> >  kernel/trace/trace_osnoise.c | 2 +-
> >  kernel/trace/trace_probe.c   | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> > index 04f0fdae19a1..f68ca1e6460f 100644
> > --- a/kernel/trace/trace_osnoise.c
> > +++ b/kernel/trace/trace_osnoise.c
> > @@ -159,7 +159,7 @@ static void osnoise_unregister_instance(struct trace_array *tr)
> >       if (!found)
> >               return;
> >
> > -     kvfree_rcu(inst);
> > +     kvfree_rcu_mightsleep(inst);
> >  }
> >
> >  /*
>
> Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>

Thanks!

 - Joel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 02/14] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-16  6:50   ` Greg Kroah-Hartman
@ 2023-03-16 15:21     ` Joel Fernandes
  0 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes @ 2023-03-16 15:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Bryan Tan, Vishnu Dasa, VMware PV-Drivers Reviewers,
	Arnd Bergmann, Uladzislau Rezki (Sony),
	Paul E . McKenney, linux-kernel

On Thu, Mar 16, 2023 at 2:50 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Wed, Mar 15, 2023 at 06:18:49PM +0000, Joel Fernandes (Google) wrote:
> > From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
> >
> > The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
> > switch to the new kvfree_rcu_mightsleep() variant. The goal is to
> > avoid accidental use of the single-argument forms, which can introduce
> > functionality bugs in atomic contexts and latency bugs in non-atomic
> > contexts.
> >
> > Cc: Bryan Tan <bryantan@vmware.com>
> > Cc: Vishnu Dasa <vdasa@vmware.com>
> > Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
> > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> > ---
> >  drivers/misc/vmw_vmci/vmci_context.c | 2 +-
> >  drivers/misc/vmw_vmci/vmci_event.c   | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks!

- Joel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 07/14] ext4/super: Rename kfree_rcu() to kfree_rcu_mightsleep()
  2023-03-15 19:07   ` Theodore Ts'o
@ 2023-03-16 15:23     ` Joel Fernandes
  0 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes @ 2023-03-16 15:23 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Andreas Dilger, Uladzislau Rezki (Sony),
	Lukas Czerner, Paul E . McKenney, linux-ext4, linux-kernel

On Wed, Mar 15, 2023 at 3:07 PM Theodore Ts'o <tytso@mit.edu> wrote:
>
> On Wed, Mar 15, 2023 at 06:18:54PM +0000, Joel Fernandes (Google) wrote:
> > From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
> >
> > The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
> > deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
> > kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
> > of the single-argument forms, which can introduce functionality bugs in
> > atomic contexts and latency bugs in non-atomic contexts.
> >
> > Cc: Theodore Ts'o <tytso@mit.edu>
> > Cc: Lukas Czerner <lczerner@redhat.com>
> > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
>
> Acked-by: Theodore Ts'o <tytso@mit.edu>
>

Thanks!

 - Joel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 ` [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
@ 2023-03-16 16:41   ` Stefan Schmidt
  2023-03-16 18:06     ` Joel Fernandes
  0 siblings, 1 reply; 35+ messages in thread
From: Stefan Schmidt @ 2023-03-16 16:41 UTC (permalink / raw)
  To: Joel Fernandes (Google),
	Alexander Aring, Miquel Raynal, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, David Girault
  Cc: Paul E . McKenney, Alexander Aring, linux-wpan, netdev, linux-kernel

Hello.

On 15.03.23 19:18, Joel Fernandes (Google) wrote:
> The k[v]free_rcu() macro's single-argument form is deprecated.
> Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
> is to avoid accidental use of the single-argument forms, which can
> introduce functionality bugs in atomic contexts and latency bugs in
> non-atomic contexts.
> 
> The callers are holding a mutex so the context allows blocking. Hence
> using the API with a single argument will be fine, but use its new name.
> 
> There is no functionality change with this patch.
> 
> Fixes: 57588c71177f ("mac802154: Handle passive scanning")
> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>   net/mac802154/scan.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/mac802154/scan.c b/net/mac802154/scan.c
> index 9b0933a185eb..5c191bedd72c 100644
> --- a/net/mac802154/scan.c
> +++ b/net/mac802154/scan.c
> @@ -52,7 +52,7 @@ static int mac802154_scan_cleanup_locked(struct ieee802154_local *local,
>   	request = rcu_replace_pointer(local->scan_req, NULL, 1);
>   	if (!request)
>   		return 0;
> -	kfree_rcu(request);
> +	kvfree_rcu_mightsleep(request);
>   
>   	/* Advertize first, while we know the devices cannot be removed */
>   	if (aborted)
> @@ -403,7 +403,7 @@ int mac802154_stop_beacons_locked(struct ieee802154_local *local,
>   	request = rcu_replace_pointer(local->beacon_req, NULL, 1);
>   	if (!request)
>   		return 0;
> -	kfree_rcu(request);
> +	kvfree_rcu_mightsleep(request);
>   
>   	nl802154_beaconing_done(wpan_dev);
>   

I just saw that there is a v2 of this patch. My ACK still stands as for v1.


Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-16 16:41   ` Stefan Schmidt
@ 2023-03-16 18:06     ` Joel Fernandes
  0 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes @ 2023-03-16 18:06 UTC (permalink / raw)
  To: Stefan Schmidt
  Cc: Alexander Aring, Miquel Raynal, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, David Girault, Paul E . McKenney,
	Alexander Aring, linux-wpan, netdev, linux-kernel

On Thu, Mar 16, 2023 at 12:41 PM Stefan Schmidt
<stefan@datenfreihafen.org> wrote:
>
> Hello.
>
> On 15.03.23 19:18, Joel Fernandes (Google) wrote:
> > The k[v]free_rcu() macro's single-argument form is deprecated.
> > Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
> > is to avoid accidental use of the single-argument forms, which can
> > introduce functionality bugs in atomic contexts and latency bugs in
> > non-atomic contexts.
> >
> > The callers are holding a mutex so the context allows blocking. Hence
> > using the API with a single argument will be fine, but use its new name.
> >
> > There is no functionality change with this patch.
> >
> > Fixes: 57588c71177f ("mac802154: Handle passive scanning")
> > Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> > ---
> >   net/mac802154/scan.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/mac802154/scan.c b/net/mac802154/scan.c
> > index 9b0933a185eb..5c191bedd72c 100644
> > --- a/net/mac802154/scan.c
> > +++ b/net/mac802154/scan.c
> > @@ -52,7 +52,7 @@ static int mac802154_scan_cleanup_locked(struct ieee802154_local *local,
> >       request = rcu_replace_pointer(local->scan_req, NULL, 1);
> >       if (!request)
> >               return 0;
> > -     kfree_rcu(request);
> > +     kvfree_rcu_mightsleep(request);
> >
> >       /* Advertize first, while we know the devices cannot be removed */
> >       if (aborted)
> > @@ -403,7 +403,7 @@ int mac802154_stop_beacons_locked(struct ieee802154_local *local,
> >       request = rcu_replace_pointer(local->beacon_req, NULL, 1);
> >       if (!request)
> >               return 0;
> > -     kfree_rcu(request);
> > +     kvfree_rcu_mightsleep(request);
> >
> >       nl802154_beaconing_done(wpan_dev);
> >
>
> I just saw that there is a v2 of this patch. My ACK still stands as for v1.
>
>
> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>

Thanks! Applied the ack and will be taking it via the RCU tree as we discussed.

 - Joel

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
                   ` (12 preceding siblings ...)
  2023-03-15 18:19 ` [PATCH v2 14/14] checkpatch: Error out if deprecated RCU API used Joel Fernandes (Google)
@ 2023-03-26 12:27 ` Joel Fernandes
  2023-03-27 19:26   ` Jens Axboe
  13 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes @ 2023-03-26 12:27 UTC (permalink / raw)
  To: Philipp Reisner, Lars Ellenberg, Christoph Böhmwalder, Jens Axboe
  Cc: Uladzislau Rezki (Sony),
	Paul E . McKenney, drbd-dev, linux-block, linux-kernel

On Wed, Mar 15, 2023 at 2:19 PM Joel Fernandes (Google)
<joel@joelfernandes.org> wrote:
>
> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
>
> The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
> switch to the new kvfree_rcu_mightsleep() variant. The goal is to
> avoid accidental use of the single-argument forms, which can introduce
> functionality bugs in atomic contexts and latency bugs in non-atomic
> contexts.
>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Philipp Reisner <philipp.reisner@linbit.com>
> Cc: Lars Ellenberg <lars.ellenberg@linbit.com>

Jens/Others, any chance for an Ack here?

 - Joel

> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  drivers/block/drbd/drbd_nl.c       | 6 +++---
>  drivers/block/drbd/drbd_receiver.c | 4 ++--
>  drivers/block/drbd/drbd_state.c    | 2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
> index 60757ac31701..f49f2a5282e1 100644
> --- a/drivers/block/drbd/drbd_nl.c
> +++ b/drivers/block/drbd/drbd_nl.c
> @@ -1615,7 +1615,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)
>                         drbd_send_sync_param(peer_device);
>         }
>
> -       kvfree_rcu(old_disk_conf);
> +       kvfree_rcu_mightsleep(old_disk_conf);
>         kfree(old_plan);
>         mod_timer(&device->request_timer, jiffies + HZ);
>         goto success;
> @@ -2446,7 +2446,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)
>
>         mutex_unlock(&connection->resource->conf_update);
>         mutex_unlock(&connection->data.mutex);
> -       kvfree_rcu(old_net_conf);
> +       kvfree_rcu_mightsleep(old_net_conf);
>
>         if (connection->cstate >= C_WF_REPORT_PARAMS) {
>                 struct drbd_peer_device *peer_device;
> @@ -2860,7 +2860,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info)
>                 new_disk_conf->disk_size = (sector_t)rs.resize_size;
>                 rcu_assign_pointer(device->ldev->disk_conf, new_disk_conf);
>                 mutex_unlock(&device->resource->conf_update);
> -               kvfree_rcu(old_disk_conf);
> +               kvfree_rcu_mightsleep(old_disk_conf);
>                 new_disk_conf = NULL;
>         }
>
> diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
> index 757f4692b5bd..e197b2a465d2 100644
> --- a/drivers/block/drbd/drbd_receiver.c
> +++ b/drivers/block/drbd/drbd_receiver.c
> @@ -3759,7 +3759,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
>                 drbd_info(connection, "peer data-integrity-alg: %s\n",
>                           integrity_alg[0] ? integrity_alg : "(none)");
>
> -       kvfree_rcu(old_net_conf);
> +       kvfree_rcu_mightsleep(old_net_conf);
>         return 0;
>
>  disconnect_rcu_unlock:
> @@ -4127,7 +4127,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
>
>                         rcu_assign_pointer(device->ldev->disk_conf, new_disk_conf);
>                         mutex_unlock(&connection->resource->conf_update);
> -                       kvfree_rcu(old_disk_conf);
> +                       kvfree_rcu_mightsleep(old_disk_conf);
>
>                         drbd_info(device, "Peer sets u_size to %lu sectors (old: %lu)\n",
>                                  (unsigned long)p_usize, (unsigned long)my_usize);
> diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c
> index 75d13ea0024f..2aeea295fa28 100644
> --- a/drivers/block/drbd/drbd_state.c
> +++ b/drivers/block/drbd/drbd_state.c
> @@ -2071,7 +2071,7 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)
>                 conn_free_crypto(connection);
>                 mutex_unlock(&connection->resource->conf_update);
>
> -               kvfree_rcu(old_conf);
> +               kvfree_rcu_mightsleep(old_conf);
>         }
>
>         if (ns_max.susp_fen) {
> --
> 2.40.0.rc1.284.g88254d51c5-goog
>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 05/14] net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-15 18:18 ` [PATCH v2 05/14] net/sysctl: " Joel Fernandes (Google)
@ 2023-03-26 12:28   ` Joel Fernandes
  2023-03-27 17:14     ` Jakub Kicinski
  0 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes @ 2023-03-26 12:28 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Uladzislau Rezki (Sony), Paul E . McKenney, netdev, linux-kernel

On Wed, Mar 15, 2023 at 2:19 PM Joel Fernandes (Google)
<joel@joelfernandes.org> wrote:
>
> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
>
> The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
> deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
> kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
> of the single-argument forms, which can introduce functionality bugs in
> atomic contexts and latency bugs in non-atomic contexts.
>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: David S. Miller <davem@davemloft.net>

Could anyone from the networking side Ack this patch so we can take it for 6.4?

Eric or David?

 - Joel

> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  net/core/sysctl_net_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
> index 74842b453407..782273bb93c2 100644
> --- a/net/core/sysctl_net_core.c
> +++ b/net/core/sysctl_net_core.c
> @@ -177,7 +177,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
>                         if (orig_sock_table) {
>                                 static_branch_dec(&rps_needed);
>                                 static_branch_dec(&rfs_needed);
> -                               kvfree_rcu(orig_sock_table);
> +                               kvfree_rcu_mightsleep(orig_sock_table);
>                         }
>                 }
>         }
> @@ -215,7 +215,7 @@ static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
>                                      lockdep_is_held(&flow_limit_update_mutex));
>                         if (cur && !cpumask_test_cpu(i, mask)) {
>                                 RCU_INIT_POINTER(sd->flow_limit, NULL);
> -                               kfree_rcu(cur);
> +                               kfree_rcu_mightsleep(cur);
>                         } else if (!cur && cpumask_test_cpu(i, mask)) {
>                                 cur = kzalloc_node(len, GFP_KERNEL,
>                                                    cpu_to_node(i));
> --
> 2.40.0.rc1.284.g88254d51c5-goog
>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep()
  2023-03-15 18:18 ` [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep() Joel Fernandes (Google)
@ 2023-03-26 12:34   ` Joel Fernandes
  2023-03-27 15:09     ` Saeed Mahameed
  0 siblings, 1 reply; 35+ messages in thread
From: Joel Fernandes @ 2023-03-26 12:34 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Boris Pismenny
  Cc: Uladzislau Rezki (Sony),
	Ariel Levkovich, Vlad Buslov, Paul E . McKenney, netdev,
	linux-rdma, linux-kernel

On Wed, Mar 15, 2023 at 2:19 PM Joel Fernandes (Google)
<joel@joelfernandes.org> wrote:
>
> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
>
> The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
> deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
> kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
> of the single-argument forms, which can introduce functionality bugs in
> atomic contexts and latency bugs in non-atomic contexts.

In a world where patches anxiously await their precious Ack, could
today be our lucky day on this one?

We need Acks to take this in for 6.4. David? Others?

 - Joel


>
> Cc: Ariel Levkovich <lariel@nvidia.com>
> Cc: Saeed Mahameed <saeedm@nvidia.com>
> Cc: Vlad Buslov <vladbu@nvidia.com>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c  | 2 +-
>  drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c
> index ca834bbcb44f..8afcec0c5d3c 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c
> @@ -242,7 +242,7 @@ mlx5e_int_port_remove(struct mlx5e_tc_int_port_priv *priv,
>                 mlx5_del_flow_rules(int_port->rx_rule);
>         mapping_remove(ctx, int_port->mapping);
>         mlx5e_int_port_metadata_free(priv, int_port->match_metadata);
> -       kfree_rcu(int_port);
> +       kfree_rcu_mightsleep(int_port);
>         priv->num_ports--;
>  }
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> index 08d0929e8260..b811dad7370a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> @@ -670,7 +670,7 @@ static int mlx5e_macsec_del_txsa(struct macsec_context *ctx)
>
>         mlx5e_macsec_cleanup_sa(macsec, tx_sa, true);
>         mlx5_destroy_encryption_key(macsec->mdev, tx_sa->enc_key_id);
> -       kfree_rcu(tx_sa);
> +       kfree_rcu_mightsleep(tx_sa);
>         macsec_device->tx_sa[assoc_num] = NULL;
>
>  out:
> @@ -849,7 +849,7 @@ static void macsec_del_rxsc_ctx(struct mlx5e_macsec *macsec, struct mlx5e_macsec
>         xa_erase(&macsec->sc_xarray, rx_sc->sc_xarray_element->fs_id);
>         metadata_dst_free(rx_sc->md_dst);
>         kfree(rx_sc->sc_xarray_element);
> -       kfree_rcu(rx_sc);
> +       kfree_rcu_mightsleep(rx_sc);
>  }
>
>  static int mlx5e_macsec_del_rxsc(struct macsec_context *ctx)
> --
> 2.40.0.rc1.284.g88254d51c5-goog
>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep()
  2023-03-26 12:34   ` Joel Fernandes
@ 2023-03-27 15:09     ` Saeed Mahameed
  0 siblings, 0 replies; 35+ messages in thread
From: Saeed Mahameed @ 2023-03-27 15:09 UTC (permalink / raw)
  To: Joel Fernandes
  Cc: Saeed Mahameed, Leon Romanovsky, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Boris Pismenny,
	Uladzislau Rezki (Sony),
	Ariel Levkovich, Vlad Buslov, Paul E . McKenney, netdev,
	linux-rdma, linux-kernel

On 26 Mar 08:34, Joel Fernandes wrote:
>On Wed, Mar 15, 2023 at 2:19 PM Joel Fernandes (Google)
><joel@joelfernandes.org> wrote:
>>
>> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
>>
>> The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
>> deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
>> kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
>> of the single-argument forms, which can introduce functionality bugs in
>> atomic contexts and latency bugs in non-atomic contexts.
>
>In a world where patches anxiously await their precious Ack, could
>today be our lucky day on this one?
>
>We need Acks to take this in for 6.4. David? Others?
>

For mlx5 usually me, but since this is a larger series that is not mlx5
centric and targeting multiple tree, I really don't know which subsystem
you should be targeting.. for netdev submissions you need to specify the
targeted branch e.g. [PATCH v2 net-next 06/14] ... 


FWIW:

Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>


> - Joel
>
>
>>
>> Cc: Ariel Levkovich <lariel@nvidia.com>
>> Cc: Saeed Mahameed <saeedm@nvidia.com>
>> Cc: Vlad Buslov <vladbu@nvidia.com>
>> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
>> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
>> ---
>>  drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c  | 2 +-
>>  drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 4 ++--
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c
>> index ca834bbcb44f..8afcec0c5d3c 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c
>> @@ -242,7 +242,7 @@ mlx5e_int_port_remove(struct mlx5e_tc_int_port_priv *priv,
>>                 mlx5_del_flow_rules(int_port->rx_rule);
>>         mapping_remove(ctx, int_port->mapping);
>>         mlx5e_int_port_metadata_free(priv, int_port->match_metadata);
>> -       kfree_rcu(int_port);
>> +       kfree_rcu_mightsleep(int_port);
>>         priv->num_ports--;
>>  }
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
>> index 08d0929e8260..b811dad7370a 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
>> @@ -670,7 +670,7 @@ static int mlx5e_macsec_del_txsa(struct macsec_context *ctx)
>>
>>         mlx5e_macsec_cleanup_sa(macsec, tx_sa, true);
>>         mlx5_destroy_encryption_key(macsec->mdev, tx_sa->enc_key_id);
>> -       kfree_rcu(tx_sa);
>> +       kfree_rcu_mightsleep(tx_sa);
>>         macsec_device->tx_sa[assoc_num] = NULL;
>>
>>  out:
>> @@ -849,7 +849,7 @@ static void macsec_del_rxsc_ctx(struct mlx5e_macsec *macsec, struct mlx5e_macsec
>>         xa_erase(&macsec->sc_xarray, rx_sc->sc_xarray_element->fs_id);
>>         metadata_dst_free(rx_sc->md_dst);
>>         kfree(rx_sc->sc_xarray_element);
>> -       kfree_rcu(rx_sc);
>> +       kfree_rcu_mightsleep(rx_sc);
>>  }
>>
>>  static int mlx5e_macsec_del_rxsc(struct macsec_context *ctx)
>> --
>> 2.40.0.rc1.284.g88254d51c5-goog
>>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 05/14] net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-26 12:28   ` Joel Fernandes
@ 2023-03-27 17:14     ` Jakub Kicinski
  2023-03-30 15:43       ` Joel Fernandes
  0 siblings, 1 reply; 35+ messages in thread
From: Jakub Kicinski @ 2023-03-27 17:14 UTC (permalink / raw)
  To: Joel Fernandes
  Cc: David S. Miller, Eric Dumazet, Paolo Abeni,
	Uladzislau Rezki (Sony),
	Paul E . McKenney, netdev, linux-kernel

On Sun, 26 Mar 2023 08:28:45 -0400 Joel Fernandes wrote:
> > Cc: Eric Dumazet <edumazet@google.com>
> > Cc: David S. Miller <davem@davemloft.net>  
> 
> Could anyone from the networking side Ack this patch so we can take it for 6.4?
> 
> Eric or David?

Let me help you. Perhaps it's a data point against keeping maintainers 
in an alphabetical order :-)

Acked-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-26 12:27 ` [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes
@ 2023-03-27 19:26   ` Jens Axboe
  2023-03-30 15:38     ` Joel Fernandes
  0 siblings, 1 reply; 35+ messages in thread
From: Jens Axboe @ 2023-03-27 19:26 UTC (permalink / raw)
  To: Joel Fernandes, Philipp Reisner, Lars Ellenberg,
	Christoph Böhmwalder
  Cc: Uladzislau Rezki (Sony),
	Paul E . McKenney, drbd-dev, linux-block, linux-kernel

On 3/26/23 6:27 AM, Joel Fernandes wrote:
> On Wed, Mar 15, 2023 at 2:19 PM Joel Fernandes (Google)
> <joel@joelfernandes.org> wrote:
>>
>> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
>>
>> The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
>> switch to the new kvfree_rcu_mightsleep() variant. The goal is to
>> avoid accidental use of the single-argument forms, which can introduce
>> functionality bugs in atomic contexts and latency bugs in non-atomic
>> contexts.
>>
>> Cc: Jens Axboe <axboe@kernel.dk>
>> Cc: Philipp Reisner <philipp.reisner@linbit.com>
>> Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
> 
> Jens/Others, any chance for an Ack here?

Begrudgingly-acked-by: Jens Axboe <axboe@kernel.dk>

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-27 19:26   ` Jens Axboe
@ 2023-03-30 15:38     ` Joel Fernandes
  0 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes @ 2023-03-30 15:38 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Paul E . McKenney, rcu

On Mon, Mar 27, 2023 at 01:26:39PM -0600, Jens Axboe wrote:
> On 3/26/23 6:27 AM, Joel Fernandes wrote:
> > On Wed, Mar 15, 2023 at 2:19 PM Joel Fernandes (Google)
> > <joel@joelfernandes.org> wrote:
> >>
> >> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
> >>
> >> The kvfree_rcu() macro's single-argument form is deprecated.  Therefore
> >> switch to the new kvfree_rcu_mightsleep() variant. The goal is to
> >> avoid accidental use of the single-argument forms, which can introduce
> >> functionality bugs in atomic contexts and latency bugs in non-atomic
> >> contexts.
> >>
> >> Cc: Jens Axboe <axboe@kernel.dk>
> >> Cc: Philipp Reisner <philipp.reisner@linbit.com>
> >> Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
> > 
> > Jens/Others, any chance for an Ack here?
> 
> Begrudgingly-acked-by: Jens Axboe <axboe@kernel.dk>

I applied the Ack verbatim, thank you!

 - Joel


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v2 05/14] net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-27 17:14     ` Jakub Kicinski
@ 2023-03-30 15:43       ` Joel Fernandes
  0 siblings, 0 replies; 35+ messages in thread
From: Joel Fernandes @ 2023-03-30 15:43 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Paul E . McKenney, rcu, David S. Miller, Eric Dumazet

On Mon, Mar 27, 2023 at 1:14 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Sun, 26 Mar 2023 08:28:45 -0400 Joel Fernandes wrote:
> > > Cc: Eric Dumazet <edumazet@google.com>
> > > Cc: David S. Miller <davem@davemloft.net>
> >
> > Could anyone from the networking side Ack this patch so we can take it for 6.4?
> >
> > Eric or David?
>
> Let me help you. Perhaps it's a data point against keeping maintainers
> in an alphabetical order :-)
>
> Acked-by: Jakub Kicinski <kuba@kernel.org>

I applied this Ack to the patch, thank you!

 - Joel

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2023-03-30 15:44 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 18:18 [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 02/14] misc: vmw_vmci: " Joel Fernandes (Google)
2023-03-16  6:50   ` Greg Kroah-Hartman
2023-03-16 15:21     ` Joel Fernandes
2023-03-15 18:18 ` [PATCH v2 03/14] tracing: " Joel Fernandes (Google)
2023-03-16  7:38   ` Daniel Bristot de Oliveira
2023-03-16 15:11     ` Joel Fernandes
2023-03-15 18:18 ` [PATCH v2 04/14] lib/test_vmalloc.c: " Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 05/14] net/sysctl: " Joel Fernandes (Google)
2023-03-26 12:28   ` Joel Fernandes
2023-03-27 17:14     ` Jakub Kicinski
2023-03-30 15:43       ` Joel Fernandes
2023-03-15 18:18 ` [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep() Joel Fernandes (Google)
2023-03-26 12:34   ` Joel Fernandes
2023-03-27 15:09     ` Saeed Mahameed
2023-03-15 18:18 ` [PATCH v2 07/14] ext4/super: " Joel Fernandes (Google)
2023-03-15 19:07   ` Theodore Ts'o
2023-03-16 15:23     ` Joel Fernandes
2023-03-15 18:18 ` [PATCH v2 08/14] rcuscale: " Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 09/14] torture: Enable clocksource watchdog with "tsc=watchdog" Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 10/14] rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 11/14] rcu/kvfree: Eliminate k[v]free_rcu() single argument macro Joel Fernandes (Google)
2023-03-15 18:18 ` [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
2023-03-16 16:41   ` Stefan Schmidt
2023-03-16 18:06     ` Joel Fernandes
2023-03-15 18:19 ` [PATCH v2 13/14] RDMA/rxe: " Joel Fernandes (Google)
2023-03-15 18:38   ` Bob Pearson
2023-03-15 18:41     ` Joel Fernandes
2023-03-15 19:05       ` Bob Pearson
2023-03-15 19:59         ` Joel Fernandes
2023-03-15 18:19 ` [PATCH v2 14/14] checkpatch: Error out if deprecated RCU API used Joel Fernandes (Google)
2023-03-16  3:49   ` Paul E. McKenney
2023-03-26 12:27 ` [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes
2023-03-27 19:26   ` Jens Axboe
2023-03-30 15:38     ` Joel Fernandes

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.