Commit a741e341 authored by Ben Walker's avatar Ben Walker Committed by Changpeng Liu
Browse files

bdev/nvme: Add configuration parameter to slow down polling



For NVMe devices, in conjunction with the new batching options,
it can be advantageous to artificially delay between polling
for completions. Add an option to slow this rate down.

Change-Id: I0fc92709ff45ead0beb388dda60694bf1ed8b258
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447716


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent c64ba314
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1332,7 +1332,8 @@ 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
nvme_adminq_poll_period_us | Optional | number      | How often the admin queue is polled for asynchronous events in microsecond
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).

### Example

+3 −0
Original line number Diff line number Diff line
@@ -118,6 +118,9 @@
  # Set how often the admin queue is polled for asynchronous events.
  # Units in microseconds.
  AdminPollRate 100000
  # Set how often I/O queues are polled from completions.
  # Units in microseconds.
  IOPollRate 0

  # Disable handling of hotplug (runtime insert and remove) events,
  # users can set to Yes if want to enable it.
+3 −0
Original line number Diff line number Diff line
@@ -162,6 +162,9 @@
  # Set how often the admin queue is polled for asynchronous events.
  # Units in microseconds.
  AdminPollRate 100000
  # Set how often I/O queues are polled from completions.
  # Units in microseconds.
  IOPollRate 0

  # Disable handling of hotplug (runtime insert and remove) events,
  # users can set to Yes if want to enable it.
+3 −0
Original line number Diff line number Diff line
@@ -94,6 +94,9 @@
  # Set how often the admin queue is polled for asynchronous events.
  # Units in microseconds.
  AdminPollRate 100000
  # Set how often I/O queues are polled from completions.
  # Units in microseconds.
  IOPollRate 0

# The Split virtual block device slices block devices into multiple smaller bdevs.
[Split]
+9 −1
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ static struct spdk_bdev_nvme_opts g_opts = {
	.timeout_us = 0,
	.retry_count = SPDK_NVME_DEFAULT_RETRY_COUNT,
	.nvme_adminq_poll_period_us = 1000000ULL,
	.nvme_ioq_poll_period_us = 0,
};

#define NVME_HOTPLUG_POLL_PERIOD_MAX			10000000ULL
@@ -538,7 +539,7 @@ bdev_nvme_create_cb(void *io_device, void *ctx_buf)
		return -1;
	}

	ch->poller = spdk_poller_register(bdev_nvme_poll, ch, 0);
	ch->poller = spdk_poller_register(bdev_nvme_poll, ch, g_opts.nvme_ioq_poll_period_us);
	return 0;
}

@@ -1353,6 +1354,11 @@ bdev_nvme_library_init(void)
		g_opts.nvme_adminq_poll_period_us = intval;
	}

	intval = spdk_conf_section_get_intval(sp, "IOPollRate");
	if (intval > 0) {
		g_opts.nvme_ioq_poll_period_us = intval;
	}

	if (spdk_process_is_primary()) {
		hotplug_enabled = spdk_conf_section_get_boolval(sp, "HotplugEnable", false);
	}
@@ -1984,6 +1990,7 @@ bdev_nvme_get_spdk_running_config(FILE *fp)
		"# Set how often the admin queue is polled for asynchronous events.\n"
		"# Units in microseconds.\n");
	fprintf(fp, "AdminPollRate %"PRIu64"\n", g_opts.nvme_adminq_poll_period_us);
	fprintf(fp, "IOPollRate %" PRIu64"\n", g_opts.nvme_ioq_poll_period_us);
	fprintf(fp, "\n"
		"# Disable handling of hotplug (runtime insert and remove) events,\n"
		"# users can set to Yes if want to enable it.\n"
@@ -2024,6 +2031,7 @@ bdev_nvme_config_json(struct spdk_json_write_ctx *w)
	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_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_object_end(w);

	spdk_json_write_object_end(w);
Loading