Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5776233imm; Tue, 12 Jun 2018 13:09:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK7ZPaLORhqAVl+NnZxCfkbedKrCssWGVkPMupN0opSrjLBe5Yz6tEnMwoij44fFK1/RtdR X-Received: by 2002:a65:6142:: with SMTP id o2-v6mr1544849pgv.347.1528834169533; Tue, 12 Jun 2018 13:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528834169; cv=none; d=google.com; s=arc-20160816; b=vMGQQ5xJBJsM55qoEYtDzDyFfgXVuHYP3npMtIk2l1eaVDNpFVlUTCNxrbCAo2fmBu 8tvZlatVVA6NKR5tLVeFo5GAiDhtc6CKtePnLjwmhkGuLOO+aVOZUvAsZEDI9MVLWl6a 5I8MWDMiO7hBurUCHauHByzMLlewg7vUlygMVNlvuPQfdCYhgQMWE5QuGnYpKX7CFPKt y3ZHkdW+WrgPx64COAV/GhlnGs5kilfyi6FtV3nb2gsM9YRtQdYHp4z3KIEpwWFel869 /1v4YcMBGyeA1BuWjVtMFokt899Yyj3tmC5EF10/ICKQqAr4w+UCHkddRyPI0YijsD3t cF7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=+Rvr+BQuBw+2tHeroUBhiOa8fdDVWCE0Gc5vFQBsLrQ=; b=IIaftXm1+g5M7k9yMinxa5M7lmIMXXSRnKEevtDqSFPtvSvKOWjJCRElI46TYGejel UaSkVoISugbw5StixcQaOQR4PoQV34UDcsDFGlmkmMDfbe4Y6h8n0b2EC5tbliM+oj7w 3Gx7Qj4tQ+8YIQHN6F+JB66RBNhvO4PALJwp3vqy5ydZ03m1boQwsXBi/k30XpQGSHjy bC32LP2+9fuVoEcBO+3e6Bgybs3jP2rGHt1pQB0MK1yW6kYzUs7Vo2oenM2couVFTJeV CTEpgQVlln+vIDujucDAAk4vx3xYNR+Q9qQrq3e8KXxRCTbof5DlcyUvxjwBYN/MHtF6 oonw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14-v6si697306pgn.631.2018.06.12.13.09.15; Tue, 12 Jun 2018 13:09:29 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934737AbeFLUGq (ORCPT + 99 others); Tue, 12 Jun 2018 16:06:46 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:47856 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S934388AbeFLUGo (ORCPT ); Tue, 12 Jun 2018 16:06:44 -0400 Received: (qmail 5599 invoked by uid 2102); 12 Jun 2018 16:06:43 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 12 Jun 2018 16:06:43 -0400 Date: Tue, 12 Jun 2018 16:06:43 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Mikulas Patocka cc: 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: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Jun 2018, Mikulas Patocka wrote: > On Tue, 12 Jun 2018, Alan Stern wrote: > > > On Tue, 12 Jun 2018, 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. > > > > There have been suggestions posted to this mailing list for changing > > the USB stack to use a threaded interrupt routine instead of a tasklet > > for this purpose. Would that make your situation any better? > > If you set real-time priority to the interrupt thread, then yes, I think > it would solve the problem. So that's a possibility. Unfortunately the proposal for using a interrupt thread hasn't made much headway so far. > > > 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. > > > > You probably never noticed this, but in fact we use _two_ bottom-half > > handlers for URB completions: one scheduled with normal priority and > > one scheduled with high priority (tasklet_hi_schedule()). Isochronous > > URB completions go to the high-priority handler. > > > > Shouldn't a high-priority tasklet be up to the job of handling audio? > > I noticed the function tasklet_hi_schedule. It has higher priority than > other softirqs - but it gets offloaded to the ksoftirqd thread that has > priority 0. So it can be preempted by anything - and it doesn't protect > against skipping. > > If we raise the priority of ksoftirqd, people will start complaining such > as "my machine is unuseable when it receives too many network packets". > So, you basically need two ksoftirqds, one for networking (with regular > priority) and one for audio (with high priority). I wonder if this is not a valid concern. At the very least we could ask the softirq maintainers what their opinion/recommendation is. > > > 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? > > > > Perhaps snd_complete_urb doesn't doing very much, but other drivers > > most definitely do. In particular, the completion handler for the USB > > video class driver can be very time consuming. Your proposed change > > would make things worse for people using USB video. > > In that case we can avoid offloading just for snd_complete_urb. Would you > agree to adding a flag such as URB_FAST_COMPLETION that is set just by the > audio driver? That's another possibility. > Do the video usb devices use isochronous or bulk transfers? I believe they use isochronous (maybe some use bulk, I haven't checked). Certainly that's the sort of application it's meant for. Alan Stern