drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
Subsystems (21)
PATCH v2 1/14 drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
From: "Uladzislau Rezki (Sony)" <[email protected]>
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.
--- 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(-)
drivers/block/drbd/drbd_nl.c +3 -3
@@ -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 ; }
drivers/block/drbd/drbd_receiver.c +2 -2
@@ -3759,7 +3759,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_indrbd_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_inforcu_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);
drivers/block/drbd/drbd_state.c +1 -1
@@ -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) {
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
PATCH v2 2/14 misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
From: "Uladzislau Rezki (Sony)" <[email protected]>
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.
--- drivers/misc/vmw_vmci/vmci_context.c | 2 +- drivers/misc/vmw_vmci/vmci_event.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/vmw_vmci/vmci_context.c +1 -1
@@ -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);
drivers/misc/vmw_vmci/vmci_event.c +1 -1
@@ -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 ; }
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Re: [PATCH v2 02/14] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
Quoted 14 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kvfree_rcu()macro's single-argument form is deprecated. Therefore switch to the newkvfree_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 <[email protected]>Cc Vishnu Dasa <[email protected]>Reviewed-by Vishnu Dasa <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>
Quoted 4 lines
--- drivers/misc/vmw_vmci/vmci_context.c | 2 +- drivers/misc/vmw_vmci/vmci_event.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH v2 02/14] misc: vmw_vmci: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
Quoted 21 lines · Greg Kroah-Hartman
Quoted 14 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kvfree_rcu()macro's single-argument form is deprecated. Therefore switch to the newkvfree_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 <[email protected]>Cc Vishnu Dasa <[email protected]>Reviewed-by Vishnu Dasa <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>Quoted 4 lines
--- drivers/misc/vmw_vmci/vmci_context.c | 2 +- drivers/misc/vmw_vmci/vmci_event.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 1 line
Thanks!
- Joel
PATCH v2 3/14 tracing: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
In reply to Joel Fernandes (Google)From: "Uladzislau Rezki (Sony)" <[email protected]>
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.
--- kernel/trace/trace_osnoise.c | 2 +- kernel/trace/trace_probe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_osnoise.c +1 -1
@@ -159,7 +159,7 @@ static void osnoise_unregister_instance(struct trace_array *tr)if (!found)return ; -kvfree_rcu (inst); +kvfree_rcu_mightsleep (inst); }/*
kernel/trace/trace_probe.c +1 -1
@@ -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 );
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Re: [PATCH v2 03/14] tracing: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
Quoted 22 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kvfree_rcu()macro's single-argument form is deprecated. Therefore switch to the newkvfree_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) <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>--- kernel/trace/trace_osnoise.c | 2 +- kernel/trace/trace_probe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)kernel/trace/trace_osnoise.c +0
-0
kernel/trace/trace_osnoise.c static void osnoise_unregister_instance(struct trace_array *tr) · line 165
Quoted 8 lines
kernel/trace/trace_osnoise.c +1
-1@@ -159,7 +159,7 @@ static void osnoise_unregister_instance(struct trace_array *tr)if (!found)return ; -kvfree_rcu (inst); +kvfree_rcu_mightsleep (inst); }/*
Thanks!
-- Daniel
Re: [PATCH v2 03/14] tracing: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
Quoted 27 lines · Daniel Bristot de Oliveira
Quoted 25 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kvfree_rcu()macro's single-argument form is deprecated. Therefore switch to the newkvfree_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) <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>--- kernel/trace/trace_osnoise.c | 2 +- kernel/trace/trace_probe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)kernel/trace/trace_osnoise.c +0
-0@@ -159,7 +159,7 @@ static void osnoise_unregister_instance(struct trace_array *tr)if (!found)return ;
Quoted 7 lines
kernel/trace/trace_osnoise.c static void osnoise_unregister_instance(struct trace_array *tr) · line 165
Quoted 5 lines
kernel/trace/trace_osnoise.c +1
-1-kvfree_rcu (inst); +kvfree_rcu_mightsleep (inst); }/*
Thanks!
- Joel
PATCH v2 4/14 lib/test_vmalloc.c: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
In reply to Joel Fernandes (Google)From: "Uladzislau Rezki (Sony)" <[email protected]>
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.
--- lib/test_vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_vmalloc.c +1 -1
@@ -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 ;
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
PATCH v2 5/14 net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
In reply to Joel Fernandes (Google)From: "Uladzislau Rezki (Sony)" <[email protected]>
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.
--- net/core/sysctl_net_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/sysctl_net_core.c +2 -2
@@ -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));
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Re: [PATCH v2 05/14] net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
Quoted 11 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kfree_rcu()andkvfree_rcu()macros' single-argument forms are deprecated. Therefore switch to the newkfree_rcu_mightsleep()andkvfree_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 <[email protected]>Cc David S. Miller <[email protected]>
Could anyone from the networking side Ack this patch so we can take it for 6.4?
Eric or David?
- Joel
Quoted 32 lines
Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>--- net/core/sysctl_net_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/core/sysctl_net_core.c +2
-3@@ -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
Re: [PATCH v2 05/14] net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
Quoted 6 lines · On Sun, 26 Mar 2023 08:28:45 -0400 Joel Fernandes wrote:
Quoted 2 lines
Cc Eric Dumazet <[email protected]>Cc David S. Miller <[email protected]>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 :-)
Joel Fernandes
AppliedRe: [PATCH v2 05/14] net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
Quoted 5 lines · Jakub Kicinski
Quoted 3 lines · On Sun, 26 Mar 2023 08:28:45 -0400 Joel Fernandes wrote:
Quoted 2 lines
Cc Eric Dumazet <[email protected]>Cc David S. Miller <[email protected]>
Quoted 8 lines
Quoted 3 lines
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 <[email protected]>
I applied this Ack to the patch, thank you!
- Joel
PATCH v2 6/14 net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep()
In reply to Joel Fernandes (Google)From: "Uladzislau Rezki (Sony)" <[email protected]>
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.
--- 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(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c +1 -1
@@ -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--; }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +2 -2
@@ -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_macsecxa_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)
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Re: [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep()
Quoted 8 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kfree_rcu()andkvfree_rcu()macros' single-argument forms are deprecated. Therefore switch to the newkfree_rcu_mightsleep()andkvfree_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
Quoted 50 lines
Cc Ariel Levkovich <[email protected]>Cc Saeed Mahameed <[email protected]>Cc Vlad Buslov <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>--- 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(-)drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c +1
-1@@ -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--; }drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +2
-3@@ -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_macsecxa_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
Saeed Mahameed
Reviewed-byRe: [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep()
Quoted 11 lines · Joel Fernandes
Quoted 8 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kfree_rcu()andkvfree_rcu()macros' single-argument forms are deprecated. Therefore switch to the newkfree_rcu_mightsleep()andkvfree_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.
Quoted 5 lines
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:
Quoted 53 lines
- Joel
Quoted 50 lines
Cc Ariel Levkovich <[email protected]>Cc Saeed Mahameed <[email protected]>Cc Vlad Buslov <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>--- 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(-)drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c +1
-1@@ -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--; }drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +2
-3@@ -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_macsecxa_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
PATCH v2 7/14 ext4/super: Rename kfree_rcu() to kfree_rcu_mightsleep()
In reply to Joel Fernandes (Google)From: "Uladzislau Rezki (Sony)" <[email protected]>
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.
--- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/super.c +1 -1
@@ -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); } }
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Re: [PATCH v2 07/14] ext4/super: Rename kfree_rcu() to kfree_rcu_mightsleep()
Quoted 8 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kfree_rcu()andkvfree_rcu()macros' single-argument forms are deprecated. Therefore switch to the newkfree_rcu_mightsleep()andkvfree_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.
Quoted 5 lines
Cc Theodore Ts'o <[email protected]>Cc Lukas Czerner <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>
Re: [PATCH v2 07/14] ext4/super: Rename kfree_rcu() to kfree_rcu_mightsleep()
Quoted 10 lines · Theodore Ts'o
Quoted 8 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kfree_rcu()andkvfree_rcu()macros' single-argument forms are deprecated. Therefore switch to the newkfree_rcu_mightsleep()andkvfree_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.
Quoted 8 lines
Quoted 5 lines
Cc Theodore Ts'o <[email protected]>Cc Lukas Czerner <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>Acked-by Theodore Ts'o <[email protected]>
Thanks!
- Joel
PATCH v2 8/14 rcuscale: Rename kfree_rcu() to kfree_rcu_mightsleep()
In reply to Joel Fernandes (Google)From: "Uladzislau Rezki (Sony)" <[email protected]>
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.
--- kernel/rcu/rcuscale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/rcuscale.c +1 -1
@@ -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); }
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
PATCH v2 9/14 torture: Enable clocksource watchdog with "tsc=watchdog"
In reply to Joel Fernandes (Google)From: "Paul E. McKenney" <[email protected]>
This commit tests the "tsc=watchdog" kernel boot parameter when running the clocksourcewd torture tests.
--- tools/testing/selftests/rcutorture/bin/torture.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/rcutorture/bin/torture.sh +3 -3
@@ -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
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
PATCH v2 10/14 rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels
In reply to Joel Fernandes (Google)From: Zqiang <[email protected]>
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.
--- kernel/rcu/rcutorture.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/rcu/rcutorture.c +6 -0
@@ -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 ();
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
PATCH v2 11/14 rcu/kvfree: Eliminate k[v]free_rcu() single argument macro
In reply to Joel Fernandes (Google)From: "Uladzislau Rezki (Sony)" <[email protected]>
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. ]
--- include/linux/rcupdate.h | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-)
include/linux/rcupdate.h +8 -21
@@ -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); \
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
PATCH v2 12/14 mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep()
In reply to Joel Fernandes (Google)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.
--- net/mac802154/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac802154/scan.c +2 -2
@@ -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);
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Re: [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep()
Hello.
Quoted 32 lines · Joel Fernandes (Google)
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 <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>--- net/mac802154/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/mac802154/scan.c +1
-1@@ -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)
net/mac802154/scan.c int mac802154_stop_beacons_locked(struct ieee802154_local *local, · line 409
Quoted 8 lines
net/mac802154/scan.c +1
-1@@ -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.
regards
Stefan Schmidt
Joel Fernandes
AppliedRe: [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep()
Quoted 42 lines · Stefan Schmidt
Hello.
Quoted 38 lines · Joel Fernandes (Google)
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 <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>--- net/mac802154/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/mac802154/scan.c +2
-2@@ -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);
Quoted 7 lines
net/mac802154/scan.c int mac802154_stop_beacons_locked(struct ieee802154_local *local, · line 409
Quoted 2 lines
net/mac802154/scan.c +0
-0nl802154_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 <[email protected]>
Thanks! Applied the ack and will be taking it via the RCU tree as we discussed.
- Joel
PATCH v2 13/14 RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
In reply to Joel Fernandes (Google)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.
--- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_mr.c +1 -1
@@ -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 ; }
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Re: [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
Quoted 23 lines · Joel Fernandes (Google)
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.
Acked-by Zhu Yanjun <[email protected]>Reviewed-by Bob Pearson <[email protected]>Reviewed-by Paul E. McKenney <[email protected]>Fixes 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")Signed-off-by Joel Fernandes (Google) <[email protected]>--- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/rxe/rxe_mr.c +0
-0
drivers/infiniband/sw/rxe/rxe_mr.c int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) · line 737
Quoted 8 lines
drivers/infiniband/sw/rxe/rxe_mr.c +1
-1@@ -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
Re: [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
Quoted 27 lines · Bob Pearson
Quoted 25 lines · Joel Fernandes (Google)
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.
Acked-by Zhu Yanjun <[email protected]>Reviewed-by Bob Pearson <[email protected]>Reviewed-by Paul E. McKenney <[email protected]>Fixes 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")Signed-off-by Joel Fernandes (Google) <[email protected]>--- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/rxe/rxe_mr.c +0
-0@@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)return -EINVAL ;
Quoted 7 lines
drivers/infiniband/sw/rxe/rxe_mr.c int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) · line 737
Quoted 6 lines
drivers/infiniband/sw/rxe/rxe_mr.c +1
-1rxe_cleanup (mr); -kfree_rcu (mr); +kfree_rcu_mightsleep (mr);return 0 ; }Please replace
kfree_rcu_mightsleep()bykfree(). 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>
Quoted 6 lines
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
Re: [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
Quoted 36 lines · Joel Fernandes
Quoted 27 lines · Bob Pearson
Quoted 25 lines · Joel Fernandes (Google)
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.
Acked-by Zhu Yanjun <[email protected]>Reviewed-by Bob Pearson <[email protected]>Reviewed-by Paul E. McKenney <[email protected]>Fixes 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")Signed-off-by Joel Fernandes (Google) <[email protected]>--- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/rxe/rxe_mr.c +0
-0@@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)return -EINVAL ;Quoted 7 lines
drivers/infiniband/sw/rxe/rxe_mr.c int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) · line 737
Quoted 6 lines
drivers/infiniband/sw/rxe/rxe_mr.c +1
-1rxe_cleanup (mr); -kfree_rcu (mr); +kfree_rcu_mightsleep (mr);return 0 ; }Please replace
kfree_rcu_mightsleep()bykfree(). There is no need to delay the kfree(mr).
Quoted 3 lines
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
Quoted 18 lines
<quote>
Quoted 6 lines
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
Re: [PATCH v2 13/14] RDMA/rxe: Rename kfree_rcu() to kvfree_rcu_mightsleep()
Quoted 42 lines · Bob Pearson
Quoted 36 lines · Joel Fernandes
Quoted 27 lines · Bob Pearson
Quoted 25 lines · Joel Fernandes (Google)
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.
Acked-by Zhu Yanjun <[email protected]>Reviewed-by Bob Pearson <[email protected]>Reviewed-by Paul E. McKenney <[email protected]>Fixes 72a03627443d ("RDMA/rxe: Remove rxe_alloc()")Signed-off-by Joel Fernandes (Google) <[email protected]>--- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/rxe/rxe_mr.c +0
-0@@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)return -EINVAL ;Quoted 7 lines
drivers/infiniband/sw/rxe/rxe_mr.c int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) · line 737
Quoted 6 lines
drivers/infiniband/sw/rxe/rxe_mr.c +1
-1rxe_cleanup (mr); -kfree_rcu (mr); +kfree_rcu_mightsleep (mr);return 0 ; }Please replace
kfree_rcu_mightsleep()bykfree(). There is no need to delay the kfree(mr).Quoted 3 lines
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.
Quoted 6 lines
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
PATCH v2 14/14 checkpatch: Error out if deprecated RCU API used
In reply to Joel Fernandes (Google)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/
--- scripts/checkpatch.pl | 9 +++++++++ 1 file changed, 9 insertions(+)
scripts/checkpatch.pl +9 -0
@@ -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*\)/ &&
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Re: [PATCH v2 14/14] checkpatch: Error out if deprecated RCU API used
Quoted 10 lines · Joel Fernandes (Google)
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.
Quoted 7 lines
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) <[email protected]>
With or without the change suggested below:
Quoted 9 lines
--- scripts/checkpatch.pl | 9 +++++++++ 1 file changed, 9 insertions(+)scripts/checkpatch.pl +0
-0
scripts/checkpatch.pl sub process { · line 6395
Quoted 8 lines
scripts/checkpatch.pl +5
-0@@ -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
Quoted 10 lines
scripts/checkpatch.pl +4
-0+ } + } + + # 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*\)/ &&Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Quoted 9 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kvfree_rcu()macro's single-argument form is deprecated. Therefore switch to the newkvfree_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.
Quoted 3 lines
Cc Jens Axboe <[email protected]>Cc Philipp Reisner <[email protected]>Cc Lars Ellenberg <[email protected]>
Jens/Others, any chance for an Ack here?
- Joel
Quoted 78 lines
Signed-off-by Uladzislau Rezki (Sony) <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Joel Fernandes (Google) <[email protected]>--- 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(-)drivers/block/drbd/drbd_nl.c +3
-3@@ -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 ; }drivers/block/drbd/drbd_receiver.c +2
-2@@ -3759,7 +3759,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_indrbd_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_inforcu_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);drivers/block/drbd/drbd_state.c +1
-2@@ -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
Jens Axboe
maintainerQuoted 11 lines · Joel Fernandes
Quoted 9 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kvfree_rcu()macro's single-argument form is deprecated. Therefore switch to the newkvfree_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.
Quoted 5 lines
Quoted 3 lines
Cc Jens Axboe <[email protected]>Cc Philipp Reisner <[email protected]>Cc Lars Ellenberg <[email protected]>Jens/Others, any chance for an Ack here?
Signature · 1 line
Jens Axboe
Joel Fernandes
AppliedQuoted 12 lines · Jens Axboe
Quoted 11 lines · Joel Fernandes
Quoted 9 lines · Joel Fernandes (Google)
From: "Uladzislau Rezki (Sony)" <[email protected]>
The
kvfree_rcu()macro's single-argument form is deprecated. Therefore switch to the newkvfree_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.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Cc Jens Axboe <[email protected]>Cc Philipp Reisner <[email protected]>Cc Lars Ellenberg <[email protected]>Jens/Others, any chance for an Ack here?
Begrudgingly-acked-by Jens Axboe <[email protected]>
I applied the Ack verbatim, thank you!
- Joel