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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0496E7E64E for ; Tue, 26 Sep 2023 16:39:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235306AbjIZQjo (ORCPT ); Tue, 26 Sep 2023 12:39:44 -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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.