The non-pmd thread static_tx_qid is assumed to be equal to the highest
core ID + 1. The function dp_netdev_del_pmds_on_numa() invalidates
this assumption by re-distributing the static_tx_qid:s on all pmd and
non-pmd threads of the "other" numa.

There might be a number of unwanted effects due to the non-pmd thread
static_tx_qid being changed. The actual fault, observed in OVS 2.5, was a
crash due to the TX burst queues containing a NULL packet buffer pointer
in the range of valid buffers, presumably caused by a race condition.

In OVS 2.6 TX burst queues have been removed, nevertheless the current
behavior is incorrect.

The correction makes dp_netdev_del_pmds_on_numa() honor the constancy
of the non-pmd static_tx_qid value by excluding all non-pmd threads
from the deletion and from the re-ordering of the static_tx_qid.

Signed-off-by: Patrik Andersson <patrik.r.anders...@ericsson.com>
---
 lib/dpif-netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 5049b40..651da5e 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3400,7 +3400,7 @@ dp_netdev_del_pmds_on_numa(struct dp_netdev *dp, int 
numa_id)
         /* We cannot call dp_netdev_del_pmd(), since it alters
          * 'dp->poll_threads' (while we're iterating it) and it
          * might quiesce. */
-        if (pmd->numa_id == numa_id) {
+        if (pmd->numa_id == numa_id && pmd->core_id != NON_PMD_CORE_ID) {
             atomic_read_relaxed(&pmd->static_tx_qid, &free_idx[k]);
             pmd_list[k] = pmd;
             ovs_assert(k < n_pmds_on_numa);
@@ -3418,7 +3418,7 @@ dp_netdev_del_pmds_on_numa(struct dp_netdev *dp, int 
numa_id)
 
         atomic_read_relaxed(&pmd->static_tx_qid, &old_tx_qid);
 
-        if (old_tx_qid >= n_pmds) {
+        if (old_tx_qid >= n_pmds && pmd->core_id != NON_PMD_CORE_ID) {
             int new_tx_qid = free_idx[--k];
 
             atomic_store_relaxed(&pmd->static_tx_qid, new_tx_qid);
-- 
1.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to