From patchwork Wed Mar 15 18:18:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 13176507 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C37D9C6FD1D for ; Wed, 15 Mar 2023 18:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232571AbjCOSTm (ORCPT ); Wed, 15 Mar 2023 14:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232474AbjCOSTc (ORCPT ); Wed, 15 Mar 2023 14:19:32 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE3D85D752 for ; Wed, 15 Mar 2023 11:19:30 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id jl13so13293037qvb.10 for ; Wed, 15 Mar 2023 11:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1678904370; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8YdMRWrceqxooe4gtO91XUx2+IJg5yOZzB8eltDBQHc=; b=Y6dmHBBxuRL29N0TD32sk5Q46SZkvb+Cz7joxJNYQa7VcRhTrhsl+leDpu6VzvnEPD nP4GzafsDqwcbrFtRQrR0TIEqr/isk3MbcwjMbp7p2wI58NJmBzfsFfLMoIzrSJ0hxf1 ucc4ysYK0e6PziMi8ddBKUqNJVFM9vedX72fo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678904370; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8YdMRWrceqxooe4gtO91XUx2+IJg5yOZzB8eltDBQHc=; b=ZFcZHupIdjlwbd49Upz8sBFzF0MWEFR9EU97WRiuvWgFkaJpFehutQXXOvYtlpwexV beeNJG03wGe+H4PGfPm1+YBdqD9rs0XQLTmBPOv7ZmZEHxMb6pW/Jwe76pWDwFft4ISf peevRdazBvP+um6RG/b/X6pyWyuiP+5AEBzlpRrmsgiUB4lXAuTG0L65wrEMMnFrJmYx 27l0n3Xdl63Xv+2y11wRv/LM6fqypUctAUsTAAnZvGyDh2LZzxi60kdjpPgWFCL4tvIE 9iGaNdXZgyNQ7u3lVJSSpH08GUckX1WcbxdLJFpeAhqId59oHMZyUJDLI9t+P6xbY9t5 RWEw== X-Gm-Message-State: AO0yUKXWt/TXmPdeh8vbSWf27ENM/1jNysa3jW6IXxYBAuFNIEm1CQ5s QGTcDVuIQz03r2UGfjKYMO7jng== X-Google-Smtp-Source: AK7set9PE5fzyQ5HDKzDk0cfTIIJsoYEhrVRDv/k57BSsbdK82f6cjhirtHedRE1n6Irj9gvwdmQdg== X-Received: by 2002:a05:6214:1d01:b0:577:5ffe:e0d8 with SMTP id e1-20020a0562141d0100b005775ffee0d8mr34099870qvd.24.1678904369778; Wed, 15 Mar 2023 11:19:29 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id v125-20020a379383000000b007458ae32290sm4113974qkd.128.2023.03.15.11.19.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 11:19:29 -0700 (PDT) From: "Joel Fernandes (Google)" To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: "Uladzislau Rezki (Sony)" , "Paul E . McKenney" , Joel Fernandes , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 05/14] net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Date: Wed, 15 Mar 2023 18:18:52 +0000 Message-Id: <20230315181902.4177819-5-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230315181902.4177819-1-joel@joelfernandes.org> References: <20230315181902.4177819-1-joel@joelfernandes.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: "Uladzislau Rezki (Sony)" 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 Cc: David S. Miller Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) Acked-by: Jakub Kicinski --- 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)); From patchwork Wed Mar 15 18:18:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 13176508 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E298C74A5B for ; Wed, 15 Mar 2023 18:19:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232525AbjCOSTo (ORCPT ); Wed, 15 Mar 2023 14:19:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232477AbjCOSTc (ORCPT ); Wed, 15 Mar 2023 14:19:32 -0400 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88ACB60412 for ; Wed, 15 Mar 2023 11:19:31 -0700 (PDT) Received: by mail-qt1-x82f.google.com with SMTP id c19so17158552qtn.13 for ; Wed, 15 Mar 2023 11:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1678904371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y6P3avYFLfmZWtirttMewFieZIFd8qLJc55Dm6AWaNQ=; b=AfJO3WF6GZ+yRdTZNjn5moqlE0pcfcwzJyR8ecGuewfHyPT8CvRJVgvhX9FiypD/QW 4t/r8YuGdxUFqFX4s51NsQEsnlk7EzA/hmPFQFKgHtdisgnd9MzLrJ6+3B7j282f7ItC f4V0U1tDhWGzVLkggiaSkFqTi3L4T7gF+mFrc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678904371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y6P3avYFLfmZWtirttMewFieZIFd8qLJc55Dm6AWaNQ=; b=v2jefdgLHkJBREkGzn2ij1ENvcr6QAS+yTaYsa0Wf/Rg/yA9Uqx2kW/DGBHIwhmJ8N k5lsLcVCFB/DOEgBOSCYlCyyXYe6kTr3ZZ89UEfxl8KqpIZksaEGMLLFYV9YqSmUPO4x ZsRarYd56wcP4M6L1YjnhU/cIpIcg88uU5eh0QiVo6OcdYR9QL3b9HiTvwn7pt8TR9JA uW2B3hamK/8sH/dBH+M45aB4Jwv/atHHAao0cotJPkrJpPqYJUV0HjYGUmdBMvTRxiS0 FiNpc0czzYTJmV/QFQ9TZ9Cmd+0RuLlF78yusGXDpYEt8hnv6EzVescQ4XwRApk600A+ IWjw== X-Gm-Message-State: AO0yUKVqst9lzWq3i/MoTUXMAnZDh03kE4qH0bP53HdKf79pbXgRRljA drKhwIO1UUUJSp4qkwJBJwnKzw== X-Google-Smtp-Source: AK7set/KQrtDeKLTF6TrIljAt+eNWc5kdtu2hQ8C4MazFU3GCyoPdEgAjOM7vonPV/MkIpsla8vYNg== X-Received: by 2002:ac8:5e0c:0:b0:3b8:6a20:675e with SMTP id h12-20020ac85e0c000000b003b86a20675emr1472979qtx.29.1678904370959; Wed, 15 Mar 2023 11:19:30 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id v125-20020a379383000000b007458ae32290sm4113974qkd.128.2023.03.15.11.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 11:19:30 -0700 (PDT) From: "Joel Fernandes (Google)" 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@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 06/14] net/mlx5: Rename kfree_rcu() to kfree_rcu_mightsleep() Date: Wed, 15 Mar 2023 18:18:53 +0000 Message-Id: <20230315181902.4177819-6-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230315181902.4177819-1-joel@joelfernandes.org> References: <20230315181902.4177819-1-joel@joelfernandes.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: "Uladzislau Rezki (Sony)" 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 Cc: Saeed Mahameed Cc: Vlad Buslov Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) Reviewed-by: Saeed Mahameed --- 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) From patchwork Wed Mar 15 18:18:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 13176509 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BFBDC61DA4 for ; Wed, 15 Mar 2023 18:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbjCOSUV (ORCPT ); Wed, 15 Mar 2023 14:20:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232477AbjCOSTx (ORCPT ); Wed, 15 Mar 2023 14:19:53 -0400 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCDD7848DD for ; Wed, 15 Mar 2023 11:19:38 -0700 (PDT) Received: by mail-qt1-x835.google.com with SMTP id cf14so17177915qtb.10 for ; Wed, 15 Mar 2023 11:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1678904377; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2CvInQkgrtFswN6a5J7y2T4rUDkhwlp0YkwDUjcLdMc=; b=KnGZSFdqJfe5cBkq4aueaxEmiLAtr5exCnajnLei2Srqi9rxmdUuZI63NoOHKdJ2+o zHIUImu4xXpy20R3uMo162yktC1I33Kf0ShmUAEpgNBOOhn4IjHGJR07QliUY+ctVwZQ HWm3wiihMoB3X4nUyfx7NPhrp6HpBq8pnQ1lE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678904377; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2CvInQkgrtFswN6a5J7y2T4rUDkhwlp0YkwDUjcLdMc=; b=5FwlMaSz6urEhKW2qo92IENR+smqvSvkzgi2CmXcap/BpOaimET9sFIzMFuB4YSzaJ ys8UsQESgcD+HPvUz8WGhWhD/F44dTWiLORgyxYHsEPZsupFESaBVK9PDR1iDfdG7wKU 9M6seuz1mnG1gOaf/m3P6nzHhOlVNNc0N/vYVLZYqZQq9AwVENrU7ukZKkzg2JO9MgIb xxtFr4rHVTD5bZrFzqFGAhgRJCqb9sQfVC5IxxrXx1e5dozjGDV5TFgmhIi9z+nrZQm2 3iE024yUruOKLvBUaazH9XcSyyrWKGrR4MX16RPTIOGzPp4q6ROIAm4ZR4+1QWiRykQR 7Fvg== X-Gm-Message-State: AO0yUKXEBhSv4KGGSSM1qKW8Cnbghy0LNn5gFlahwbu7ACekagF5l294 Kjr/Iph5Wm0RnJ8vbxzYuImzRw== X-Google-Smtp-Source: AK7set9oYtHUFfrwlWQH2asNzIQYPCQs5mupkZKf2svsaI8b0gVoCB+qZF/+IC8hu7UCi4R1iYnkCg== X-Received: by 2002:a05:622a:50c:b0:3d3:33bd:a29 with SMTP id l12-20020a05622a050c00b003d333bd0a29mr1523968qtx.16.1678904377358; Wed, 15 Mar 2023 11:19:37 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id v125-20020a379383000000b007458ae32290sm4113974qkd.128.2023.03.15.11.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 11:19:37 -0700 (PDT) From: "Joel Fernandes (Google)" 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@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 12/14] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep() Date: Wed, 15 Mar 2023 18:18:59 +0000 Message-Id: <20230315181902.4177819-12-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230315181902.4177819-1-joel@joelfernandes.org> References: <20230315181902.4177819-1-joel@joelfernandes.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Signed-off-by: Joel Fernandes (Google) Acked-by: Stefan Schmidt --- 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);