Low on Stack: Flexible protocols vs. Limited Memory#
Open vSwitch and OVN 2024 Fall Conference (Prague) digest Program Core pick Prague · 20–21 November 2024
Speakers: Ilya Maximets, Red Hat, Inc.
Why: Deep OVS internals on a real correctness hazard — stack exhaustion from recursive parsing/execution of flexible protocols (Netlink actions, OpenFlow translation) — and it decodes the warnings operators actually see in the field (resubmit limits, deferred action limits).
What: How OVS bounds recursion on both sides of the datapath. Kernel: ~16 kB stack, so nested Netlink actions (e.g., clone(clone(...)), up to 64 kB of nesting in a 16-bit length field) are executed via a Deferred Actions FIFO instead of unbounded recursion. Userspace: 2–8 MB stacks, but OpenFlow translation recurses through goto_table/resubmit/ct(table=N)/patch-port output; the existing depth/resubmit limits work out to roughly 512 B–2 kB of stack budget per rule.
How: The genuinely new technique: track actual stack consumption at runtime using __builtin_frame_address(0) and pthread_attr_getstacksize(), and trigger recirculation when the frame address approaches the stack limit — an RFC patch ("ofproto-dpif-xlate: Recirculate on stack exhaustion") that turns a potential crash into a graceful recirculate-with-frozen-state.
Where applicable: All OVS deployments, kernel and userspace; most acute where controller-generated pipelines (OVN, or any SDN app composing deep resubmit chains) stress translation depth.
