Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1009483imm; Fri, 15 Jun 2018 09:41:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ5xYm5Yrqnc5bdnoqqA/FEmFjKIg7/CymhNYforZ9pO3WXRTAU4W3d+0YKG0eaDwvbOH1a X-Received: by 2002:a62:1747:: with SMTP id 68-v6mr2730417pfx.69.1529080906762; Fri, 15 Jun 2018 09:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529080906; cv=none; d=google.com; s=arc-20160816; b=aGZ7vA0StPuNEZgbcQyP9b49fA0MgXKbTHK0hOUXc8Nqq3wtV/nqvFMlZ1Ka8G9TVa h7N3dZWRk81NOkODmbC88TzfsNcarh/SSznoJPPvoehJJyXyjODUij0xlCYQ7IQWbFw8 Xc2WpRkEAceB6ylRvOV2hi+xwnpGD6Cu5b2PmLegxd+p7PBBuUKPUkBC18ptqbFKR11n E/htcZE098WeKo+SU4Jegodhx/cnfKCJ1pDUN6VOk9noa8FRCUKjxclICOqizorQc+Sf R/4XnDslRaDlqzvF0/0Q04XZYc3oCxUvmMYVOuyiCGQmdQfZagakKrm5iU0s1Js/INZr K3Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=JIPjn1oi0IiJyUaR816rq6yrN0e24+1G7o1GQU+xJ0M=; b=IOt9tSpr4Hmx7NIe/5JCddHO+P1JoTo0eSMvNsYs6gwL4r/0sY2ICLaIw3haf+2wGM bxLnVPi86eTqrs8Gh2hpWWZ64kN4F1VlmZ+Gl0oNaV8XUA6maAJ/kLXc26rBsCD1k9W/ 01X10d9LLIHyTl3c4uaCIlxJwhzWTZ6vS+4HBre7rEB4I1E6t4ZuBfeC1vdDRCiGUFYI PjhT+Qpj2UGDr6+2uBJCWxY0z2fJLZ2DCCPipoJ+YVCG8LEtsp8R7DVyFNwSOT51l1xK J0Ue+BnVDkdjfWUQWxabRdyTr1W8sXirg5ELRXnU5oocB2cgQw4+8RpQM20LzBPuYvoe 9dSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6-v6si8234583pfj.338.2018.06.15.09.41.32; Fri, 15 Jun 2018 09:41:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966116AbeFOQlM (ORCPT + 99 others); Fri, 15 Jun 2018 12:41:12 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36658 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964992AbeFOQlL (ORCPT ); Fri, 15 Jun 2018 12:41:11 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA80C7D858; Fri, 15 Jun 2018 16:41:10 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87B5920284D6; Fri, 15 Jun 2018 16:41:10 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id w5FGfAYl008755; Fri, 15 Jun 2018 12:41:10 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w5FGfAOO008751; Fri, 15 Jun 2018 12:41:10 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 15 Jun 2018 12:41:10 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Steven Rostedt cc: Alan Stern , Thomas Gleixner , Ming Lei , Greg Kroah-Hartman , USB list , Kernel development list Subject: Re: [PATCH] usb: don't offload isochronous urb completions to ksoftirq In-Reply-To: <20180614183546.7e04024c@gandalf.local.home> Message-ID: References: <20180613183145.17564d82@gandalf.local.home> <20180614183546.7e04024c@gandalf.local.home> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 15 Jun 2018 16:41:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 15 Jun 2018 16:41:10 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mpatocka@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 14 Jun 2018, Steven Rostedt wrote: > On Thu, 14 Jun 2018 18:23:11 -0400 (EDT) > Mikulas Patocka wrote: > > > I don't think it's so easy. The kernel 2.4 and below did this. And the > > problem was that if there's a storm of network packets, the softirq code > > would cause lockup of the whole machine. In order to not lockup the > > machine - somewhere in the 2.4 cycle - the ksoftirqd thread was > > introduced. > > > > If you have CONFIG_PREEMPT_RT_FULL and you call softirqs in the interrupt > > thread, you could only stall the interrupt thread. If you do the same > > thing without CONFIG_PREEMPT_RT_FULL, you stall the whole CPU. > > > > Note, PREEMPT_RT also uses ksoftirqd too. Although we may set it to RT > prio 1. It is triggered if the softirq itself raises a softirq of the > same kind, and then the work is passed off to the ksoftirqd. I think the major problem (in the upstream kernel) with softirq latency is this: static inline void invoke_softirq(void) { if (ksoftirqd_running()) return; It means that if any piece of code kicks ksoftirq, no tasklets are processed in the irq context at all. So, the ehci callbacks will be offloaded to ksoftirqd (no matter how small they are) and this causes audio skipping. Could this be changed, so that it processes tasklets submitted with "tasklet_hi_schedule" in irq context even if ksoftirqd is running? It's not easy - __do_softirq lacks any locking - so it can't run concurrently in process context and in irq context. > Causing the interrupt thread to stall (or by going into a loop of > softirqs) is likely to lock up the CPU on RT too, as interrupt threads > are usually run at priority 50, which will keep normal threads from > running on that CPU. > > -- Steve BTW. when I subject the machine to a ping flood (ping -f), the non-realtime kernel (with the patch to avoid offloading ehci urb callbacks) performs better than the real-time kernel. With the real-time kernel, all the networking work is done in the thread "irq/12-eth0", that has (by default) priority -51, it consumes 30% CPU time and causes sound skipping. I can avoid the skipping by lowering the priority of "irq/12-eth0". With non-realtime kernel, no such problem during ping flood exists. Mikulas