Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp805276rwb; Wed, 28 Sep 2022 09:17:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bsYlRuE8rku42c5v6BXIq5D2Toex/dqKKHj8Br9oKepZrIQmADygg9b81JekNJh1hRRcL X-Received: by 2002:a17:906:dac9:b0:780:ab6f:591f with SMTP id xi9-20020a170906dac900b00780ab6f591fmr28168309ejb.77.1664381826865; Wed, 28 Sep 2022 09:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664381826; cv=none; d=google.com; s=arc-20160816; b=MI+rESC9Ea1T18fkJADP9U4Ii5znhmHsvDfEWafzmrPdGwCNqumJoknntTv1Smx/dg P19kIGthOSUW/s/sGE1Ml+b+p5ejtlWG7Xz2NFbQab8/umiRURmjWOVQAHrxq2P9E0WF TjARvKFGY9sCv9r99TgsO8oRE3D7Iyut/Y46Y41dN3g7p6GxvdVTePMia+MtbhlHrGdK 4eLu9xHoyxC7cxBuw/A0BO8tObUhun4/RkKiF5w1KNBNk28ulHN04VJLbJ+XwFLmtHrP 6FW1Pdh+yqC+w7sWHNz6ehXcyKI2/vHLAhrlLOZtmsVvdBWRL0Pp8/Rpo3Ae7BAEOjDS NMmw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=u3hQlRISjMMHWol9t8o6CSBJ3EiI81ZKlzHJpSf0TeI=; b=pe2XShgE2n0QK2RyCwKoG3dzEVQknIQ2W7Xqhp/8nbKq0nI0+YhhHlNIBGL6RJ3aEQ B1XZknSq+1d8KtLQOrrSN/XXjzJKoaDIpqe1J/gfBjdkueVRx8/yIrqzol+6IxOBIY2E vmifuos3xg2lMV7igfxTTD8KvXp8BVWvGNYWGbQPCuHu4fP8AR6gy+e56YIn5b0QB7I7 IgaZGWPDtS0CtW6fEVfZwfKhSBzZFz2wgETDLzEj3izLz9WHljX9MwdIKM3+mtKJVN/s OmC4lnckBoluhoyVA7iy72fv2JDVrGuK/darVo/UnUxm4f3BjKLQrXbqZ5ISk7oveB6W 7VuA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a0564021f0e00b00445f660de5asi4982499edb.141.2022.09.28.09.16.40; Wed, 28 Sep 2022 09:17: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234258AbiI1P5b (ORCPT + 99 others); Wed, 28 Sep 2022 11:57:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbiI1P5G (ORCPT ); Wed, 28 Sep 2022 11:57:06 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 852A2E10AB for ; Wed, 28 Sep 2022 08:56:23 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A00C81063; Wed, 28 Sep 2022 08:56:29 -0700 (PDT) Received: from wubuntu (unknown [10.57.34.4]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 796763F73D; Wed, 28 Sep 2022 08:56:20 -0700 (PDT) Date: Wed, 28 Sep 2022 16:56:18 +0100 From: Qais Yousef To: David Laight Cc: John Stultz , LKML , John Dias , Connor O'Brien , Rick Yiu , John Kacur , Chris Redpath , Abhijeet Dharmapurikar , Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Thomas Gleixner , Heiko Carstens , Vasily Gorbik , "kernel-team@android.com" Subject: Re: [RFC][PATCH v3 0/3] Softirq -rt Optimizations Message-ID: <20220928155618.ylyns4x4tog34zui@wubuntu> References: <20220921012550.3288570-1-jstultz@google.com> <20220928130043.d6ijyxbq43tfvqg7@wubuntu> <529cd76702b44678a4d4abe539105942@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <529cd76702b44678a4d4abe539105942@AcuMS.aculab.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 09/28/22 13:51, David Laight wrote: > From: Qais Yousef > > Sent: 28 September 2022 14:01 > > > > Hi John > > > > On 09/21/22 01:25, John Stultz wrote: > > > Hey all, > > > > > > This series is a set of patches that optimize scheduler decisions around > > > realtime tasks and softirqs. This series is a rebased and reworked set > > > of changes that have been shipping on Android devices for a number of > > > years, originally created to resolve audio glitches seen on devices > > > caused by softirqs for network or storage drivers. > > > > > > Long running softirqs cause issues because they aren’t currently taken > > > into account when a realtime task is woken up, but they will delay > > > realtime tasks from running if the realtime tasks are placed on a cpu > > > currently running a softirq. > > > > Thanks a lot for sending this series. I've raised this problem in various > > venues in the past, but it seems it is hard to do something better than what > > you propose here. > > > > Borrowing some behaviours from PREEMPT_RT (like threadedirqs) won't cut it > > outside PREEMPT_RT AFAIU. > > > > Peter did suggest an alternative at one point in the past to be more aggressive > > in limiting softirqs [1] but I never managed to find the time to verify it > > - especially its impact on network throughput as this seems to be the tricky > > trade-of (and tricky thing to verify for me at least). I'm not sure if BLOCK > > softirqs are as sensitive. > > I've had issues with the opposite problem. > Long running RT tasks stopping the softint code running. > > If an RT task is running, the softint will run in the context of the > RT task - so has priority over it. > If the RT task isn't running the softint stops the RT task being scheduled. > This is really just the same. > > If the softint defers back to thread context it won't be scheduled > until any RT task finishes. This is the opposite priority. If we can get a subset of threadedirqs (call it threadedsoftirqs) from PREEMPT_RT where softirqs can be converted into RT kthreads, that'll alleviate both sides of the problem IMO. But last I checked with Thomas this won't be possible. But things might have changed since then.. > > IIRC there is another strange case where the RT thread has been woken > but isn't yet running - can't remember the exact details. > > I can (mostly) handle the RT task being delayed (there are a lot of RT > threads sharing the work) but it is paramount that the ethernet receive > code actually runs - I can't afford to drop packets (they contain audio > the RT threads are processing). > > In my case threaded NAPI (mostly) fixes it - provided the NAPI thread are RT. There's a netdev_budget and netdev_bugdet_usecs params in procfs that control how long the NET_RX spends in the softirq. Maybe you need to tweak those too. In your case, you probably want to increase the budget. Note that in Android the BLOCK layer seems to cause similar problems which don't have these NET facilities. So NET is only one side of the problem. Thanks -- Qais Yousef