Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2014143rdh; Tue, 26 Sep 2023 09:43:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHod9p00vIuPFj3mUwpGkp+z5SFQpOS9zXfvWf+DYfoq5kA70OpXf/aZ0kC5FHddytFMqLs X-Received: by 2002:a05:6a21:3d88:b0:15e:dad1:96c5 with SMTP id bj8-20020a056a213d8800b0015edad196c5mr5700022pzc.30.1695746580816; Tue, 26 Sep 2023 09:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695746580; cv=none; d=google.com; s=arc-20160816; b=bs+JDhT+NP7cMMfwz4QPzlaVUQY7QmBBP0x7XMamTiBGdsMUTU9fb+dKjbvEwqxyKC g4RFyjF7YPhj8hAqE3AHJpF74m9uY3ZgguaSo9o1VdhckD7uxboC3RWj3GRa01iyf/Nm EM7pqVGhzQrIUZPie4WrWSXHY0ymchnSGrLuv4BmWPQuIDrj2jDJDdhckPMAEK19Fwxn TAVQR40mmBJ2GXQssZr77WNQoHquVZ5E29OtgrfpzKdzg48xEcg0J6W3EPE6XrNJWQ/T Tlwg3rkjwZGBooQrWGr4RcSF4d2s4rFvMp3EJjW6PotTvyFHTQnTmw1Ml/ueX1R+H6Sn wBrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=HTmUTbxQ5bQ41oA2tn5gRuKzoZ8Je83Vaz6f3bUcjSs=; fh=lqgUfKU8wdXJgXYYCiRH9il2iOGYMUTeYxg/Rft2sa8=; b=un2BcXCOfWc0LWwoVF1+3Py9i/UuANP6/SYECEyFxxtL2lQ6yMf9v3Fmw5wGTcItjA YIKHaTdvjPnpgbr0phPY1NkVGKwyM1JKrCGloTiYO6+IVq/WC4vwvwj4Alo0UxjKM/jj WwSm1Zp4DRz2MoF9acuFn4quwJ18VCKGqNMo/12oY1osQdW7j8adkzzVvVAsi54d9/AZ wcPRnN460mFZhSQsfRcRRGk5ThLod7BfEyS8xGokAJwHWVICH7/dLMmcSwnj+0+UbHRL gEqDttxwgGv0A0oTbqktS34EfTupXr3oI1c7jC1UtlxLAoKu0ebhLO7K18eNLsehXcCE zSFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KknepFX8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id m21-20020a656a15000000b00578b9fb24f6si14346069pgu.616.2023.09.26.09.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 09:43:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KknepFX8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 37079810F0EA; Tue, 26 Sep 2023 09:39:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235294AbjIZQjn (ORCPT + 99 others); Tue, 26 Sep 2023 12:39:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235266AbjIZQjm (ORCPT ); Tue, 26 Sep 2023 12:39:42 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D96A3BF for ; Tue, 26 Sep 2023 09:39:35 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 827F0C433C8; Tue, 26 Sep 2023 16:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695746375; bh=FM7oK82lTwWUP1SNytxmkVrvI0P1f1Z/XcQki5E3Rd8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KknepFX8Kr9s8GW52l0GM0gVsrX820UOTQjD11GmRmINH5RjuIMHABPjyOrS6YEns MNzrSq+vzrUa8JcNxAnPJHgLDeoHFIw6T590Ik72/Uvt+T4+rNC4UfK0XNGNkJM691 DF7ejAdGJ8ICFhgyBbuUflywEv2pb3DDkkoPozaEEVB5wW5bWHKdBzDz4w+gb+o8sD 4ne4NO70TlG7YOI09Ws9Jn1JfcetffX6yfn3DMXcBbcV673UJOAqRKpJmwt0UvHrAC WajHPvFI5td95CRCeCp4xais43Gn4jqYaEcZ2TVE4wIJRHyGYL7sQFMPZWqY9NeBCK kpm6FAzfR7ZWw== Received: from [148.252.128.164] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qlB5w-00GO0i-PU; Tue, 26 Sep 2023 17:39:33 +0100 Date: Tue, 26 Sep 2023 17:39:31 +0100 Message-ID: <87msx8nb24.wl-maz@kernel.org> From: Marc Zyngier To: Rex Nie Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH] irqchip/gic-v3: move reading of GICR_TYPER later In-Reply-To: <20230925023408.1441-1-rex.nie@jaguarmicro.com> References: <20230925023408.1441-1-rex.nie@jaguarmicro.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 148.252.128.164 X-SA-Exim-Rcpt-To: rex.nie@jaguarmicro.com, tglx@linutronix.de, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 09:39:42 -0700 (PDT) On Mon, 25 Sep 2023 03:34:08 +0100, Rex Nie wrote: > > This changeset will reduce one reading of GICR_TYPER register > when any of next 2 condictions meets: > 1. found redistributor for current cpu > 2. single_redist is true for gic_data.redist_regions[i] > > Signed-off-by: Rex Nie > --- > drivers/irqchip/irq-gic-v3.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c > index eedfa8e9f077..d08a4773f631 100644 > --- a/drivers/irqchip/irq-gic-v3.c > +++ b/drivers/irqchip/irq-gic-v3.c > @@ -982,7 +982,6 @@ static int gic_iterate_rdists(int (*fn)(struct redist_region *, void __iomem *)) > } > > do { > - typer = gic_read_typer(ptr + GICR_TYPER); > ret = fn(gic_data.redist_regions + i, ptr); > if (!ret) > return 0; > @@ -990,6 +989,7 @@ static int gic_iterate_rdists(int (*fn)(struct redist_region *, void __iomem *)) > if (gic_data.redist_regions[i].single_redist) > break; > > + typer = gic_read_typer(ptr + GICR_TYPER); > if (gic_data.redist_stride) { > ptr += gic_data.redist_stride; > } else { I personally prefer establishing the exit condition for the loop as early as possible. Doing it later makes this code slightly more fragile, and I somehow doubt that you will notice the extra reads. Can you at least quantify the improvement? M. -- Without deviation from the norm, progress is not possible.