Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3640646ybl; Sun, 8 Dec 2019 20:07:57 -0800 (PST) X-Google-Smtp-Source: APXvYqzqjh4iJ65BcXeBTJ9/qf8GnBR1oPvMRZtOmY4mf4euTrXfvIiXlbBQuuws1g89ppdFJil1 X-Received: by 2002:aca:a811:: with SMTP id r17mr22756773oie.59.1575864477361; Sun, 08 Dec 2019 20:07:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575864477; cv=none; d=google.com; s=arc-20160816; b=c6aD4FNa9k5hshayZt1Ro5x1hhk9FUJDXQFhYgYCw/p81PHiSTniH3orZJUWLwAyxk Ej1O4cZRqeCqdYRWxJV8rv7EulJHEKTNlkyZWWzO/BFbjyBsXo78QZtezI81Ael8vM26 rigfe5HLcQReWDXFhuRUO3S2gcA0TdHXhHRmOvllFXpF7yJ4A4/sCCB+JYSRD7V/29x4 OjKfMDfPaD0UorkOjD1Tt+fANi/+1UCNKmd+85AWlnVb0WCgUCuJ24voqkO4gfv24DGg RLJedVQjzlchNFyOso50CPB80HWuoL7qxD2Kgs7LEZSkjvFV3sGkK7Df5YJ89H15gNca jFZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=SSKZQVNYBrUoRU4TPgH9Xi7HOKeo/fTJhl3EcFgABvc=; b=CTlJaPFdraOHsL+2ccjCnyieQhUQ7+aPZKbesRQHg4eonLp/A7YE6O6YtbJCF0EWWj eUPm70Y/BRzC1N1EhEQSsDQiS19ysJRM+CJUWcwPfNYGND+lqZGjdgbTKu7A068pIIOr A00z7TyY7bPnoqtjFs7Kr7EBDo/9P6P8EZJiqTA2+1R34scprUXU5HGCDb+b+22PhsPN VrHnZ7a7dmrk5j7jw8pqK7RHBQ4Kd0mJPX/hdGCe+HLaOrkVYqevKQBrgxJDchgsIdEs 5EgG1bT5eBDHLDL3MokXZFV3py7t9STtMItRrAJcfikVDDgzxuBY7GXIq95IWAM94L6G VAWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bYE7UvRj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j71si10706808oib.213.2019.12.08.20.07.46; Sun, 08 Dec 2019 20:07:57 -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; dkim=pass header.i=@chromium.org header.s=google header.b=bYE7UvRj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726988AbfLIEGF (ORCPT + 99 others); Sun, 8 Dec 2019 23:06:05 -0500 Received: from mail-vk1-f194.google.com ([209.85.221.194]:38820 "EHLO mail-vk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbfLIEGF (ORCPT ); Sun, 8 Dec 2019 23:06:05 -0500 Received: by mail-vk1-f194.google.com with SMTP id m128so3973544vkb.5 for ; Sun, 08 Dec 2019 20:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SSKZQVNYBrUoRU4TPgH9Xi7HOKeo/fTJhl3EcFgABvc=; b=bYE7UvRj8WqhH/yPnmNYzBwI9HgYLmCbDkmqzmiM6urz1iwQWs3gJP4jUyz3Nk3Cl4 mZJ0unsgC7SUGo4APlmBV0tzbpoinfMIDbAGlv5Kmp1K1xUSURUJfKfItDQyq/w535tp U5hyBNlIHd4inJvg287aAk+wQyGQ+ybxr8HgY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SSKZQVNYBrUoRU4TPgH9Xi7HOKeo/fTJhl3EcFgABvc=; b=sDV9H9rOZalPWmWwxR7z03SrrvQXqnjjUtSMCZDhmdmJDzmVMe/toAsLvM6eWdZygC yHTBi1dmmVT8JZPgcYnRrpRL4Km/2r+k8kEqY8p7lJY1HII4hMcb87WWYVYkqGFEQVUx zXOijtzfMPsJAEoqVcIiy4ri9fogYV4XKTv+XeIKVnDL/mZKRGLgf+gGt+y4KLX7LdUe 2a9asgEMWwxOrdPvlsPixcPzEZWieXs3hLc4alu6DA+rsrQqZSaKQ6SIDlxlXR/LIriS wHiUqGRk4nzA6FOjX/AsPkp7zuo95uLU61AkSKiI+kdq3MY3dkBSIuNVgvARoW61jjqT 3m2w== X-Gm-Message-State: APjAAAWEvWXNd//pdGQh01quo0yREfAN1M5wd1fj5X+Xlfpws4PE8c/G Q0Ykp8xtC8EoY471wgjo3dBHBgJwdpmSKEwPWXMpOw== X-Received: by 2002:a1f:8fd3:: with SMTP id r202mr22038987vkd.77.1575864364344; Sun, 08 Dec 2019 20:06:04 -0800 (PST) MIME-Version: 1.0 References: <20191203101552.199339-1-ikjn@chromium.org> <20191203165301.GH10631@localhost> <20191204075533.GI10631@localhost> <20191205142641.GL10631@localhost> <20191206152604.GO10631@localhost> In-Reply-To: <20191206152604.GO10631@localhost> From: Ikjoon Jang Date: Mon, 9 Dec 2019 12:05:53 +0800 Message-ID: Subject: Re: [PATCH v4 2/2] usb: overridable hub bInterval by device node To: Johan Hovold Cc: 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 6, 2019 at 11:25 PM Johan Hovold wrote: > > 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. ;) yeah right, I'm giving one treatment but I mean not any further. > > > > 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. Honestly I'm a bit confused on the border line between hardware and software definition. That's quite reasonable it's policy that software can poll more often than hardware specified, but can we think it's just overriding hardware property specifying maximum value from beginning? Is it still policy? or 'overriding hardware property' part is already not a hardware description? :-S > > > > 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 Thanks! > > Johan