From patchwork Tue May 9 19:56:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 91739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3143519vqo; Tue, 9 May 2023 13:13:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ48NouAB6vNGWJPUUUnI77KeIZ04ADobRsXu1+NpxxUPnus1CSQ4OeIdVSTsEvQlP80nLs2 X-Received: by 2002:a17:903:4d5:b0:1ac:aac1:e344 with SMTP id jm21-20020a17090304d500b001acaac1e344mr1892302plb.36.1683663197218; Tue, 09 May 2023 13:13:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683663197; cv=none; d=google.com; s=arc-20160816; b=DdcMk08gn5BZIj/tACUkLNDrvGVWBdXZfAlZtWhRNoNywWwQ4VDFXc2Q3dfqbBZ0eB oOwlM3fz4OsNiruME5dHQ9C+qoI7zdp8OvUoldJ2UebPGA34hiQwg+7/oXhQ0MR5ra2W KBXDfiwqeWL4cJcgqLMXCGxzJzZxMqO4xWwOLaNrtKpzTpDIm55w5xNs8tswGmEo3ARs tbVQ5W0hhUS35rjySGRTrcA5U7qvSlepOD/qJ/3FVzZd+EjQAOKwJIj0GWhupSvPBsYs V/7BQnjimG4QATKSOrX4uViF4FmHNR300lqKEqUeePFLWLC+GM7bCLPM3U8ZyGCcLmwG 6NuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=i/vEnI/WFdPHZGqXC/3G2/DQm+2OzEhIX3KzqGEKGV0=; b=RBbliM8gfqe1ZWjjSjgozvjs4pGZ8q3xHy39zojTS18ES4/V3AXEQ+K3BZBUHnAFnO udLvsZVOPYqEfSdEkBtRUWKD/W/siD+/N2XYi1kVwS+m5CchFTSI0wl7eg/IpPFl3iWV NW1fKE9hWBlT31aXs6ituI916a/QB22HDuhQSsVO85iiQaJVX3oG8qQ4q3MIwws70JrX 33NEEf1CgPVWZaHqXHu2E6YJfAdfXS1kpeGOzXksuLRZdexqH+e63TXY+yfqZVUtAac+ 1sqVtgmtAE/39EwFAlV6n48tIMqC2vU4E5ToFDlBGzFUoDTdfu8EXr1jVwuCkFGw7Hfs T1UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WWeCfinM; dkim=neutral (no key) header.i=@linutronix.de header.b=jkNrt+ob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a170903120700b001aae741abafsi2320097plh.440.2023.05.09.13.13.03; Tue, 09 May 2023 13:13:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WWeCfinM; dkim=neutral (no key) header.i=@linutronix.de header.b=jkNrt+ob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234047AbjEIT4W (ORCPT + 99 others); Tue, 9 May 2023 15:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229826AbjEIT4U (ORCPT ); Tue, 9 May 2023 15:56:20 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 282E43C0C; Tue, 9 May 2023 12:56:19 -0700 (PDT) Date: Tue, 09 May 2023 19:56:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683662177; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i/vEnI/WFdPHZGqXC/3G2/DQm+2OzEhIX3KzqGEKGV0=; b=WWeCfinM04pROlGUdsFazYzPo/sHmWF1rxTCgVX0XqZBRZKudUJeWlUvdD2l4I+sGpoEiO Xfu/U31CiC/2oI+o4ewfoLNO9UbhWURr82RMzVzyf0/xOvdk6c1XE14S0Ea92QD60Jap6f f14SGK/zw8KQ9A8IZF49QhIxMgRJ52mjJ7ZVsQrGSwmP2vhODHPyTe9N4UUGi8ik2CKrQ4 Fr9X6lIBug1URhSCG8YQ1SN8dL1ySTICcuJQQfzmvp4ZGIiiiU5+9OvlYMwxJieUzxWAt8 qbiRSFc41hu7z6D6XuGG9DAD5lf1KDTtiZC1OhpZzVrhdsNKBbFBrCAGc8CyCg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683662177; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i/vEnI/WFdPHZGqXC/3G2/DQm+2OzEhIX3KzqGEKGV0=; b=jkNrt+obk5uJZpjgeqWqBfdwhbBGIEuDQRMWAK0+7IOWxkrQSxWaupXqOkUlxULv+fhH/C TBkW2+utiV1lUWDg== From: "tip-bot2 for Paolo Abeni" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] Revert "softirq: Let ksoftirqd do its job" Cc: Paolo Abeni , Thomas Gleixner , Jason Xing , Jakub Kicinski , Eric Dumazet , Sebastian Andrzej Siewior , "Paul E. McKenney" , Peter Zijlstra , netdev@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <305d7742212cbe98621b16be782b0562f1012cb6.camel@redhat.com> References: <305d7742212cbe98621b16be782b0562f1012cb6.camel@redhat.com> MIME-Version: 1.0 Message-ID: <168366217649.404.15332707412932478981.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765448820885525613?= X-GMAIL-MSGID: =?utf-8?q?1765448820885525613?= The following commit has been merged into the irq/core branch of tip: Commit-ID: d15121be7485655129101f3960ae6add40204463 Gitweb: https://git.kernel.org/tip/d15121be7485655129101f3960ae6add40204463 Author: Paolo Abeni AuthorDate: Mon, 08 May 2023 08:17:44 +02:00 Committer: Thomas Gleixner CommitterDate: Tue, 09 May 2023 21:50:27 +02:00 Revert "softirq: Let ksoftirqd do its job" This reverts the following commits: 4cd13c21b207 ("softirq: Let ksoftirqd do its job") 3c53776e29f8 ("Mark HI and TASKLET softirq synchronous") 1342d8080f61 ("softirq: Don't skip softirq execution when softirq thread is parking") in a single change to avoid known bad intermediate states introduced by a patch series reverting them individually. Due to the mentioned commit, when the ksoftirqd threads take charge of softirq processing, the system can experience high latencies. In the past a few workarounds have been implemented for specific side-effects of the initial ksoftirqd enforcement commit: commit 1ff688209e2e ("watchdog: core: make sure the watchdog_worker is not deferred") commit 8d5755b3f77b ("watchdog: softdog: fire watchdog even if softirqs do not get to run") commit 217f69743681 ("net: busy-poll: allow preemption in sk_busy_loop()") commit 3c53776e29f8 ("Mark HI and TASKLET softirq synchronous") But the latency problem still exists in real-life workloads, see the link below. The reverted commit intended to solve a live-lock scenario that can now be addressed with the NAPI threaded mode, introduced with commit 29863d41bb6e ("net: implement threaded-able napi poll loop support"), which is nowadays in a pretty stable status. While a complete solution to put softirq processing under nice resource control would be preferable, that has proven to be a very hard task. In the short term, remove the main pain point, and also simplify a bit the current softirq implementation. Signed-off-by: Paolo Abeni Signed-off-by: Thomas Gleixner Tested-by: Jason Xing Reviewed-by: Jakub Kicinski Reviewed-by: Eric Dumazet Reviewed-by: Sebastian Andrzej Siewior Cc: "Paul E. McKenney" Cc: Peter Zijlstra Cc: netdev@vger.kernel.org Link: https://lore.kernel.org/netdev/305d7742212cbe98621b16be782b0562f1012cb6.camel@redhat.com Link: https://lore.kernel.org/r/57e66b364f1b6f09c9bc0316742c3b14f4ce83bd.1683526542.git.pabeni@redhat.com --- kernel/softirq.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/kernel/softirq.c b/kernel/softirq.c index 1b72551..807b34c 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -80,21 +80,6 @@ static void wakeup_softirqd(void) wake_up_process(tsk); } -/* - * If ksoftirqd is scheduled, we do not want to process pending softirqs - * right now. Let ksoftirqd handle this at its own rate, to get fairness, - * unless we're doing some of the synchronous softirqs. - */ -#define SOFTIRQ_NOW_MASK ((1 << HI_SOFTIRQ) | (1 << TASKLET_SOFTIRQ)) -static bool ksoftirqd_running(unsigned long pending) -{ - struct task_struct *tsk = __this_cpu_read(ksoftirqd); - - if (pending & SOFTIRQ_NOW_MASK) - return false; - return tsk && task_is_running(tsk) && !__kthread_should_park(tsk); -} - #ifdef CONFIG_TRACE_IRQFLAGS DEFINE_PER_CPU(int, hardirqs_enabled); DEFINE_PER_CPU(int, hardirq_context); @@ -236,7 +221,7 @@ void __local_bh_enable_ip(unsigned long ip, unsigned int cnt) goto out; pending = local_softirq_pending(); - if (!pending || ksoftirqd_running(pending)) + if (!pending) goto out; /* @@ -432,9 +417,6 @@ static inline bool should_wake_ksoftirqd(void) static inline void invoke_softirq(void) { - if (ksoftirqd_running(local_softirq_pending())) - return; - if (!force_irqthreads() || !__this_cpu_read(ksoftirqd)) { #ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK /* @@ -468,7 +450,7 @@ asmlinkage __visible void do_softirq(void) pending = local_softirq_pending(); - if (pending && !ksoftirqd_running(pending)) + if (pending) do_softirq_own_stack(); local_irq_restore(flags);