linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@mellanox.com>
To: Gal Pressman <galpress@amazon.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	dledford@redhat.com, davem@davemloft.net,
	Mustafa Ismail <mustafa.ismail@intel.com>,
	linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	nhorman@redhat.com, sassmann@redhat.com, poswald@suse.com,
	Shiraz Saleem <shiraz.saleem@intel.com>
Subject: Re: [RDMA RFC v6 14/16] RDMA/irdma: Add ABI definitions
Date: Wed, 20 May 2020 09:37:26 -0300	[thread overview]
Message-ID: <20200520123726.GD24561@mellanox.com> (raw)
In-Reply-To: <a0240054-7a5c-5698-d213-b2070756c846@amazon.com>

On Wed, May 20, 2020 at 12:02:35PM +0300, Gal Pressman wrote:
> On 20/05/2020 11:52, Greg KH wrote:
> > On Wed, May 20, 2020 at 10:54:25AM +0300, Gal Pressman wrote:
> >> On 20/05/2020 10:04, Jeff Kirsher wrote:
> >>> +struct i40iw_create_qp_resp {
> >>> +   __u32 qp_id;
> >>> +   __u32 actual_sq_size;
> >>> +   __u32 actual_rq_size;
> >>> +   __u32 i40iw_drv_opt;
> >>> +   __u16 push_idx;
> >>> +   __u8 lsmm;
> >>> +   __u8 rsvd;
> >>> +};
> >>
> >> This struct size should be 8 bytes aligned.
> > 
> > Aligned in what way?  Seems sane to me, what would you want it to look
> > like instead?
> 
> The uverbs ABI structs sizes are assumed to be padded to 8 bytes alignment, I
> would expect the reserved field to be an array of 5 bytes as done in other
> structs in this file (irdma_modify_qp_req for example).
> Jason could correct me if I'm wrong?

"it is complicated"

The udata structs must have alignment that is compatible with the core
struct that prefixes them. Of course we have a mess here, and nothing
is uniform.. 

In this case struct ib_uverbs_create_qp_resp has a '__u32
driver_data[0]' aligned to 8 bytes thus the alignment of this struct
can be 4 or 8.

I generally don't recommend relying on this weird side effect, and
encourage explicit padding when possible, but since the intent of this
new driver is to be ABI compatible with the old driver, it should be
kept the same.

The userspace has a number of static_asserts which are designed to
automatically check these various cases. I assume Intel has revised
the userspace to use the new struct names and tested it..

Jason


  reply	other threads:[~2020-05-20 12:37 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20  7:03 [RDMA RFC v6 00/16] Intel RDMA Driver Updates 2020-05-19 Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 01/16] RDMA/irdma: Add driver framework definitions Jeff Kirsher
2020-05-20  7:26   ` Greg KH
2020-05-27  1:57     ` Saleem, Shiraz
2020-05-20  7:04 ` [RDMA RFC v6 02/16] RDMA/irdma: Implement device initialization definitions Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 03/16] RDMA/irdma: Implement HW Admin Queue OPs Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 04/16] RDMA/irdma: Add HMC backing store setup functions Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 05/16] RDMA/irdma: Add privileged UDA queue implementation Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 06/16] RDMA/irdma: Add QoS definitions Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 07/16] RDMA/irdma: Add connection manager Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 08/16] RDMA/irdma: Add PBLE resource manager Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 09/16] RDMA/irdma: Implement device supported verb APIs Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 10/16] RDMA/irdma: Add RoCEv2 UD OP support Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 11/16] RDMA/irdma: Add user/kernel shared libraries Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 12/16] RDMA/irdma: Add miscellaneous utility definitions Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 13/16] RDMA/irdma: Add dynamic tracing for CM Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 14/16] RDMA/irdma: Add ABI definitions Jeff Kirsher
2020-05-20  7:54   ` Gal Pressman
2020-05-20  8:52     ` Greg KH
2020-05-20  9:02       ` Gal Pressman
2020-05-20 12:37         ` Jason Gunthorpe [this message]
2020-05-27  1:58           ` Saleem, Shiraz
2020-05-20  7:04 ` [RDMA RFC v6 15/16] RDMA/irdma: Add irdma Kconfig/Makefile and remove i40iw Jeff Kirsher
2020-05-20  7:04 ` [RDMA RFC v6 16/16] RDMA/irdma: Update MAINTAINERS file Jeff Kirsher
2020-05-20  7:49   ` Gal Pressman
2020-05-27  1:58     ` Saleem, Shiraz
2020-05-21 14:12 ` [RDMA RFC v6 00/16] Intel RDMA Driver Updates 2020-05-19 Jason Gunthorpe
2020-05-27  1:58   ` Saleem, Shiraz
2020-05-27  5:08     ` Leon Romanovsky
2020-05-29 15:21       ` Saleem, Shiraz
2020-06-01 14:28         ` Jason Gunthorpe
2020-06-02 22:59           ` Saleem, Shiraz
2020-06-02 23:29             ` Jason Gunthorpe

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=20200520123726.GD24561@mellanox.com \
    --to=jgg@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=dledford@redhat.com \
    --cc=galpress@amazon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mustafa.ismail@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=poswald@suse.com \
    --cc=sassmann@redhat.com \
    --cc=shiraz.saleem@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).