From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Gustavo Padovan <gustavo@padovan.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org, "Rob Clark" <robdclark@gmail.com>,
"Daniel Stone" <daniels@collabora.com>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Riley Andrews" <riandrews@android.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
"Arve Hjønnevåg" <arve@android.com>,
"Greg Hackmann" <ghackmann@google.com>,
"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>,
"John Harrison" <John.C.Harrison@Intel.com>
Subject: Re: [PATCH v2 06/11] staging/android: turn fence_info into a __u64 pointer
Date: Tue, 2 Feb 2016 15:16:09 +0100 [thread overview]
Message-ID: <56B0BA29.1040003@linux.intel.com> (raw)
In-Reply-To: <1454419402-10769-7-git-send-email-gustavo@padovan.org>
Op 02-02-16 om 14:23 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.
>
> v2: use type __u64 for fence_info
> 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..03b1214 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..8e2ed32 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;
>
With the information from the commit I would expect fence_info would be a true pointer.
so if (sync_file_info->num_fences == 0) not copying fence_info, but set all members including this one.
else for_all_fences() copy_to_user(fence_info struct)
Otherwise you still can't extend the struct without breaking the abi.
~Maarten
WARNING: multiple messages have this Message-ID (diff)
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Gustavo Padovan <gustavo@padovan.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: 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 v2 06/11] staging/android: turn fence_info into a __u64 pointer
Date: Tue, 2 Feb 2016 15:16:09 +0100 [thread overview]
Message-ID: <56B0BA29.1040003@linux.intel.com> (raw)
In-Reply-To: <1454419402-10769-7-git-send-email-gustavo@padovan.org>
Op 02-02-16 om 14:23 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.
>
> v2: use type __u64 for fence_info
> 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..03b1214 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..8e2ed32 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;
>
With the information from the commit I would expect fence_info would be a true pointer.
so if (sync_file_info->num_fences == 0) not copying fence_info, but set all members including this one.
else for_all_fences() copy_to_user(fence_info struct)
Otherwise you still can't extend the struct without breaking the abi.
~Maarten
next prev parent reply other threads:[~2016-02-02 14:16 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 13:23 [PATCH v2 00/11] android sync framework: clean up IOCTLs and ABI Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 13:23 ` [PATCH v2 01/11] staging/android: remove SYNC_WAIT ioctl Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 13:23 ` [PATCH v2 02/11] staging/android: rename sync_pt_info to fence_info Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 14:19 ` Maarten Lankhorst
2016-02-02 13:23 ` [PATCH v2 03/11] staging/android: rename sync_file_info_data to sync_file_info Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 13:23 ` [PATCH v2 04/11] staging/android: remove driver_data from struct fence_info Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 13:23 ` [PATCH v2 05/11] staging/android: remove len field " Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 13:23 ` [PATCH v2 06/11] staging/android: turn fence_info into a __u64 pointer Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 14:16 ` Maarten Lankhorst [this message]
2016-02-02 14:16 ` Maarten Lankhorst
2016-02-02 20:28 ` Gustavo Padovan
2016-02-02 20:28 ` Gustavo Padovan
2016-02-03 8:32 ` Maarten Lankhorst
2016-02-03 8:32 ` Maarten Lankhorst
2016-02-02 15:28 ` Emil Velikov
2016-02-02 13:23 ` [PATCH v2 07/11] staging/android: add num_fences field to struct sync_file_info Gustavo Padovan
2016-02-02 13:23 ` [PATCH v2 08/11] staging/android: make info->len return only the size of fence_infos Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 14:18 ` Maarten Lankhorst
2016-02-02 14:18 ` Maarten Lankhorst
2016-02-02 18:46 ` Gustavo Padovan
2016-02-02 18:46 ` Gustavo Padovan
2016-02-02 13:23 ` [PATCH v2 09/11] staging/android: rename SYNC_IOC_FENCE_INFO Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 13:23 ` [PATCH v2 10/11] staging/android: add flags member to sync ioctl structs Gustavo Padovan
2016-02-02 13:23 ` Gustavo Padovan
2016-02-02 13:23 ` [PATCH v2 11/11] staging/android: remove redundant comments on sync_merge_data Gustavo Padovan
2016-02-02 13:23 ` 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=56B0BA29.1040003@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--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=gustavo@padovan.org \
--cc=linux-kernel@vger.kernel.org \
--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 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.