Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9122091pxu; Mon, 28 Dec 2020 07:10:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyK7CBK06JyHosauRUzGxAw2tuPsiH59rom6Ev7C+GCoidvms4taqbExSxjsbtmPZ4QSajW X-Received: by 2002:a50:b944:: with SMTP id m62mr42172028ede.182.1609168219499; Mon, 28 Dec 2020 07:10:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168219; cv=none; d=google.com; s=arc-20160816; b=iJ68ZXfJtwhNfPWJfm+p6hUAxT3SnUVO1+b3oVHhnwBiJCxLjQ8KOEQ7Q4u+BOSJ9Q vGmegRaCivpgBpKXmHmNEM2Ati8QoQ21CfYvWkXS0LNWsulhQ1foLZ1B828FCvutzt0a tS0Ez+JeoFtvz4JTs1VowODhhgj+AxGo8ix0fMNRUg95wtXZog3fGOc+1IJcv1FmwMih /w3gkUUgHjccZlyWcODmYRBmnxfLhV3gdFcGMme5PwPeDNEazK+7seTC9qYYubetYnOZ wU4GdSDV78X/3pkuhV5J/zqRhJjNIkHpybcSJ/Xl0eoXBmKfiMgD+5AKd8ZuZTsb+8Ib XuJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+dEO6CndQIKVWVvxeMLuXVGs2ZhGRzIMkdbRCOfPL2o=; b=XyfmZYGvWVsI7RK7jWY0b3MbD34zVC2F8ILXhbncMjtw5MiBnnv1Nak5PCE2B9hKYQ IhWZ2ChEa1XEgkogOBCUcOCs28YK3tsMfy/s6I8Afx1INVuBm8zoAOgt1SK/FNYk8T83 YU6aityzON9wS/K80gA2L/tNMr72oVSO5AwQwawEq3tQRUsP++uim4Q51UNj9cfs0CZ1 Smm6dgfydpzozy2gZabL0PW6/QpiQvfwUfrp8WM4fjRPAAddmajlfQ6cznGgLbe5cubJ D23rB6/82C8b2ganBLBDi4ehm4IDMEgD/2vztW03CV/YVCIlt9HiB85xpZdgVp4FpaYy ZkmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vuax8Tmu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si20931586edn.508.2020.12.28.07.09.56; Mon, 28 Dec 2020 07:10:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vuax8Tmu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437553AbgL1OKQ (ORCPT + 99 others); Mon, 28 Dec 2020 09:10:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:44654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438976AbgL1OKO (ORCPT ); Mon, 28 Dec 2020 09:10:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E980206D8; Mon, 28 Dec 2020 14:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164573; bh=Y0bj8V92Eo1BPrmlUG9rIJXY31tSQks4F35z2s17nCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vuax8TmucU2hTaVCM0e03B2jE8PohzaX0LSk8S8lc6GCKDKsetRl6rBB7/XkaEkQK kN246gDi0Mcax0MXjRn/M3mgfbpl2azxL8Az9OIVuks6Sb6L1cClY6ELbEwx/s0JtW k3hfGIrkqNGsJa4EijeYJfd5deHb3kgW1N8bFmAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.10 223/717] RDMA/core: Track device memory MRs Date: Mon, 28 Dec 2020 13:43:41 +0100 Message-Id: <20201228125031.669807985@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky [ Upstream commit b47a98efa97889c5b16d17e77eed3dc4500674eb ] Device memory (DM) are registered as MR during initialization flow, these MRs were not tracked by resource tracker and had res->valid set as a false. Update the code to manage them too. Before this change: $ ibv_rc_pingpong -j & $ rdma res show mr <-- shows nothing After this change: $ ibv_rc_pingpong -j & $ rdma res show mr dev ibp0s9 mrn 0 mrlen 4096 pdn 3 pid 734 comm ibv_rc_pingpong Fixes: be934cca9e98 ("IB/uverbs: Add device memory registration ioctl support") Link: https://lore.kernel.org/r/20201117070148.1974114-2-leon@kernel.org Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/core/uverbs_std_types_mr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/infiniband/core/uverbs_std_types_mr.c b/drivers/infiniband/core/uverbs_std_types_mr.c index 9b22bb553e8b3..dc58564417292 100644 --- a/drivers/infiniband/core/uverbs_std_types_mr.c +++ b/drivers/infiniband/core/uverbs_std_types_mr.c @@ -33,6 +33,7 @@ #include "rdma_core.h" #include "uverbs.h" #include +#include "restrack.h" static int uverbs_free_mr(struct ib_uobject *uobject, enum rdma_remove_reason why, @@ -134,6 +135,9 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_MR_REG)( atomic_inc(&pd->usecnt); atomic_inc(&dm->usecnt); + rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); + rdma_restrack_set_name(&mr->res, NULL); + rdma_restrack_add(&mr->res); uobj->object = mr; uverbs_finalize_uobj_create(attrs, UVERBS_ATTR_REG_DM_MR_HANDLE); -- 2.27.0