Thilak Raj Surendra Babu via dev <[email protected]> writes: > Add optional logging of userspace connection tracking lifecycles. > Each connection logs exactly one line, written when it is purged, > with its tuple, when it was created, when and why it was purged, > and how long it lived. > > A PMD thread must never block, format a string, or write a log > line, so no part of this runs on one. The thread that already > removes the connection -- the 'ct_clean' sweep thread for a normal > expiry, or whichever thread handles an explicit flush -- does the > formatting and the vlog write itself, inline, right there. No ring > buffer, no dedicated consumer thread, and no new memory: the only > addition to 'struct conn' is the 'created' timestamp, set once at > creation and never touched again. A connection's removal from the > table is unconditional and is never delayed by logging; a line can > only ever be skipped (and counted by the > 'conntrack_log_ratelimited' coverage counter), never the removal > itself. > > Logging is disabled by default. When disabled, the cost on the > datapath is a single atomic load. When enabled, output can be > restricted to a list of conntrack zones and is capped at a > configurable number of lines per second (default 1000, 0 for > unlimited) so that a connection storm cannot flood the log; > reclaiming connections continues at full speed regardless of the > cap. Configure with 'ovs-appctl conntrack/log-set [enable|disable] > [zones=LIST] [rate=N]' and inspect the current configuration with > 'ovs-appctl conntrack/log-show'. > > Earlier revisions of this change used a lock-free ring buffer and a > separate consumer thread to move logging work off any thread that > could be a PMD. That is unnecessary here: the sweep and flush > threads already touch every connection they purge, are never PMDs, > and run far below packet rate, so moving the work there directly > needs no new thread, no ring, and no additional memory. > > Tested with 'make check', including a new ofproto-dpif.at test case > covering enabling, disabling, rate-limiting, and zone-filtering, > and with the new 'ovstest test-conntrack benchmark-new-conns' > micro-benchmark on real 25G hardware: logging disabled, or capped > at the default rate, is indistinguishable from logging off for > both connection creation and flush; only an explicit, non-default > 'rate=0' (unlimited) measurably slows a bulk flush, trading flush > time for a guarantee that no line is dropped. > > Signed-off-by: Thilak Raj Surendra Babu <[email protected]> > Assisted-by: Claude Sonnet 5, Claude Code > --- > v2 -> v3: No code changes. Rebased onto current master: two unrelated > NEWS entries landed upstream at the same insertion point since v2 and > made git-am's context match fail (0-day robot: "Failed to merge in > the changes"). Resolved the NEWS conflict only; everything else is > unchanged from v2. > > v1 -> v2: No code changes. Resending because the 0-day robot reported > a git-am "Patch format detection failed" error on v1; this did not > reproduce locally (git am applies cleanly at the current master > merge-base, checkpatch is clean), and a transient 502 from > patchwork's own mbox endpoint around the same time suggests an > infra-side hiccup fetching the patch rather than an issue with it.
I sent feedback on v2. As you note, the code is the same. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
