From patchwork Thu Feb 2 09:03:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13125567 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 8C806C636D4 for ; Thu, 2 Feb 2023 09:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232272AbjBBJDc (ORCPT ); Thu, 2 Feb 2023 04:03:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232406AbjBBJDX (ORCPT ); Thu, 2 Feb 2023 04:03:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1B8854563 for ; Thu, 2 Feb 2023 01:03:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A9806192B for ; Thu, 2 Feb 2023 09:03:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43E41C433EF; Thu, 2 Feb 2023 09:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675328596; bh=BLv0X8oB0G+4RyZ/NzLQim9FuHxKh/daMoqV0NvAgDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q/qPpeg69LrS1nlgJ+AZ/fGoB3W9JnoSxjhO9T3HpXrf8fhFE5j3e+KpmyBZ/80WM DcMTR1K0tOFvBLGZPa3QSZDmDNlPnVzHt1GYiObzf/bvnjioeo52BXg/PWLnQ1+hif RiXbrYxCfB7hNdyvC8AVEe6jr6Svn4x/s3WJQLPwSMY96vgAmA6IELu5bGZbBc+XaG jsLExdCVz73GvYNOMUbAIB5AtjFQ/nIhoORybHBC7FirmPJ5jMomO36p7nYLvMHv9X fDJVSqcJbc+dTTxUdwaMPKFRJZUP97ftiTHGIybPwJ3aCG6cvsBUbX3uq4Do4PchjF XVO3YhdQSp4cA== From: Leon Romanovsky To: Jason Gunthorpe Cc: Leon Romanovsky , linux-rdma@vger.kernel.org, Michael Guralnik Subject: [PATCH rdma-next 1/2] RDMA/mlx5: Fix MR cache debugfs in switchdev mode Date: Thu, 2 Feb 2023 11:03:06 +0200 Message-Id: <482a78c54acbcfa1742a0e06a452546428900ffa.1675328463.git.leon@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Leon Romanovsky Block MR cache debugfs creation while in switchdev mode and add missing debugfs cleanup in error path. This change fixes the following debugfs errors: bond0: (slave enp8s0f1): Enslaving as a backup interface with an up link mlx5_core 0000:08:00.0: lag map: port 1:1 port 2:1 mlx5_core 0000:08:00.0: shared_fdb:1 mode:queue_affinity mlx5_core 0000:08:00.0: Operation mode is single FDB debugfs: Directory '2' with parent '/' already present! ... debugfs: Directory '22' with parent '/' already present! Fixes: 73d09b2fe833 ("RDMA/mlx5: Introduce mlx5r_cache_rb_key") Signed-off-by: Michael Guralnik Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/mlx5/mr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 3a9a787184fc..3f410eef58e4 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -848,6 +848,9 @@ static void mlx5_mkey_cache_debugfs_add_ent(struct mlx5_ib_dev *dev, int order = order_base_2(ent->rb_key.ndescs); struct dentry *dir; + if (!mlx5_debugfs_root || dev->is_rep) + return; + if (ent->rb_key.access_mode == MLX5_MKC_ACCESS_MODE_KSM) order = MLX5_IMR_KSM_CACHE_ENTRY + 2; @@ -1006,6 +1009,7 @@ int mlx5_mkey_cache_init(struct mlx5_ib_dev *dev) err: mutex_unlock(&cache->rb_lock); + mlx5_mkey_cache_debugfs_cleanup(dev); mlx5_ib_warn(dev, "failed to create mkey cache entry\n"); return ret; }