Re: [RFC 3/9] staging/android/sync: Move sync framework out of staging

Gustavo Padovan
2016-01-13T19:51:37Z

2016-01-13 John.C.Harrison@Intel.com <John.C.Harrison@Intel.com>:

> From: John Harrison <John.C.Harrison@Intel.com>
>
> The sync framework is now used by the i915 driver. Therefore it can be
> moved out of staging and into the regular tree. Also, the public
> interfaces can actually be made public and exported.
>
> v0.3: New patch for series.
>
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> Signed-off-by: Geoff Miller <geoff.miller@intel.com>
> Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Arve Hjønnevåg <arve@android.com>
> Cc: Riley Andrews <riandrews@android.com>
> ---
> drivers/android/Kconfig | 28 ++
> drivers/android/Makefile | 2 +
> drivers/android/sw_sync.c | 260 ++++++++++++
> drivers/android/sw_sync.h | 59 +++
> drivers/android/sync.c | 734 +++++++++++++++++++++++++++++++++
> drivers/android/sync.h | 366 ++++++++++++++++
> drivers/android/sync_debug.c | 255 ++++++++++++
> drivers/android/trace/sync.h | 82 ++++
> drivers/staging/android/Kconfig | 28 --
> drivers/staging/android/Makefile | 2 -
> drivers/staging/android/sw_sync.c | 260 ------------
> drivers/staging/android/sw_sync.h | 59 ---
> drivers/staging/android/sync.c | 734 ---------------------------------
> drivers/staging/android/sync.h | 366 ----------------
> drivers/staging/android/sync_debug.c | 255 ------------
> drivers/staging/android/trace/sync.h | 82 ----
> drivers/staging/android/uapi/sw_sync.h | 32 --
> drivers/staging/android/uapi/sync.h | 97 -----
> include/uapi/Kbuild | 1 +
> include/uapi/sync/Kbuild | 3 +
> include/uapi/sync/sw_sync.h | 32 ++
> include/uapi/sync/sync.h | 97 +++++
> 22 files changed, 1919 insertions(+), 1915 deletions(-)
> create mode 100644 drivers/android/sw_sync.c
> create mode 100644 drivers/android/sw_sync.h
> create mode 100644 drivers/android/sync.c
> create mode 100644 drivers/android/sync.h
> create mode 100644 drivers/android/sync_debug.c
> create mode 100644 drivers/android/trace/sync.h
> delete mode 100644 drivers/staging/android/sw_sync.c
> delete mode 100644 drivers/staging/android/sw_sync.h
> delete mode 100644 drivers/staging/android/sync.c
> delete mode 100644 drivers/staging/android/sync.h
> delete mode 100644 drivers/staging/android/sync_debug.c
> delete mode 100644 drivers/staging/android/trace/sync.h
> delete mode 100644 drivers/staging/android/uapi/sw_sync.h
> delete mode 100644 drivers/staging/android/uapi/sync.h
> create mode 100644 include/uapi/sync/Kbuild
> create mode 100644 include/uapi/sync/sw_sync.h
> create mode 100644 include/uapi/sync/sync.h
>
> diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig
> index bdfc6c6..9edcd8f 100644
> --- a/drivers/android/Kconfig
> +++ b/drivers/android/Kconfig
> @@ -32,6 +32,34 @@ config ANDROID_BINDER_IPC_32BIT
>
> Note that enabling this will break newer Android user-space.
>
> +config SYNC
> + bool "Synchronization framework"
> + default n
> + select ANON_INODES
> + select DMA_SHARED_BUFFER
> + ---help---
> + This option enables the framework for synchronization between multiple
> + drivers. Sync implementations can take advantage of hardware
> + synchronization built into devices like GPUs.
> +
> +config SW_SYNC
> + bool "Software synchronization objects"
> + default n
> + depends on SYNC
> + ---help---
> + A sync object driver that uses a 32bit counter to coordinate
> + synchronization. Useful when there is no hardware primitive backing
> + the synchronization.
> +
> +config SW_SYNC_USER
> + bool "Userspace API for SW_SYNC"
> + default n
> + depends on SW_SYNC
> + ---help---
> + Provides a user space API to the sw sync object.
> + *WARNING* improper use of this can result in deadlocking kernel
> + drivers from userspace.

Also, SW_SYNC_USER is a way too dangerous to be upstreamed a /dev file
because as the warning says it can deadlock the kernel. What I did in my
patches was to move the sw_sync_user features to a debugfs file.

Gustavo