block: Update ROW scheduling algorithm

commit d4e362a0981599562414ae8ac268f9afe08fb76c
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Thu Jan 24 14:01:25 2013 +0200
    block: add REQ_URGENT to request flags
    This patch adds a new flag to be used in cmd_flags field of struct request
    for marking request as urgent.
    Urgent request is the one that should be given priority currently handled
    (regular) request by the device driver. The decision of a request urgency
    is taken by the scheduler.
    Change-Id: Ic20470987ef23410f1d0324f96f00578f7df8717
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

commit 37309493e97bb70953784887e96fc9ad674881f9
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Tue Mar 12 21:02:33 2013 +0200
    block: urgent request: remove unnecessary urgent marking
    An urgent request is marked by the scheduler in rq->cmd_flags with the
    REQ_URGENT flag. There is no need to add an additional marking by
    the block layer.
    Change-Id: I05d5e9539d2f6c1bfa80240b0671db197a5d3b3f
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

commit 1c82a0cb05547d8f762b9486b53d7365aff70178
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Thu Feb 21 13:46:29 2013 +0200
    block: test-iosched: Sleep before each test
    In order to be sure that the packing statistics collected after the test
    reflect *only* requests issued by the test (and not real request from
    FS) - sleep before each test in order to give an already dispatched
    requests time to complete.
    Change-Id: If2f40efad1d79084a8ea85afe93cce58e49ff698
    CRs-Fixed: 453712
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

commit 2b1d718247a8af2e66193209dc84fc6234576597
Author: Dolev Raviv <draviv@codeaurora.org>
Date:   Tue Feb 12 17:11:17 2013 +0200
    block: fix test crashing due to synchronization issue
    The __blk_run_queue function is called from several contexts. The fix is
    replacing it with blk_run_queue function, this function is guarded with
    a lock, thus making it thread safe and prevents the crashing.
    Change-Id: I3e12fa9c8b9e161375fffa3570abfa46b223a60b
    Signed-off-by: Dolev Raviv <draviv@codeaurora.org>

commit 3b61f1bc4be1f05ddd847c769c20b7374719d93d
Author: Lee Susman <lsusman@codeaurora.org>
Date:   Sun Jan 6 10:57:30 2013 +0200
    mmc: enhance long_sequential_test for higher throughput
    Change the test design so that requests are dynamically created
    and freed. This enables running tests with more than 128 requests,
    therefore more than 50MiB can be written/read and makes it possible
    to measure driver write/read throughput more accurately.
    Change-Id: I56c9d6c1afba5c91a0621a16d97feafd4689521d
    Signed-off-by: Lee Susman <lsusman@codeaurora.org>
    Conflicts:
    	drivers/mmc/card/mmc_block_test.c

commit dab12d90c40bf9a5cb555565d0f9350c94372d99
Author: Dolev Raviv <draviv@codeaurora.org>
Date:   Wed Jan 9 12:00:02 2013 +0200
    block: test-iosched:  Add support for setting rq_disk
    Some block devices requires the rq_disk field to be assigned.
    This patch exposes a new API to the block device test utility for
    getting the rq_disk assigned, in the created request.
    Change-Id: I61dc4dad50eb7600728156a6cd08bb1ee134df0d
    Signed-off-by: Dolev Raviv <draviv@codeaurora.org>

commit 732188fc31441138b9bb6050bb251929339ced61
Author: Lee Susman <lsusman@codeaurora.org>
Date:   Wed Dec 19 14:19:30 2012 +0200
    block: test-iosched infrastructure enhancement
    Add functionality to test-iosched so that it could simulate the
    ROW scheduler behaviour. The main additions are:
    - 3 distinct requests queue with counters
    - support for urgent request pending
    - reinsert request implementation (callback + dispatch behavior)
    Change-Id: I83b5d9e3d2b8cd9a2353afa6a3e6a4cbc83b0cd4
    Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
    Signed-off-by: Lee Susman <lsusman@codeaurora.org>
    Conflicts:
    	drivers/mmc/card/mmc_block_test.c

commit c8be5f101184346cd3deea7ab55a54a877f2b499
Author: Lee Susman <lsusman@codeaurora.org>
Date:   Thu Nov 15 13:36:15 2012 +0200
    mmc: improve mmc_block_test printouts
    Change the printout format to be more readable.
    Specifically, add quotes around the test case name
    strings.
    Change-Id: I51b0c1b94389e4b51af84c5e993207b18efc2226
    Signed-off-by: Lee Susman <lsusman@codeaurora.org>
    Conflicts:
    	drivers/mmc/card/mmc_block_test.c

commit 67d0debf3a5a544f4a4cd0726bda80efdc80dea1
Author: Sujit Reddy Thumma <sthumma@codeaurora.org>
Date:   Fri Dec 14 19:36:58 2012 +0530
    cfq-iosched: Fix null pointer dereference
    NULL pointer dereference can happen in cfq_choose_cfqg()
    when there are no cfq groups to select other than the
    current serving group. Prevent this by adding a NULL
    check before dereferencing.
    Unable to handle kernel NULL pointer dereference at virtual address
    [<c02502cc>] (cfq_dispatch_requests+0x368/0x8c0) from
    [<c0243f30>] (blk_peek_request+0x220/0x25c)
    [<c0243f30>] (blk_peek_request+0x220/0x25c) from
    [<c0243f74>] (blk_fetch_request+0x8/0x1c)
    [<c0243f74>] (blk_fetch_request+0x8/0x1c) from
    [<c041cedc>] (mmc_queue_thread+0x58/0x120)
    [<c041cedc>] (mmc_queue_thread+0x58/0x120) from
    [<c00ad310>] (kthread+0x84/0x90)
    [<c00ad310>] (kthread+0x84/0x90) from
    [<c000eeac>] (kernel_thread_exit+0x0/0x8)
    CRs-Fixed: 416466
    Change-Id: I1fab93a4334b53e1d7c5dcc8f93cff174bae0d5e
    Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>

commit f2c9ff60ca2f35a9b82ee66eae1b0dcc2f19230b
Author: Lee Susman <lsusman@codeaurora.org>
Date:   Wed Oct 24 14:14:37 2012 +0200
    mmc: card: Add long sequential read test to test-iosched
    Long sequential read test measures read throughput
    at the driver level by reading large requests sequentially.
    Change-Id: I3b6d685930e1d0faceabbc7d20489111734cc9d4
    Signed-off-by: Lee Susman <lsusman@codeaurora.org>
    Conflicts:
    	drivers/mmc/card/mmc_block_test.c

commit b7d21408e698323398ec282be733469362481386
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Thu Apr 11 14:57:15 2013 +0300
    block: urgent request: Update dispatch_urgent in case of requeue/reinsert
    The block layer implements a mechanism for verifying that the device
    driver won't be notified of an URGENT request if there is already an
    URGENT request in flight. This is due to the fact that interrupting an
    URGENT request isn't efficient.
    This patch fixes the above described mechanism in case the URGENT request
    was returned back to the block layer from some reason: by requeue or
    reinsert.
    CRs-fixed: 473376, 473036, 471736
    Change-Id: Ie8b8208230a302d4526068531616984825f1050d
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

commit b088b5be23950cf626e95bc4836818efa34aa3dd
Author: Maya Erez <merez@codeaurora.org>
Date:   Sun Apr 14 15:19:52 2013 +0300
    block: row: Fix starvation tolerance values
    The current starvation tolerance values increase the boot time
    since high priority SW requests are delayed by regular priority requests.
    In order to overcome this, increase the starvation tolerance values.
    Change-Id: I9947fca9927cbd39a1d41d4bd87069df679d3103
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
    Signed-off-by: Maya Erez <merez@codeaurora.org>

commit f17c3d157a1f0b0391a1e9bc1463c1787dc36db8
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Thu Mar 21 11:04:02 2013 +0200
    block: row: Update sysfs functions
    All ROW (time related) configurable parameters are stored in ms so there
    is no need to convert from/to ms when reading/updating them via sysfs.
    Change-Id: Ib6a1de54140b5d25696743da944c076dd6fc02ae
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

commit f05df26db203322cd9fb8e169fd6395b6cd0c3a3
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Thu Mar 21 13:02:07 2013 +0200
    block: row: Prevent starvation of regular priority by high priority
    At the moment all REGULAR and LOW priority requests are starved as long as
    there are HIGH priority requests to dispatch.
    This patch prevents the above starvation by setting a starvation limit the
    REGULAR\LOW priority requests can tolerate.
    Change-Id: Ibe24207982c2c55d75c0b0230f67e013d1106017
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

commit 7d38b98d5526de7f81740c6cd9c59fe4871da9ae
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Tue Mar 12 21:17:18 2013 +0200
    block: row: Re-design urgent request notification mechanism
    When ROW scheduler reports to the block layer that there is an urgent
    request pending, the device driver may decide to stop the transmission
    of the current request in order to handle the urgent one. This is done
    in order to reduce the latency of an urgent request. For example:
    long WRITE may be stopped to handle an urgent READ.
    This patch updates the ROW URGENT notification policy to apply with the
    below:
    - Don't notify URGENT if there is an un-completed URGENT request in driver
    - After notifying that URGENT request is present, the next request
      dispatched is the URGENT one.
    - At every given moment only 1 request can be marked as URGENT.
      Independent of it's location (driver or scheduler)
    Other changes to URGENT policy:
    - Only READ queues are allowed to notify of an URGENT request pending.
    CR fix:
    If a pending urgent request (A) gets merged with another request (B)
    A is removed from scheduler queue but is not removed from
    rd->pending_urgent_rq.
    CRs-Fixed: 453712
    Change-Id: I321e8cf58e12a05b82edd2a03f52fcce7bc9a900
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

commit f1be87977d47873be18f94989b0c62744885da2f
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Thu Jan 24 16:17:27 2013 +0200
    block: row: Update initial values of ROW data structures
    This patch sets the initial values of internal ROW
    parameters.
    Change-Id: I38132062a7fcbe2e58b9cc757e55caac64d013dc
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
    [smuckle@codeaurora.org: ported from msm-3.7]
    Signed-off-by: Steve Muckle <smuckle@codeaurora.org>

commit 34ed1adb842ff02ed61fdc7cb3d4d2cc1d257b3a
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Thu Jan 24 15:08:40 2013 +0200
    block: row: Don't notify URGENT if there are un-completed urgent req
    When ROW scheduler reports to the block layer that there is an urgent
    request pending, the device driver may decide to stop the transmission
    of the current request in order to handle the urgent one. If the current
    transmitted request is an urgent request - we don't want it to be
    stopped.
    Due to the above ROW scheduler won't notify of an urgent request if
    there are urgent requests in flight.
    Change-Id: I2fa186d911b908ec7611682b378b9cdc48637ac7
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

commit 5e6a9ef859d9aa113adbda232c5cce4e564fc9b4
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Thu Jan 17 20:56:07 2013 +0200
    block: row: Idling mechanism re-factoring
    At the moment idling in ROW is implemented by delayed work that uses
    jiffies granularity which is not very accurate. This patch replaces
    current idling mechanism implementation with hrtime API, which gives
    nanosecond resolution (instead of jiffies).
    Change-Id: I86c7b1776d035e1d81571894b300228c8b8f2d92
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

commit 5485c2085045dad126acf22dd6f46de6ec73fb06
Author: Tatyana Brokhman <tlinder@codeaurora.org>
Date:   Wed Jan 23 17:15:49 2013 +0200
    block: row: Dispatch requests according to their io-priority
    This patch implements "application-hints" which is a way the issuing
    application can notify the scheduler on the priority of its request.
    This is done by setting the io-priority of the request.
    This patch reuses an already existing mechanism of io-priorities developed
    for CFQ. Please refer to kernel/Documentation/block/ioprio.txt for
    usage example and explanations.
    Change-Id: I228ec8e52161b424242bb7bb133418dc8b73925a
    Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Change-Id: Ied672614b7f8a24f471fffca4c668810cf1c32f4