Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp577059pxt; Thu, 12 Aug 2021 05:13:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/XhVze+5ZyZUeTcpAEh+KcwPbIGufYnm311qvB36WZKfh5PtQyByxyXD6aXTe2P4NZjqr X-Received: by 2002:a05:6402:215:: with SMTP id t21mr5205655edv.68.1628770388624; Thu, 12 Aug 2021 05:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628770388; cv=none; d=google.com; s=arc-20160816; b=iH8ZeIz072vGeU9fTdsUn70RWsVYBkuZC7atdrWqSY0c8FC/45XBfNEdRchZAXZx7q 8IJAdRkSrO7E8dSk9ONAj3AvnIzR+z2Ws0TuMVcXSUJDI/mtvf1BH9n1yn1CWtQEZvVk 9GkFMciGKjeuOrDkXmsSh+ST9Mi9QRcogxUXJuncWZRE2YMCdnwL9/Qh0CR8SAkRIxlp H5zgm0hJvXlvXTAV0nrQEk/bdyEES4UN+kE9hfqCab53us51kgg1SndmCtSTd8sMKx0E M3agE0c1sKjrhu66UEYpvdnSJKINf3Mx9eSWytfxrakZKP1fzFLHx1pZbOvxIKjMKbNt xNTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FVskKCl1yiOLa7tUE7ecSFjkdCcT3iQIU3DHdWUifrk=; b=IpO38OJ17K+wRym1LIVuYQrvvxuGjNdbWLzwnp5wAqj+PozkPdGy35EzLvog/r02iC E7SvbfYWAvKJlIs1ExXlCLMGMugM7rDJcY1lmY1xBMniylpPQN8Y2IeOK5ncupYArO9p G3ZiwZoEmc+VaGfe2Ofs4B8HYaMb6Q1thmI5fwuLNwoHDC8J+NGdbUrbW6D6K0d69Ue8 FwVT0ZOLBJnOB6qu2qWI3ERJcUXnqbD/MRF6VS24t2Unx61hEU4YB4pjoP1ZiMeundwI acwDrShax1yVIvL0NUGN0Y8ohi5GtbZg2AvORvLBrV7TwuIhK2kQBrLNIY1meiRYew+d tlAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="N2TulBv/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id l22si1951742eja.443.2021.08.12.05.12.42; Thu, 12 Aug 2021 05:13:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="N2TulBv/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236054AbhHLJcW (ORCPT + 99 others); Thu, 12 Aug 2021 05:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235823AbhHLJcV (ORCPT ); Thu, 12 Aug 2021 05:32:21 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C3FC0613D3 for ; Thu, 12 Aug 2021 02:31:56 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so14286092pjr.1 for ; Thu, 12 Aug 2021 02:31:56 -0700 (PDT) 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:content-transfer-encoding; bh=FVskKCl1yiOLa7tUE7ecSFjkdCcT3iQIU3DHdWUifrk=; b=N2TulBv/LnNVY4R0n44Ryimm1NeBT5sGkW7wDOan3PefdEv6z8dCkKmVHCwRyf8hUY w4D019j82RLvfDJtrxXZSYnRLvk4xMvipUw7KRs2m5VkLsNx4w7nSNL6tlFewsz8ZG1t FjDJA0HYtqqXOB9vEsv81ledxzP5JQKTlugrA= 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:content-transfer-encoding; bh=FVskKCl1yiOLa7tUE7ecSFjkdCcT3iQIU3DHdWUifrk=; b=qvXlb4GeYLYF5yIXZbsnpcQFJPnnKsjXW0TKH16KkVntlHHjJWyoHfeOmxcwa4fo+8 x6WslcHnjGFvPHh2vF9rJ/chn0utISosnLItksI2v+Fjtm/zzqpjPgtitmJjck5TqbCd Ox8xjgQxur5e5HZtRhLL+TA3WadwO9Q6OcFK/LItPd7duG3sshtTAShdeoX5Q6D+Acyt wT00nS8INKJBW6qDGQdJmpRz3wB/ikeuol2QoNJTsN3FRP/37teZLKVHLa/T++n59O5T b0rBaCbN3No4IZy8BDwFEk+g2c6pLudyzIEMJgB8oUFTL5ZLDo3Glxk3fRSw8BAcumsj 4S/A== X-Gm-Message-State: AOAM53171IEpF9HE8jZjhbL4/XkEk1J+ApT6QQitV2D5Vi9zHTimFGmZ ztN1OfwZ0X0Z+hl7kZ6tbJuG35z7k5S6ZUXE8kzaFQ== X-Received: by 2002:aa7:8d92:0:b029:3e0:8660:b9aa with SMTP id i18-20020aa78d920000b02903e08660b9aamr2266006pfr.55.1628760716086; Thu, 12 Aug 2021 02:31:56 -0700 (PDT) MIME-Version: 1.0 References: <20210809165904.RFC.1.I5165a4a8da5cac23c9928b1ec3c3a1a7383b7c23@changeid> <7b48f4c132a8b4b3819282e961fbe8b3ed753069.camel@mediatek.com> In-Reply-To: <7b48f4c132a8b4b3819282e961fbe8b3ed753069.camel@mediatek.com> From: Ikjoon Jang Date: Thu, 12 Aug 2021 17:31:45 +0800 Message-ID: Subject: Re: [RFC PATCH] usb: xhci-mtk: handle bandwidth table rollover To: =?UTF-8?B?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= Cc: "gregkh@linuxfoundation.org" , "linux-arm-kernel@lists.infradead.org" , "matthias.bgg@gmail.com" , "linux-mediatek@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "mathias.nyman@intel.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org HI, On Wed, Aug 11, 2021 at 5:02 PM Chunfeng Yun (=E4=BA=91=E6=98=A5=E5=B3=B0) wrote: > > On Mon, 2021-08-09 at 17:42 +0800, Ikjoon Jang wrote: > > On Mon, Aug 9, 2021 at 5:11 PM Greg Kroah-Hartman > > wrote: > > > > > > On Mon, Aug 09, 2021 at 04:59:29PM +0800, Ikjoon Jang wrote: > > > > xhci-mtk has 64 slots for periodic bandwidth calculations and > > > > each > > > > slot represents byte budgets on a microframe. When an endpoint's > > > > allocation sits on the boundary of the table, byte budgets' slot > > > > should be rolled over but the current implementation doesn't. > > > > > > > > This patch applies a 6 bits mask to the microframe index to > > > > handle > > > > its rollover 64 slots and prevent out-of-bounds array access. > > > > > > > > Signed-off-by: Ikjoon Jang > > > > --- > > > > > > > > drivers/usb/host/xhci-mtk-sch.c | 79 +++++++++---------------- > > > > -------- > > > > drivers/usb/host/xhci-mtk.h | 1 + > > > > 2 files changed, 23 insertions(+), 57 deletions(-) > > > > > > Why is this "RFC"? What needs to be addressed in this change > > > before it > > > can be accepted? > > > > sorry, I had to mention why this is RFC: > > > > I simply don't know about the details of the xhci-mtk internals. > > It was okay from my tests with mt8173 and I think this will be > > harmless > > as this is "better than before". > > > > But when I removed get_esit_boundary(), I really have no idea why > > it was there. I'm wondering if there was another reason of that > > function > > other than just preventing out-of-bounds. Maybe chunfeng can answer > > this? > We use @esit to prevent out-of-bounds array access. it's not a ring, > can't insert out-of-bounds value into head slot. Thanks, so that function was only for out-of-bounds array access. then I think we just can remove that function and use it as a ring. Can you tell me _why_ it can't be used as a ring? I think a transaction (e.g. esit_boundary =3D 7) can start its first SSPLIT from Y_7 (offset =3D 7). But will that allocation be matched with this? - if ((offset + sch_ep->num_budget_microframes) > esit_bounda= ry) - break; I mean I'm not sure why this is needed. Until now, I couldn't find a way to accept the USB audio headset with a configuration of { INT-IN 64 + ISOC-OUT 384 + ISOC-IN 192 } without this patch. > > > > > Thanks! > > > > > > > > thanks, > > > > > > greg k-h