Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5701666imm; Tue, 12 Jun 2018 11:51:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJq8IEoHYHenTyz+WA2xpk1Jgeu8B1vIrRwKwFV3ipjvB+MgUZmZwF91UEn3eYV0J5Yw5Ma X-Received: by 2002:a62:211a:: with SMTP id h26-v6mr1610481pfh.133.1528829518613; Tue, 12 Jun 2018 11:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528829518; cv=none; d=google.com; s=arc-20160816; b=Wkl7KFg1YMHC5diHUFZXcuPubPObpadqtd2wZbFF3PN5T+80if8STTSvy8UwoY12Q5 qjfOOEB8C2o/pNkMm6KGWLmS42hRz7ah4jKo/xg1aMn8YN9Fzsw9kfHujiOZ2blNZk8W 0wXViy8a6rTIWZuNJO2yZfd7E6r7Dzs1VFw/IEq8A3/o6/p/jXRzPEZSuLCP491AsJxb 8hAG5eIsDzNbwJLJUfQZLu+R4BE4RQzhUM0xn+th/R8jiWwC7d1kEHCJTC2bIMCSa1C7 WIds1xLAyw0h6vWNx8/2dgCzfY7zmnFJZx03roVL5rLQ5kRZppaCW5cseteTNhjgONHE ot/A== 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=RChPpO371Oit6OApr//IHnuZKlTtDCyXbSgsCbSgSYQ=; b=C8BlJklxC8GaUqpcpc1w8J3GwDjlVfVMKSEeHkNJ41s5NJ95j+X5jKIuhDqhNL6OUr djgCXJnZj2NYcpZjVDovuBm6mM1mHoYK9ZtRclav/7v3mTcbzdx5bbXElAqntKpgFz3m /NQPx3adeHR1/e7Whi76kWNHye1Vf+jkEOS8s/S/Z6iCAu/6KeXCDXtYFaLXE1nRnMk9 4sKbCVk9FLo2k+KA+ueoJFP5PzHwjeQ4LftwRiIcUK/REVE4I/RrXY4YEaW9WNlcsgKt GPTMOHfEqrkWebv6la6UHCsKzVm6422JKKvQOudiS7UJLUzX3+ENsMcTnEDqYd3SQc7Q KQEg== 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 n6-v6si584636pga.622.2018.06.12.11.51.44; Tue, 12 Jun 2018 11:51:58 -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 S933419AbeFLSuf (ORCPT + 99 others); Tue, 12 Jun 2018 14:50:35 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54990 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932343AbeFLSuc (ORCPT ); Tue, 12 Jun 2018 14:50:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C3C787A73; Tue, 12 Jun 2018 18:50:32 +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 F24EC111CA18; Tue, 12 Jun 2018 18:50:29 +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 w5CIoTNw028373; Tue, 12 Jun 2018 14:50:29 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w5CIoTL4028369; Tue, 12 Jun 2018 14:50:29 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Tue, 12 Jun 2018 14:50:29 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Greg Kroah-Hartman cc: Alan Stern , Ming Lei , USB list , Kernel development list Subject: Re: [PATCH] usb: don't offload isochronous urb completions to ksoftirq In-Reply-To: <20180612175242.GA12855@kroah.com> Message-ID: References: <20180612175242.GA12855@kroah.com> 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.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 12 Jun 2018 18:50:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 12 Jun 2018 18:50:32 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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 Tue, 12 Jun 2018, Greg Kroah-Hartman wrote: > On Tue, Jun 12, 2018 at 01:19:28PM -0400, Mikulas Patocka wrote: > > > > > > On Tue, 12 Jun 2018, Alan Stern wrote: > > > > > On Tue, 12 Jun 2018, Mikulas Patocka wrote: > > > > > > > > How about making the softirq thread's priority adjustable? > > > > > > > > But you would have to argue with softirq maintainers about it - and you > > > > say that you don't have time for that. > > > > > > But maybe _you_ do... > > > > ksoftirqd has priority 0 - it is not suitable for real-time tasks, such as > > audio. > > > > In my opinion, it is much easier to fix this in the ehci driver (by not > > offloading isochronous completions), than to design a new > > real-time-capable ksoftirqd. > > Ok, but what happens when you plug your device into a xhci controller? > Do we also need to change that? Only touching a specific host > controller is not good, you will be playing "whack a mole" for forever. xhci doesn't set the HCD_BH flag, so it doesn't offload callbacks to softirq and doesn't suffer from this problem. Neither ohci and uhci do. > Isoc packets are, by definition, not supposed to be guaranteed at all. > So if they are "slow" or dropped or delayed somehow, that's fine. The > sound protocol should be fine with it. The sound USB protocol doesn't provide any redundancy - so a missed packet means audible clipping. There are crappy USB controllers that skip an isochronous packet when they encounter too high memory latency - they are unuseable for audio - but this is not the problem here. The USB specification doesn't allow re-sending failed isochronous packets. > Now yes, in reality, as you have found out, things can be "tight" on > low-powered processors under heavy load. But what you are doing here is > a priority inversion. You do not solve such a thing by going around and > raising everything else up as well, this is supposed to be a "general > purpose" kernel. You can tune a specific machine/device just fine this > way, but not by messing with the kernel for the most part. > > > snd_complete_urb is doing nothing but submitting the same urb again. Is > > resubmitting the urb really causing so much latency that you can't do it > > in the interrupt handler? > > snd_complete_urb() does much more than just submition of the same urb. How is snd_complete_urb() different from a hard-irq handler of a PCI sound card? AFAIK sound irq handlers just set the current position in the ring and wake up a process that wants to read or write to the ring. This is so simple task, that there's no reason to offload it to softirq. > Perhaps if this is a real problem, the sound driver should have more > than one urb pending? Is there a pool here that is somehow getting used > up? It has 12 urbs - but it means that 12ms scheduling latency (which is common) means sound skipping. Games or proffesional sound applications need bounded sound latency, so you can't just increase the number of urbs arbitrarily. > thanks, > > greg k-h Mikulas