Revert "staging: ion: Add GFP_NO_KSWAPD flag to high order allocations"

This reverts commit 34a28f93e64f80d6f6bd5bf945a0f48e09957540.
Revert "staging: ion: Add source of allocated page"

This reverts commit 62ade932eb5446df02c9e3c58b4b3f9439779ef9.
Revert "ion: fix remaining instances of sg_dma_len"

This reverts commit c5b0de72b0f7262439d9de0ea7c4feca427e2aab.
Revert "ion: cma_secure_heap: validate buffer length"

This reverts commit cc3fb1311b46eff8eac26ee4e5a9a15fc13d9a01.
Revert "ion: secure_buffer: fix iteration of sg_table"

This reverts commit 781868c7b1fa6a9879a524e7e44cec04256013f2.
Revert "staging: ion: msm: Only parse available dt nodes"

This reverts commit e6a2b7c49638a41d5fa1dc8d65a324d038244a6a.
Revert "ion: Squashed commit of upstream updates"

This reverts commit 1ec369a25dac64764f62cbd36679651c34007a52.
Revert "ion: chunk_heap: fix leak in allocated counter"

This reverts commit c9507092ef39f130ee82e70b645cbd432e8ec3d9.
Revert "ion: remove use of qcom,msm-ion-reserve"

This reverts commit 88821715e2eb6aeb43c7e7f9277f1a58600d919d.
Revert "ion: remove ion_cp_heap"

This reverts commit 0bf5daa1f8f958b0547f65f3697b14c3327eb6dd.
Revert "ion: use PAGE_KERNEL instead of pgprot_kernel"

This reverts commit 9a9efd25fb2a285cb0e18d6236269e206f14e270.
Revert "ion: use iounmap instead of __arm_iounmap"

This reverts commit 8744a1d2040f83643e59953587b6b50d7a8ed1a6.
ion: Add missing unlock on error path

A mutex_unlock was missing for the alloc_lock on an error
path. Add it.

Change-Id: If88b72fbc2fd18504347b784d5daa2bc9170c55f
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: retry during race with shrinking/allocating

There exists a race between shrinking/allocating

Thread 1:                           Thread:2
mutex_lock(&sheap->alloc_lock)
ion_secure_cma_add_to_pool()
mutex_lock(&sheap->chunk_lock)
chunk->cnt = 0
mutex_unlock(&sheap->chunk_lock)
                                    ion_secure_cma_shrinker
                                    mutex_lock(&sheap->chunk_lock)
                                    __ion_secure_cma_shrink_pool
                                    chunk->cnt == 0 for the
                                       just allocated chunk
                                    ion_secure_cma-free_chunk
ion_secure_cma_alloc_from_pool
no memory to allocate!

If this race happens, just retry adding memory to the pool instead
of BUGing out the system.

Change-Id: Ic95782db6d88a33f01dcc5248fc957ca0f378078
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>