From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAB284A35; Tue, 13 Oct 2026 12:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895839; cv=none; b=C9akGfEso3iifdCCqbnrhm1FtJmiTTtfAk2hEWgIPOz5GQe6ZVY1JkVgNuhht1qIbOE0I+SSzMQmEW2WgkMaxRvhshyhrL6jaAny8M77k2TVU/adXbuMeb/uhLQrRbeKVYDL0SB4KfBMvA2usSb1lEiM7U996ssrCgj8SAMn9us= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895839; c=relaxed/simple; bh=SK2k8KOAjv2LwqFiNElBE5yNP6BkeW4CTe9U9FyrSzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WWqw5ERL1yJQGhrPBbRdxV32XMSNopg8SNktfUJrZT5fd6qsX7NMZLT/ayLHVTWwMg83nA6brcVmr4S+cW2txWP0mZy6393aZ6/ZEsRG/FudeuvMRFCklFPTfaN+JRnM+Tx78ihWJNE+2RvAabkaKw/QpSpbgpOzEyn67wccNKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SW2imb6L; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SW2imb6L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AC091F000FF; Tue, 13 Oct 2026 12:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791895838; bh=1eho8VB5e+Dhj/5odru5bUzGUw17lfHoxVEn2/3HUA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SW2imb6LShaetBt+6Se+4FRx1O7CikKj3exAYbP96oZSuSnEbHA+k0HjiNQ7tiy4V EVXnQQ7o7Y1moD+SpBttezeh1TclLKbvNqkHJBqSM0kKZJ5l6hF3mS+yO38EWE1Jdl zewn1xmLfM3av+HhIt70jlQPWzfgRNxQfb1tuwVg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Denis V. Lunev" , Ilya Maximets , "David S. Miller" Subject: [PATCH 6.12 408/497] openvswitch: fix soft lockup in the netlink flow dump Date: Tue, 13 Oct 2026 13:39:35 +0200 Message-ID: <20261013112917.574775280@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112907.864180619@linuxfoundation.org> References: <20261013112907.864180619@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Denis V. Lunev commit aaaaf87ea99b8766c9a8aa0e71aa42e6bc8a5320 upstream. A production compute node carrying a few thousand datapath flows hit a soft lockup inside a single netlink flow dump and panicked. ovs_flow_cmd_dump() calls ovs_flow_stats_get() for every flow it emits, and that releases stats->lock with spin_unlock_bh() once per CPU that has touched the flow. Every release is a local_bh_enable(), and each one runs the pending softirq backlog in the dumping thread's own context. The skb bounds the flows one callback emits, but not the softirq work it absorbs. On a CPU that carries the box's packet load the backlog refills as fast as it drains, so the dumping thread becomes that CPU's softirq engine. It never sleeps and it has no reschedule point, so under voluntary preemption nothing can take the CPU away from it: neither the ksoftirqd the kernel woke to take the work over, nor the stopper thread the softlockup detector dispatches to refresh its timestamp. Hold BH off across the whole callback instead, the way ctnetlink_dump_table() does, so the nested spin_unlock_bh() stop draining softirqs. The loop already runs under rcu_read_lock() and cannot sleep. What it gives up is preemption under CONFIG_PREEMPT, since a BH-off region is not preemptible outside PREEMPT_RT. The region stays short: the skb caps the flows one callback emits, and empty buckets cost no skb space but are each visited once per dump, as the cursor only moves forward. The table grows on insert and shrinks only on flush, so the walk is bounded by the largest flow count the datapath has held. The softirq backlog the callback used to absorb has no bound at all. Fixes: 63e7959c4b9b ("openvswitch: Per NUMA node flow stats.") Cc: stable@vger.kernel.org Signed-off-by: Denis V. Lunev Reviewed-by: Ilya Maximets Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/openvswitch/datapath.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1499,6 +1499,12 @@ static int ovs_flow_cmd_dump(struct sk_b return -ENODEV; } + /* + * Not needed for safety. Stops every spin_unlock_bh() in + * ovs_flow_stats_get() from running the softirq backlog. + */ + local_bh_disable(); + ti = rcu_dereference(dp->table.ti); for (;;) { struct sw_flow *flow; @@ -1519,6 +1525,8 @@ static int ovs_flow_cmd_dump(struct sk_b cb->args[0] = bucket; cb->args[1] = obj; } + + local_bh_enable(); rcu_read_unlock(); return skb->len; }