public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	dri-devel@lists.freedesktop.org,
	"Daniel Stone" <daniels@collabora.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Rob Clark" <robdclark@gmail.com>,
	"Greg Hackmann" <ghackmann@google.com>,
	"John Harrison" <John.C.Harrison@Intel.com>,
	"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>
Subject: Re: [PATCH 06/10] staging/android: turn fence_info into a __64 pointer
Date: Tue, 2 Feb 2016 11:04:59 -0200	[thread overview]
Message-ID: <20160202130459.GA29160@joana> (raw)
In-Reply-To: <20160201180008.GB3207@joana>

2016-02-01 Gustavo Padovan <gustavo@padovan.org>:

> Hi Maarten,
> 
> 2016-02-01 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>:
> 
> > Op 29-01-16 om 22:20 schreef Gustavo Padovan:
> > > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > >
> > > Making fence_info a pointer enables us to extend the struct in the future
> > > without breaking the ABI.
> > >
> > > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > > ---
> > >  drivers/staging/android/sync.c      | 2 +-
> > >  drivers/staging/android/uapi/sync.h | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
> > > index f7530f0..51d4f47 100644
> > > --- a/drivers/staging/android/sync.c
> > > +++ b/drivers/staging/android/sync.c
> > > @@ -525,7 +525,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
> > >  	if (info->status >= 0)
> > >  		info->status = !info->status;
> > >  
> > > -	len = sizeof(struct sync_file_info);
> > > +	len = sizeof(struct sync_file_info) - sizeof(__u64 *);
> > >  
> > >  	for (i = 0; i < sync_file->num_fences; ++i) {
> > >  		struct fence *fence = sync_file->cbs[i].fence;
> > > diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
> > > index ed281fc..9f07aa7 100644
> > > --- a/drivers/staging/android/uapi/sync.h
> > > +++ b/drivers/staging/android/uapi/sync.h
> > > @@ -54,7 +54,7 @@ struct sync_file_info {
> > >  	char	name[32];
> > >  	__s32	status;
> > >  
> > > -	__u8	fence_info[0];
> > > +	__u64	*fence_info;
> > >  };
> > >
> > Pointers are awful, it should be a __u64 since it's a pointer type. Userspace should cast it to a uintptr_t in userspace.
> 
> Oh, I made a mistake. I'll fix this.
> 
> 
> > This structure also won't work on 64-bits systems, there may be a hole between fence_info and status (or num_fences in next patch).
> > 
> > It's probably best to move it to the top and ensure the struct is 64-bits aligned.
> 
> That is not possible because we are not allocating only 64bits there but
> a array of struct fence_info, so it needs to be the last one. Maybe we
> can add some sort of padding?

Actually it is 64bits aligned:

struct sync_file_info {                                                         
        char    name[32];                                                       
        __s32   status;                                                         
        __u32   flags;                                                          
        __u32   num_fences;                                                     
        __u32   len;                                                            
                                                                                
        __u64   fence_info;                                                     
};

So nothing to worry here.

	Gustavo

  reply	other threads:[~2016-02-02 13:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 21:20 [PATCH 00/10] android sync framework: clean up IOCTLs and ABI Gustavo Padovan
2016-01-29 21:20 ` [PATCH 01/10] staging/android: remove SYNC_WAIT ioctl Gustavo Padovan
2016-01-29 21:20 ` [PATCH 02/10] staging/android: rename sync_pt_info to fence_info Gustavo Padovan
2016-01-29 21:20 ` [PATCH 03/10] staging/android: rename sync_file_info_data to sync_file_info Gustavo Padovan
2016-01-29 21:20 ` [PATCH 04/10] staging/android: remove driver_data from struct fence_info Gustavo Padovan
2016-01-29 21:20 ` [PATCH 05/10] staging/android: remove len field " Gustavo Padovan
2016-01-29 21:20 ` [PATCH 06/10] staging/android: turn fence_info into a __64 pointer Gustavo Padovan
2016-01-30 18:04   ` Emil Velikov
2016-02-01  8:41   ` Maarten Lankhorst
2016-02-01 18:00     ` Gustavo Padovan
2016-02-02 13:04       ` Gustavo Padovan [this message]
2016-01-29 21:20 ` [PATCH 07/10] staging/android: add num_fences field to struct sync_file_info Gustavo Padovan
2016-01-29 21:20 ` [PATCH 08/10] staging/android: rename SYNC_IOC_FENCE_INFO Gustavo Padovan
2016-01-29 21:20 ` [PATCH 09/10] staging/android: add flags member to sync ioctl structs Gustavo Padovan
2016-01-30 18:12   ` Emil Velikov
2016-02-01 13:24     ` Gustavo Padovan
2016-02-01  8:39   ` Maarten Lankhorst
2016-01-29 21:20 ` [PATCH 10/10] staging/android: remove redundant comments on sync_merge_data Gustavo Padovan

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=20160202130459.GA29160@joana \
    --to=gustavo@padovan.org \
    --cc=John.C.Harrison@Intel.com \
    --cc=arve@android.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniels@collabora.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ghackmann@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=riandrews@android.com \
    --cc=robdclark@gmail.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