Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp177110pxj; Wed, 16 Jun 2021 23:43:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrmpisOGeeqrm9BkJuPtdOOtE0hXuj4kVTBdBpLraZr9eOSLpPZg8ZxB9h+CaXgsxYpt0B X-Received: by 2002:a5d:80c8:: with SMTP id h8mr450931ior.120.1623912233400; Wed, 16 Jun 2021 23:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623912233; cv=none; d=google.com; s=arc-20160816; b=rQmtvTF8ePAIFr+SCehEalHXcVjyciEsOcuKLSoZxq+bdNzjALlc+juE8Uj9jL1Seo ae5yAbqstSkyNnHmPYoxvYDaM37AIkUg7yqc15vOfRxYsQ63pwao94U3M49YXpJD/2Or wF4HxvLZdUC9zxWwHAmo6mv0pFu0b74tGZNE7w0Uw0DasritLGBiX2RVPSJsWyexJ3Zq EbATw9WglRrVvwyHhph7FKFMSmaxoGDHCDFD/M+ads8E0z+EqMbLB910yl+2N61L3Bil yVKxkSv8XGkqnJ/4JlcT1zbwXGs9T3nsGPoWNwr01uckuqjvDksctqr+iR1/QryD0F4G SAiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1SwndIUIKNvXBBkZ06kdRxeJOgiX9z7S8kudSGRVH1M=; b=hl8vlTey+nJmKdK4ZP6cml2FAXKpxszum5e4/EzqBu8n0Ab0KtaboPq+dMNMkIDLcx FxwVO3lsKC+TDx+R7uy5wWhxSFrqCohlfoyCX8mo78s3Fyi72F4m3lDd5RzcKKXQhcBv 9g89VqC2r0yUW4KhzJDK15ghMfCeO+bzs/af6NnvPb1YhwOeUF4XOaZ99PA7QJHu5tX/ YiBCWx8b/tnKxA/eiFnQtvtU9ChsL6gB26MSdPj4J6A1oKddfLMEqqt5hjryKgDypKqk k0ZsexnXBXnd2dRIGBwT+tZwb0AlUiHCRh8z+gj9kwV4i5adMvCMopZ3/KK7BuTz5u4y Dh0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k08qDhZl; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d70si5941995iog.4.2021.06.16.23.43.40; Wed, 16 Jun 2021 23:43:53 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=k08qDhZl; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbhFQGoD (ORCPT + 99 others); Thu, 17 Jun 2021 02:44:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:52324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbhFQGn7 (ORCPT ); Thu, 17 Jun 2021 02:43:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BF7D3610A1; Thu, 17 Jun 2021 06:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623912112; bh=k22wDppAh/+MfBvxHK3lLfrhgV48Cp0+hy+NlhOezjo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k08qDhZlti1TGwtsRZt2sGX5il6HZSEPQc9KEU9lcYZJ9epJmsJhpdQhHJo+8JEH8 z+uvVXOG6rQoPoalYEBq8a1AQBGwW+LtHW7etqnBNL7/j4hsMvJ+/o8WeqsxHMjh1r LoLKrExPTPT9OJWkitYeLYaZCCX3meQ69TMJ7Znqc0tM5loMkBaZGKTqg347zPV1Di m+ggFt9C8a2N2O+Vu6BQR+c2q8UtqJIU6tl3lpFSlys9YeSoNedn3zzesycIq24dpL jh/zQzUaBGBKVRPGLSEgwiOx0s75d+5KfrJphRDuHnDmmNuQz9ZAZjJ45s4pWnHvgg U9W90I8i+UCbQ== Date: Thu, 17 Jun 2021 09:41:47 +0300 From: Leon Romanovsky To: Anand Khoje Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, dledford@redhat.com, jgg@ziepe.ca, haakon.bugge@oracle.com Subject: Re: [PATCH v5 for-next 3/3] IB/core: Obtain subnet_prefix from cache in IB devices Message-ID: References: <20210616154509.1047-1-anand.a.khoje@oracle.com> <20210616154509.1047-4-anand.a.khoje@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210616154509.1047-4-anand.a.khoje@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 09:15:09PM +0530, Anand Khoje wrote: > ib_query_port() calls device->ops.query_port() to get the port > attributes. The method of querying is device driver specific. > The same function calls device->ops.query_gid() to get the GID and > extract the subnet_prefix (gid_prefix). > > The GID and subnet_prefix are stored in a cache. But they do not get > read from the cache if the device is an Infiniband device. The > following change takes advantage of the cached subnet_prefix. > Testing with RDBMS has shown a significant improvement in performance > with this change. > > The function ib_cache_is_initialised() is introduced because > ib_query_port() gets called early in the stage when the cache is not > built while reading port immutable property. > > In that case, the default GID still gets read from HCA for IB link- > layer devices. > > In the situation of an event causing cache update, the subnet_prefix > will get retrieved from newly updated GID cache in ib_cache_update(), > so that we do not end up reading a stale value from cache via > ib_query_port(). > > Fixes: fad61ad ("IB/core: Add subnet prefix to port info") > Suggested-by: Leon Romanovsky > Suggested-by: Aru Kolappan > Signed-off-by: Anand Khoje > Signed-off-by: Haakon Bugge > --- > > v1 -> v2: > - Split the v1 patch in 3 patches as per Leon's suggestion. > > v2 -> v3: > - Added changes as per Mark Zhang's suggestion of clearing > flags in git_table_cleanup_one(). > v3 -> v4: > - Removed the enum ib_port_data_flags and 8 byte flags from > struct ib_port_data, and the set_bit()/clear_bit() API > used to update this flag as that was not necessary. > Done to keep the code simple. > - Added code to read subnet_prefix from updated GID cache in the > event of cache update. Prior to this change, ib_cache_update > was reading the value for subnet_prefix via ib_query_port(), > due to this patch, we ended up reading a stale cached value of > subnet_prefix. > v4 -> v5: > - Removed the code to reset cache_is_initialised bit from cleanup > as per Leon's suggestion. > - Removed ib_cache_is_initialised() function. > > --- > drivers/infiniband/core/cache.c | 14 ++++++++++++-- > drivers/infiniband/core/device.c | 9 +++++++++ > include/rdma/ib_verbs.h | 1 + > 3 files changed, 22 insertions(+), 2 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky