msm: kgsl: Restrict GPU memory object alignment to 32MB

The code was being very generous in giving the user the ability to
align GPU objects on 4GB boundaries. Cut the restriction down to
32MB which is still pretty generous but within the realm of
possiblity (especially for a 32 bit GPU).  While we are at it fix
a bug in the page_alloc code that was accidently resetting the
alignment to the alloc page size.  The alignment cannot be _less_
than the max page_alloc size but there certainly isn't any reason
why you couldn't specify a larger alignment if you so wished.

Change-Id: Ic0dedbadebd4c6fd98e3bf2f3d6d5bb924223157
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: kgsl: Track the submitted timestamp for a draw context

Track the last timestamp that each draw context has submitted to
the ringbuffer.  This complete the picture for the draw context
dump:

kgsl-3d0: context[13]: queue=165, submit=115, start=101, retire=100

here, timestamp 165-116 are on the queue, 115-102 are on the
ringbuffer, 101 is in the GPU and 100 and older have been retired.
If we get a fence timeout with this data we can easily see where the
fence timestamp is in the pipeline.

Change-Id: Ic0dedbadf54c1714296149af02b6938eef375d50
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
i2c-qup: don't ignore the last byte of a message

Ignoring the last byte of the I2C write message when
the I2C transfer has the multiple messages with
write and read from different slave addresses. This
leads to i2c master pulls the clock line low and
also client misses one byte of data from the
write message.

This patch allows the last byte of the write message
in this particular case also.

Change-Id: I433479e95c5f167dce56d57e5c9ca1c65312ff68
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
msm: kgsl: Fix race in active count wait

Active count is a variable that is mutex protected. When waiting
for this variable the value should be verified with mutex held.

Change-Id: Iee8c43cacd22f05b03a350f3b46b3e5a9fff5c63
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: kgsl: Add syncpoint tracepoints

The point is to add syncpoint tracepoints to trace the point at
which syncpoints are created and expired.

Change-Id: Ic0dedbadb9cd913c2949e9786c84f7517b8e0581
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: kgsl: Save a copy of the fence name for syncpoint events

Android native fences have the annoying habit of disappearing before
we are done querying them. Instead of reaching into the fence struct
to find the name for the fence, copy it off at init time and use that
for our various logging needs.

CRs-fixed: 743080
Change-Id: Ic0dedbad21eddf71d5e8a086eea09c5201660f0a
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Call sync_fence_log only if CONFIG_SYNC is defined

Add a wrapper kgsl_sync_fence_log around sync_fence_log.
This helps get rid of compilation error if CONFIG_SYNC is
not defined.

CRs-Fixed: 748003
Change-Id: I20d9c0e4b449cb2352274b5f4062300d5562bae6
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
msm: kgsl: Change drawctxt mutex to spinlock

adreno_drawctxt_dump is called from within timer context and hence
this function cannot sleep. But it needs exclusive access to its
cmdqueue. Therefore, changing the drawctxt mutex to spinlock.

Change-Id: I180c3a4703ffc51bb9929df44dae862e2e6a432b
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
netfilter: nf_conntrack: decrement global counter after object release

nf_conntrack_free() decrements our counter (net->ct.count)
before releasing the conntrack object. That counter is used in the
nf_conntrack_cleanup_net_list path to check if it's time to
kmem_cache_destroy our cache of conntrack objects. I think we have
a race there that should be easier to trigger (although still hard)
with CONFIG_DEBUG_OBJECTS_FREE as object releases become slowier
according to the following splat:

[ 1136.321305] WARNING: CPU: 2 PID: 2483 at lib/debugobjects.c:260
debug_print_object+0x83/0xa0()
[ 1136.321311] ODEBUG: free active (active state 0) object type:
timer_list hint: delayed_work_timer_fn+0x0/0x20
...
[ 1136.321390] Call Trace:
[ 1136.321398]  [<ffffffff8160d4a2>] dump_stack+0x45/0x56
[ 1136.321405]  [<ffffffff810514e8>] warn_slowpath_common+0x78/0xa0
[ 1136.321410]  [<ffffffff81051557>] warn_slowpath_fmt+0x47/0x50
[ 1136.321414]  [<ffffffff812f8883>] debug_print_object+0x83/0xa0
[ 1136.321420]  [<ffffffff8106aa90>] ? execute_in_process_context+0x90/0x90
[ 1136.321424]  [<ffffffff812f99fb>] debug_check_no_obj_freed+0x20b/0x250
[ 1136.321429]  [<ffffffff8112e7f2>] ? kmem_cache_destroy+0x92/0x100
[ 1136.321433]  [<ffffffff8115d945>] kmem_cache_free+0x125/0x210
[ 1136.321436]  [<ffffffff8112e7f2>] kmem_cache_destroy+0x92/0x100
[ 1136.321443]  [<ffffffffa046b806>] nf_conntrack_cleanup_net_list+0x126/0x160 [nf_conntrack]
[ 1136.321449]  [<ffffffffa046c43d>] nf_conntrack_pernet_exit+0x6d/0x80 [nf_conntrack]
[ 1136.321453]  [<ffffffff81511cc3>] ops_exit_list.isra.3+0x53/0x60
[ 1136.321457]  [<ffffffff815124f0>] cleanup_net+0x100/0x1b0
[ 1136.321460]  [<ffffffff8106b31e>] process_one_work+0x18e/0x430
[ 1136.321463]  [<ffffffff8106bf49>] worker_thread+0x119/0x390
[ 1136.321467]  [<ffffffff8106be30>] ? manage_workers.isra.23+0x2a0/0x2a0
[ 1136.321470]  [<ffffffff8107210b>] kthread+0xbb/0xc0
[ 1136.321472]  [<ffffffff81072050>] ? kthread_create_on_node+0x110/0x110
[ 1136.321477]  [<ffffffff8161b8fc>] ret_from_fork+0x7c/0xb0
[ 1136.321479]  [<ffffffff81072050>] ? kthread_create_on_node+0x110/0x110
[ 1136.321481] ---[ end trace 25f53c192da70825 ]---

CRs-fixed: 717356
Change-Id: I5e4aff3390cadadbac9ffe8fcdb651c79e42c685
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Git-commit: 0c3c6c00c69649f4749642b3e5d82125fde1600c
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>