Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp222324pxj; Wed, 16 Jun 2021 00:31:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYyXI/BQtZU6HMhTD3GQeX+ag8uvivcW4BKYXGIATDMqb/w9HXl6ep6AJDOWzhbW6tKTGZ X-Received: by 2002:a05:6638:24cb:: with SMTP id y11mr2890728jat.122.1623828692117; Wed, 16 Jun 2021 00:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623828692; cv=none; d=google.com; s=arc-20160816; b=m8bcOV4Jf9psP9fbMeeCWOpoNfkXn25QFKlf6icQ08xJPf/Kgb8A+gJWIiUpgssVOT /OjpC7LJnqlIR4UXldGeKuntIQ4e8QnWoXP/wblopoxo2VrhfCSlDxBes7foQjby5u1I oGcirv20soqr58nuEcTYkIQ/C/GUkXv8yKlOqzILbrPAnzLlPhr0RB9/3ttnl3jt6JGz PVriJDPchCyKRbD+zPPM5OLHvms7362KUYlkI0UWw3VVQ8y2QxPQsGK6ofeRIm6fAoPd GFXpfr3kpYOwS1q4GbDRz4p1WP2fKV9wMXuJhDMVKMWM876QpS0W1i9gXtW+GMlwjJWC KC1Q== 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=2e6h6tw9QG/USEAj/ib+hORiuVLmY4MdHAiGHcUYsaw=; b=NdMfKGZYYSdZ/ugeW2ec7JK4KIm95jwjSxynST0dcqc1ncjFJpRjBK8imisi6M3SuB A3dvgIlrYJ7A/VzABp68VfMrAkLuqZeJly9Aay07F2ieJ2nCdWMazNE5ETPviBQgYk3L 97PkwXmIeqOUXhaejLY5HJd+B0BrE7a9/bIBZEXgqGJAIW4ztw+7pUunui3pKxq6/E4e e+BOZl4uVU/Z3VBtK3lqT1PawYSjx5MDGNV0w4m0M0pB8WB9L1hewFbhjGckKDiufENy P2fdQrbJqm0AUZn8wXOMGeVJ1PaZ9ApCG3QvSUpsG7O3y8sgAo7jLImoyloeAO4oaKzu VuCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SmbwDkTa; 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 x6si1418856iol.30.2021.06.16.00.31.20; Wed, 16 Jun 2021 00:31:32 -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=SmbwDkTa; 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 S232038AbhFPHcf (ORCPT + 99 others); Wed, 16 Jun 2021 03:32:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:47084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232010AbhFPHcZ (ORCPT ); Wed, 16 Jun 2021 03:32:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 671AD6044F; Wed, 16 Jun 2021 07:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623828620; bh=AtPZETMQfDlVwaPKTN13KJ1TnXAOl86TlunvJ+giqQE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SmbwDkTaAtzCdGIoo3TjArnHzGu4mMtE5z69zB4RF6vPqusQ/pDqCQ1zDLZPLj4Ju 0LjblC76piWB8sZ3PZXQi6QbKSY+HPvCi61FNrq49Lrk/VlAPGTdeNafVPkj174Ie5 vRyAmtL9XVFUxnmejAUBsiOA9NK90S2xbXlbpkuhogGpD2LOvz3KEhP25uS7GpbA2K sNdKzrk8vo3broeYW22Dr4a++wkQRu4A/+pARShU4NqEuYcudYaSGBirvCvnZvz9Kc q5DDVkslM6XZ2fi0AbPNardkV8RhhPWaMTiYJ1HrnmfXAYxmRbD4Vtu932X7l30K4t 1beWfKGXgIDhg== Date: Wed, 16 Jun 2021 10:30:16 +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 v4 for-next 3/3] IB/core: Obtain subnet_prefix from cache in IB devices Message-ID: References: <20210616065213.987-1-anand.a.khoje@oracle.com> <20210616065213.987-4-anand.a.khoje@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210616065213.987-4-anand.a.khoje@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 12:22:13PM +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 > --- <...> > @@ -1523,13 +1526,21 @@ static int config_non_roce_gid_cache(struct ib_device *device, > device->port_data[port].cache.lmc = tprops->lmc; > device->port_data[port].cache.port_state = tprops->state; > > - device->port_data[port].cache.subnet_prefix = tprops->subnet_prefix; > + ret = rdma_query_gid(device, port, 0, &gid); > + if (ret) { > + write_unlock_irq(&device->cache.lock); And this patch can't compile. It should be cache_lock and not cache.lock. Thanks