Currently, we have a single thread (the 'flow_dumper') that fetches the flows from the datapath and distributes them to revalidator threads. To clean up the code (and provide a small performance benefit), we are looking at removing this flow_dumper thread, and have each revalidator fetch flows from the datapath instead.
This patchset provides groundwork for that, by allowing threaded execution of flow_dump_next() as part of the same flow dump operation. The lifetime of a flow dump operation is planned as follows:- 1) A 'leader' thread will call flow_dump_start() to initialize the iterator. 2) Each thread that intends to dump will call flow_dump_state_init() to allocate its own buffers for dumping. 3) Multiple threads will call flow_dump_next() with the same iterator, each passing their own state and output pointers. 4) When each thread's call to flow_dump_next() returns non-zero, it will stop iterating and call flow_dump_state_uninit() to clean up its buffers. 5) All threads will synchronize to ensure none are still using the iterator. 6) The 'leader' thread will call flow_dump_done() to uninitialize the iterator. v2: * Combine patches 2-5 of v1 into one patch that removes nl_dump buffers. * Allow netlink dumpers to block if another thread has the last message. * Drop patch to remove actions from flow_dump_next(). Decided we want them after all. * Replace 'buffer' with opaque 'state'. Flow dumpers will now deal with two opaque pieces of data: A shared 'iterator' and a thread-local 'state'. This provides dpif implementations with more flexibility, and clarifies the semantics of the interface. * Improve interface descriptions/documentation. * Completely remove dump status caching at the dpif layer. It is now up to the dpif implementation to track this correctly. Joe Stringer (7): dpif-linux: Fix flow_dump_next annotation. netlink: Remove buffer from 'struct nl_dump'. netlink: Rename 'dump->seq' to 'dump->nl_seq' netlink: Make nl_dump_next() thread-safe. dpif: Separate local and shared flow dump state. dpif: Make dpif_flow_dump_next() thread-safe. dpif: Don't synchronize flow_dump_next() status. lib/dpif-linux.c | 93 ++++++++++++++++++------- lib/dpif-netdev.c | 77 +++++++++++++++------ lib/dpif-provider.h | 48 ++++++++----- lib/dpif.c | 100 ++++++++++++++------------- lib/dpif.h | 27 +++++--- lib/netdev-linux.c | 42 ++++++++---- lib/netlink-socket.c | 150 ++++++++++++++++++++++++----------------- lib/netlink-socket.h | 23 +++++-- lib/route-table.c | 14 ++-- ofproto/ofproto-dpif-upcall.c | 15 ++++- ofproto/ofproto-dpif.c | 18 +++-- utilities/ovs-dpctl.c | 31 ++++++--- 12 files changed, 423 insertions(+), 215 deletions(-) -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev