Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3134758pxb; Sun, 20 Feb 2022 10:17:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQYiqA+RJKyRKSvNQtI2acu/JJ7m8nvl6AupOcbqTOOqKaSHQyvFSud7BJNWPv+/saip4a X-Received: by 2002:a05:6402:5cd:b0:412:d3fe:843d with SMTP id n13-20020a05640205cd00b00412d3fe843dmr10318867edx.97.1645381040938; Sun, 20 Feb 2022 10:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645381040; cv=none; d=google.com; s=arc-20160816; b=0gXSZYb9+V3/F5hj1Y5SGv6n/XCXmByyoCCPHWIMNFSW9kkC91ZJNH3N+dKTNQdYxE +9fhy1SmbMfbcDLBiyD9ZaVBb2EMaR6aEWoiY2yz4KHPJj+VbAv43L8Q8hNKKUiL6CVG 2tbCNW/LZhL+4l7//MWkbmcMD3v4x4LviwmsIsx3VE1sjAJBuHvN157JlOj2jr0gzHET +7OTRvHGVPmPOXv1ZbFtmGMCn3/gPOeyJMESOwaiFegamm6dnwwMceytYb36cWJiCZ+G /DBQvwPmWSd46fJAQdr4b6tJOWooJyvciG8ZL7ImvibDFlRdahPVx4wLqjyiFssbV393 +2Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature; bh=0TN4ATVWAdcxhGx67OgDbD7R8aOIvw+hMLWngxKutiQ=; b=MA6f98UlT1TYiAkOV82v0zUXHh6RfdVwNVG4YKdFY8HM3Wc8gxTKIyeJFwFSPGYKQC zfmpY7mp3F8WW5mgKlo0+VMvZ0/csVDP7WjhOYnotcNqEZjRWL+R5Xy4/nAhbkrVBTjC b/dfdfiycz3UoPh2f/fp4xVVU5U8xervOBGl41hxJF070wAdhW17lkA7uXh4mLuqET3L rAeCR/nRlOVqJ5w5sogA3zXPNq7z3IgZlFpC8c8P0QQMbRdqZjSf2S/H/cHBo6JPfoOJ k/uHlcKMBrIo/HTT6h4FwCi/1A3oB6zs7WYNPZ3fKS9ai3G5w2dutXBi0OBVHfnSO3qp CCKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JpAlhX43; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7si6047195ejj.396.2022.02.20.10.16.53; Sun, 20 Feb 2022 10:17:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JpAlhX43; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244109AbiBTPFT (ORCPT + 99 others); Sun, 20 Feb 2022 10:05:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239628AbiBTPFS (ORCPT ); Sun, 20 Feb 2022 10:05:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EA3631DCF for ; Sun, 20 Feb 2022 07:04:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BED01611CE for ; Sun, 20 Feb 2022 15:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30047C340E8; Sun, 20 Feb 2022 15:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645369496; bh=fZPTSvnh4YHQ8D1myNfcH54rXKHDXQJ0WyVEVbo+D4s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JpAlhX433ZrMRryMljDJdvPbfIU6fHHqJCPrVFj/Eg6dRhXWNfDXIT3+j9SRfycrj hHNKdfLkZnJtOUFQC7uxAcAKlFZppp1aqt/1RJDEQtQM6fxuslQ9NERHGWT37cAUC9 oAJojKSEBTNvnqM4A44eH1CA5j84amNmU8OmRsUSNma4/Db+wb3Fea+Xp9yJYuMQG6 HfsBxXtPD5y231gpPJXGK8hfJIayhSEVIIMbMMEbjQ9vAAydsEr8HznUmkpOaPWIq9 D5hMtrlFUkFMprsuko3GWRFYFOJS6r/Mm7y7ngBG348C4ipnkZExI7whhSGJUrG4j2 1Bvfg+8EpxcOQ== Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nLnle-0094yi-0f; Sun, 20 Feb 2022 15:04:54 +0000 MIME-Version: 1.0 Date: Sun, 20 Feb 2022 15:04:53 +0000 From: Marc Zyngier To: Ard Biesheuvel Cc: Barry Song <21cnbao@gmail.com>, Thomas Gleixner , Will Deacon , Linux Kernel Mailing List , Linux ARM , Linuxarm , Barry Song Subject: Re: [PATCH] irqchip/gic-v3: use dsb(ishst) to synchronize data to smp before issuing ipi In-Reply-To: References: <20220218215549.4274-1-song.bao.hua@hisilicon.com> <6432e7e97b828d887da8794c150161c4@kernel.org> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <49ee858267c75144c601b1e42d4f4c28@kernel.org> X-Sender: maz@kernel.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: ardb@kernel.org, 21cnbao@gmail.com, tglx@linutronix.de, will@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, song.bao.hua@hisilicon.com 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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-02-20 13:30, Ard Biesheuvel wrote: > On Sat, 19 Feb 2022 at 10:57, Marc Zyngier wrote: >> >> On 2022-02-18 21:55, Barry Song wrote: >> > dsb(ishst) should be enough here as we only need to guarantee the >> > visibility of data to other CPUs in smp inner domain before we >> > send the ipi. >> > >> > Signed-off-by: Barry Song >> > --- >> > 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 5e935d97207d..0efe1a9a9f3b 100644 >> > --- a/drivers/irqchip/irq-gic-v3.c >> > +++ b/drivers/irqchip/irq-gic-v3.c >> > @@ -1211,7 +1211,7 @@ static void gic_ipi_send_mask(struct irq_data >> > *d, const struct cpumask *mask) >> > * Ensure that stores to Normal memory are visible to the >> > * other CPUs before issuing the IPI. >> > */ >> > - wmb(); >> > + dsb(ishst); >> > >> > for_each_cpu(cpu, mask) { >> > u64 cluster_id = MPIDR_TO_SGI_CLUSTER_ID(cpu_logical_map(cpu)); >> >> I'm not opposed to that change, but I'm pretty curious whether this >> makes >> any visible difference in practice. Could you measure the effect of >> this >> change >> for any sort of IPI heavy workload? >> > > Does this have to be a DSB ? We can use a DMB ISHST for the other interrupt controllers that use a MMIO access to signal the IPI, as we need to order the previous writes with the MMIO access (and DMB fits that bill). For GICv3 when ICC_SRE_EL1.SRE==1, we need to order a set of writes with a system register access with side effects, and the only barrier that allows us to do that is DSB. It is a bit unfortunate that the relative lightweight nature of the sysreg CPU interface is encumbered by fairly heavy barriers (the most horrible one being the DSB SY on each read of IAR to be able to synchronise the CPU interface and the redistributor). Thanks, M. -- Jazz is not dead. It just smells funny...