sched: fix race between try_to_wake_up() and move_task()

Until a task's state has been seen as interruptible/uninterruptible
and it is no longer on_cpu, it is possible that the task may move
to another CPU (load balancing may cause this). Here is an example
where the race condition results in incorrect operation:

- cpu 0 calls put_prev_task on task A, task A's state is TASK_RUNNING
- cpu 0 runs task B, which attempts to wake up A
- cpu 0 begins try_to_wake_up(), recording src_cpu for task A as cpu 0
- cpu 1 then pulls task A (perhaps due to idle balance)
- cpu 1 runs task A, which then sleeps, becoming INTERRUPTIBLE
- cpu 0 continues in try_to_wake_up(), thinking task A's previous
  cpu is 0, where it is actually 1
- if select_task_rq returns cpu 0, task A will be woken up on cpu 0
  without properly updating its cpu to 0 in set_task_cpu()

CRs-Fixed: 665958
Change-Id: Icee004cb320bd8edfc772d9f74e670a9d4978a99
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
power: qpnp-charger: reset unsettled flag upon insertion

There could be a potential race between USB removal and userspace
code setting the input current settled property. A state where
USB was removed but input current settled property is set was observed.

Fix this by resetting input current settled property while USB is
inserted as well as USB removed.

Moreover prevent setting of this flag when USB is not present.

CRs-Fixed: 708352
Change-Id: I45196ce5ab0f7ad2b0ccefd33ba9d707f10aea55
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Merge "power: qpnp-charger: reset unsettled flag upon insertion"
msm: mdss: when fb splash logo enabled do not attach iommu

If fb splash logo is enabled pan display gets called with
continuous splash enabled. IOMMU attach should not be called
in such a case as this will lead to IOMMU page faults.

Change-Id: I59ac704c6fd77a7e731db0b544338cac3b8e8fe6
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
Merge "msm: mdss: when fb splash logo enabled do not attach iommu"
target/rd: Refactor rd_build_device_space + rd_release_device_space

This patch refactors rd_build_device_space() + rd_release_device_space()
into rd_allocate_sgl_table() + rd_release_device_space() so that they
may be used seperatly for setup + release of protection information
scatterlists.

Also add explicit memset of pages within rd_allocate_sgl_table() based
upon passed 'init_payload' value.

v2 changes:
  - Drop unused sg_table from rd_release_device_space (Wei)

Change-Id: I0d42113c0e2d703fe7567a804003b034fd4fa0b7
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Git-commit:4442dc8a92b8f9ad8ee9e7f8438f4c04c03a22dc
Git-repo:https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
[ggober@codeaurora.org:resolve trivial merge conflicts in target_core_rd.c]
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
Merge "sched: fix race between try_to_wake_up() and move_task()"
Merge "target/rd: Refactor rd_build_device_space + rd_release_device_space"