André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 3 | ======================== |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 4 | Null block device driver |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 5 | ======================== |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 6 | |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 7 | Overview |
| 8 | ======== |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 9 | |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 10 | The null block device (``/dev/nullb*``) is used for benchmarking the various |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 11 | block-layer implementations. It emulates a block device of X gigabytes in size. |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 12 | It does not execute any read/write operation, just mark them as complete in |
| 13 | the request queue. The following instances are possible: |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 14 | |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 15 | Multi-queue block-layer |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 16 | |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 17 | - Request-based. |
| 18 | - Configurable submission queues per device. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 19 | |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 20 | No block-layer (Known as bio-based) |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 21 | |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 22 | - Bio-based. IO requests are submitted directly to the device driver. |
| 23 | - Directly accepts bio data structure and returns them. |
| 24 | |
Matias Bjørling | 89ed05e | 2013-12-21 00:10:59 +0100 | [diff] [blame] | 25 | All of them have a completion queue for each core in the system. |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 26 | |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 27 | Module parameters |
| 28 | ================= |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 29 | |
| 30 | queue_mode=[0-2]: Default: 2-Multi-queue |
| 31 | Selects which block-layer the module should instantiate with. |
| 32 | |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 33 | = ============ |
| 34 | 0 Bio-based |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 35 | 1 Single-queue (deprecated) |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 36 | 2 Multi-queue |
| 37 | = ============ |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 38 | |
| 39 | home_node=[0--nr_nodes]: Default: NUMA_NO_NODE |
Matias Bjørling | 89ed05e | 2013-12-21 00:10:59 +0100 | [diff] [blame] | 40 | Selects what CPU node the data structures are allocated from. |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 41 | |
| 42 | gb=[Size in GB]: Default: 250GB |
| 43 | The size of the device reported to the system. |
| 44 | |
| 45 | bs=[Block size (in bytes)]: Default: 512 bytes |
| 46 | The block size reported to the system. |
| 47 | |
Minwoo Im | e881524 | 2017-11-07 22:23:01 +0900 | [diff] [blame] | 48 | nr_devices=[Number of devices]: Default: 1 |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 49 | Number of block devices instantiated. They are instantiated as /dev/nullb0, |
| 50 | etc. |
| 51 | |
Fam Zheng | a278731 | 2014-08-14 13:26:22 +0800 | [diff] [blame] | 52 | irqmode=[0-2]: Default: 1-Soft-irq |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 53 | The completion mode used for completing IOs to the block-layer. |
| 54 | |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 55 | = =========================================================================== |
| 56 | 0 None. |
| 57 | 1 Soft-irq. Uses IPI to complete IOs across CPU nodes. Simulates the overhead |
Matias Bjørling | 89ed05e | 2013-12-21 00:10:59 +0100 | [diff] [blame] | 58 | when IOs are issued from another CPU node than the home the device is |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 59 | connected to. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 60 | 2 Timer: Waits a specific period (completion_nsec) for each IO before |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 61 | completion. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 62 | = =========================================================================== |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 63 | |
Minwoo Im | e881524 | 2017-11-07 22:23:01 +0900 | [diff] [blame] | 64 | completion_nsec=[ns]: Default: 10,000ns |
Fam Zheng | a278731 | 2014-08-14 13:26:22 +0800 | [diff] [blame] | 65 | Combined with irqmode=2 (timer). The time each completion event must wait. |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 66 | |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 67 | submit_queues=[1..nr_cpus]: Default: 1 |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 68 | The number of submission queues attached to the device driver. If unset, it |
weiping zhang | 23c4490 | 2017-10-14 00:26:28 +0800 | [diff] [blame] | 69 | defaults to 1. For multi-queue, it is ignored when use_per_node_hctx module |
| 70 | parameter is 1. |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 71 | |
Matias Bjørling | 89ed05e | 2013-12-21 00:10:59 +0100 | [diff] [blame] | 72 | hw_queue_depth=[0..qdepth]: Default: 64 |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 73 | The hardware queue depth of the device. |
| 74 | |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 75 | Multi-queue specific parameters |
| 76 | ------------------------------- |
Matias Bjorling | 12f8f4f | 2013-12-18 13:41:42 +0100 | [diff] [blame] | 77 | |
Matias Bjørling | 2000524 | 2013-12-21 00:11:00 +0100 | [diff] [blame] | 78 | use_per_node_hctx=[0/1]: Default: 0 |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 79 | Number of hardware context queues. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 80 | |
| 81 | = ===================================================================== |
| 82 | 0 The number of submit queues are set to the value of the submit_queues |
Matias Bjørling | 2000524 | 2013-12-21 00:11:00 +0100 | [diff] [blame] | 83 | parameter. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 84 | 1 The multi-queue block layer is instantiated with a hardware dispatch |
Matias Bjørling | 2000524 | 2013-12-21 00:11:00 +0100 | [diff] [blame] | 85 | queue for each CPU node in the system. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 86 | = ===================================================================== |
Matias Bjørling | b2b7e00 | 2015-11-12 20:25:10 +0100 | [diff] [blame] | 87 | |
weiping zhang | fc18631 | 2017-10-14 00:26:54 +0800 | [diff] [blame] | 88 | no_sched=[0/1]: Default: 0 |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 89 | Enable/disable the io scheduler. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 90 | |
| 91 | = ====================================== |
| 92 | 0 nullb* use default blk-mq io scheduler |
| 93 | 1 nullb* doesn't use io scheduler |
| 94 | = ====================================== |
Minwoo Im | bf9fc98 | 2017-11-07 09:25:37 -0700 | [diff] [blame] | 95 | |
Liu Bo | 6723d8d | 2018-05-25 22:40:04 +0800 | [diff] [blame] | 96 | blocking=[0/1]: Default: 0 |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 97 | Blocking behavior of the request queue. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 98 | |
| 99 | = =============================================================== |
| 100 | 0 Register as a non-blocking blk-mq driver device. |
| 101 | 1 Register as a blocking blk-mq driver device, null_blk will set |
Liu Bo | 6723d8d | 2018-05-25 22:40:04 +0800 | [diff] [blame] | 102 | the BLK_MQ_F_BLOCKING flag, indicating that it sometimes/always |
| 103 | needs to block in its ->queue_rq() function. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 104 | = =============================================================== |
Liu Bo | 6723d8d | 2018-05-25 22:40:04 +0800 | [diff] [blame] | 105 | |
Minwoo Im | bf9fc98 | 2017-11-07 09:25:37 -0700 | [diff] [blame] | 106 | shared_tags=[0/1]: Default: 0 |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 107 | Sharing tags between devices. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 108 | |
| 109 | = ================================================================ |
| 110 | 0 Tag set is not shared. |
| 111 | 1 Tag set shared between devices for blk-mq. Only makes sense with |
Minwoo Im | bf9fc98 | 2017-11-07 09:25:37 -0700 | [diff] [blame] | 112 | nr_devices > 1, otherwise there's no tag set to share. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 113 | = ================================================================ |
Matias Bjørling | ca4b2a0 | 2018-07-06 19:38:39 +0200 | [diff] [blame] | 114 | |
| 115 | zoned=[0/1]: Default: 0 |
André Almeida | 04c5695 | 2019-09-11 11:46:34 -0300 | [diff] [blame] | 116 | Device is a random-access or a zoned block device. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 117 | |
| 118 | = ====================================================================== |
| 119 | 0 Block device is exposed as a random-access block device. |
| 120 | 1 Block device is exposed as a host-managed zoned block device. Requires |
John Pittman | 373282e | 2019-01-04 12:06:37 -0500 | [diff] [blame] | 121 | CONFIG_BLK_DEV_ZONED. |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 122 | = ====================================================================== |
Matias Bjørling | ca4b2a0 | 2018-07-06 19:38:39 +0200 | [diff] [blame] | 123 | |
| 124 | zone_size=[MB]: Default: 256 |
| 125 | Per zone size when exposed as a zoned block device. Must be a power of two. |
Minwoo Im | 0d41382 | 2019-04-07 17:19:38 +0900 | [diff] [blame] | 126 | |
| 127 | zone_nr_conv=[nr_conv]: Default: 0 |
| 128 | The number of conventional zones to create when block device is zoned. If |
| 129 | zone_nr_conv >= nr_zones, it will be reduced to nr_zones - 1. |