Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp744020rwd; Tue, 16 May 2023 07:15:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5PzcTlhlqGWWkFLXCfWbkdqhQQZ3ZHYBYlMSGPUNF1Vlzk8Yie/2VxmS4CmSqIQqg2Oveu X-Received: by 2002:a05:6a00:2401:b0:63b:5501:6795 with SMTP id z1-20020a056a00240100b0063b55016795mr49456600pfh.24.1684246506300; Tue, 16 May 2023 07:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684246506; cv=none; d=google.com; s=arc-20160816; b=Fi7Iq7I94mPNpt+/Dvs3m/mrpeacNO88FtjZ0cLxKd59f1Ep0Tntwgk0pIB7rQ6m64 SKyzzEsnA6FExJFyQASmvcDzncChm0lf6v2gYefyLvMy+mLdWDt8Jao8471ZBUtBJlhy m0COws4C31gWj0UvwQSg8nO5Tx3nyUOi2o+uRaLL7Fmadsq3TDVR66kczgwFfuTo3T8A PMvbGpKVKBzy38UcmsrFX7IvRZJkC2Juu51cvGLwWDV5DVz3g9BBzw4MjE2Mqxuk7r0I qucDHY9ylrpoqEzmRdmYlI4gzVwlkC/p+jj2szpjFe5bWIF1B4BO8HbOm8alKh/zISIT Yy4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=p2kJoaiY6sFc2XexA1NSIp8tkp+KMAr9FWBhMM10K8M=; b=HadS3weyXQVTRjbsirDLptRLC190Ur7t+uKpYbEMxRYzxWGWORLshe7W3gUOqyopD2 soWGYtpQAXVEmVmuQSs27OKt8P1GacVGwu1AkjBQeNWImY0Je2FuUXf2y0IrwbkkQZ9r SaafcefGl/MTczF1O6WQbUC2TaL1+i0/Gb+/sT11RgVl31TH4rEjIOI939xvPA3jaHl2 7dv+aE4J3NRr/fHPbAqSq/S3ZxIOB/qLgiLgYMi+f1x72nFw+OjGUC8FT1P56HPRssBZ PYLkKnug5eA1pwwWVD1FpQZMkAn+h89iOW/DUc+7EA1HODQSwl49UbgzG/ngvrzJtqdh KLMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=riLXV+N5; dkim=neutral (no key) header.i=@linutronix.de; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v68-20020a626147000000b006495af75ac6si13136275pfb.86.2023.05.16.07.14.52; Tue, 16 May 2023 07:15:06 -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=riLXV+N5; dkim=neutral (no key) header.i=@linutronix.de; 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 S233867AbjEPOLi (ORCPT + 99 others); Tue, 16 May 2023 10:11:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233858AbjEPOLh (ORCPT ); Tue, 16 May 2023 10:11:37 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1E99525D; Tue, 16 May 2023 07:11:34 -0700 (PDT) Date: Tue, 16 May 2023 16:11:31 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684246292; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=p2kJoaiY6sFc2XexA1NSIp8tkp+KMAr9FWBhMM10K8M=; b=riLXV+N5V8BdO+sfICU58zzviuCKe9WJxAYet3PjRWtiPOwFtgliU3sHxUi6l3baLUDeQA d2VLsy7KtIBhvNWVKC6KeYkpY1ApsJvTS49MTG3ler7Bcl/5uxUwZsXOlCSCbZdBwtXsYJ we3NjLMA59WE5KLa2Sj6G6vNMDt8DEfJH22mqdT239W8G+cmmBpeKhkppny1ol55kILooa M1m6NbgnsAjROIDn3M92M3fU3Ue2wKS+f2ht+lgTaGnowZ7TVuHwY6u/IUI2Zf/8vJUyyG 5N06JKGdvT0wg613LkTa/3qHQjSnq8LAPKPyowbyqMeX2mYIBGE3PVojvwP9bw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684246292; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=p2kJoaiY6sFc2XexA1NSIp8tkp+KMAr9FWBhMM10K8M=; b=GsSf85KlemRQc6no2AW5TCBPerki9GVIsRc+w9rsP2YAjhc78yfxiGKJXD8NJVD9LCL9Ev FziApyZgVfUG2cAg== From: Sebastian Andrzej Siewior To: Valentin Schneider Cc: Thomas Gleixner , LKML , linux-rt-users@vger.kernel.org, Steven Rostedt , Juri Lelli Subject: Re: [ANNOUNCE] v6.3.1-rt13 Message-ID: <20230516141131.fScCnP3q@linutronix.de> References: <20230509164640.-aaZNrjH@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 On 2023-05-10 12:37:42 [+0100], Valentin Schneider wrote: > The ktimersd threads solved some priority inversion problem we were seeing, > IIRC it looked something like so: > - GP kthread is waiting on swait_event_idle_timeout_exclusive(...) > - p0 (CFS NICE0) did spin_lock(L) then got throttled by CFS bandwidth > - p1 (CFS NICE0) did local_bh_disable() + did spin_lock(L) > > So p0 owns L, but cannot get bandwidth replenished since local softirqs are > disabled, and the GP kthread can't be woken up by timeout to initiate > boosting either. > > Even if ksoftirqd has its priority tuned to ensure timers can be expired, > the above never wakes ksoftirqd due to: > > static inline bool should_wake_ksoftirqd(void) > { > return !this_cpu_read(softirq_ctrl.cnt); > } > > on the other hand, ktimersd are woken up unconditionally, so in this > scenario it gets to run and donate its priority via > > ksoftirqd_run_begin() > `\ > local_lock(&softirq_ctrl.lock) > > (note that this only solves the CFS bandwidth issue if ktimersd are FIFO or > above, but they are spawned as FIFO1) > > > TL;DR: for RT, I think we should also kill should_wake_ksoftirqd() If I remember correctly this check was to avoid waking ksoftirqd because softirqs are already handled. In this case the systems stalls until p0/1 makes some progress. Waking ksoftirqd makes sense if its scheduling policy is elevated. Now we need overloading strategy since the current idea is to solve it by moving everything to ksoftirqd and letting it run at SCHED_OTHER. Sebastian