Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1349529 > unrolled thread
| Started by | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| First post | 2016-03-03 20:50 +0100 |
| Last post | 2016-03-12 18:40 +0100 |
| Articles | 5 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v7 5/5] staging/android: add flags member to sync ioctl structs Gustavo Padovan <gustavo@padovan.org> - 2016-03-03 20:50 +0100
[PATCH] staging/android: change IOCTLs opcode after ABI change Gustavo Padovan <gustavo@padovan.org> - 2016-03-03 23:50 +0100
Re: [PATCH] staging/android: change IOCTLs opcode after ABI change Greg Hackmann <ghackmann@google.com> - 2016-03-09 03:40 +0100
Re: [PATCH] staging/android: change IOCTLs opcode after ABI change Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-11 23:10 +0100
Re: [PATCH] staging/android: change IOCTLs opcode after ABI change Rob Clark <robdclark@gmail.com> - 2016-03-12 18:40 +0100
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-03-03 20:50 +0100 |
| Subject | [PATCH v7 5/5] staging/android: add flags member to sync ioctl structs |
| Message-ID | <r8Hq2-3mU-5@gated-at.bofh.it> |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Play safe and add flags member to all structs. So we don't need to
break API or create new IOCTL in the future if new features that requires
flags arises.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
v2: check if flags are valid (zero, in this case)
v3: return -EINVAL if flags are not zero'ed
v4: add padding for 64-bit alignment
v5: rebase to use only stacked sync_file_info
---
drivers/staging/android/sync.c | 8 ++++++++
drivers/staging/android/uapi/sync.h | 14 ++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 48ee175..ae81c95 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -445,6 +445,11 @@ static long sync_file_ioctl_merge(struct sync_file *sync_file,
goto err_put_fd;
}
+ if (data.flags || data.pad) {
+ err = -EINVAL;
+ goto err_put_fd;
+ }
+
fence2 = sync_file_fdget(data.fd2);
if (!fence2) {
err = -ENOENT;
@@ -504,6 +509,9 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
if (copy_from_user(&info, (void __user *)arg, sizeof(info)))
return -EFAULT;
+ if (info.flags || info.pad)
+ return -EINVAL;
+
/*
* Passing num_fences = 0 means that userspace doesn't want to
* retrieve any sync_fence_info. If num_fences = 0 we skip filling
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index a122bb5..859977c 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -16,14 +16,18 @@
/**
* struct sync_merge_data - data passed to merge ioctl
- * @fd2: file descriptor of second fence
* @name: name of new fence
+ * @fd2: file descriptor of second fence
* @fence: returns the fd of the new fence to userspace
+ * @flags: merge_data flags
+ * @pad: padding for 64-bit alignment, should always be zero
*/
struct sync_merge_data {
- __s32 fd2;
char name[32];
+ __s32 fd2;
__s32 fence;
+ __u32 flags;
+ __u32 pad;
};
/**
@@ -31,12 +35,14 @@ struct sync_merge_data {
* @obj_name: name of parent sync_timeline
* @driver_name: name of driver implementing the parent
* @status: status of the fence 0:active 1:signaled <0:error
+ * @flags: fence_info flags
* @timestamp_ns: timestamp of status change in nanoseconds
*/
struct sync_fence_info {
char obj_name[32];
char driver_name[32];
__s32 status;
+ __u32 flags;
__u64 timestamp_ns;
};
@@ -44,14 +50,18 @@ struct sync_fence_info {
* struct sync_file_info - data returned from fence info ioctl
* @name: name of fence
* @status: status of fence. 1: signaled 0:active <0:error
+ * @flags: sync_file_info flags
* @num_fences number of fences in the sync_file
+ * @pad: padding for 64-bit alignment, should always be zero
* @sync_fence_info: pointer to array of structs sync_fence_info with all
* fences in the sync_file
*/
struct sync_file_info {
char name[32];
__s32 status;
+ __u32 flags;
__u32 num_fences;
+ __u32 pad;
__u64 sync_fence_info;
};
--
2.5.0
[toc] | [next] | [standalone]
| From | Gustavo Padovan <gustavo@padovan.org> |
|---|---|
| Date | 2016-03-03 23:50 +0100 |
| Subject | [PATCH] staging/android: change IOCTLs opcode after ABI change |
| Message-ID | <r8Kee-5DY-25@gated-at.bofh.it> |
| In reply to | #1349529 |
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Burn the old opcode to avoid any potential old userspace running the old
API to get weird errors. Changing the opcodes will make them fail right
away.
This is just a precaution, there no upstream users of these interfaces
yet and the only user is Android, but we don't expect anyone trying to
run android userspace and all it dependencies on top of upstream kernels.
Moreover Android should be converted to use upstream sync_files.
Suggested-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/staging/android/uapi/sync.h | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 859977c..fbadb8a 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -69,13 +69,20 @@ struct sync_file_info {
#define SYNC_IOC_MAGIC '>'
/**
+ * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the
+ * old API to get weird errors when trying to handling sync_files. The API
+ * change happened during the de-stage of the Sync Framework when there was
+ * no upstream users available.
+ */
+
+/**
* DOC: SYNC_IOC_MERGE - merge two fences
*
* Takes a struct sync_merge_data. Creates a new fence containing copies of
* the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the
* new fence's fd in sync_merge_data.fence
*/
-#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 1, struct sync_merge_data)
+#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
/**
* DOC: SYNC_IOC_FENCE_INFO - get detailed information on a fence
@@ -88,6 +95,6 @@ struct sync_file_info {
* pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
* To iterate over the sync_pt_infos, use the sync_pt_info.len field.
*/
-#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 2, struct sync_file_info)
+#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
#endif /* _UAPI_LINUX_SYNC_H */
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Greg Hackmann <ghackmann@google.com> |
|---|---|
| Date | 2016-03-09 03:40 +0100 |
| Subject | Re: [PATCH] staging/android: change IOCTLs opcode after ABI change |
| Message-ID | <raCcy-1nR-21@gated-at.bofh.it> |
| In reply to | #1349664 |
On 03/03/2016 02:42 PM, Gustavo Padovan wrote: > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk> > > Burn the old opcode to avoid any potential old userspace running the old > API to get weird errors. Changing the opcodes will make them fail right > away. > > This is just a precaution, there no upstream users of these interfaces > yet and the only user is Android, but we don't expect anyone trying to > run android userspace and all it dependencies on top of upstream kernels. > > Moreover Android should be converted to use upstream sync_files. > > Suggested-by: Rob Clark <robdclark@gmail.com> > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Acked-by: Greg Hackmann <ghackmann@google.com>
[toc] | [prev] | [next] | [standalone]
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2016-03-11 23:10 +0100 |
| Subject | Re: [PATCH] staging/android: change IOCTLs opcode after ABI change |
| Message-ID | <rbDpU-4rR-31@gated-at.bofh.it> |
| In reply to | #1349664 |
On Thu, Mar 03, 2016 at 07:42:43PM -0300, Gustavo Padovan wrote: > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk> > > Burn the old opcode to avoid any potential old userspace running the old > API to get weird errors. Changing the opcodes will make them fail right > away. > > This is just a precaution, there no upstream users of these interfaces > yet and the only user is Android, but we don't expect anyone trying to > run android userspace and all it dependencies on top of upstream kernels. > > Moreover Android should be converted to use upstream sync_files. > > Suggested-by: Rob Clark <robdclark@gmail.com> > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> > --- > drivers/staging/android/uapi/sync.h | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) Where does this belong in this patch series? Before it? After it? In the middle? Please resend the whole series, gather up all of the reviewed and signed-off-by markings from everyone involved, and I'll be glad to apply them. thanks, greg k-h
[toc] | [prev] | [next] | [standalone]
| From | Rob Clark <robdclark@gmail.com> |
|---|---|
| Date | 2016-03-12 18:40 +0100 |
| Subject | Re: [PATCH] staging/android: change IOCTLs opcode after ABI change |
| Message-ID | <rbVGa-19K-31@gated-at.bofh.it> |
| In reply to | #1356226 |
On Fri, Mar 11, 2016 at 5:00 PM, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > On Thu, Mar 03, 2016 at 07:42:43PM -0300, Gustavo Padovan wrote: >> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk> >> >> Burn the old opcode to avoid any potential old userspace running the old >> API to get weird errors. Changing the opcodes will make them fail right >> away. >> >> This is just a precaution, there no upstream users of these interfaces >> yet and the only user is Android, but we don't expect anyone trying to >> run android userspace and all it dependencies on top of upstream kernels. >> >> Moreover Android should be converted to use upstream sync_files. >> >> Suggested-by: Rob Clark <robdclark@gmail.com> >> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> >> --- >> drivers/staging/android/uapi/sync.h | 11 +++++++++-- >> 1 file changed, 9 insertions(+), 2 deletions(-) > > Where does this belong in this patch series? Before it? After it? In > the middle? Not sure if overkill, but if we wanted to be pedantic about bisectability put all the uabi struct changes plus ioctl # changes into a single patch (with the following patches starting to use the new fields)? Either way, I think the only two people in the world effected by this (ie. who are playing with AOSP on an upstream (plus a few patches) kernel) are Rob Herring and John Stultz. (Adding them to CC so they are aware). BR, -R > Please resend the whole series, gather up all of the reviewed and > signed-off-by markings from everyone involved, and I'll be glad to apply > them. > > thanks, > > greg k-h
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web