nvme: rpc interface updates to manage 'timeout_admin_us' value

Signed-off-by: Matt Dumm <matt.dumm@hpe.com>
Change-Id: Ib97371924e56275ba9b845725d1d42682fd0f94a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8163
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Matt Dumm 2021-06-02 17:42:34 +00:00 committed by Tomasz Zawadzki
parent 5288c4df83
commit 67fbfdd8af
6 changed files with 34 additions and 3 deletions

View File

@ -95,6 +95,8 @@ to create a rbd bdev with an already registered Rados Cluster Object.
New RPC `bdev_rbd_get_clusters_info` was added, it allows to get the info of the registered
Rados Cluster names.
New optional parameter, 'timeout_admin_us', added to the bdev_nvme_set_options RPC.
Revised a parameter `--stripe-size_kb` to `--stripe-size-kb` of `bdev_raid_create` method
provided in `scripts/rpc.py` for consistency.

View File

@ -2763,6 +2763,7 @@ 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
timeout_admin_us | Optional | number | Timeout for each admin command, in microseconds. If 0, treat same as io timeouts ('timeout_us')
keep_alive_timeout_ms | Optional | number | Keep alive timeout period in milliseconds, default is 10s
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
@ -2789,6 +2790,7 @@ request:
"high_priority_weight": 8,
"nvme_adminq_poll_period_us": 2000,
"timeout_us": 10000000,
"timeout_admin_us": 20000000,
"keep_alive_timeout_ms": 600000,
"action_on_timeout": "reset",
"io_queue_requests" : 2048,

View File

@ -2047,9 +2047,27 @@ bdev_nvme_get_opts(struct spdk_bdev_nvme_opts *opts)
*opts = g_opts;
}
static int
bdev_nvme_validate_opts(const struct spdk_bdev_nvme_opts *opts)
{
if ((opts->timeout_us == 0) && (opts->timeout_admin_us != 0)) {
/* Can't set timeout_admin_us without also setting timeout_us */
SPDK_WARNLOG("Invalid options: Can't have (timeout_us == 0) with (timeout_admin_us > 0)\n");
return -EINVAL;
}
return 0;
}
int
bdev_nvme_set_opts(const struct spdk_bdev_nvme_opts *opts)
{
int ret = bdev_nvme_validate_opts(opts);
if (ret) {
SPDK_WARNLOG("Failed to set nvme opts.\n");
return ret;
}
if (g_bdev_nvme_init_thread != NULL) {
if (!TAILQ_EMPTY(&g_nvme_ctrlrs)) {
return -EPERM;
@ -3429,6 +3447,7 @@ bdev_nvme_opts_config_json(struct spdk_json_write_ctx *w)
spdk_json_write_named_object_begin(w, "params");
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_uint64(w, "timeout_admin_us", g_opts.timeout_admin_us);
spdk_json_write_named_uint32(w, "keep_alive_timeout_ms", g_opts.keep_alive_timeout_ms);
spdk_json_write_named_uint32(w, "retry_count", g_opts.retry_count);
spdk_json_write_named_uint32(w, "arbitration_burst", g_opts.arbitration_burst);

View File

@ -75,6 +75,7 @@ rpc_decode_action_on_timeout(const struct spdk_json_val *val, void *out)
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},
{"timeout_admin_us", offsetof(struct spdk_bdev_nvme_opts, timeout_admin_us), spdk_json_decode_uint64, true},
{"keep_alive_timeout_ms", offsetof(struct spdk_bdev_nvme_opts, keep_alive_timeout_ms), spdk_json_decode_uint32, 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},

View File

@ -456,6 +456,7 @@ if __name__ == "__main__":
rpc.bdev.bdev_nvme_set_options(args.client,
action_on_timeout=args.action_on_timeout,
timeout_us=args.timeout_us,
timeout_admin_us=args.timeout_admin_us,
keep_alive_timeout_ms=args.keep_alive_timeout_ms,
retry_count=args.retry_count,
arbitration_burst=args.arbitration_burst,
@ -473,6 +474,8 @@ if __name__ == "__main__":
help="Action to take on command time out. Valid valies are: none, reset, abort")
p.add_argument('-t', '--timeout-us',
help="Timeout for each command, in microseconds. If 0, don't track timeouts.", type=int)
p.add_argument('--timeout-admin-us',
help="Timeout for each admin command, in microseconds. If 0, treat same as io timeouts.", type=int)
p.add_argument('-k', '--keep-alive-timeout-ms',
help="Keep alive timeout period in millisecond. If 0, disable keep-alive.", type=int)
p.add_argument('-n', '--retry-count',

View File

@ -425,9 +425,9 @@ def bdev_uring_delete(client, name):
@deprecated_alias('set_bdev_nvme_options')
def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, keep_alive_timeout_ms=None,
retry_count=None, arbitration_burst=None, low_priority_weight=None,
medium_priority_weight=None, high_priority_weight=None,
def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, timeout_admin_us=None,
keep_alive_timeout_ms=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,
delay_cmd_submit=None):
"""Set options for the bdev nvme. This is startup command.
@ -435,6 +435,7 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, keep_
Args:
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)
timeout_admin_us: Timeout for each admin command, in microseconds. If 0, treat same as io timeouts (optional)
keep_alive_timeout_ms: Keep alive timeout period in millisecond, default is 10s (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)
@ -454,6 +455,9 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, keep_
if timeout_us is not None:
params['timeout_us'] = timeout_us
if timeout_admin_us is not None:
params['timeout_admin_us'] = timeout_admin_us
if keep_alive_timeout_ms is not None:
params['keep_alive_timeout_ms'] = keep_alive_timeout_ms