All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche-Sjgp3cTcYWE@public.gmane.org>
To: "jgg-uk2M96/98Pc@public.gmane.org" <jgg-uk2M96/98Pc@public.gmane.org>
Cc: "matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	"monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [RFC PATCH] rxe: Fix structure layouts for 32/64 bit compat
Date: Thu, 8 Feb 2018 00:01:48 +0000	[thread overview]
Message-ID: <1518048106.2870.86.camel@wdc.com> (raw)
In-Reply-To: <20180207235725.GA9080-uk2M96/98Pc@public.gmane.org>

On Wed, 2018-02-07 at 16:57 -0700, Jason Gunthorpe wrote:
> On Wed, Feb 07, 2018 at 11:54:25PM +0000, Bart Van Assche wrote:
> > On Wed, 2018-02-07 at 16:41 -0700, Jason Gunthorpe wrote:
> > > diff --git a/include/uapi/rdma/rdma_user_rxe.h b/include/uapi/rdma/rdma_user_rxe.h
> > > index e3e6852b58eb45..b501deb18d8184 100644
> > > +++ b/include/uapi/rdma/rdma_user_rxe.h
> > > @@ -58,6 +58,8 @@ struct rxe_global_route {
> > >  struct rxe_av {
> > >  	__u8			port_num;
> > >  	__u8			network_type;
> > > +	__u16			reserved1;
> > > +	__u32			reserved2;
> > 
> > Hello Jason,
> > 
> > Seeing two consecutive reserved members is a bit weird. Have you considered
> > to use something like __u8 reserved[6] instead?
> 
> Ah, I had that originally but changed it to make pahole work properly..
> Can switch it back.
> 
> Although, this does really firmly say what the alighment is, eg
> down the road someone might be tempted to do:
> 
> - __u8 reserved[6];
> + __u32 new_value;
> + __u16 reserved;
> 
> Which would be quite wrong..

Please consider to add BUILD_BUG_ON() statements into the rxe driver to verify
offsets of members of ABI structures. That approach is used in the rdma-core
library for e.g. the umad library and srp_daemon.

Thanks,

Bart.



      parent reply	other threads:[~2018-02-08  0:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07 23:41 [RFC PATCH] rxe: Fix structure layouts for 32/64 bit compat Jason Gunthorpe
     [not found] ` <20180207234153.GA14067-uk2M96/98Pc@public.gmane.org>
2018-02-07 23:54   ` Bart Van Assche
     [not found]     ` <1518047664.2870.82.camel-Sjgp3cTcYWE@public.gmane.org>
2018-02-07 23:57       ` Jason Gunthorpe
     [not found]         ` <20180207235725.GA9080-uk2M96/98Pc@public.gmane.org>
2018-02-08  0:01           ` Bart Van Assche [this message]

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=1518048106.2870.86.camel@wdc.com \
    --to=bart.vanassche-sjgp3ctcywe@public.gmane.org \
    --cc=jgg-uk2M96/98Pc@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=monis-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.