From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF96EC433E2 for ; Mon, 31 Aug 2020 09:56:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B852208DB for ; Mon, 31 Aug 2020 09:56:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="x+4s51Vq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="cKvb8cb8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B852208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZWlGkCWsiOL5usTzrJkeNukBIQbUd2kOkhu/cK/dCa0=; b=x+4s51VqTMXZWI7idBWWWRoIR 6cxgsLdF4rR8ASW4UpJ52nh/0vnat7FcF7EA4xpivtrCYkvR0NAM69sUTuIj1KN392FmDAmbMBgx6 VaS797KJxrWfrRYB5XWat7hE8AHw2fKy2n4DjDC084GAeFVYg9zCOoYakGPGBVJPcrFfSQ2Jq1IDE kcNhDHZsqECS7LI1BOO+rm//zwc7876siHdgWqsWcrRcqQII3zGxqAWb8wgewys4orLUG1teqWURB VAdIX58/WMl4XbLApQCnsNCigFYRWpH+Uz8WlEPfx/AgIDhzKro27mfiePM2zZPPqBRiHbKK8Ddk6 H4O7urfVw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCgWp-00032V-Ma; Mon, 31 Aug 2020 09:55:07 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCgWn-00031p-J0 for linux-arm-kernel@lists.infradead.org; Mon, 31 Aug 2020 09:55:06 +0000 Received: from saruman (91-155-214-58.elisa-laajakaista.fi [91.155.214.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 356372098B; Mon, 31 Aug 2020 09:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598867704; bh=HT/dHnUDrMXwyD5q0jInxv9lB8IyvR2AIAngyUE4ihs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=cKvb8cb8UjAzTAmanRgpW0ydgrUNNIScnsG4pOpTle6dEDHASTV2qlifBQDcLULSZ vvIVAUAQ3mRJ85ywB8acd9Q1/3WhCoxmaPIzl3rsEN9yJDSw9C4jd9hercXUv/wwNv I5r+gaMFlrQuWcuyVfRfkiDvKVGlUUm6LAsu19j0= From: Felipe Balbi To: Tao Ren Subject: Re: [PATCH] usb: gadget: aspeed: fixup vhub port irq handling In-Reply-To: <20200817225603.GA21228@taoren-ubuntu-R90MNF91> References: <20200528011154.30355-1-rentao.bupt@gmail.com> <875z9hz8k3.fsf@kernel.org> <20200817225603.GA21228@taoren-ubuntu-R90MNF91> Date: Mon, 31 Aug 2020 12:54:57 +0300 Message-ID: <87y2lv9m32.fsf@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200831_055505_753305_06C6BDBC X-CRM114-Status: GOOD ( 22.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aspeed@lists.ozlabs.org, taoren@fb.com, Andrew Jeffery , Greg Kroah-Hartman , openbmc@lists.ozlabs.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Boyd , Joel Stanley , Benjamin Herrenschmidt , Chunfeng Yun , linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============4556254876336037098==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============4556254876336037098== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Tao Ren writes: > On Mon, Aug 17, 2020 at 04:49:32PM +0300, Felipe Balbi wrote: >>=20 >> Hi, >>=20 >> rentao.bupt@gmail.com writes: >> > From: Tao Ren >> > >> > This is a follow-on patch for commit a23be4ed8f48 ("usb: gadget: aspee= d: >> > improve vhub port irq handling"): for_each_set_bit() is replaced with >> > simple for() loop because for() loop runs faster on ASPEED BMC. >> > >> > Signed-off-by: Tao Ren >> > --- >> > drivers/usb/gadget/udc/aspeed-vhub/core.c | 10 +++------- >> > drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 3 +++ >> > 2 files changed, 6 insertions(+), 7 deletions(-) >> > >> > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/g= adget/udc/aspeed-vhub/core.c >> > index cdf96911e4b1..be7bb64e3594 100644 >> > --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c >> > +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c >> > @@ -135,13 +135,9 @@ static irqreturn_t ast_vhub_irq(int irq, void *da= ta) >> >=20=20 >> > /* Handle device interrupts */ >> > if (istat & vhub->port_irq_mask) { >> > - unsigned long bitmap =3D istat; >> > - int offset =3D VHUB_IRQ_DEV1_BIT; >> > - int size =3D VHUB_IRQ_DEV1_BIT + vhub->max_ports; >> > - >> > - for_each_set_bit_from(offset, &bitmap, size) { >> > - i =3D offset - VHUB_IRQ_DEV1_BIT; >> > - ast_vhub_dev_irq(&vhub->ports[i].dev); >> > + for (i =3D 0; i < vhub->max_ports; i++) { >> > + if (istat & VHUB_DEV_IRQ(i)) >> > + ast_vhub_dev_irq(&vhub->ports[i].dev); >>=20 >> how have you measured your statement above? for_each_set_bit() does >> exactly what you did. Unless your architecture has an instruction which >> helps finds the next set bit (like cls on ARM), which, then, makes it >> much faster. > > I did some testing and result shows for() loop runs faster than > for_each_set_bit() loop. Please refer to details below (discussion with > Benjamin in the original patch) and kindly let me know your suggestions. no strong feelings, just surprised that you're already worried about 20~40 cycles of cpu time ;-) Patch applied for next merge window =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJFBAEBCAAvFiEElLzh7wn96CXwjh2IzL64meEamQYFAl9MyPERHGJhbGJpQGtl cm5lbC5vcmcACgkQzL64meEamQbRNw//Ycg/zGDlByFwp5tnmnP1LkeCxblvsqjG n01I9rv8UAccFtJT/9QSYTtd6KOMvXM3dkMaX46ikxSPYPU3cZzQlMCqK4d40JJ4 YZxp/EnTM/Kt4V0R7tim2n1L7Nghyn1fY6crnN+R0PRYmFfrj3iEokFMIHhjnS8d PoDaT0aq3qH2uZRop0yN3mZmouAaTItfbXqxg42o13ZocuePy+M0bPeHPRXWZ9KQ aqL4vC9XZM7AXzeTVxn+53gnGzhFbCTmEiIdhfiBBffJT624hsfocIPUAxrj+kJj QyFUADnX5OHRElPzoiZyFKZlfAQUueQ6tC2I7/KFYuVu/tWT9/QE92aBOJ9Djomk 1+YCWr4MKz4RB313qyAw9zae77IpS2rQTbQwYts5iL3MTfpd1lwdTMX6TMJgReyG KBJ+amV5/Y74n5mxypnUXCQOTr3EqyHkr5ieYH6vkx9rzd3RylX6Qr1yGw839avx yIYcescxC9Wohlg8XAEs5ZCv+YsbapCzGlm7tq7m/eWHINbYIDOM+tpPkAfjzVmZ ZA5iNVntd+4punCL1Alpw+At/ZoJVMVHHdHDt73rfrZUIq8Xh20acsJCBh0xeQAE D6nte7wBz1h55Yz7NkWmNDaH9A0uUzYYnVeWRmZlt2RoNgkcx0w1OPXSJYtlInVi K+VeRcQfwJ0= =rGY9 -----END PGP SIGNATURE----- --=-=-=-- --===============4556254876336037098== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============4556254876336037098==--