Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp152124pxj; Thu, 3 Jun 2021 03:19:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyfFkb/YcudXL/nNBOTMtSpsCOt7V+iTDjjLfAAg7c2fQS/sT4SSfkh5bhmsA+m5jfN1lA X-Received: by 2002:a17:906:2a08:: with SMTP id j8mr38402251eje.483.1622715585950; Thu, 03 Jun 2021 03:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622715585; cv=none; d=google.com; s=arc-20160816; b=N1MRct1NPxOo5OJA6JSkvP6Gxl7fgm7p9yucNex6ikbw8ggDbvuPTTfqd5D2RHcV0w o1hEp+HGY5+ova336/gYcqh7niWrQHML8xr4kk5SIispi+eCtpciqfwLIbZ/71BfBQx3 DgjY/zGkrh/x8G9RTimilLDOIuLUDjKF2oq0Uz38YObXtBXV0b//bgwvQMxk1MjtIZ+r XSfcAEC2wbinH5Z6GbknpMpJ4vuJjIb/it7cf7fNi50Hl0XRBg7XKZZ2sLSntaYoPcos rKvWyiBNjAh7hjO02HeS2lnEBTWV0Wc3N24O7GKUAq9wNJEFugUP1KbKpK+UVC2D7Djp Ncvg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1eYV7NgMFMdRG/hm0zJA3sMk57cD8Z1Q2h1jjoOBwwU=; b=Jk24CMozHYQ1Ctl1rx4Ou+3DeD7ZTcIOtA9YAGGsvbhuJEWoSQViOeyEdMprlt/TM9 HDqbBWiiOJI5rsDmu2V/lPyQxdIg0YC4Cj6J2RcMto0tpX1WaLyiiV3yX+8XWGEX+mYB I7X/sfwObdbWHRVTbxWRIP8n2SwZqLkfG0R9YWG99xelwZDRTwJzXZHpoZMkWOGl/kJO Ch8PRVFg1qHd8vVFTU4lTEK65Yqe6Q+xK/JYgXAIgh7KWip5X6ZcNlemhRY+h7l0CYxV DRelqhNlyXDxhCNDh/2co/GQ36UU5LkhtrcLjr5e1IphtMlEEtQm6uj3c/MJQYG3WrQC GAiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qBn9EBCT; 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 a22si2530596edb.395.2021.06.03.03.19.22; Thu, 03 Jun 2021 03:19:45 -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=qBn9EBCT; 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 S230092AbhFCKSa (ORCPT + 99 others); Thu, 3 Jun 2021 06:18:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:53772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbhFCKSa (ORCPT ); Thu, 3 Jun 2021 06:18:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 696EA6139A; Thu, 3 Jun 2021 10:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622715406; bh=7HZciQxLsBuDoWMd4Kb6D5lue9+WuT5FUDqHbpuuJFQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qBn9EBCTr/3wcixKOMWXn/re9l7QnkKOGGYXUU7FMUKCbzdv6J01w7AQa7hlB8tDG 1+GPwyig2oF++DkVY1lBIYDte4/IP9mhnSf3o0RUYpmd/jscIrozXAOkY+VtvgxvW8 708BT7bDa6iZZqOYm0UqNQ1tCQHjLivlzV81NT4FxZKcOWrE7vj+xExLp3hxGChQNs SWG2V6nXkz3Mn+qLTI+eqUqtNg+dcY0GLdCPRSkZtuht/OrzCWGf3bV4COqT7N95n+ wLoe7vzrAKNM1ykOKcuREzzqFDIbpnkcrzqgDvsBkYvkDyHwqRkDjokBleLInCkY9i ZwQdoM98OQ3kQ== Date: Thu, 3 Jun 2021 13:16:42 +0300 From: Leon Romanovsky To: Haakon Bugge Cc: Anand Khoje , OFED mailing list , "linux-kernel@vger.kernel.org" , "dledford@redhat.com" , "jgg@ziepe.ca" Subject: Re: [PATCH v2 3/3] IB/core: Obtain subnet_prefix from cache in IB devices Message-ID: References: <20210603065024.1051-1-anand.a.khoje@oracle.com> <20210603065024.1051-4-anand.a.khoje@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 03, 2021 at 09:29:32AM +0000, Haakon Bugge wrote: > > > > On 3 Jun 2021, at 11:07, Leon Romanovsky wrote: > > > > On Thu, Jun 03, 2021 at 12:20:24PM +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. > >> > >> Fixes: fad61ad ("IB/core: Add subnet prefix to port info") > >> Signed-off-by: Anand Khoje > >> Signed-off-by: Haakon Bugge > >> --- > >> drivers/infiniband/core/cache.c | 7 ++++++- > >> drivers/infiniband/core/device.c | 9 +++++++++ > >> include/rdma/ib_cache.h | 6 ++++++ > >> include/rdma/ib_verbs.h | 6 ++++++ > >> 4 files changed, 27 insertions(+), 1 deletion(-) > > > > Can you please help me to understand how cache is updated? > > > > There are a lot of calls to ib_query_port() and I wonder how callers can > > get new GID after it was changed in already initialized cache. > > The cache is initialized when it is created, just before the bit IB_PORT_CACHE_INITIALIZED is set in flags. > > After commit d58c23c92548 ("IB/core: Only update PKEY and GID caches on respective events"), the GID portion of the cache is updated when a IB_EVENT_GID_CHANGE event is received. > > Before said commit, it was updated on any event. This part is clear to me, the missing piece is to understand what will happen if cache and GID are not in sync because of asynchronous nature of events. Thanks > > > Thxs, H?kon >