From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 276E939B4B7 for ; Thu, 5 Mar 2026 17:00:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772730047; cv=none; b=tSvCn1hfKNr28cVNB5PedHG+zl7trK3hlUQlYfiF0KdO70JideTdWJ5Y5M4rGqcNxYo6g0sa7crGhNqN7xblYfq947GoAN9GcYyWW3LW4xypozEJ5tTbvKzO6vNLNywCFDUVuisaDlXx8RJhE/A+PJbJHMWNoAI+IPRcUIsfg5g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772730047; c=relaxed/simple; bh=Fsjpz7mico7djIZXnNouPz2+U4fJlm5g8oYpHNpANlo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=NOr5JRrkZovdRRPxvmUybexkND2ZFt9gGFDYiP3AuoSUDyDnv77ClUsIYa7mzAzI4hMt2Vi5bAUyrboAsgdK2OSYSL3Ic6/DG4R4X8KE8eNiIZ3cBldaN9hq5TcFufBMEiufg8mfG+OUeTmJHW0pyPuFzwM31E+Y9Wnctj8jGh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=TCiPYZGw; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="TCiPYZGw" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772730038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=V9oQAaduJt8pxLeHVbi8GY9sJfDXNBsxqdEawOwAQeo=; b=TCiPYZGwLOuCjz4LIakBQ8pKLh0tPupPJnevDfjRInuW21te9Af0NxLjMNHXsJMaHz3fmU 54xkpRhprS+JYIWnqY2W+aFeFjRFJpLIEVBrG32FxdgESR3w9kiJo6edJiHVailJqr8rt0 Y1KClEcK2FMfaqZpoUtseiP3PRVNKnw= From: wen.yang@linux.dev To: Thomas Gleixner , Ingo Molnar Cc: linux-kernel@vger.kernel.org, Wen Yang Subject: [PATCH] softirq: add detail info to WARN in do_softirq_post_smp_call_flush() Date: Fri, 6 Mar 2026 01:00:08 +0800 Message-Id: <20260305170008.26261-1-wen.yang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Wen Yang When the following WARNING occasionally occurs during the idle path, the bare WARN_ON_ONCE() provides no context about what actually changed in the softirq pending mask, making it hard to diagnose the root cause: WARNING: CPU: 1 PID: 0 at kernel/softirq.c:297 do_softirq_post_smp_call_flush+0xbc/0xc4 Call trace: do_softirq_post_smp_call_flush+0xbc/0xc4 flush_smp_call_function_queue+0x98/0xcc do_idle+0x110/0x15c cpu_startup_entry+0x3c/0x44 secondary_start_kernel+0x138/0x13c __secondary_switched+0xb0/0xb4 Replace WARN_ON_ONCE() with WARN_ONCE() to print the before and after values of the softirq pending mask. This allows us to identify exactly which softirq bit was raised unexpectedly during flush_smp_call_function_queue, and determine whether it is causing preemption delays. Signed-off-by: Wen Yang --- kernel/softirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/softirq.c b/kernel/softirq.c index 5f435c1e48d8..45f9647df5eb 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -356,7 +356,9 @@ void do_softirq_post_smp_call_flush(unsigned int was_pending) unsigned int is_pending = local_softirq_pending(); if (unlikely(was_pending != is_pending)) { - WARN_ON_ONCE(was_pending != (is_pending & ~SCHED_SOFTIRQ_MASK)); + WARN_ONCE(was_pending != (is_pending & ~SCHED_SOFTIRQ_MASK), + "Sirq mask changed(#%x -> #%x) may delay preemption.", + was_pending, is_pending); invoke_softirq(); } } -- 2.25.1