[ovs-git] [ovn-org/ovn] 69b561: ofctrl: change ofctrl_dup_flow to module internal ...

Han Zhou noreply at github.com
Wed Sep 9 20:33:03 UTC 2020


  Branch: refs/heads/master
  Home:   https://github.com/ovn-org/ovn
  Commit: 69b56114bd253531d2dab7336a99d1c7563eb7be
      https://github.com/ovn-org/ovn/commit/69b56114bd253531d2dab7336a99d1c7563eb7be
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-09 (Wed, 09 Sep 2020)

  Changed paths:
    M controller/ofctrl.c
    M controller/ofctrl.h

  Log Message:
  -----------
  ofctrl: change ofctrl_dup_flow to module internal function

Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Han Zhou <hzhou at ovn.org>


  Commit: 2820330c38e057afbcee359d2830b9a4321cc632
      https://github.com/ovn-org/ovn/commit/2820330c38e057afbcee359d2830b9a4321cc632
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-09 (Wed, 09 Sep 2020)

  Changed paths:
    M tests/ovn.at

  Log Message:
  -----------
  ovn.at: Fix AT for conjunction case.

1. Fix flows priorities in the comments.
2. Clean up hv1.

Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Han Zhou <hzhou at ovn.org>


  Commit: 176be88fd13dad8aac51de82ccfb83b31d00a258
      https://github.com/ovn-org/ovn/commit/176be88fd13dad8aac51de82ccfb83b31d00a258
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-09 (Wed, 09 Sep 2020)

  Changed paths:
    M controller/lflow.c

  Log Message:
  -----------
  lflow.c: No need to remove flows for adding new datapath.

When handling a new datapath, the flows should have never existed, so there is
no need to remove them before adding. Although it seems not harmful to do it,
the implementation was not complete. To remove existing flows, it also need to
remove the flow references. Because the flows never existed, so this wasn't a
problem. So, instead of fixing the incomplete flow removing, this patch simply
avoid the unnecessary operation.

Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Han Zhou <hzhou at ovn.org>


  Commit: 580aea72e26f53deb72a0d0f5516327a4af7c8fe
      https://github.com/ovn-org/ovn/commit/580aea72e26f53deb72a0d0f5516327a4af7c8fe
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-09 (Wed, 09 Sep 2020)

  Changed paths:
    M controller/lflow.c
    M controller/ofctrl.c
    M controller/ofctrl.h
    M tests/ovn.at

  Log Message:
  -----------
  ovn-controller: Fix conjunction handling with incremental processing.

When translating lflows to OVS flows, different lflows can refer to same OVS
flow as a result of calling ofctrl_add_or_append_flow(), particularly for
conjunction combinding. However, the implementation doesn't work with
incremental processing, because when any of the lflows are removed, we rely on
the lflow's uuid to remove the OVS flow in the desired flow table. Currently
only one single lflow uuid is maintained in the desired flow, so removing one
of the lflows that references to the same desired flow resulted in wrong
behavior: either removing flows that are used by other lflows, or the existing
flows are not updated (part of the conjunction actions should be removed from
the flow).

To solve the problem, this patch maintains the cross reference (M:N) between
lflows (and other sb objects) and desired flows, and handles the flow removal
and updates with a flood-removal and re-add approach.

Fixes: e659bab31a9 ("Combine conjunctions with identical matches into one flow.")
Cc: Mark Michelson <mmichels at redhat.com>
Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Han Zhou <hzhou at ovn.org>


  Commit: f249af7f9916548890c4bf1bce514566273db5a0
      https://github.com/ovn-org/ovn/commit/f249af7f9916548890c4bf1bce514566273db5a0
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-09 (Wed, 09 Sep 2020)

  Changed paths:
    M tests/ovn.at

  Log Message:
  -----------
  ovn.at: Add test case for duplicated flow handling.

In ofctrl_put() of controller/ofctrl.c, some special considerations have been
made to handle duplicated match conditions from difference desired flows
because OVS doesn't allow multiple flows with same priority and same match
condition. This patch adds a test to cover such scenarios make sure it works
as expected.

Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Han Zhou <hzhou at ovn.org>


  Commit: 354d3853d40cbce89a434632f67daed7fc992d8b
      https://github.com/ovn-org/ovn/commit/354d3853d40cbce89a434632f67daed7fc992d8b
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-09 (Wed, 09 Sep 2020)

  Changed paths:
    M controller/ofctrl.c

  Log Message:
  -----------
  ofctrl.c: Maintain references between installed flows and desired flows.

Currently there is no link maintained between installed flows and desired
flows. This patch maintains the mapping between them, which will be useful
for a future patch that incrementally processes the flow installation without
having to do the full comparison between them.

This patch also refactors the struct ovn_flow with two different wrapper
types: desired_flow and installed_flow, and the related static functions,
to make the code easier to read and avoid misuses of the struct.

Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Han Zhou <hzhou at ovn.org>


  Commit: 23063cf4178c05f5d6b3e4ec6d323ccc88df6101
      https://github.com/ovn-org/ovn/commit/23063cf4178c05f5d6b3e4ec6d323ccc88df6101
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-09 (Wed, 09 Sep 2020)

  Changed paths:
    M controller/ofctrl.c

  Log Message:
  -----------
  ofctrl.c: Refactor - move openflow msg construction to functions.

These functions will be reused in multiple places in a future patch.

Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Han Zhou <hzhou at ovn.org>


  Commit: 6f0b1e02d9ab3a94048c4818f2d382938cad4b71
      https://github.com/ovn-org/ovn/commit/6f0b1e02d9ab3a94048c4818f2d382938cad4b71
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-09 (Wed, 09 Sep 2020)

  Changed paths:
    M controller/ofctrl.c
    M controller/ofctrl.h

  Log Message:
  -----------
  ofctrl: Incremental processing for flow installation by tracking.

With incremental processing for flow computation, the bottle neck of
ovn-controller in large scale environment is in the flow installation
(ofctrl_put()), which does full comparison between the two big flow tables: the
installed flows and desired flows.

This patch implements tracking desired flow changes when flows are
incrementally computed by I-P engine, and then incrementally processing the
flow installation using the tracked information in ofctrl_put(). It falls back
to the full comparison whenever tracking information is unavailable, e.g. when
I-P engine triggers full recompute.

In ovn-scale-test with 3000 HVs and 30k lports, the end-to-end latency between
the moment a lflow is updated in SB DB and the moment when all the 3K HVs
complete OVS flow updating has reduced around 60% (from 1s to 400ms).

Below is the perf result for a ovn-controller processing a new port-binding:

Beore:
+   96.76%     0.00%  ovn-controller  [unknown]           [k] 0xffffffffffffffff
+   90.21%     0.00%  ovn-controller  ovn-controller      [.] main
+   39.93%     1.19%  ovn-controller  ovn-controller      [.] ofctrl_put
+   31.27%    12.47%  ovn-controller  ovn-controller      [.] ovn_flow_lookup
+   22.12%     3.12%  ovn-controller  ovn-controller      [.] encaps_run
+   18.69%     2.77%  ovn-controller  ovn-controller      [.] minimatch_equal
+   17.63%     4.11%  ovn-controller  ovn-controller      [.] patch_run
+   15.91%     0.00%  ovn-controller  ovn-controller      [.] add_bridge_mappings (inlined)
+   14.03%    12.08%  ovn-controller  ovn-controller      [.] minimask_equal
+   12.41%     0.00%  ovn-controller  ovn-controller      [.] chassis_tunnel_add (inlined)
+   11.40%     0.00%  ovn-controller  ovn-controller      [.] tunnel_add (inlined)

After:
+   94.59%     0.00%  ovn-controller  [unknown]           [k] 0xffffffffffffffff
+   83.56%     0.09%  ovn-controller  ovn-controller      [.] main
+   35.37%     3.13%  ovn-controller  ovn-controller      [.] encaps_run
+   27.54%     7.53%  ovn-controller  ovn-controller      [.] patch_run
+   24.86%     0.00%  ovn-controller  ovn-controller      [.] add_bridge_mappings (inlined)
+   20.01%     0.00%  ovn-controller  ovn-controller      [.] chassis_tunnel_add (inlined)
+   18.51%     0.00%  ovn-controller  ovn-controller      [.] tunnel_add (inlined)
+   14.08%     0.17%  ovn-controller  ovn-controller      [.] physical_run
+   11.37%    11.28%  ovn-controller  ovn-controller      [.] next_real_row
+   10.50%     2.59%  ovn-controller  ovn-controller      [.] consider_port_binding
...
+    2.14%     0.32%  ovn-controller  ovn-controller      [.] ofctrl_put                                                                                                                                                                                                                 ▒

Before the optimization, ofctrl_put took 40% of CPU, and now it disappears from
the hot spots.

Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Han Zhou <hzhou at ovn.org>


  Commit: f4e508dd7a6cfbfc2e3250a8c11a8d0fdc1dfdd0
      https://github.com/ovn-org/ovn/commit/f4e508dd7a6cfbfc2e3250a8c11a8d0fdc1dfdd0
  Author: Han Zhou <hzhou at ovn.org>
  Date:   2020-09-09 (Wed, 09 Sep 2020)

  Changed paths:
    M controller/ofctrl.c

  Log Message:
  -----------
  ofctrl.c: Merge opposite changes of tracked flows before installing.

This patch optimizes the previous patch that incrementally processes
flow installation by merging the "add-after-delete" flow changes as
much as possible to avoid unnecessary OpenFlow updates.

Acked-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Han Zhou <hzhou at ovn.org>


Compare: https://github.com/ovn-org/ovn/compare/51bf8e630f07...f4e508dd7a6c


More information about the git mailing list