block: ROW: Correct minimum values of ROW tunable parameters The ROW scheduling algorithm exposes several tunable parameters. This patch updates the minimum allowed values for those parameters.

Change-Id: I5ec19d54b694e2e83ad5376bd99cc91f084967f5
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
block:row: fix idling mechanism in ROW This patch addresses the following issues found in the ROW idling mechanism: 1. Fix the delay passed to queue_delayed_work (pass actual delay and not the time when to start the work) 2. Change the idle time and the idling-trigger frequency to be HZ dependent (instead of using msec_to_jiffies()) 3. Destroy idle_workqueue() in queue_exit

Change-Id: If86513ad6b4be44fb7a860f29bd2127197d8d5bf
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
block: row: Add some debug information on ROW queues 1. Add a counter for number of requests on queue. 2. Add function to print queues status (number requests currently on queue and number of already dispatched requests in current dispatch cycle).

Change-Id: I1e98b9ca33853e6e6a8ddc53240f6cd6981e6024
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
block: row: Insert dispatch_quantum into struct row_queue There is really no point in keeping the dispatch quantum of a queue outside of it. By inserting it to the row_queue structure we spare extra level in accessing it.

Change-Id: Ic77571818b643e71f9aafbb2ca93d0a92158b199
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
block: row: fix sysfs functions - idle_time conversion idle_time was updated to be stored in msec instead of jiffies. So there is no need to convert the value when reading from user or displaying the value to him.

Change-Id: I58e074b204e90a90536d32199ac668112966e9cf
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
block: row: Aggregate row_queue parameters to one structure Each ROW queues has several parameters which default values are defined in separate arrays. This patch aggregates all default values into one array. The values in question are: - is idling enabled for the queue - queue quantum - can the queue notify on urgent request

Change-Id: I3821b0a042542295069b340406a16b1000873ec6
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
block: ioctl support for sanitize in eMMC 4.5 Adding a new ioctl to support sanitize operation in eMMC cards version 4.5. The sanitize ioctl support helps performing this operation via user application.

Change-Id: I79aa4163e7753a75bed5a26a9a92de902b4b9c21
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
block: Squash update blk types
block: make auto block plug flush threshold per-disk based We do auto block plug flush to reduce latency, the threshold is 16 requests. This works well if the task is accessing one or two drives. The problem is if the task is accessing a raid 0 device and the raid disk number is big, say 8 or 16, 16/8 = 2 or 16/16=1, we will have heavy lock contention.

This patch makes the threshold per-disk based. The latency should be
still ok accessing one or two drives. The setup with application
accessing a lot of drives in the meantime uaually is big machine,
avoiding lock contention is more important, because any contention
will actually increase latency.

Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
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
block: row: hardcode magic values. Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>