Changeset 12ae766 for lib/format_dpdk.c


Ignore:
Timestamp:
02/11/15 11:09:31 (6 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
1b59edf
Parents:
858ce90
Message:

Move pthread register outside of the libtrace lock.
DAG does a decent amount of work in this step, which
can be done in parallel. Instead let formats grab a
lock if they need it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_dpdk.c

    r75e088f r12ae766  
    14191419 * gives it.
    14201420 *
    1421  * We then allow a mapper thread to be started on every real core as DPDK would
     1421 * We then allow a mapper thread to be started on every real core as DPDK would,
    14221422 * we also bind these to the corresponding CPU cores.
    14231423 *
     
    14371437    // in this case physical cores on the system will not exist so we don't bind
    14381438    // these to any particular physical core
     1439    pthread_mutex_lock(&libtrace->libtrace_lock);
    14391440    if (reading) {
    14401441#if HAVE_LIBNUMA
     
    14721473        // TODO proper libtrace style error here!!
    14731474        fprintf(stderr, "Too many threads for DPDK!!\n");
     1475        pthread_mutex_unlock(&libtrace->libtrace_lock);
    14741476        return -1;
    14751477    }
     
    14961498        if (i != 0) {
    14971499            fprintf(stderr, "Warning pthread_setaffinity_np failed\n");
     1500            pthread_mutex_unlock(&libtrace->libtrace_lock);
    14981501            return -1;
    14991502        }
     
    15081511        }
    15091512    }
     1513    pthread_mutex_unlock(&libtrace->libtrace_lock);
    15101514    return 0;
    15111515}
     
    15231527
    15241528    assert(rte_lcore_id() < RTE_MAX_LCORE);
    1525 
     1529    pthread_mutex_lock(&libtrace->libtrace_lock);
    15261530    // Skip if master!!
    15271531    if (rte_lcore_id() == rte_get_master_lcore()) {
    15281532        fprintf(stderr, "INFO: we are skipping unregistering the master lcore\n");
     1533        pthread_mutex_unlock(&libtrace->libtrace_lock);
    15291534        return;
    15301535    }
     
    15351540    RTE_PER_LCORE(_lcore_id) = -1; // Might make the world burn if used again
    15361541    assert(cfg->lcore_count >= 1); // We cannot unregister the master LCORE!!
     1542    pthread_mutex_unlock(&libtrace->libtrace_lock);
    15371543    return;
    15381544}
Note: See TracChangeset for help on using the changeset viewer.