public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	talal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH V3 libibverbs 2/7] Add member functions to poll an extended CQ
Date: Wed, 25 May 2016 11:26:24 -0600	[thread overview]
Message-ID: <20160525172624.GA4602@obsidianresearch.com> (raw)
In-Reply-To: <1464181344-11987-3-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On Wed, May 25, 2016 at 04:02:19PM +0300, Yishai Hadas wrote:

>  struct ibv_cq_ex {
>  	struct ibv_context     *context;
>  	struct ibv_comp_channel *channel;
> @@ -869,6 +873,23 @@ struct ibv_cq_ex {
>  	uint32_t		async_events_completed;
>  
>  	uint32_t		comp_mask;

I'd also suggest looking at the cacheline layout of this structure,
grouping related things together to minimize the foot print.

I also think this is not enough to deal with future extention needs.

This:

+       struct ibv_cq_ex *(*create_cq_ex)(struct ibv_context *context,
+                                         struct ibv_cq_init_attr_ex *init_attr);

Should take sizeof(ibv_cq_ex) as an argument and allocate and zero at least
enough memory to cover the caller's struct size. Have the
ibv_create_cq_ex inline do this

This ensures if we add new function pointers to the end then they are
null'd even if libibverbs is older, which is a little safer than
overflowing memory.

This stuff:

+struct ibv_cq_init_attr_ex {
+       /* Minimum number of entries required for CQ */
+       int                     cqe;

And other similar should use 'unsigned int' for values that cannot be negative.

These two don't seem well thought out:

+enum ibv_create_cq_wc_flags {
+       IBV_WC_EX_WITH_BYTE_LEN         = 1 << 0,
+       IBV_WC_EX_WITH_IMM              = 1 << 1,

+enum {
+       IBV_WC_STANDARD_FLAGS = IBV_WC_EX_WITH_BYTE_LEN         |


Eg RC QP's do not have several of those fields.

I expect that if the caller asks for (eg) IBV_WC_EX_WITH_SLID then it
must be available. This means it is an error to ask for it on QPs that
do not deliver that value, like RC.

Thus IBV_WC_STANDARD_FLAGS is misnamed and/or useless.

You need to do a full audit of all the QP types and which fields they
can return and rethink these constants. Ensure the core code and/or
driver properly enforces the flags.

The driver should also null fields accessor function pointers that it
cannot return.

> +	uint16_t (*read_slid)(struct ibv_cq_ex *current);

Maybe make this uint32_t for OPA? Thoughts Intel?

You also need to post the driver side before this can be accepted...

Jason
--
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

  parent reply	other threads:[~2016-05-25 17:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 13:02 [PATCH V3 libibverbs 0/7] Completion timestamping Yishai Hadas
     [not found] ` <1464181344-11987-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-05-25 13:02   ` [PATCH V3 libibverbs 1/7] Add support for extended creating CQ verb Yishai Hadas
2016-05-25 13:02   ` [PATCH V3 libibverbs 2/7] Add member functions to poll an extended CQ Yishai Hadas
     [not found]     ` <1464181344-11987-3-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-05-25 17:26       ` Jason Gunthorpe [this message]
     [not found]         ` <20160525172624.GA4602-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-25 21:12           ` Hefty, Sean
2016-05-26 15:00           ` Matan Barak
     [not found]             ` <153e0a54-2ca6-f05a-d36a-05e736a348d7-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-05-26 17:07               ` Jason Gunthorpe
2016-05-25 13:02   ` [PATCH V3 libibverbs 3/7] Add timestamp_mask and hca_core_clock to ibv_query_device_ex Yishai Hadas
2016-05-25 13:02   ` [PATCH V3 libibverbs 4/7] Add completion timestamp to poll_cq Yishai Hadas
2016-05-25 13:02   ` [PATCH V3 libibverbs 5/7] Create a single threaded CQ Yishai Hadas
2016-05-25 13:02   ` [PATCH V3 libibverbs 6/7] Add a verb that queries real time values from the HCA Yishai Hadas
2016-05-25 13:02   ` [PATCH V3 libibverbs 7/7] Add timestamp support in rc_pingpong Yishai Hadas

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=20160525172624.GA4602@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=talal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@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