sync: signal pt before sync_timeline object gets destroyed

There is a race condition

Assume we have *one* sync_fence object, with *one* sync_pt
which belongs to *one* sync_timeline, given this condition,
sync_timeline->kref will have two counts, one for sync_timeline
(implicit) and another for sync_pt.

Assume following is the situation on CPU

Theead-1 : (Thread which calls sync_timeline_destroy())
  -> (some function calls)
   -> sync_timeline_destory()
    -> sync_timeline_signal() (CPU is inside this
function after putting reference to sync_timeline)

At this time Thread-2 comes and does following

Thread-2 : (fclose on fence fd)
> sync_fence_release() -> because of fclose() on fence object
 -> sync_fence_free()
  -> sync_pt_free()
   -> kref_put(&pt->parent->kref, sync_timeline_free);
    -> sync_timeline_free() (CPU is inside this because
this time kref will be zero after _put)

Thread-2 will free sync_timeline object before Thread-1
has finished its work inside sync_timeline_signal.

With this change we signals all sync_pt before putting
reference to sync_timeline object.

Change-Id: Ic680e4d0bbef1c46bcb7cfba693395645241d203
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
Signed-off-by: Rom Lemarchand <romlem@google.com>
msm: kgsl: Use a read/lock for the context idr

Everybody loves a rcu but in this case we are dangerously mixing rcu's
and atomic operations. Add a read/write lock to explicitly protect the
idr. Also fix a few spots where the idr was used without protection.

Change-Id: Ic2f1e5c45692683b52a9f662ccdd2fb59bc7ae0e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Add a missing refcount put for kgsl_context

Fix a potential memory leak by putting in the missing kgsl_context_put()
in fault trace detect.

Change-Id: Ic0b43c831a88ac3e45bbe484bde843b46b6f09f6
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Try fault tolerance even if there is no active context

No active context means that GPU could have failed when executing
commands that set an active context. In this case there are no bad
commands. This sort of hang can mostly be attributed to power
fluctuations or memory barriers which in all likelyhood can pass
after a reset. So treat no active context as a recoverable hang
scenario as well.

Change-Id: I0481a480bdb895f67daa2ed32df49eb1afe29029
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
Signed-off-by: Ananta Kishore K <akollipa@codeaurora.org>
msm: kgsl: Fix the KGSL driver to compile when CONFIG_DEBUG_FS=n

Fix a compilation error when CONFIG_DEBUG_FS is disabled. Add an
initialization flag to the process struct rather than rely on a
pointer to the debugfs node which will always be NULL if debugfs
is not available.

CRs-fixed: 542231
Change-Id: Ic0dedbadf0241fd476e56d6e116a811697b38190
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Handle failure of find_process_private()

Handle the case of NULL return from find_process_private() upon
its failure by failing from get_process_private().

CRs-fixed: 542831
Change-Id: I8a365368ecf68f0d1aa01199aca76bc7ac49e154
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: vidc: free the recon buffers in cleanup function

- The recon buffers were not released when video recording
  was killed abruptly leading to memory leak.

- Fix provided to release the recon buffers when media
  server killed abruptly.

Change-Id: I48ac1a592719446b7e4bf87bbd707d09351d1e61
Signed-off-by: srikarri <sridur@codeaurora.org>
Revert bcmdhd driver to sane state

 * Firmware is not compatible with these changes!

Revert "net: wireless: bcmdhd: Fix of Wireless Location Service"

This reverts commit b9a1b93d685e89954c06f637ab9c64ef189be0f9.

Revert "net: wireless: bcmdhd: Fix of Wireless Location Service"

This reverts commit b7adad29fb903bffe6e1db5129ad411827df4352.

Revert "net: wireless: bcmdhd: Update Location Service code"

This reverts commit 79095cb79b45b3957240f6dbbee6eab2334956b9.

Revert "net: wireless: bcmdhd: enable WL_IFACE_COMB_NUM_CHANNELS"

This reverts commit 4589ecdfdc732a54574c01f8e1a8d83e9a10a8d2.

Revert "net: wireless: bcmdhd: Update to version 1.88.45"

This reverts commit 17cb1b5c878f86a1d830a616b98805b2434073a8.

Revert "net: wireless: bcmdhd: Update to version 1.88.42"

This reverts commit d6f5b4fe9cca76c3e4f2427170fcdccfe44fb1fb.

Revert "net: wireless: bcmdhd: Update to version 1.88.41"

This reverts commit 5562cf9003a1884f397e452681521febfee1c6a3.

Change-Id: Iac7e0f89833668068dcc1c67278f0768130d2076
Merge "sync: signal pt before sync_timeline object gets destroyed" into jb-mr2
Merge "msm: kgsl: Use a read/lock for the context idr" into jb-mr2
Merge "msm: kgsl: Add a missing refcount put for kgsl_context" into jb-mr2
Merge "msm: kgsl: Try fault tolerance even if there is no active context" into jb-mr2
Merge "msm: kgsl: Fix the KGSL driver to compile when CONFIG_DEBUG_FS=n" into jb-mr2
Merge "msm: kgsl: Handle failure of find_process_private()" into jb-mr2
Merge "msm: vidc: free the recon buffers in cleanup function" into jb-mr2
Merge "Revert bcmdhd driver to sane state" into jb-mr2