event: Remove max_delay_us parameter
The thread scheduling mechanism is being rewritten and this won't be used in the new system. Change-Id: I829e8118ed0a10480bd86934b45e68fcb810931a Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/444453 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
ae9faf3ac7
commit
3569ea154a
@ -112,7 +112,9 @@ struct spdk_app_opts {
|
|||||||
struct spdk_pci_addr *pci_blacklist;
|
struct spdk_pci_addr *pci_blacklist;
|
||||||
struct spdk_pci_addr *pci_whitelist;
|
struct spdk_pci_addr *pci_whitelist;
|
||||||
|
|
||||||
/* The maximum latency allowed when passing an event
|
/* DEPRECATED. No longer has any effect.
|
||||||
|
*
|
||||||
|
* The maximum latency allowed when passing an event
|
||||||
* from one core to another. A value of 0
|
* from one core to another. A value of 0
|
||||||
* means all cores continually poll. This is
|
* means all cores continually poll. This is
|
||||||
* specified in microseconds.
|
* specified in microseconds.
|
||||||
|
@ -46,7 +46,7 @@ struct spdk_event {
|
|||||||
void *arg2;
|
void *arg2;
|
||||||
};
|
};
|
||||||
|
|
||||||
int spdk_reactors_init(unsigned int max_delay_us);
|
int spdk_reactors_init(void);
|
||||||
void spdk_reactors_fini(void);
|
void spdk_reactors_fini(void);
|
||||||
|
|
||||||
void spdk_reactors_start(void);
|
void spdk_reactors_start(void);
|
||||||
|
@ -279,7 +279,6 @@ spdk_app_opts_init(struct spdk_app_opts *opts)
|
|||||||
opts->master_core = SPDK_APP_DPDK_DEFAULT_MASTER_CORE;
|
opts->master_core = SPDK_APP_DPDK_DEFAULT_MASTER_CORE;
|
||||||
opts->mem_channel = SPDK_APP_DPDK_DEFAULT_MEM_CHANNEL;
|
opts->mem_channel = SPDK_APP_DPDK_DEFAULT_MEM_CHANNEL;
|
||||||
opts->reactor_mask = NULL;
|
opts->reactor_mask = NULL;
|
||||||
opts->max_delay_us = 0;
|
|
||||||
opts->print_level = SPDK_APP_DEFAULT_LOG_PRINT_LEVEL;
|
opts->print_level = SPDK_APP_DEFAULT_LOG_PRINT_LEVEL;
|
||||||
opts->rpc_addr = SPDK_DEFAULT_RPC_ADDR;
|
opts->rpc_addr = SPDK_DEFAULT_RPC_ADDR;
|
||||||
opts->num_entries = SPDK_APP_DEFAULT_NUM_TRACE_ENTRIES;
|
opts->num_entries = SPDK_APP_DEFAULT_NUM_TRACE_ENTRIES;
|
||||||
@ -629,7 +628,7 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn,
|
|||||||
* reactor_mask will be 0x1 which will enable core 0 to run one
|
* reactor_mask will be 0x1 which will enable core 0 to run one
|
||||||
* reactor.
|
* reactor.
|
||||||
*/
|
*/
|
||||||
if ((rc = spdk_reactors_init(opts->max_delay_us)) != 0) {
|
if ((rc = spdk_reactors_init()) != 0) {
|
||||||
SPDK_ERRLOG("Reactor Initilization failed: rc = %d\n", rc);
|
SPDK_ERRLOG("Reactor Initilization failed: rc = %d\n", rc);
|
||||||
goto app_start_log_close_err;
|
goto app_start_log_close_err;
|
||||||
}
|
}
|
||||||
@ -985,12 +984,8 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MAX_REACTOR_DELAY_OPT_IDX:
|
case MAX_REACTOR_DELAY_OPT_IDX:
|
||||||
tmp = spdk_strtol(optarg, 10);
|
fprintf(stderr,
|
||||||
if (tmp < 0) {
|
"Deprecation warning: The maximum allowed latency parameter is no longer supported.\n");
|
||||||
fprintf(stderr, "Invalid maximum latency %s\n", optarg);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
opts->max_delay_us = (uint64_t)tmp;
|
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
/*
|
/*
|
||||||
|
@ -64,8 +64,6 @@ struct spdk_reactor {
|
|||||||
struct rusage rusage;
|
struct rusage rusage;
|
||||||
|
|
||||||
struct spdk_ring *events;
|
struct spdk_ring *events;
|
||||||
|
|
||||||
uint64_t max_delay_us;
|
|
||||||
} __attribute__((aligned(64)));
|
} __attribute__((aligned(64)));
|
||||||
|
|
||||||
static struct spdk_reactor *g_reactors;
|
static struct spdk_reactor *g_reactors;
|
||||||
@ -74,8 +72,7 @@ static enum spdk_reactor_state g_reactor_state = SPDK_REACTOR_STATE_INVALID;
|
|||||||
|
|
||||||
static bool g_context_switch_monitor_enabled = true;
|
static bool g_context_switch_monitor_enabled = true;
|
||||||
|
|
||||||
static void spdk_reactor_construct(struct spdk_reactor *w, uint32_t lcore,
|
static void spdk_reactor_construct(struct spdk_reactor *w, uint32_t lcore);
|
||||||
uint64_t max_delay_us);
|
|
||||||
|
|
||||||
static struct spdk_mempool *g_spdk_event_mempool = NULL;
|
static struct spdk_mempool *g_spdk_event_mempool = NULL;
|
||||||
|
|
||||||
@ -239,10 +236,6 @@ _spdk_reactor_run(void *arg)
|
|||||||
{
|
{
|
||||||
struct spdk_reactor *reactor = arg;
|
struct spdk_reactor *reactor = arg;
|
||||||
struct spdk_thread *thread;
|
struct spdk_thread *thread;
|
||||||
uint64_t now;
|
|
||||||
uint64_t sleep_cycles;
|
|
||||||
uint32_t sleep_us;
|
|
||||||
int rc;
|
|
||||||
char thread_name[32];
|
char thread_name[32];
|
||||||
|
|
||||||
snprintf(thread_name, sizeof(thread_name), "reactor_%u", reactor->lcore);
|
snprintf(thread_name, sizeof(thread_name), "reactor_%u", reactor->lcore);
|
||||||
@ -252,7 +245,6 @@ _spdk_reactor_run(void *arg)
|
|||||||
}
|
}
|
||||||
SPDK_NOTICELOG("Reactor started on core %u\n", reactor->lcore);
|
SPDK_NOTICELOG("Reactor started on core %u\n", reactor->lcore);
|
||||||
|
|
||||||
sleep_cycles = reactor->max_delay_us * spdk_get_ticks_hz() / SPDK_SEC_TO_USEC;
|
|
||||||
if (g_context_switch_monitor_enabled) {
|
if (g_context_switch_monitor_enabled) {
|
||||||
spdk_set_thread(thread);
|
spdk_set_thread(thread);
|
||||||
_spdk_reactor_context_switch_monitor_start(reactor, NULL);
|
_spdk_reactor_context_switch_monitor_start(reactor, NULL);
|
||||||
@ -262,31 +254,7 @@ _spdk_reactor_run(void *arg)
|
|||||||
while (1) {
|
while (1) {
|
||||||
_spdk_event_queue_run_batch(reactor, thread);
|
_spdk_event_queue_run_batch(reactor, thread);
|
||||||
|
|
||||||
rc = spdk_thread_poll(thread, 0, 0);
|
spdk_thread_poll(thread, 0, 0);
|
||||||
|
|
||||||
/* Determine if the thread can sleep */
|
|
||||||
if (sleep_cycles && rc == 0) {
|
|
||||||
uint64_t next_run_tick;
|
|
||||||
|
|
||||||
now = spdk_get_ticks();
|
|
||||||
sleep_us = reactor->max_delay_us;
|
|
||||||
next_run_tick = spdk_thread_next_poller_expiration(thread);
|
|
||||||
|
|
||||||
/* There are timers registered, so don't sleep beyond
|
|
||||||
* when the next timer should fire */
|
|
||||||
if (next_run_tick > 0 && next_run_tick < (now + sleep_cycles)) {
|
|
||||||
if (next_run_tick <= now) {
|
|
||||||
sleep_us = 0;
|
|
||||||
} else {
|
|
||||||
sleep_us = ((next_run_tick - now) *
|
|
||||||
SPDK_SEC_TO_USEC) / spdk_get_ticks_hz();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sleep_us > 0) {
|
|
||||||
usleep(sleep_us);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_reactor_state != SPDK_REACTOR_STATE_RUNNING) {
|
if (g_reactor_state != SPDK_REACTOR_STATE_RUNNING) {
|
||||||
break;
|
break;
|
||||||
@ -300,10 +268,9 @@ _spdk_reactor_run(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_reactor_construct(struct spdk_reactor *reactor, uint32_t lcore, uint64_t max_delay_us)
|
spdk_reactor_construct(struct spdk_reactor *reactor, uint32_t lcore)
|
||||||
{
|
{
|
||||||
reactor->lcore = lcore;
|
reactor->lcore = lcore;
|
||||||
reactor->max_delay_us = max_delay_us;
|
|
||||||
|
|
||||||
reactor->events = spdk_ring_create(SPDK_RING_TYPE_MP_SC, 65536, SPDK_ENV_SOCKET_ID_ANY);
|
reactor->events = spdk_ring_create(SPDK_RING_TYPE_MP_SC, 65536, SPDK_ENV_SOCKET_ID_ANY);
|
||||||
assert(reactor->events != NULL);
|
assert(reactor->events != NULL);
|
||||||
@ -374,7 +341,7 @@ spdk_reactors_stop(void *arg1, void *arg2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_reactors_init(unsigned int max_delay_us)
|
spdk_reactors_init(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
uint32_t i, last_core;
|
uint32_t i, last_core;
|
||||||
@ -410,7 +377,7 @@ spdk_reactors_init(unsigned int max_delay_us)
|
|||||||
|
|
||||||
SPDK_ENV_FOREACH_CORE(i) {
|
SPDK_ENV_FOREACH_CORE(i) {
|
||||||
reactor = spdk_reactor_get(i);
|
reactor = spdk_reactor_get(i);
|
||||||
spdk_reactor_construct(reactor, i, max_delay_us);
|
spdk_reactor_construct(reactor, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_reactor_state = SPDK_REACTOR_STATE_INITIALIZED;
|
g_reactor_state = SPDK_REACTOR_STATE_INITIALIZED;
|
||||||
|
Loading…
Reference in New Issue
Block a user