From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19C13C433EF for ; Wed, 17 Nov 2021 18:26:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0399C61BF4 for ; Wed, 17 Nov 2021 18:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240032AbhKQS3h (ORCPT ); Wed, 17 Nov 2021 13:29:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:55478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239997AbhKQS3c (ORCPT ); Wed, 17 Nov 2021 13:29:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0897A61BD3; Wed, 17 Nov 2021 18:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637173593; bh=egTOWZok2LDjlwNFZaUiL4p9ekcH/5KxuwhLpRQVX54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qM01AiRFituJX5zzSS2GSL824fLNVYiatRUoewCIYAB3QvufLFANfD47AvKp4k6J+ ZC3KzlYBKZVJIdRgvJ+9VOWwZ1/YaKFbih6WQG6R5ehJFjUnXkTWZyV+9WYRT1swja PeDdCRerL/TO9HKwe1HWNdf73cwnN0LbyKBoSnhEuE7lXKw/DfccPOQPX8dHBzaaFc 80wYBuMTFlnwwHTjEzkjgULzLLa03ZxP7coBq9Ye3BSwmT6KgO/EPwDzX9w7CHkMB+ 07mTZYULQRTWns+UpJ4Bp0ktaw6UFrv3HTnclLYtLonPqU9p8lf8XIpw2KeQNm2KX/ XEnzzMu7Rb7sw== From: Leon Romanovsky To: "David S . Miller" , Jakub Kicinski Cc: Leon Romanovsky , Alexandre Belloni , Andrew Lunn , Aya Levin , Claudiu Manoil , drivers@pensando.io, Florian Fainelli , Ido Schimmel , intel-wired-lan@lists.osuosl.org, Ioana Ciornei , Jesse Brandeburg , Jiri Pirko , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Michael Chan , netdev@vger.kernel.org, oss-drivers@corigine.com, Saeed Mahameed , Shannon Nelson , Simon Horman , Taras Chornyi , Tariq Toukan , Tony Nguyen , UNGLinuxDriver@microchip.com, Vivien Didelot , Vladimir Oltean Subject: [PATCH net-next 2/6] devlink: Delete useless checks of holding devlink lock Date: Wed, 17 Nov 2021 20:26:18 +0200 Message-Id: X-Mailer: git-send-email 2.33.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky The snapshot API is fully protected by devlink->lock and these internal functions are not exported directly to the code outside of the devlink.c. This makes the checks of holding devlink lock as completely redundant. Signed-off-by: Leon Romanovsky --- net/core/devlink.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index 1cb2e0ae9173..dcc09c62f3e5 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -5223,8 +5223,6 @@ static int __devlink_snapshot_id_increment(struct devlink *devlink, u32 id) unsigned long count; void *p; - lockdep_assert_held(&devlink->lock); - p = xa_load(&devlink->snapshot_ids, id); if (WARN_ON(!p)) return -EINVAL; @@ -5259,8 +5257,6 @@ static void __devlink_snapshot_id_decrement(struct devlink *devlink, u32 id) unsigned long count; void *p; - lockdep_assert_held(&devlink->lock); - p = xa_load(&devlink->snapshot_ids, id); if (WARN_ON(!p)) return; @@ -5298,8 +5294,6 @@ static void __devlink_snapshot_id_decrement(struct devlink *devlink, u32 id) */ static int __devlink_snapshot_id_insert(struct devlink *devlink, u32 id) { - lockdep_assert_held(&devlink->lock); - if (xa_load(&devlink->snapshot_ids, id)) return -EEXIST; @@ -5325,8 +5319,6 @@ static int __devlink_snapshot_id_insert(struct devlink *devlink, u32 id) */ static int __devlink_region_snapshot_id_get(struct devlink *devlink, u32 *id) { - lockdep_assert_held(&devlink->lock); - return xa_alloc(&devlink->snapshot_ids, id, xa_mk_value(1), xa_limit_32b, GFP_KERNEL); } @@ -5353,8 +5345,6 @@ __devlink_region_snapshot_create(struct devlink_region *region, struct devlink_snapshot *snapshot; int err; - lockdep_assert_held(&devlink->lock); - /* check if region can hold one more snapshot */ if (region->cur_snapshots == region->max_snapshots) return -ENOSPC; @@ -5391,8 +5381,6 @@ static void devlink_region_snapshot_del(struct devlink_region *region, { struct devlink *devlink = region->devlink; - lockdep_assert_held(&devlink->lock); - devlink_nl_region_notify(region, snapshot, DEVLINK_CMD_REGION_DEL); region->cur_snapshots--; list_del(&snapshot->list); -- 2.33.1