Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp62159imm; Thu, 14 Jun 2018 15:23:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJmCjnVXGm63SFZJohV4MbEM1i2cfReVg83IwADZmbwqifzXCbb3JcOZs0kwTKGFkg6QfGv X-Received: by 2002:a17:902:b28:: with SMTP id 37-v6mr4876234plq.201.1529015030992; Thu, 14 Jun 2018 15:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529015030; cv=none; d=google.com; s=arc-20160816; b=N7+lzNQBNLL4K6Sut6sh2T3t3nMODtrzCYfiVbVUnAT31XaM91yg3g7vr1m3X7dCp5 vhO4485nq/vTpsa4sX0ZVCVaQLCsJ1KA4TQeuh3+bWNn5Pb2xzf2INXTRbVpo6OrNvai DCx4/wAWJgCKfTPhRGiiwFi4MlzGnflIPUEvilu97Et1QN5QNbas9xxLJc6DaG0wjQWv DmidhMLyrYY3F/spkXstDoHpr4AAy1S6f3iWrKfkcqNwsiMZWfzvvLvHyBdf00JDcmLC JpAKxYC12xwmGuHjF/wCGVtktN6tLeAp+GqrA2AM9f/2QFnA4LaGZTgkyhBtcRXqDoxa riNA== 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=f5mBZdlrnmDLu4M4BBkOjd40vk09jt/KM8VWqVLaOHU=; b=qubuFKLj36bOW6O5PvdwK7BqC5xCS84WDWQwsS9RDOPPB3tVEkyxpBij81yjIW4cap vUsTcvlEb8jdIUbCMVV1uPCLY5t1ICTtaYmWN2UK84mJrz0tAyOtdfI/8Q5h2NEbbJhJ Olvntna11ttjTMddUPCyuBxwJtsx+B6MtY6ZRcP6rH4PEt549SGkIbgRU4xxDm06Zvdi 9miPHeosFk2kIYYlWVDgw2kAZ9/Eqt+JBcAcSBTxOieyGwy/G3Z2SPAdizf7UY415jAP +N4N273Y6b6PPof6jYEwZz7vC3VwOiZeTdOC1eP5BYYI2EOUxVE3qDH6lEZnBTUIyTjF SXsA== 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 t9-v6si5374064pgn.559.2018.06.14.15.23.36; Thu, 14 Jun 2018 15:23:50 -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 S936126AbeFNWXN (ORCPT + 99 others); Thu, 14 Jun 2018 18:23:13 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936073AbeFNWXM (ORCPT ); Thu, 14 Jun 2018 18:23:12 -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 A497D40122A1; Thu, 14 Jun 2018 22:23:11 +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 87241201E8ED; Thu, 14 Jun 2018 22:23:11 +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 w5EMNBFU008525; Thu, 14 Jun 2018 18:23:11 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w5EMNB67008521; Thu, 14 Jun 2018 18:23:11 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Thu, 14 Jun 2018 18:23:11 -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: <20180613183145.17564d82@gandalf.local.home> Message-ID: References: <20180613183145.17564d82@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.5]); Thu, 14 Jun 2018 22:23:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 14 Jun 2018 22:23:11 +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 Wed, 13 Jun 2018, Steven Rostedt wrote: > On Wed, 13 Jun 2018 15:30:31 -0400 (EDT) > Mikulas Patocka wrote: > > > On Wed, 13 Jun 2018, Alan Stern wrote: > > > > > [Steve: Sorry for dumping you into the middle of this discussion. > > > Please see especially the last two paragraphs below. Mikulas is > > > getting dropouts with USB audio because part of the processing uses a > > > tasklet.] > > > > The problem is this: > > > > I have a single core machine with a usb2 sound card. When I increase the > > priority of a music player, the audio starts skipping. > > > > The reason for the skipping is that the ehci usb driver is offloading urb > > callbacks using tasklet_hi_schedule, the callbacks end up being offloaded > > to the ksoftirqd thread (that has priority 0), the music player with > > elevated priority preempts ksoftirqd and causes delays in the urb > > callbacks. > > > > Is this some deficiency in the softirq subsystem? (should we perhaps treat > > tasklet_hi specially and not offload it as much as the others?) Or should > > the ehci driver be fixed not to use tasklets? > > > > What we do for softirqs in the RT patch is to have whoever raised the > softirq run the softirq. If local_bh_disabled() is active (bh is > disabled) then a bit is set in the current task struct, where when > local_bh_enable() is called, it will then execute the softirqs that it > raised while bh was disabled. > > Perhaps try out the PREEMPT_RT patch and see if the problem goes away. I tried the realtime patch with CONFIG_PREEMPT_RT_FULL and it plays well. > Hopefully this softirq work may make it into the kernel soon. We could > even enabled it without full PREEMPT_RT. 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. Mikulas > https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.16/patch-4.16.12-rt5.patch.xz > > -- Steve >