Received: by 10.223.185.116 with SMTP id b49csp1055736wrg; Fri, 16 Feb 2018 11:36:07 -0800 (PST) X-Google-Smtp-Source: AH8x226mjJ2aIIvnFv3XX9vOyc4aPA59Fl39WHo/8g05YpoKTgzDKi4uuDdscRZSFWNlOp4TMdmj X-Received: by 10.98.63.147 with SMTP id z19mr3084535pfj.221.1518809767183; Fri, 16 Feb 2018 11:36:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518809767; cv=none; d=google.com; s=arc-20160816; b=v/5uOY0+5AZefBlHkUO9SroP/5iFH4zj9tYw4Tr1ytRgvBuJz5HaW4Oz9+eRyUx2BI UDCtULJGB/YbRz6A+VoJU+JEOYVebahOea4tB9OU2a7yls7SEClKZf1O9TrBDbdkL0ZG yQpOWrqq3xPoHySv9smC21jZb8ZYg2gS5+Bgr+E2hf4jAjghGCsYgiLMVte1CWpmYPse CZ8K7OvY75A5iX0xam6o3MAGb6vas7Dw6qkBFuzfzUOXC2oiZrc6A++XFaYizXBPTixm 0tFM6qFCxzxEZ7l/d678Z4D/Gg/tohXV6NuVnsC45kb/3NuQpsxTftuA+sL5U7/eJVOv WDbg== 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=Z+IKY6y6itFN0xD9DPJWv46T9C5LGBgUqsgY9p89vkg=; b=qAxQRznAVwA4cpgbsA45bUaJTj6HbQw+KtmJivQnfSsGKj/Fq0SgkNoEsMmFvnUlTn jvh5GPka7aqQgESkj1sUpbSWEUvjr9YKdKxXHQEZY2848vj3+jJODGfdST6JLRYhWszG zhgq40zJ+1YBL3qPnX2iuHLY2uTk6T3uhwTg4Ck4DpUfaSynH/J+xSeOnaCoz/kQioxq vx3BJbfDaGNB5FJpUhQ8WD1to55xku1gxX0W2cNfA/EEtErPtytQl/mNiGbY5Y3IpIry PW1ZyDXNy41Ny4jgnHgCutIma5WxwJKZt+EdmEBip1LYERhVGzwiSwmgyF4819e6Xb7A 6Osw== 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 17si3660467pfw.21.2018.02.16.11.35.52; Fri, 16 Feb 2018 11:36:07 -0800 (PST) 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 S1751560AbeBPS3F (ORCPT + 99 others); Fri, 16 Feb 2018 13:29:05 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:54582 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751466AbeBPS3D (ORCPT ); Fri, 16 Feb 2018 13:29:03 -0500 Received: (qmail 4305 invoked by uid 2102); 16 Feb 2018 13:29:01 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 16 Feb 2018 13:29:01 -0500 Date: Fri, 16 Feb 2018 13:29:01 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Sebastian Andrzej Siewior cc: Mauro Carvalho Chehab , Frederic Weisbecker , LKML , Peter Zijlstra , Thomas Gleixner , Subject: Re: [RFC PATCH] usb: hcd: complete URBs in threaded-IRQ context instead of tasklet In-Reply-To: <20180216170450.yl5owfphuvltstnt@breakpoint.cc> 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 Fri, 16 Feb 2018, Sebastian Andrzej Siewior wrote: > I've been going over Frederic's softirq patches and it seems that there > were two problems. One was network related, the other was Mauro's USB > dvb-[stc] device which was not able to stream properly over time. > > Here is an attempt to let the URB complete in the threaded handler > instead of going to the tasklet. In case the system is SMP then the > patch [0] would be required in order to have the IRQ and its thread on > the same CPU. > > Mauro, would you mind giving it a shot? > > [0] genirq: Let irq thread follow the effective hard irq affinity > https://git.kernel.org/tip/cbf8699996a6e7f2f674b3a2a4cef9f666ff613e > > --- > > The urb->complete callback was initially invoked in IRQ context after > the HCD dropped its lock because the callback could re-queue the URB > again. Later this completion was deferred to the tasklet allowing the > HCD hold the lock. Also the BH handler can be interrupted by the IRQ > handler adding more "completed" requests to its queue. > While this batching is good in general, the softirq defers its doing for > short period of time if it is running constantly without a break. This > breaks some use cases where constant USB throughput is required. > As an alternative approach to tasklet handling, I defer the URB > completion to the HCD's threaded handler. There are two lists for > "high-prio" proccessing and lower priority (to mimic current behaviour). > The URBs in the high-priority list are always preffered over the URBs > in the low-priority list. We originally used tasklets because we didn't want to incur the delays associated with running in a process context. It seems odd to be reversing that decision now. > The URBs from the root-hub never create an interrupt so I currently > process them in a workqueue (I'm not sure if an URB-enqueue in the > completion handler would break something). It worked okay before we changed over to using tasklets. Alan Stern