Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp399177lqp; Tue, 11 Jun 2024 07:45:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWrsLjkAM47K/9DkV/kSFlrxXJQzcVfRLzbtHTst2hFhx2dv38ZZ0YktpHG8GQnCOU1OtSj/o4VWv5lku4EEt6u46Q3I4WKtJ4WknBLIg== X-Google-Smtp-Source: AGHT+IHuEHHKh0TrIUvoBZM8kd18qelbefg+vbnjZAsgihO431nLGqmilzDnAZn+XmduwZWiqlDG X-Received: by 2002:a05:6358:5923:b0:19f:36bc:9d7a with SMTP id e5c5f4694b2df-19f36bca38emr1293954255d.1.1718117146160; Tue, 11 Jun 2024 07:45:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718117146; cv=pass; d=google.com; s=arc-20160816; b=xlGAxghEOGmRvWAmR/jiRrsDCbdmBG99KEpYMNrSyM7WVwEAFvCCotjgRFWOu1/MFt UzUsRvJIdIa/AVw2ZVL3vKq4uLPYyZVPSNT19sXJkDNRU6VnKrP/SmWa63OpHCUVNiZ3 7eTFYzRmSZcoDfMsXLTJngmDzt7aSIJp/QIQ5zzn7hgVhMkKs6Kg98PryBzaMVrjZH3b Zu3zGoqG4Ne7e3bDxVYKd1bSvhO6ArMBFtL82UYNe6M/pDZdrePe5MzQyFSyIvDhIThS TmEOfBrWUIUiDUMP0tR/lOP7CSbrz0ZDI6ZX98NEVO2/7Hl7HeEtURq7+GWGppktFoMN BqPw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ZDmcQfJiJg3AhnNDskLBlCw1R+pPrp3kDPPVyHiSs34=; fh=uV87bbLvFI24VmuTvpBOBKA2V/qIi+Cz2WQoQf5oN1k=; b=0L4Ywraek4USkHUghgpHOacRHhtdVuAcliosDq7IEW8LnU8Hh4Sv/zRIWnwSyZFBLj lNKQjX6QOLFRqhzbx8Bf/ah/Hq+Hkc5SVsF8XpdWyrGiT4jG9qJkfew1PEmOzFJKrg19 CbWWLPVsmlS99+xXUWgP2I69pe1ShFduGFO/Tq25EBW9+dTY/EMvH1kUkRN6u9QFepE2 g/r7UFsOglyKGdV0TduHmC3VXNNYe6OE7nYr/MjzfyZECtWkv/G3xaIU+U/E2StVpduP OI429fcAeWZBMFwnwLEF+ePdPzGUlWV2ZUhmII0cQb6yrqYZ7xREeLqQ6yaZF6QHifRW Wt7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FmixNAO3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-210078-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210078-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b0793fd7d8si57182166d6.496.2024.06.11.07.45.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 07:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210078-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FmixNAO3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-210078-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210078-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D6E811C23061 for ; Tue, 11 Jun 2024 14:45:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FC7312E78; Tue, 11 Jun 2024 14:45:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FmixNAO3" Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7A421CD2B; Tue, 11 Jun 2024 14:45:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718117138; cv=none; b=j38oZzz8v+2iIbZQ7peXsllSYQtK6gh4Gg4k8M1bZ+Kw42UAR9Z6C1vDzSv3uj9KFyf4bvN4jfBFcG01pWnD7HRfMtO6BQH2eJXjH+aHQgLqWZYZVs12RPqUvu2+c00nO3U2XU1/yhu3rhy0FL2tHEbOSyv+RYRLptdryvxZWj8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718117138; c=relaxed/simple; bh=/H9XWnYs0Gk9ZeqHTnYujfKVyliogBQwwJWeAfHwh98=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Q6wxpCU4nASVbcUmKFDtR01Lv3LyB2zIRcs0FmEis+uS0ZurjgiU1fWzjN9ZTCewLSig3waHa37Kmi8xskO8ErkLGKd7v4L8cs9g6LCc0qfG7RfdRRiFz/fqsnvskacdirlN1OCOHtdIlwgaINHChzZykQQtYxuODI/zM5dmexw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FmixNAO3; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-57c83100bd6so3012020a12.3; Tue, 11 Jun 2024 07:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718117135; x=1718721935; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZDmcQfJiJg3AhnNDskLBlCw1R+pPrp3kDPPVyHiSs34=; b=FmixNAO3O1YHsSEWlGUa8WiSiUhz4+org9mTv2BvJHGls82Ie0d1QH15vBw83RWO+q gQxuH1tMJ6VWhohRIu7DFM772BfkMTcpPT8FLJPjy1EhcGSreL1Xi1soghw7p7EEB5je rq7Y7gYFDF3ikhRzMZc72q2JqBF6M0ceAfPRqR+wpzW5Ba4ciG6bWMz+r6TzeD6bDE2J wFMAdU4UzNMiwBMs/qV7Oro8+RoATZ4d9+XqNJKREpaOfSE42YRCyqP5i7U5ccFyjyPn L8OdkbWzxz0wQTdfy5sG3XYFOHRozf3d0iUkPyvsRWuUAlixhPHs6ufjBxcarGT64HI3 AZcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718117135; x=1718721935; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZDmcQfJiJg3AhnNDskLBlCw1R+pPrp3kDPPVyHiSs34=; b=n5hY09PCY7I2Kn+G6G33ejnKq9y7rGW9EDPgR9gGOZuGgvJdOLvzdvQWU2cMdUBrTw v2cgJ93C62dbPVbLCZ5yHtY8HWRWzb1b2NLV3oZLLSLBLahHZxGSUfPFCSIMMh90MSC+ 8BgYnRDZl4PKlpavr0a5kBi1WSpxdcswewah97KkX+j1TPnLCeZqccLu4EaRIEFOyE5S flD1QESbp6zD6a3vYDTBVfp5CeDOAO+VTEZIZ3yWr72G4rywZOmyyKdrxXNAbxbuInnq 3MDz6kCM7Jmp/k7c7EAvANysfbVnapecIzLucw6san1FRloMvi/tygd7ozMRkFJDN7g2 ryYw== X-Forwarded-Encrypted: i=1; AJvYcCX5EJLYIRci5+SOconfn80861dm0w1OMljKLRUE3vmuY9dvsQrdUY7rHMXNYhBWCcfyHovEDtT1Du7ocK3EdIeMmKwSBYvKFFvxBV6VsXD2n8t9vr3ZMStzGwNHGE/gR4rkOADVDndb X-Gm-Message-State: AOJu0YxTsQjLUAmkzscFjUqAhXA8Djp7d3S/XhKkRUMXPANevG9r/L8G Lhkc9pdKMV5lB8GH4AxQvu+n0BFCaS3+5P/904AzrreaqjCHMOmEiWgrpSWiTp0pejZZ7E6taUg tZXIAVM/QzCs4xb9PtYo5om2i6z0= X-Received: by 2002:a50:8d5c:0:b0:578:3335:6e88 with SMTP id 4fb4d7f45d1cf-57c506bf7a9mr8912411a12.0.1718117133955; Tue, 11 Jun 2024 07:45:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240601120640.73556-1-joswang1221@gmail.com> <1662c9c9-7330-4794-843a-940f05802021@linux.intel.com> <2521588d-30a6-0224-c7c9-3015e9cc65a3@linux.intel.com> In-Reply-To: <2521588d-30a6-0224-c7c9-3015e9cc65a3@linux.intel.com> From: joswang Date: Tue, 11 Jun 2024 22:45:26 +0800 Message-ID: Subject: Re: [RFC 1/1] usb: host: xhci-plat: add enable XHCI-AVOID-BEI quirk by dts To: Mathias Nyman Cc: mathias.nyman@intel.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, joswang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 11, 2024 at 6:01=E2=80=AFPM Mathias Nyman wrote: > > On 6.6.2024 17.08, joswang wrote: > > On Wed, Jun 5, 2024 at 6:31=E2=80=AFPM Mathias Nyman > > wrote: > ... > >> > >> I was thinking of turning XHCI_AVOID_BEI behavior into the new default= , so no > >> quirk flag would be needed: > >> > >> Currently without the quirk flag: > >> > >> - ISOC TRBs trigger interrupt if TRB is the last in the TD > >> > >> Currently with XHCI_AVOID_BEI quirk flag: > >> > >> - ISOC TRBs trigger interrupt if TRB is the last in the TD > >> - Interrupt is additionally triggered every 32 isoc TRB (initially). > >> - if more than 128 events are processed in one interrupt then the > >> 32 is halved, and we trigger an interrupts every 16th isoc TRB, an= d so > >> on, 16 -> 8... > >> > >> I would remove the quirk flag, and make all controllers interrupt > >> behave as if it was set. i.e. interrupt at least every 32 isoc TRB > > > > Thank you for your detailed analysis. > > Excuse me, I have a question, do you mean to set "Currently with > > XHCI_AVOID_BEI quirk flag" as the default behavior? > > Yes, unless it causes some issues or there are strong objections > > >> > >> Is there an actual real world case where interrupting every 32nd ISOC = TRB is > >> too often? > > > > I mean that if the XHCI_AVOID_BEI quirk flag is set, an interrupt will > > be triggered every 8 TRBs, which makes the interrupts seem to be quite > > frequent. > > Thanks > > Jos > > > > It should start with interrupting every 32nd isoc TD, not 8th > > #define AVOID_BEI_INTERVAL_MAX 32 > > ir->isoc_bei_interval =3D AVOID_BEI_INTERVAL_MAX; > > Thanks > Mathias As you mentioned=EF=BC=8Cif more than 128 events are processed in one interrupt then the 32 is halved, and we trigger an interrupts every 16th isoc TRB, and so on, 16 -> 8... xhci_handle_events() ...... if (event_loop++ > TRBS_PER_SEGMENT / 2) { if (ir->isoc_bei_interval > AVOID_BEI_INTERVAL_MIN) ir->isoc_bei_interval =3D ir->isoc_bei_interval / 2; } ....... Thanks Jos Wang