From: "Håkon Bugge" <haakon.bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
OFED mailing list
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
Anna Schumaker
<Anna.Schumaker-ZwjVKphTwtPQT0dZR+AlfA@public.gmane.org>,
santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH rdma-next 6/6] staging/o2iblnd: Avoid calling ib_query_device
Date: Thu, 7 Jan 2016 17:00:42 +0100 [thread overview]
Message-ID: <A69ACF81-2EF1-446D-8D46-EFE414C7DAC4@oracle.com> (raw)
In-Reply-To: <1450358340-19361-7-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
I do have a holistic view on this and similar patches to avoid calling
ib_query_xyz().
Caching logic has been introduced in ibcore (cache.c). It does,
however, provide a non-transparent call to ib_query_xyz() attributes,
e.g., ib_get_cached_gid().
On my opinion, caching should be transparent.
(When caching in CPUs were introduced, we could still use the same
instructions, right?)
So, my proposal would be to make the ib_query_xyz() fast, by have
_its_ implementations using a cache.
This can be done by changing a single statement per query, and it will
take effect for all clients and ULPs:
Change ib_query_xyz() to call ib_get_cache_xyz() instead of
device->query_xyz().
This way, all legacy calls to ib_query_xyz() will use the cached
version and no changes are required in ULPs / clients.
The complication is to update the cache properly before events are
forwarded, but I think that can be done failry simply.
My 2 cents.
Thxs, Håkon
> On 17. des. 2015, at 14.19, Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
>
> Instead, use the cached copy of the attributes present on the device.
>
> Based on a patch from Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
>
> Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 21 +--------------------
> 1 file changed, 1 insertion(+), 20 deletions(-)
>
> diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
> index 7c730e3..7231ef8 100644
> --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
> +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
> @@ -2070,32 +2070,13 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts)
>
> static int kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)
> {
> - struct ib_device_attr *attr;
> - int rc;
> -
> /* It's safe to assume a HCA can handle a page size
> * matching that of the native system */
> hdev->ibh_page_shift = PAGE_SHIFT;
> hdev->ibh_page_size = 1 << PAGE_SHIFT;
> hdev->ibh_page_mask = ~((__u64)hdev->ibh_page_size - 1);
>
> - LIBCFS_ALLOC(attr, sizeof(*attr));
> - if (attr == NULL) {
> - CERROR("Out of memory\n");
> - return -ENOMEM;
> - }
> -
> - rc = ib_query_device(hdev->ibh_ibdev, attr);
> - if (rc == 0)
> - hdev->ibh_mr_size = attr->max_mr_size;
> -
> - LIBCFS_FREE(attr, sizeof(*attr));
> -
> - if (rc != 0) {
> - CERROR("Failed to query IB device: %d\n", rc);
> - return rc;
> - }
> -
> + hdev->ibh_mr_size = hdev->ibh_ibdev->attrs.max_mr_size;
> if (hdev->ibh_mr_size == ~0ULL) {
> hdev->ibh_mr_shift = 64;
> return 0;
> --
> 2.3.7
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-01-07 16:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-17 13:18 [PATCH rdma-next 0/6] dev attr cleanup (less is more) Or Gerlitz
[not found] ` <1450358340-19361-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-17 13:18 ` [PATCH rdma-next 1/6] IB/core: Save the device attributes on the device structure Or Gerlitz
[not found] ` <1450358340-19361-2-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-17 13:44 ` Sagi Grimberg
[not found] ` <5672BC33.9050606-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-17 17:41 ` Jason Gunthorpe
[not found] ` <20151217174138.GB26015-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-12-17 18:31 ` Bart Van Assche
[not found] ` <5672FF78.40401-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-12-18 5:16 ` ira.weiny
[not found] ` <20151218051632.GE13023-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-12-18 9:01 ` Or Gerlitz
[not found] ` <CAJ3xEMiUnmybdSb9v_WWNxHXZ4NvKfHbK5j4Vum9_8ux1AUo6w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-19 0:50 ` ira.weiny
2015-12-18 8:08 ` Or Gerlitz
[not found] ` <5673BF09.7050200-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-18 16:49 ` Jason Gunthorpe
[not found] ` <20151218164909.GA7354-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-12-20 17:05 ` Or Gerlitz
2015-12-17 13:18 ` [PATCH rdma-next 2/6] IB/core: Avoid calling ib_query_device when possible Or Gerlitz
2015-12-17 13:18 ` [PATCH rdma-next 3/6] IB/ulps: Avoid calling ib_query_device Or Gerlitz
2015-12-17 13:18 ` [PATCH rdma-next 4/6] net/rds: " Or Gerlitz
2015-12-17 13:18 ` [PATCH rdma-next 5/6] xprtrdma: " Or Gerlitz
2015-12-17 13:19 ` [PATCH rdma-next 6/6] staging/o2iblnd: " Or Gerlitz
[not found] ` <1450358340-19361-7-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-01-07 16:00 ` Håkon Bugge [this message]
2015-12-17 15:36 ` [PATCH rdma-next 0/6] dev attr cleanup (less is more) Christoph Hellwig
[not found] ` <20151217153651.GA28053-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-12-17 20:22 ` Or Gerlitz
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=A69ACF81-2EF1-446D-8D46-EFE414C7DAC4@oracle.com \
--to=haakon.bugge-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=Anna.Schumaker-ZwjVKphTwtPQT0dZR+AlfA@public.gmane.org \
--cc=chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.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