From patchwork Wed Mar 15 14:52:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiraz Saleem X-Patchwork-Id: 13175998 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 EE1F2C6FD1D for ; Wed, 15 Mar 2023 14:55:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232491AbjCOOzf (ORCPT ); Wed, 15 Mar 2023 10:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232925AbjCOOzJ (ORCPT ); Wed, 15 Mar 2023 10:55:09 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95F939028 for ; Wed, 15 Mar 2023 07:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678892056; x=1710428056; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aTl2vtN3cwYPirEjRT4yCJZMmsTz4eHmoTimWby6ZTE=; b=CQ952CHNArRqdnVSOfu1wgO081ggWLJItHOqNLR8HJlC0RWfMIWuluMQ 0eT+Pdasib1BgRkQUkzt5nlPiWxLnXF3SS6PgP03RpDF7/Ilt2Z410M+q 1n2i3DoKPVfwTHrW8/MB+Gkgt14NDOKXk4IQAK0oKax9klxp0P61IyDyN gV90S0XpLCry7R9SfsFbdmrf/Z71RdP8PoN8Zbvigdqrm9Dicx8bniqEJ RjYgtJ+d+LxiUmZt94+r7gA+/W8CzouPUMciBBPZcU8YFYiktaeXHGEhC 4EOUNdhLtXSl/BmULGlicdegqg+WIIfJM6Y9JduiZ0rXRgiVGhjmJtl4e Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="321561534" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="321561534" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 07:52:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="748457447" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="748457447" Received: from ssaleem-mobl1.amr.corp.intel.com ([10.255.35.84]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 07:52:46 -0700 From: Shiraz Saleem To: jgg@nvidia.com, leon@kernel.org Cc: linux-rdma@vger.kernel.org, Mustafa Ismail , Shiraz Saleem Subject: [PATCH for-rc 2/4] RDMA/irdma: Fix memory leak of PBLE objects Date: Wed, 15 Mar 2023 09:52:29 -0500 Message-Id: <20230315145231.931-3-shiraz.saleem@intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230315145231.931-1-shiraz.saleem@intel.com> References: <20230315145231.931-1-shiraz.saleem@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Mustafa Ismail On rmmod of irdma, the PBLE object memory is not being freed. PBLE object memory are not statically pre-allocated at function initialization time unlike other HMC objects. PBLEs objects and the Segment Descriptors (SD) for it can be dynamically allocated during scale up and SD's remain allocated till function deinitialization. Fix this leak by adding IRDMA_HMC_IW_PBLE to the iw_hmc_obj_types[] table and skip pbles in irdma_create_hmc_obj but not in irdma_del_hmc_objects(). Fixes: 44d9e52977a1 ("RDMA/irdma: Implement device initialization definitions") Signed-off-by: Mustafa Ismail Signed-off-by: Shiraz Saleem --- drivers/infiniband/hw/irdma/hw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c index 2e1e2ba..43dfa47 100644 --- a/drivers/infiniband/hw/irdma/hw.c +++ b/drivers/infiniband/hw/irdma/hw.c @@ -41,6 +41,7 @@ IRDMA_HMC_IW_XFFL, IRDMA_HMC_IW_Q1, IRDMA_HMC_IW_Q1FL, + IRDMA_HMC_IW_PBLE, IRDMA_HMC_IW_TIMER, IRDMA_HMC_IW_FSIMC, IRDMA_HMC_IW_FSIAV, @@ -827,6 +828,8 @@ static int irdma_create_hmc_objs(struct irdma_pci_f *rf, bool privileged, info.entry_type = rf->sd_type; for (i = 0; i < IW_HMC_OBJ_TYPE_NUM; i++) { + if (iw_hmc_obj_types[i] == IRDMA_HMC_IW_PBLE) + continue; if (dev->hmc_info->hmc_obj[iw_hmc_obj_types[i]].cnt) { info.rsrc_type = iw_hmc_obj_types[i]; info.count = dev->hmc_info->hmc_obj[info.rsrc_type].cnt;