From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.108.3.165 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795758046; b=l9UWiB/fuHuLFWvuWhCz/5qcrl3W67S1wfYKPtN3XJQjv3uUk4IbPf+Ht7Vs2L2oNkVr K8DXCgJ+C1zX+5Nqb8cakQzA0GjOgTv91Qy3NMGA/n4C5MbyNY84xz0GXakISiTPBPlKN AAQ7pkUBphqbd/zBld316CGaQg15zS5jaq5TtkA9fUTfxdxTko38HgAJIV1tC3RMnwbRV 4Lg+Ijk+y2RbHfIyQkyL4umXKjASlyCz72o7Si14syCqQrldJ9fJwPXbk+gdBIkW9Nd+r wwtMYkmAwrSVh9adhe1WmDPqixVO9552pTxRQ48fBbABK57/eF9ZljViF+vZh/JTpDw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795758046; h=DMARC-Filter:DKIM-Signature:X-SMAIL-HELO:Received:X-Sender:X-Auth-ID: X-SMAIL-MID:X-SMAIL-UIID:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=N+SGFIhOxjJHVtpPUhttF/00IVXwVUg4xCVzfn3t13U=; b=Z7SjZgRlbNxikWvu7IniOwp4BUYsUSU9+mHWm+8xxR6sI89UF1VD1ekuVs7bXCYCEzQo E8V32Q6syjhYphApI1IvZywIYO80GFTX6vm74BzIQ4qvSKEvx4FJGAOqyZ1gdHoBuP676 4HZx9mLfNF/jgA7GOrRpI4YMHflHp81vc7lnSFtx53r70INc8+CfuD4AtLuY5QUftKTG8 TEK4s3rAO8JJa3aSa7zYRTI9zlwdLCV4XtDs1Vy6WSZo1IoCMCASrlmGTnlQi8dc+akTe arsKSURhF2Y6PtrGUPks6Mpe5udAdPBsNWXu4Jql8KB1X8DtiesjjU3XKAO3xQpPAvA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=sina.com; spf=pass smtp.mailfrom=sina.com; dkim=pass header.d=sina.com header.i=@sina.com header.a=rsa-sha256 header.s=201208 header.b=b92HE7ju; arc=none smtp.remote-ip=202.108.3.165 Received: from mail3-165.sinamail.sina.com.cn (mail3-165.sinamail.sina.com.cn [202.108.3.165]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00F2D606A31C for ; Fri, 27 Nov 2026 05:40:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 00F2D606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=sina.com header.i=@sina.com header.a=rsa-sha256 header.s=201208 header.b=b92HE7ju DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1795758044; bh=N+SGFIhOxjJHVtpPUhttF/00IVXwVUg4xCVzfn3t13U=; h=From:Subject:Date:Message-ID; b=b92HE7ju5Dhq8X3y4HEg8nNsRhoTYzakfsYYwg6mUcraLf/ssJKd8gm4HbA5ylJ96 yyRnlWjdH8SyaeZbg2Cs2hPqUdkghd+gYcN3Isi8dVb5h6rrWFlwFX+f1FAYAdRchK CTAVDoT2jLykyQ+J1DckwZEANeaiUk7ia2xPC1QY= X-SMAIL-HELO: lxu-pcd Received: from unknown (HELO lxu-pcd)([111.198.225.163]) by sina.com (10.54.253.33) with ESMTP id 6B0917D000003A34; Fri, 27 Nov 2026 13:40:35 +0800 (CST) X-Sender: eadavis@sina.com X-Auth-ID: eadavis@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=eadavis@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=eadavis@sina.com X-SMAIL-MID: 130876685376 X-SMAIL-UIID: 520914DA7489484CBD27AD0D49FC6AA1-20261127-134035-1 From: Edward Adam Davis To: eadavis@sina.com Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org, syzbot+97fde463a8ffb9e839d2@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com, tj@kernel.org Subject: [PATCH next v2] workqueue: Avoid noise generated by userspace realtime tasks Date: Fri, 27 Nov 2026 13:40:31 +0800 Message-ID: <20261127054032.56845-1-eadavis@sina.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261126102530.37205-1-eadavis@sina.com> References: <20261126102530.37205-1-eadavis@sina.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A user creates a SCHED_FIFO real-time thread and pins it to CPU0, and arm watchdog timer on CPU1 with 3s threshold. The real-time thread runs for an extended period without voluntarily yielding the CPU, preventing standard kworker threads on CPU0 from gaining access to the processor. As a result, certain kernel works cannot be executed in a timely manner, which may even trigger a watchdog report: BUG: workqueue lockup - pool cpus=0 node=0 flags=0x0 nice=0 stuck for 5s! Showing busy workqueues and worker pools: workqueue mm_percpu_wq: flags=0x108 pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2 pending: vmstat_update To address this, a check for CPU-bound tasks has been added to the work pool; this helps prevent false-positive reports caused by prolonged CPU occupancy by real-time tasks. Fixes: 82607adcf9cd ("workqueue: implement lockup detector") Reported-by: syzbot+97fde463a8ffb9e839d2@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=97fde463a8ffb9e839d2 Signed-off-by: Edward Adam Davis --- v1 -> v2: 1. update subject 2. use cpu_curr_snapshot_rcu() to get stall cpu's current task 3. Exclude cases where tasks running on a stalled CPU are kernel threads 4. not for RT kernel kernel/workqueue.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index baadc7815585..9bd9cccdf3cf 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -8287,6 +8287,23 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) if (!time_after(now, ts + thresh)) continue; + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) { + struct task_struct *p; + unsigned int policy; + int cpu; + + cpu = pool->cpu; + if (cpu >= 0 && !(pool->flags & POOL_DISASSOCIATED)) { + guard(rcu)(); + p = cpu_curr_snapshot_rcu(cpu); + if (p && !(p->flags & PF_KTHREAD)) { + policy = READ_ONCE(p->policy); + if (policy == SCHED_FIFO || + policy == SCHED_RR) + continue; + } + } + } lockup_detected = true; stall_time = jiffies_to_msecs(now - pool_ts) / 1000; max_stall_time = max(max_stall_time, stall_time); -- 2.43.0