From: optimistyzy Date: Thu, 9 Mar 2017 06:30:33 +0000 (+0800) Subject: Bluestore, NVMeDevice: fix the core id for rte_remote_launch X-Git-Tag: v12.0.1~117^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F13896%2Fhead;p=ceph.git Bluestore, NVMeDevice: fix the core id for rte_remote_launch Previously, we use the id. The id value will be 1 always since we will only support one NVMe device per osd. Also we have coremask conf , the default is 3, and we will use core 1. It is correct. However if we specify another core mask, e.g., 0xC, still passing 1 to start the dpdk_thread is wrong. we need to pass core id = 4. Since for each shareddata, we only use one cpu core, so just passing rte_get_next_lcore(-1, 0, 0), which selects the first slave core. Signed-off-by: optimistyzy --- diff --git a/src/os/bluestore/NVMEDevice.cc b/src/os/bluestore/NVMEDevice.cc index c7cdb38afa4ad..80df2c425b58d 100644 --- a/src/os/bluestore/NVMEDevice.cc +++ b/src/os/bluestore/NVMEDevice.cc @@ -143,6 +143,7 @@ struct Task { class SharedDriverData { unsigned id; + uint32_t core_id; std::string sn; spdk_nvme_ctrlr *ctrlr; spdk_nvme_ns *ns; @@ -158,7 +159,8 @@ class SharedDriverData { bool aio_stop = false; void _aio_thread(); void _aio_start() { - int r = rte_eal_remote_launch(dpdk_thread_adaptor, static_cast(&run_func), id); + int r = rte_eal_remote_launch(dpdk_thread_adaptor, static_cast(&run_func), + core_id); assert(r == 0); } void _aio_stop() { @@ -167,7 +169,7 @@ class SharedDriverData { aio_stop = true; queue_cond.Signal(); } - int r = rte_eal_wait_lcore(id); + int r = rte_eal_wait_lcore(core_id); assert(r == 0); aio_stop = false; } @@ -185,9 +187,10 @@ class SharedDriverData { std::atomic_ulong completed_op_seq, queue_op_seq; PerfCounters *logger = nullptr; - SharedDriverData(unsigned i, const std::string &sn_tag, + SharedDriverData(unsigned i, uint32_t core, const std::string &sn_tag, spdk_nvme_ctrlr *c, spdk_nvme_ns *ns) : id(i), + core_id(core), sn(sn_tag), ctrlr(c), ns(ns), @@ -556,7 +559,7 @@ class NVMEManager { // only support one device per osd now! assert(shared_driver_datas.empty()); // index 0 is occured by master thread - shared_driver_datas.push_back(new SharedDriverData(shared_driver_datas.size()+1, sn_tag, c, ns)); + shared_driver_datas.push_back(new SharedDriverData(shared_driver_datas.size()+1, rte_get_next_lcore(-1, 0, 0), sn_tag, c, ns)); *driver = shared_driver_datas.back(); } };