sched/deadline: Fix a precision problem in the microseconds range

An overrun could happen in function start_hrtick_dl()
when a task with SCHED_DEADLINE runs in the microseconds
range.

For example, if a task with SCHED_DEADLINE has the following parameters:

  Task  runtime  deadline  period
   P1   200us     500us    500us

The deadline and period from task P1 are less than 1ms.

In order to achieve microsecond precision, we need to enable HRTICK feature
by the next command:

  PC#echo "HRTICK" > /sys/kernel/debug/sched_features
  PC#trace-cmd record -e sched_switch &
  PC#./schedtool -E -t 200000:500000:500000 -e ./test

The binary test is in an endless while(1) loop here.
Some pieces of trace.dat are as follows:

  <idle>-0   157.603157: sched_switch: :R ==> 2481:4294967295: test
  test-2481  157.603203: sched_switch:  2481:R ==> 0:120: swapper/2
  <idle>-0   157.605657: sched_switch:  :R ==> 2481:4294967295: test
  test-2481  157.608183: sched_switch:  2481:R ==> 2483:120: trace-cmd
  trace-cmd-2483 157.609656: sched_switch:2483:R==>2481:4294967295: test

We can get the runtime of P1 from the information above:

  runtime = 157.608183 - 157.605657
  runtime = 0.002526(2.526ms)

The correct runtime should be less than or equal to 200us at some point.

The problem is caused by a conditional judgment "delta > 10000"
in function start_hrtick_dl().

Because no hrtimer start up to control the rest of runtime
when the reset of runtime is less than 10us.

So the process will continue to run until tick-period is coming.

Move the code with the limit of the least time slice
from hrtick_start_fair() to hrtick_start() because the
EDF schedule class also needs this function in start_hrtick_dl().

To fix this problem, we call hrtimer_start() unconditionally in
start_hrtick_dl(), and make sure the scheduling slice won't be smaller
than 10us in hrtimer_start().

Signed-off-by: Xiaofeng Yan <xiaofeng.yan@huawei.com>
Reviewed-by: Li Zefan <lizefan@huawei.com>
Acked-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1409022941-5880-1-git-send-email-xiaofeng.yan@huawei.com
[ Massaged the changelog and the code. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
usb: dwc3: Set the max speed

Set the gadget's max speed coressponding to the core's max speed.

Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
USB: gadget: f_mtp: Fix integer overflow when transferring large files.

The ALIGN() macro will overflow if given large integers, and MTP uses
0xFFFFFFFF for SendObject data packet size when the file is >= 4 gig.

Signed-off-by: Mike Lockwood <lockwood@google.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Fix AUXPCM Sample Rate settings

Fix strings for defining sample rates of AUXPCM.
This wrong string causes mixer settings to fail
for anything other than default 8000.

Bug: 13763881

Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9xxx: Set chopper settings for UHQA mode

UHQA (Ultra High Quality Audio) requires chopper to set the
frequency to the actual frequency. Change enables chopper
to set the frequency to half for all audio streams
with different sampling rates and 24-bits per sample
other than UHQA mode.

Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Fix for cmd status overwrite

There is a race condition between offload callback thread
and HAL thread which can cause an eos ack notification to
be overwritten by a stop command request. Fix this by
using separate status vars for commands originating from
different thread contexts

Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
WIFI DRIVER: multy commit update from Nexus 5 WIFI driver. TNX @neobuddy89

 net: wireless: bcmdhd: add GSCAN Support

add GSCAN code in DHD 1.88 v2 (r)
Signed-off-by: Ecco park <eccopark@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/ac4fac16133553f7ead9be5d21f417e0a9974724#diff-77bc7e0951553856d3a11f2dfb4e73feR69

 net: wireless: bcmdhd: Fixed Coverity issue.

Signed-off-by: Ecco Park <eccopark@broadcom.com>
https://github.com/neobuddy89/hammerhead/commit/5a742d1c2b36da9c5a5e9a3432979b092b7c5991

 net: wireless: bcmdhd: Add support for hidden SSID in PNO

1. Hidden SSID support for PNO
2. Gscan Hotlist LOST event now enabled
3. Support for Get feature list/matrix command

Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/ebce1c4a8db4c2d4a3c4dfd848fee6296b5c0052

 net: wireless: bcmdhd: Added support for get ch list

Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/848835cbb2b24a9facc4f8227038d2259a0c1fb9

 net: wireless: bcmdhd: Changed sync mechanism for batch get

1. Changed sync mechanism for batch scan results get
   because of a race condition with wait_for_completion
2. Misc fixes for running legacy PNO ssid scan with gscan

Bug: 17071068 Deadlock on rtnl_lock

Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/919df534d1e0043f601d2cdcea8433ce7439718c

 net: wireless: bcmdhd: fix hang in wifi_get_cached_gscan_results

Bug: 15144213

Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/5ff0082f8ef53a4861bedd1d0867c18f97712d8c

 net: wireless: bcmdhd: Gscan v3 and bug fixes

Bug: 15085610

Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/5d644ab2ff4fd270fe4b5819a347798641d43729

 net: wireless: bcmdhd: Use systime for scan result ts

Earlier relative time (ms) was being used.

Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/923f3effecc1518630086e6a9e6252244d50567c

 net: wireless: bcmdhd: Fix batch scan timing out

Removed wait and sleep code from batch scan get result function (when
scan was ongoing in the FW) which resulted in HAL timing out.

Bug: 17048507

Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/74bba7ffcad23a2431f5712ba996efe83895b95d

 net: wireless: bcmdhd: 15395235 16510235 & 16803503 fixes

1. Enable FW roaming during suspend
2. Added support for asynchronous batch scan results get
3. Fixed chanspec to channel conversion in full scan result

Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/ea6f2df49be07da21f87466d11e4b228b30f8af4

 net: wireless: bcmdhd: Set KSO enable sleep to 5ms

Signed-off-by: Ecco park <eccopark@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/f5e61f065233d5a29d639d145e85d5289c98b56e

 net: wireless: bcmdhd: Add Link Layer Statistics support

Signed-off-by: Chilam Ng <chilam@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
https://github.com/neobuddy89/hammerhead/commit/5c2c57b1e75c343d2ad45d6015046aa7ed60501f

 net: wireless: bcmdhd: Update to Version 1.88.10

Change-Id: I0e41b9af42120286b99d23acdf52fd19997a267e
Signed-off-by: Kyunghoe Kim <kyunghoe.kim@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
https://github.com/neobuddy89/hammerhead/commit/2c62a17adfafdf7430c9ac5c04b18c436e17b142
Dorimanx Note: took only the OSL updates for BCMDBG_CTRACE

 net: wireless: bcmdhd: Fix WL_SCHED_SCAN compilation

Change-Id: I44f57cc63377c4009aafb4028970a9af43944241
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
https://github.com/neobuddy89/hammerhead/commit/62b584ca24c67586ad5f0af2b6fc69f678ee98d3