Commit Graph

29 Commits

Author SHA1 Message Date
Iliyan Malchev
c9c7c24204 Revert "base: sync: signal a sync pt when not adding to the active_list"
This reverts commit 8588a01924.
2013-06-06 14:06:01 -07:00
Jamie Gennis
960c8ece5c sync: fix timeout = 0 wait behavior
Change-Id: I8b9254e92c26d9f44abbc0c77fb44624de947013
Signed-off-by: Jamie Gennis <jgennis@google.com>
2013-03-15 17:13:10 -07:00
Erik Gilling
5b5e7c9540 sync: don't log wait timeouts when timeout = 0
Signed-off-by: Erik Gilling <konkers@android.com>
2013-03-15 17:13:09 -07:00
Ørjan Eide
b29f6aa9d3 sync: Fix race condition between merge and signal
The copied sync_pt was activated immediately. If the sync_pt was
signaled before the entire merge was completed, the new fence's pt_list
could be iterated over while it is still in the process of being
created.

Moving the the sync_pt_activate call for all new sync_pts to after both
the sync_fence_copy_pts and the sync_fence_merge_pts calls ensure that
the pt_list is complete and immutable before it can be reached from the
timeline's active list.

Change-Id: I7aa4d404a822347b6ce148018d2a66e4f6a20c78
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
Signed-off-by: Uma Maheshwari Bhiram <ubhira@codeaurora.org>
2013-03-15 17:08:48 -07:00
Rebecca Schultz Zavin
60e1206a28 sync: Fix error paths
Check the return value of get_unused_fd to make sure a valid
file descriptor is returned.

Make sure to call put_unused_fd even if an error occurs before
the fd can be used.

Change-Id: I0fe8f78d9e30ecfc4d271c5d875424543dae2d0f
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2013-03-04 12:47:48 -08:00
Ajay Dudani
cce2ad4094 sync: add tracepoint support
Change-Id: I181326db4247009161557e45444c9b3548b83d25
Signed-off-by: Erik Gilling <konkers@android.com>
2013-03-04 12:47:44 -08:00
Ajay Dudani
1e6aefcbc4 sync: refactor sync debug printing
Move driver callbacks to fill strings instead of using seq_files.  This
will allow those values to be used in a future tracepoint patch.

Change-Id: I9b706343e35b11124141fe520e520514a32003d2
Signed-off-by: Erik Gilling <konkers@android.com>
2013-03-04 12:47:43 -08:00
Ajay Dudani
af27e2c678 sync: use proper barriers when waiting indefinitely
The previous fix only addressed waiting with a timeout.

Change-Id: I8ad735d2d0dfdd53592904e8a54f5689cb5eaa5e
Signed-off-by: Erik Gilling <konkers@android.com>
2013-03-04 12:47:43 -08:00
Ajay Dudani
a3dbe58ecf sync: update new fence status with sync_fence_signal_pt
If a fence's pt is signaled before sync_fence_create is called, the fence
will never transition into the signaled state.  This also address a tiny
race if a merged fence's pt after sync_fence_get_status checks it's status
and before fence->status is updated.

Change-Id: Ic8e292a323db26c6f04cb4757d920278b3125ff6
Signed-off-by: Erik Gilling <konkers@android.com>
2013-03-04 12:47:42 -08:00
Ajay Dudani
b93dcc91c1 sync: dump sync state of fence errors
Change-Id: I297a43aadf83504993040ea875c7f22d988628f1
Signed-off-by: Erik Gilling <konkers@android.com>
2013-03-04 12:47:41 -08:00
Erik Gilling
c5949fef4b sync: protect unlocked access to fence status
Fence status is checked outside of locks in both sync_fence_wait and
sync_fence_poll.  This patch adds propper barrier protection in these
cases to avoid seeing stale status.

Change-Id: I9d8b6ce6accb415e797df58068a1ccd54e6be445
Signed-off-by: Erik Gilling <konkers@android.com>
2013-03-04 12:47:35 -08:00
Ajay Dudani
6b6caf862a sync: improve timeout dumps
Change-Id: I3b378d63c324c7b5862dd214f380b5e91131cc2a
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:44 -08:00
Ajay Dudani
fda22cb757 sync: use correct signed type when handling SYNC_IOC_WAIT
Change-Id: Ic7d5adf9b145765e52b23186b8c3c793ccf29be7
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:43 -08:00
Ajay Dudani
84439187e0 sync: dump sync state to console on timeout
Change-Id: I74bca6b4a2afa7ed5b1f5233c5165d2edddf269a
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:42 -08:00
Ajay Dudani
a679ded048 sync: clean up compiler warnings
Change-Id: I8a2ec5db652c61fd04571402067b37273b91e78f
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:42 -08:00
Ajay Dudani
f177ba4c6a sync: fix erase-o in sync_fence_wait
Change-Id: I189707cf658a9f1f2943515c891b43961994e774
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:41 -08:00
Ajay Dudani
d064955d29 sync: change wait timeout to mirror poll semantics
Change-Id: Ib38e6d339d41885a33027752690d65a52b6897f6
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:41 -08:00
Ajay Dudani
863f04856c sync: add reference counting to timelines
If a timeline is destroyed while fences still hold pts on it, the reworked
fence release handler can cause the timeline to be freed before all it's points
are freed.

Change-Id: I1cd8ddb638eded7db9db446ff6b37f3dd165d6c4
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:40 -08:00
Ajay Dudani
29b442f3ce sync: add internal refcounting to fences
If a fence is released while a timeline that one of it's pts is on is being
signaled, it is possible for that fence to be deleted before it is signaled.
This patch adds a refcount for internal references such as signaled pt
processing.

Change-Id: Ie8605e6fd2ac026c207220a03d84e1c1078ec719
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:39 -08:00
Ajay Dudani
a67bfd0627 sync: optimize fence merges
If the two fences being merged contain sync_pts from the same timeline,
those two pts will be collapsed into a single pt representing the latter
of the two.

Change-Id: Iced7ebb7e5a17a0c8b1a2969ba3388a4edb9ecaf
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:39 -08:00
Ajay Dudani
c7f11c39a8 sync: reorder sync_fence_release
Previously fence's pts were freed before the were the fence was removed from the
global fence list.  This led to a race with the debugfs support where it would
iterate over sync_pts that had been freed.

Change-Id: Ia3ddbf77de42ca593fc2dc353b5d04e42ddf3946
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:38 -08:00
Jeff Boody
8588a01924 base: sync: signal a sync pt when not adding to the active_list
A sync point that is not added to the active_list will never signal
in sync_timeline_signal thus causing sync_fence_wait to deadlock or
block until the timeout expired.

Change-Id: I75168d0eec874bf70dd8c28db9508dd8fc1077d3
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
2013-01-10 10:36:27 -08:00
Erik Gilling
4fb837a718 sync: export sync API symbols
This is needed to allow modules to link against the sync subsystem

Change-Id: I15c1818de329f24e4113ef1d0923413b22fd0eff
Signed-off-by: Erik Gilling <konkers@android.com>
2012-05-30 13:12:40 -07:00
Erik Gilling
c80114fd8b sync: allow async waits to be canceled
In order to allow drivers to cleanly handled teardown we need to allow them
to cancel pending async waits.  To do this cleanly, we move allocation of
sync_fence_waiter to the driver calling sync_async_wait().

Change-Id: Ifcd95648be6ec07026d67f810070a4310f099989
Signed-off-by: Erik Gilling <konkers@android.com>
2012-05-30 13:12:40 -07:00
Erik Gilling
a1eeacaf7a sync: add poll support
Change-Id: I294e481bba92658e6dd26f157ddbf0e9ff4ce8a5
Signed-off-by: Erik Gilling <konkers@android.com>
2012-05-16 13:27:24 -07:00
Erik Gilling
3913bff501 sync: add ioctl to get fence data
Change-Id: I71410aef7e03a52562f7cb15b993ac8441b1fa12
Signed-off-by: Erik Gilling <konkers@android.com>
2012-05-16 13:27:23 -07:00
Erik Gilling
981c8a993d sync: add debugfs support
Change-Id: I8a7ea63e454fbeee1ecf17e6c3caff7c43b24734
Signed-off-by: Erik Gilling <konkers@android.com>
2012-05-16 13:27:23 -07:00
Erik Gilling
ad433ba4d1 sync: add timestamps to sync_pts
Change-Id: I2ad855072b86873880769a09a3176e85aa1199d7
Signed-off-by: Erik Gilling <konkers@android.com>
2012-05-16 13:27:23 -07:00
Erik Gilling
010accf8a0 sync: Add synchronization framework
not run through checkpatch yet.

Change-Id: I209f9db2824e0313f467f11ab09e5f54f0a4a6b5
Signed-off-by: Erik Gilling <konkers@android.com>
2012-05-16 13:27:22 -07:00