event: Remove usage of rte_launch

Change-Id: I38dc084783859851f70a3b0c78e3546c5dff1872
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/363609
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Ben Walker 2017-06-02 11:40:40 -07:00 committed by Daniel Verkamp
parent ef60d87b84
commit 9b8ddd2256
2 changed files with 14 additions and 33 deletions

View File

@ -35,9 +35,6 @@
#include "spdk_internal/event.h"
#include <rte_config.h>
#include <rte_launch.h>
#include "spdk/env.h"
#include "spdk/log.h"
#include "spdk/conf.h"

View File

@ -43,15 +43,13 @@
#include <pthread_np.h>
#endif
#include <rte_config.h>
#include <rte_launch.h>
#include "spdk/log.h"
#include "spdk/io_channel.h"
#include "spdk/env.h"
#define SPDK_MAX_SOCKET 64
#define SPDK_MAX_REACTORS 128
#define SPDK_REACTOR_SPIN_TIME_US 1000
#define SPDK_TIMER_POLL_ITERATIONS 5
#define SPDK_EVENT_BATCH_SIZE 8
@ -118,7 +116,7 @@ struct spdk_reactor {
uint64_t max_delay_us;
} __attribute__((aligned(64)));
static struct spdk_reactor g_reactors[RTE_MAX_LCORE];
static struct spdk_reactor g_reactors[SPDK_MAX_REACTORS];
static enum spdk_reactor_state g_reactor_state = SPDK_REACTOR_STATE_INVALID;
@ -433,26 +431,6 @@ spdk_reactor_construct(struct spdk_reactor *reactor, uint32_t lcore, uint64_t ma
reactor->event_mempool = g_spdk_event_mempool[reactor->socket_id];
}
static void
spdk_reactor_start(struct spdk_reactor *reactor)
{
if (reactor->lcore != spdk_env_get_current_core()) {
switch (rte_eal_get_lcore_state(reactor->lcore)) {
case FINISHED:
rte_eal_wait_lcore(reactor->lcore);
/* FALLTHROUGH */
case WAIT:
rte_eal_remote_launch(_spdk_reactor_run, (void *)reactor, reactor->lcore);
break;
case RUNNING:
printf("Something already running on lcore %d\n", reactor->lcore);
break;
}
} else {
_spdk_reactor_run(reactor);
}
}
int
spdk_app_get_core_count(void)
{
@ -529,6 +507,7 @@ spdk_reactors_start(void)
{
struct spdk_reactor *reactor;
uint32_t i, current_core;
int rc;
g_reactor_state = SPDK_REACTOR_STATE_RUNNING;
@ -536,15 +515,20 @@ spdk_reactors_start(void)
SPDK_ENV_FOREACH_CORE(i) {
if (i != current_core) {
reactor = spdk_reactor_get(i);
spdk_reactor_start(reactor);
rc = spdk_env_thread_launch_pinned(reactor->lcore, _spdk_reactor_run, reactor);
if (rc < 0) {
SPDK_ERRLOG("Unable to start reactor thread on core %u\n", reactor->lcore);
assert(false);
return;
}
}
}
/* Start the master reactor */
reactor = spdk_reactor_get(current_core);
spdk_reactor_start(reactor);
_spdk_reactor_run(reactor);
rte_eal_mp_wait_lcore();
spdk_env_thread_wait_all();
g_reactor_state = SPDK_REACTOR_STATE_SHUTDOWN;
}
@ -693,9 +677,9 @@ spdk_poller_register(struct spdk_poller **ppoller, spdk_poller_fn fn, void *arg,
abort();
}
if (lcore >= RTE_MAX_LCORE) {
SPDK_ERRLOG("Attempted use lcore %u larger than max lcore %u\n",
lcore, RTE_MAX_LCORE - 1);
if (lcore >= SPDK_MAX_REACTORS) {
SPDK_ERRLOG("Attempted to use lcore %u which is larger than max lcore %u\n",
lcore, SPDK_MAX_REACTORS - 1);
abort();
}