]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Bluestore, NVMeDevice: fix the core id for rte_remote_launch 13896/head
authoroptimistyzy <optimistyzy@gmail.com>
Thu, 9 Mar 2017 06:30:33 +0000 (14:30 +0800)
committeroptimistyzy <optimistyzy@gmail.com>
Thu, 9 Mar 2017 06:37:32 +0000 (14:37 +0800)
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 <optimistyzy@gmail.com>
src/os/bluestore/NVMEDevice.cc

index c7cdb38afa4ad12d054a0ba023dd57b180c27ff4..80df2c425b58de43f8f329c28d78d14ca78f96f9 100644 (file)
@@ -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<void*>(&run_func), id);
+    int r = rte_eal_remote_launch(dpdk_thread_adaptor, static_cast<void*>(&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();
   }
 };