mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anand Khoje <anand.a.khoje@oracle.com>
To: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: dledford@redhat.com, jgg@ziepe.ca, haakon.bugge@oracle.com,
	leon@kernel.org
Subject: [PATCH v7 for-next 2/3] IB/core: Shifting initialization of device->cache_lock.
Date: Wed, 30 Jun 2021 15:16:14 +0530	[thread overview]
Message-ID: <20210630094615.808-3-anand.a.khoje@oracle.com> (raw)
In-Reply-To: <20210630094615.808-1-anand.a.khoje@oracle.com>

The lock cache_lock of struct ib_device is initialized in function
ib_cache_setup_one(). This is much later than the device initialization
in _ib_alloc_device().

This change shifts initialization of cache_lock in _ib_alloc_device().

Suggested-by: Haakon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Anand Khoje <anand.a.khoje@oracle.com>
---
 drivers/infiniband/core/cache.c  | 2 --
 drivers/infiniband/core/device.c | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 929399e..0c98dd3 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -1621,8 +1621,6 @@ int ib_cache_setup_one(struct ib_device *device)
 	u32 p;
 	int err;
 
-	rwlock_init(&device->cache_lock);
-
 	err = gid_table_setup_one(device);
 	if (err)
 		return err;
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index fa20b18..ba0ad72 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -607,6 +607,8 @@ struct ib_device *_ib_alloc_device(size_t size)
 	for (i = 0; i < ARRAY_SIZE(device->cq_pools); i++)
 		INIT_LIST_HEAD(&device->cq_pools[i]);
 
+	rwlock_init(&device->cache_lock);
+
 	device->uverbs_cmd_mask =
 		BIT_ULL(IB_USER_VERBS_CMD_ALLOC_MW) |
 		BIT_ULL(IB_USER_VERBS_CMD_ALLOC_PD) |
-- 
1.8.3.1


  parent reply	other threads:[~2021-06-30  9:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30  9:46 [PATCH v7 for-next 0/3] IB/core: Obtaining subnet_prefix from cache in Anand Khoje
2021-06-30  9:46 ` [PATCH v7 for-next 1/3] IB/core: Updating cache for subnet_prefix in config_non_roce_gid_cache() Anand Khoje
2021-06-30  9:46 ` Anand Khoje [this message]
2021-06-30  9:46 ` [PATCH v7 for-next 3/3] IB/core: Read subnet_prefix in ib_query_port via cache Anand Khoje
2021-07-06  7:25 ` [PATCH v7 for-next 0/3] IB/core: Obtaining subnet_prefix from cache in Anand Khoje
2021-07-09 13:21   ` Jason Gunthorpe
2021-07-09 14:46     ` Anand Khoje

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210630094615.808-3-anand.a.khoje@oracle.com \
    --to=anand.a.khoje@oracle.com \
    --cc=dledford@redhat.com \
    --cc=haakon.bugge@oracle.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®