Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp863279ybl; Fri, 6 Dec 2019 07:26:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxx+BAoCBCQq1fvC1piuIjmIArt69kqpiWh4X7jgNwWQwW6dtPhk41HfgOhjkEYnBKATBLL X-Received: by 2002:a9d:73c4:: with SMTP id m4mr10565352otk.87.1575646009596; Fri, 06 Dec 2019 07:26:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575646009; cv=none; d=google.com; s=arc-20160816; b=pvUcFVtrXo2dPOtq4x9C8NUFTwWAlDiEEyb6v7r5+EhMxeA6KrLmEsxooFX5qNgGky CmvF6i6eGjUuJVl4mEp0DNvDrbt7AcBUYx0B/2xm/EKvZ52cl17uGDAbmAMVDf5TZC8M Ow1SimC752UGleOrI8TQjKsZZ8AnWajDnpOUgNW/3UbP/RlQj6EzJdFv57KjOWSMOzrF 1OsxiC0zcmZ8c9r4I2K7XtDk+kW3lHLUfPsyBpEVjekBLpec64SZWmLW9oD9PbR3/UQ/ W1pr7xky1Dp5RKujV/zjC/vt2+F2nxG/myrfFz/KiWa+tvrsVX2kxNTpMeb/RP7UhlWX Z5+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ehQLu8k8mjUAanGmyYx+MeCss32pgffQdbVz/2SjwNM=; b=k1fegTWaEo/lw2dn0XvoyGhR4uMIRDNyhHeoNAgYpR/kAyo81CZtrN8Ed7LNjxh8+N pu0icm3x5u1tOb1h33ith/srZbuf1djc1e6S86ferzsKEWJQlG5MkzLR2CkqoexbWW1P BFnNNzBrMo1H0f+DkPnP07IKs4w2sFC5x+rA98ZQ+NjYBFerhpoBPYc9XLsudKaAJCnu /51lboAkE2k+CsrHQVZAXRD+HysFpEbLafkNdNOjQRNkiRfbCEbzKRRkcDEftRT2f5lY ric66xLMUz3eqoiI2lK59IO2wL1gf4CCWAr8aw1VTdNS8KCe6uxVAdHuYRFD16WPm57Z gQAQ== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 81si6896274otj.236.2019.12.06.07.26.37; Fri, 06 Dec 2019 07:26:49 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726420AbfLFP0B (ORCPT + 99 others); Fri, 6 Dec 2019 10:26:01 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40700 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726246AbfLFP0B (ORCPT ); Fri, 6 Dec 2019 10:26:01 -0500 Received: by mail-lf1-f66.google.com with SMTP id y5so5569021lfy.7; Fri, 06 Dec 2019 07:25:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ehQLu8k8mjUAanGmyYx+MeCss32pgffQdbVz/2SjwNM=; b=q1SH5JmrGeNnpIKv14tWDMQIuM5i7xWlId8PljHxhiCzq038sLO9cwK0pGRbdGQich VoeIks+asKnI7TYSYpiirsdcx/vKN2TRy8FVtL5Xj3lOQMWlJqWDLIrdMOEoI1MHeZJ3 FzqSCWTMCKziR+7DDcK1ExFq+hEprNV6nL5M+XSuK4Lbs0NMZyDPYn/EQu/Ul6GXCGD2 +eiLfsnmzTvhHbUaH6mUa/gIHC9xwpEKCqTm4i0lKdnQKUDdcRx9ZKJBgA97b2O1y4EE eIG7ev4sBBovpsS/jSen1oEY8OBqdB/Xyk0lVUT3OhMczYx+7OKzElazVM1pp/cw00T/ KGGQ== X-Gm-Message-State: APjAAAXd9I/LMtTkrT6zPUvpd1ZUKiu6Xlr88E2oYlE+6Pp5BCDCR61C VdCJGn1rNBE3hQFIEG8laKs= X-Received: by 2002:ac2:44a3:: with SMTP id c3mr5452943lfm.1.1575645959064; Fri, 06 Dec 2019 07:25:59 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id o69sm6782605lff.14.2019.12.06.07.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 07:25:58 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1idFUa-00054S-8o; Fri, 06 Dec 2019 16:26:04 +0100 Date: Fri, 6 Dec 2019 16:26:04 +0100 From: Johan Hovold To: Ikjoon Jang Cc: Johan Hovold , linux-usb@vger.kernel.org, GregKroah-Hartman , RobHerring , MarkRutland , AlanStern , SuwanKim , "GustavoA . R . Silva" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas Boichat , Mathias Nyman Subject: Re: [PATCH v4 2/2] usb: overridable hub bInterval by device node Message-ID: <20191206152604.GO10631@localhost> References: <20191203101552.199339-1-ikjn@chromium.org> <20191203165301.GH10631@localhost> <20191204075533.GI10631@localhost> <20191205142641.GL10631@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 06, 2019 at 11:57:30AM +0800, Ikjoon Jang wrote: > On Thu, Dec 5, 2019 at 10:26 PM Johan Hovold wrote: > > > > On Thu, Dec 05, 2019 at 03:32:38PM +0800, Ikjoon Jang wrote: > > > On Wed, Dec 4, 2019 at 3:55 PM Johan Hovold wrote: > > > > > > But related to my question above, why do you need to do this during > > > > enumeration? Why not just set the lower interval value in the hub > > > > driver? > > > > > > Because I want device tree's bInterval to be checked against the same rules > > > defined in usb_parse_endpoint(). e.g. although hardware says its maximum > > > is 255, but the practical limit is still 0 to 16, so the code can > > > print warnings when bInterval from device node is too weird. > > > > But that could be handled refactoring the code in question or similar. > > Yes, that should be worked. I can't exactly figure out how to refactor > the code for now, but maybe parsed endpoint descriptors are being > checked with default hard wired bInterval value and after that > an overridden value should be checked again. > > Actually I don't care about the details of software policies. I just want > all devices to be handled in the same manner without any further > special treatments. I'd say you're indeed trying to give a specific device special treatment. ;) > > The fundamental problem here is that you're using devicetree, which is > > supposed to only describe the hardware, to encode policy which should be > > deferred to user space. > > The hub hardware has a default bInterval inside which is actually > adjustable. So I can think setting bInterval is to describe the hardware > rather than policy. No, the USB spec says bInterval is a maximum requested value and that the host is free to poll more often. And that's policy. > > So I think you need to figure out an interface that allows user space to > > set the polling interval for any hub at runtime instead. > > Changing the interval at runtime is an another way to solve the > power consumption problem, but it's not so easy. At least xhci needs > to restart an endpoint and no devices are changing the interval after > enumeration stage. The usb-hid driver actually supports configuring the polling rate for devices like mice and keyboards after enumeration (through a module parameter, but still). Unfortunately, the xhci driver does not yet support this and always uses the device maximum bInterval. A bug report for this was filed many years ago, perhaps it's time to address that (adding Mathias on CC): https://bugzilla.kernel.org/show_bug.cgi?id=82571 Johan