Message ID | 20220707205401.81664-2-vincent.fu@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | null_blk: harmonize some module parameter and configfs options | expand |
Hi Vincent, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on axboe-block/for-next] [also build test WARNING on linus/master v5.19-rc5 next-20220707] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Vincent-Fu/null_blk-add-module-parameters-for-4-options/20220708-055453 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next reproduce: make htmldocs If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> Documentation/block/null_blk.rst:86: WARNING: Malformed table. vim +86 Documentation/block/null_blk.rst 29 30 queue_mode=[0-2]: Default: 2-Multi-queue 31 Selects which block-layer the module should instantiate with. 32 33 = ============ 34 0 Bio-based 35 1 Single-queue (deprecated) 36 2 Multi-queue 37 = ============ 38 39 home_node=[0--nr_nodes]: Default: NUMA_NO_NODE 40 Selects what CPU node the data structures are allocated from. 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 48 nr_devices=[Number of devices]: Default: 1 49 Number of block devices instantiated. They are instantiated as /dev/nullb0, 50 etc. 51 52 irqmode=[0-2]: Default: 1-Soft-irq 53 The completion mode used for completing IOs to the block-layer. 54 55 = =========================================================================== 56 0 None. 57 1 Soft-irq. Uses IPI to complete IOs across CPU nodes. Simulates the overhead 58 when IOs are issued from another CPU node than the home the device is 59 connected to. 60 2 Timer: Waits a specific period (completion_nsec) for each IO before 61 completion. 62 = =========================================================================== 63 64 completion_nsec=[ns]: Default: 10,000ns 65 Combined with irqmode=2 (timer). The time each completion event must wait. 66 67 submit_queues=[1..nr_cpus]: Default: 1 68 The number of submission queues attached to the device driver. If unset, it 69 defaults to 1. For multi-queue, it is ignored when use_per_node_hctx module 70 parameter is 1. 71 72 hw_queue_depth=[0..qdepth]: Default: 64 73 The hardware queue depth of the device. 74 75 memory_backed=[0/1]: Default: 0 76 Whether or not to use a memory buffer to respond to IO requests 77 78 = ============================================= 79 0 Transfer no data in response to IO requests 80 1 Use a memory buffer to respond to IO requests 81 = ============================================= 82 83 discard=[0/1]: Default: 0 84 Support discard operations (requires memory-backed null_blk device). 85 > 86 = ==================================== 87 0 Do not support discard operations 88 1 Enable support for discard operations 89 = ===================================== 90
diff --git a/Documentation/block/null_blk.rst b/Documentation/block/null_blk.rst index edbbab2f1..cf020e4da 100644 --- a/Documentation/block/null_blk.rst +++ b/Documentation/block/null_blk.rst @@ -72,6 +72,28 @@ submit_queues=[1..nr_cpus]: Default: 1 hw_queue_depth=[0..qdepth]: Default: 64 The hardware queue depth of the device. +memory_backed=[0/1]: Default: 0 + Whether or not to use a memory buffer to respond to IO requests + + = ============================================= + 0 Transfer no data in response to IO requests + 1 Use a memory buffer to respond to IO requests + = ============================================= + +discard=[0/1]: Default: 0 + Support discard operations (requires memory-backed null_blk device). + + = ==================================== + 0 Do not support discard operations + 1 Enable support for discard operations + = ===================================== + +cache_size=[Size in MB]: Default: 0 + Cache size in MB for memory-backed device. + +mbps=[Maximum bandwidth in MB/s]: Default: 0 (no limit) + Bandwidth limit for device performance. + Multi-queue specific parameters ------------------------------- diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 3778df206..8f821fa94 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -201,6 +201,22 @@ static bool g_use_per_node_hctx; module_param_named(use_per_node_hctx, g_use_per_node_hctx, bool, 0444); MODULE_PARM_DESC(use_per_node_hctx, "Use per-node allocation for hardware context queues. Default: false"); +static bool g_memory_backed; +module_param_named(memory_backed, g_memory_backed, bool, 0444); +MODULE_PARM_DESC(memory_backed, "Create a memory-backed block device. Default: false"); + +static bool g_discard; +module_param_named(discard, g_discard, bool, 0444); +MODULE_PARM_DESC(discard, "Support discard operations (requires memory-backed null_blk device). Default: false"); + +static unsigned long g_cache_size; +module_param_named(cache_size, g_cache_size, ulong, 0444); +MODULE_PARM_DESC(mbps, "Cache size in MiB for memory-backed device. Default: 0 (none)"); + +static unsigned int g_mbps; +module_param_named(mbps, g_mbps, uint, 0444); +MODULE_PARM_DESC(mbps, "Limit maximum bandwidth (in MiB/s). Default: 0 (no limit)"); + static bool g_zoned; module_param_named(zoned, g_zoned, bool, S_IRUGO); MODULE_PARM_DESC(zoned, "Make device as a host-managed zoned block device. Default: false"); @@ -650,6 +666,10 @@ static struct nullb_device *null_alloc_dev(void) dev->irqmode = g_irqmode; dev->hw_queue_depth = g_hw_queue_depth; dev->blocking = g_blocking; + dev->memory_backed = g_memory_backed; + dev->discard = g_discard; + dev->cache_size = g_cache_size; + dev->mbps = g_mbps; dev->use_per_node_hctx = g_use_per_node_hctx; dev->zoned = g_zoned; dev->zone_size = g_zone_size;
Add as module parameters these options: memory_backed discard mbps cache_size Previously these could only be set via configfs. Still missing is bad_blocks Signed-off-by: Vincent Fu <vincent.fu@samsung.com> --- Documentation/block/null_blk.rst | 22 ++++++++++++++++++++++ drivers/block/null_blk/main.c | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+)