diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2017-11-08 14:15:11 +0000 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2017-11-08 14:45:54 +0000 |
commit | 055c52583a2794da8ba1e85a48cce3832372b12f (patch) | |
tree | 8ceb1cb78fbb46a0f341f8ee24feb3c6b5540013 /examples/performance-thread/common | |
parent | f239aed5e674965691846e8ce3f187dd47523689 (diff) |
New upstream version 17.11-rc3
Change-Id: I6a5baa40612fe0c20f30b5fa773a6cbbac63a685
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'examples/performance-thread/common')
-rw-r--r-- | examples/performance-thread/common/lthread.h | 2 | ||||
-rw-r--r-- | examples/performance-thread/common/lthread_diag.c | 3 | ||||
-rw-r--r-- | examples/performance-thread/common/lthread_sched.c | 17 | ||||
-rw-r--r-- | examples/performance-thread/common/lthread_tls.c | 13 |
4 files changed, 17 insertions, 18 deletions
diff --git a/examples/performance-thread/common/lthread.h b/examples/performance-thread/common/lthread.h index 5c2c1a5f..0cde5919 100644 --- a/examples/performance-thread/common/lthread.h +++ b/examples/performance-thread/common/lthread.h @@ -87,7 +87,7 @@ int _lthread_desched_sleep(struct lthread *lt); void _lthread_free(struct lthread *lt); -struct lthread_sched *_lthread_sched_get(int lcore_id); +struct lthread_sched *_lthread_sched_get(unsigned int lcore_id); struct lthread_stack *_stack_alloc(void); diff --git a/examples/performance-thread/common/lthread_diag.c b/examples/performance-thread/common/lthread_diag.c index bce1a0c3..b5007d77 100644 --- a/examples/performance-thread/common/lthread_diag.c +++ b/examples/performance-thread/common/lthread_diag.c @@ -296,8 +296,7 @@ _lthread_diag_default_cb(uint64_t time, struct lthread *lt, int diag_event, /* * plug in default diag callback with mask off */ -void _lthread_diag_ctor(void)__attribute__((constructor)); -void _lthread_diag_ctor(void) +RTE_INIT(_lthread_diag_ctor) { diag_cb = _lthread_diag_default_cb; diag_mask = 0; diff --git a/examples/performance-thread/common/lthread_sched.c b/examples/performance-thread/common/lthread_sched.c index 98291478..779aeb17 100644 --- a/examples/performance-thread/common/lthread_sched.c +++ b/examples/performance-thread/common/lthread_sched.c @@ -117,8 +117,7 @@ uint64_t diag_mask; /* constructor */ -void lthread_sched_ctor(void) __attribute__ ((constructor)); -void lthread_sched_ctor(void) +RTE_INIT(lthread_sched_ctor) { memset(schedcore, 0, sizeof(schedcore)); rte_atomic16_init(&num_schedulers); @@ -562,11 +561,14 @@ void lthread_run(void) * Return the scheduler for this lcore * */ -struct lthread_sched *_lthread_sched_get(int lcore_id) +struct lthread_sched *_lthread_sched_get(unsigned int lcore_id) { - if (lcore_id > LTHREAD_MAX_LCORES) - return NULL; - return schedcore[lcore_id]; + struct lthread_sched *res = NULL; + + if (lcore_id < LTHREAD_MAX_LCORES) + res = schedcore[lcore_id]; + + return res; } /* @@ -578,10 +580,9 @@ int lthread_set_affinity(unsigned lcoreid) struct lthread *lt = THIS_LTHREAD; struct lthread_sched *dest_sched; - if (unlikely(lcoreid > LTHREAD_MAX_LCORES)) + if (unlikely(lcoreid >= LTHREAD_MAX_LCORES)) return POSIX_ERRNO(EINVAL); - DIAG_EVENT(lt, LT_DIAG_LTHREAD_AFFINITY, lcoreid, 0); dest_sched = schedcore[lcoreid]; diff --git a/examples/performance-thread/common/lthread_tls.c b/examples/performance-thread/common/lthread_tls.c index 47505f2d..2259fad4 100644 --- a/examples/performance-thread/common/lthread_tls.c +++ b/examples/performance-thread/common/lthread_tls.c @@ -62,9 +62,7 @@ RTE_DEFINE_PER_LTHREAD(void *, dummy); static struct lthread_key key_table[LTHREAD_MAX_KEYS]; -void lthread_tls_ctor(void) __attribute__((constructor)); - -void lthread_tls_ctor(void) +RTE_INIT(thread_tls_ctor) { key_pool = NULL; key_pool_init = 0; @@ -198,11 +196,12 @@ void _lthread_tls_destroy(struct lthread *lt) void *lthread_getspecific(unsigned int k) { + void *res = NULL; - if (k > LTHREAD_MAX_KEYS) - return NULL; + if (k < LTHREAD_MAX_KEYS) + res = THIS_LTHREAD->tls->data[k]; - return THIS_LTHREAD->tls->data[k]; + return res; } /* @@ -212,7 +211,7 @@ void */ int lthread_setspecific(unsigned int k, const void *data) { - if (k > LTHREAD_MAX_KEYS) + if (k >= LTHREAD_MAX_KEYS) return POSIX_ERRNO(EINVAL); int n = THIS_LTHREAD->tls->nb_keys_inuse; |