diff --git a/CHANGELOG.md b/CHANGELOG.md index 5acfc360c..c4b471462 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,7 +73,10 @@ initialization. ### rpc -Added optional parameter '--md-size'to 'construct_null_bdev' RPC method. +Added optional parameters '--arbitration-burst' and '--low/medium/high-priority-weight' to +'bdev_nvme_set_options' RPC method. + +Added optional parameter '--md-size' to 'construct_null_bdev' RPC method. Added optional parameters '--dif-type' and '--dif-is-head-of-md' to 'construct_null_bdev' RPC method. diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index f6559638b..b81c8399e 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -1407,6 +1407,10 @@ Name | Optional | Type | Description action_on_timeout | Optional | string | Action to take on command time out: none, reset or abort timeout_us | Optional | number | Timeout for each command, in microseconds. If 0, don't track timeouts retry_count | Optional | number | The number of attempts per I/O before an I/O fails +arbitration_burst | Optional | number | The value is expressed as a power of two, a value of 111b indicates no limit +low_priority_weight | Optional | number | The maximum number of commands that the controller may launch at one time from a low priority queue +medium_priority_weight | Optional | number | The maximum number of commands that the controller may launch at one time from a medium priority queue +high_priority_weight | Optional | number | The maximum number of commands that the controller may launch at one time from a high priority queue nvme_adminq_poll_period_us | Optional | number | How often the admin queue is polled for asynchronous events in microseconds nvme_ioq_poll_period_us | Optional | number | How often I/O queues are polled for completions, in microseconds. Default: 0 (as fast as possible). io_queue_requests | Optional | number | The number of requests allocated for each NVMe I/O queue. Default: 512. @@ -1420,6 +1424,10 @@ request: { "params": { "retry_count": 5, + "arbitration_burst": 3, + "low_priority_weight": 8, + "medium_priority_weight":8, + "high_priority_weight": 8, "nvme_adminq_poll_period_us": 2000, "timeout_us": 10000000, "action_on_timeout": "reset", diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 7ae8f1657..7f1bc17bf 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -105,6 +105,10 @@ static struct spdk_bdev_nvme_opts g_opts = { .action_on_timeout = SPDK_BDEV_NVME_TIMEOUT_ACTION_NONE, .timeout_us = 0, .retry_count = 4, + .arbitration_burst = 0, + .low_priority_weight = 0, + .medium_priority_weight = 0, + .high_priority_weight = 0, .nvme_adminq_poll_period_us = 1000000ULL, .nvme_ioq_poll_period_us = 0, .io_queue_requests = 0, @@ -777,6 +781,11 @@ hotplug_probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, } } + opts->arbitration_burst = (uint8_t)g_opts.arbitration_burst; + opts->low_priority_weight = (uint8_t)g_opts.low_priority_weight; + opts->medium_priority_weight = (uint8_t)g_opts.medium_priority_weight; + opts->high_priority_weight = (uint8_t)g_opts.high_priority_weight; + SPDK_DEBUGLOG(SPDK_LOG_BDEV_NVME, "Attaching to %s\n", trid->traddr); return true; @@ -817,6 +826,11 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, snprintf(opts->hostnqn, sizeof(opts->hostnqn), "%s", ctx->hostnqn); } + opts->arbitration_burst = (uint8_t)g_opts.arbitration_burst; + opts->low_priority_weight = (uint8_t)g_opts.low_priority_weight; + opts->medium_priority_weight = (uint8_t)g_opts.medium_priority_weight; + opts->high_priority_weight = (uint8_t)g_opts.high_priority_weight; + return true; } @@ -2103,6 +2117,10 @@ bdev_nvme_config_json(struct spdk_json_write_ctx *w) spdk_json_write_named_string(w, "action_on_timeout", action); spdk_json_write_named_uint64(w, "timeout_us", g_opts.timeout_us); spdk_json_write_named_uint32(w, "retry_count", g_opts.retry_count); + spdk_json_write_named_uint32(w, "arbitration_burst", g_opts.arbitration_burst); + spdk_json_write_named_uint32(w, "low_priority_weight", g_opts.low_priority_weight); + spdk_json_write_named_uint32(w, "medium_priority_weight", g_opts.medium_priority_weight); + spdk_json_write_named_uint32(w, "high_priority_weight", g_opts.high_priority_weight); spdk_json_write_named_uint64(w, "nvme_adminq_poll_period_us", g_opts.nvme_adminq_poll_period_us); spdk_json_write_named_uint64(w, "nvme_ioq_poll_period_us", g_opts.nvme_ioq_poll_period_us); spdk_json_write_named_uint32(w, "io_queue_requests", g_opts.io_queue_requests); diff --git a/module/bdev/nvme/bdev_nvme.h b/module/bdev/nvme/bdev_nvme.h index fb44e2d8f..8c6455e22 100644 --- a/module/bdev/nvme/bdev_nvme.h +++ b/module/bdev/nvme/bdev_nvme.h @@ -50,6 +50,10 @@ struct spdk_bdev_nvme_opts { enum spdk_bdev_timeout_action action_on_timeout; uint64_t timeout_us; uint32_t retry_count; + uint32_t arbitration_burst; + uint32_t low_priority_weight; + uint32_t medium_priority_weight; + uint32_t high_priority_weight; uint64_t nvme_adminq_poll_period_us; uint64_t nvme_ioq_poll_period_us; uint32_t io_queue_requests; diff --git a/module/bdev/nvme/bdev_nvme_rpc.c b/module/bdev/nvme/bdev_nvme_rpc.c index ca83650bb..2adfb4750 100644 --- a/module/bdev/nvme/bdev_nvme_rpc.c +++ b/module/bdev/nvme/bdev_nvme_rpc.c @@ -73,6 +73,10 @@ static const struct spdk_json_object_decoder rpc_bdev_nvme_options_decoders[] = {"action_on_timeout", offsetof(struct spdk_bdev_nvme_opts, action_on_timeout), rpc_decode_action_on_timeout, true}, {"timeout_us", offsetof(struct spdk_bdev_nvme_opts, timeout_us), spdk_json_decode_uint64, true}, {"retry_count", offsetof(struct spdk_bdev_nvme_opts, retry_count), spdk_json_decode_uint32, true}, + {"arbitration_burst", offsetof(struct spdk_bdev_nvme_opts, arbitration_burst), spdk_json_decode_uint32, true}, + {"low_priority_weight", offsetof(struct spdk_bdev_nvme_opts, low_priority_weight), spdk_json_decode_uint32, true}, + {"medium_priority_weight", offsetof(struct spdk_bdev_nvme_opts, medium_priority_weight), spdk_json_decode_uint32, true}, + {"high_priority_weight", offsetof(struct spdk_bdev_nvme_opts, high_priority_weight), spdk_json_decode_uint32, true}, {"nvme_adminq_poll_period_us", offsetof(struct spdk_bdev_nvme_opts, nvme_adminq_poll_period_us), spdk_json_decode_uint64, true}, {"nvme_ioq_poll_period_us", offsetof(struct spdk_bdev_nvme_opts, nvme_ioq_poll_period_us), spdk_json_decode_uint64, true}, {"io_queue_requests", offsetof(struct spdk_bdev_nvme_opts, io_queue_requests), spdk_json_decode_uint32, true}, diff --git a/scripts/rpc.py b/scripts/rpc.py index e0f7fb044..fa09fcae0 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -324,6 +324,10 @@ if __name__ == "__main__": action_on_timeout=args.action_on_timeout, timeout_us=args.timeout_us, retry_count=args.retry_count, + arbitration_burst=args.arbitration_burst, + low_priority_weight=args.low_priority_weight, + medium_priority_weight=args.medium_priority_weight, + high_priority_weight=args.high_priority_weight, nvme_adminq_poll_period_us=args.nvme_adminq_poll_period_us, nvme_ioq_poll_period_us=args.nvme_ioq_poll_period_us, io_queue_requests=args.io_queue_requests) @@ -336,6 +340,14 @@ if __name__ == "__main__": help="Timeout for each command, in microseconds. If 0, don't track timeouts.", type=int) p.add_argument('-n', '--retry-count', help='the number of attempts per I/O when an I/O fails', type=int) + p.add_argument('--arbitration-burst', + help='the value is expressed as a power of two', type=int) + p.add_argument('--low-priority-weight', + help='the maximum number of commands that the controller may launch at one time from a low priority queue', type=int) + p.add_argument('--medium-priority-weight', + help='the maximum number of commands that the controller may launch at one time from a medium priority queue', type=int) + p.add_argument('--high-priority-weight', + help='the maximum number of commands that the controller may launch at one time from a high priority queue', type=int) p.add_argument('-p', '--nvme-adminq-poll-period-us', help='How often the admin queue is polled for asynchronous events', type=int) p.add_argument('-i', '--nvme-ioq-poll-period-us', diff --git a/scripts/rpc/bdev.py b/scripts/rpc/bdev.py index 3d987e738..e376d2404 100644 --- a/scripts/rpc/bdev.py +++ b/scripts/rpc/bdev.py @@ -322,6 +322,8 @@ def bdev_aio_delete(client, name): @deprecated_alias('set_bdev_nvme_options') def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, retry_count=None, + arbitration_burst=None, low_priority_weight=None, + medium_priority_weight=None, high_priority_weight=None, nvme_adminq_poll_period_us=None, nvme_ioq_poll_period_us=None, io_queue_requests=None): """Set options for the bdev nvme. This is startup command. @@ -329,6 +331,10 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, retry action_on_timeout: action to take on command time out. Valid values are: none, reset, abort (optional) timeout_us: Timeout for each command, in microseconds. If 0, don't track timeouts (optional) retry_count: The number of attempts per I/O when an I/O fails (optional) + arbitration_burst: The value is expressed as a power of two (optional) + low_prioity_weight: The number of commands that may be executed from the low priority queue at one time (optional) + medium_prioity_weight: The number of commands that may be executed from the medium priority queue at one time (optional) + high_prioity_weight: The number of commands that may be executed from the high priority queue at one time (optional) nvme_adminq_poll_period_us: How often the admin queue is polled for asynchronous events in microseconds (optional) nvme_ioq_poll_period_us: How often to poll I/O queues for completions in microseconds (optional) io_queue_requests: The number of requests allocated for each NVMe I/O queue. Default: 512 (optional) @@ -344,6 +350,18 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, retry if retry_count: params['retry_count'] = retry_count + if arbitration_burst: + params['arbitration_burst'] = arbitration_burst + + if low_priority_weight: + params['low_priority_weight'] = low_priority_weight + + if medium_priority_weight: + params['medium_priority_weight'] = medium_priority_weight + + if high_priority_weight: + params['high_priority_weight'] = high_priority_weight + if nvme_adminq_poll_period_us: params['nvme_adminq_poll_period_us'] = nvme_adminq_poll_period_us