Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3664670pxv; Tue, 13 Jul 2021 00:28:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsJFg+AKo6KfxeNbtgSG3/pcWspvYsUnCRPPkU7FFlaifSjtlNXGs0suMQlIxvaKr1uydS X-Received: by 2002:a17:906:c1da:: with SMTP id bw26mr3969081ejb.253.1626161317381; Tue, 13 Jul 2021 00:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626161317; cv=none; d=google.com; s=arc-20160816; b=iE+3n2w0xAgh14CeTuSc4cuhKf26iZuCVR8LOgI3OehzBIEsHMNdjj5WTGfRswhv01 Byqn2iKihKxLasHbioUIqtr3SenSRR71VymesUPQv7FWaP8YMR0CdxD0qF0e2ocHATyo D/g3wQIaaG49d/5AnOPNSwM49HHBZum1+7baHmb0aPXCLSFE8L+/vdikTms0oGjVrFqK Cubtlp4CkLJZipSW4Q70kCrzhsDPE2BJ1LLjepLlFd5tCca+chR1Tg7CsxJ5F6naszcQ o71qERnWxzTic+9HTc2GNCNE6yerOsb3S2JeSJ9aqYvzC4G9zjylFaPzj76dOFri5aDE cy4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:references:cc:to:from :subject; bh=ZJMqOP6atR+Hpf4u9jY7nRL6MW9wj2QhfAqFkp9jsjc=; b=Z1KbvqFtmqAaIgvm0sWAWRx7stjEdV4oj0/WAx86xNS+A/yTnkijeIvPme/VOqZl/p 2bhmrc57nF5qbysdD0GOU1mpmrIRpcSf6QZ9gAvErlOs5haqtU8/MSlxWpQpGz2ohmvB c7Dxwi53pK68WrG+raOlDZWPckPdjodYTDF0PU48cnC5+ocOmKvxv0DyiqyJUSjPX6xk jSkGZ4X2ztI2dSk94eruk8evjyNRTq6vYUUBntQqABbB4AAiJX9uSwG+t/dRNRiuIlNg kfenTy7MGSepKSG6j1qR7GgKY1RSrq7tvKA3V2cJjFS3o5ZOniFdOtcI5K58GY4sOHgW 4NMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp33si20862105ejc.40.2021.07.13.00.28.13; Tue, 13 Jul 2021 00:28:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234290AbhGMHaA (ORCPT + 99 others); Tue, 13 Jul 2021 03:30:00 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:15006 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234241AbhGMH37 (ORCPT ); Tue, 13 Jul 2021 03:29:59 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GPBvP6gWQzbbpG; Tue, 13 Jul 2021 15:23:45 +0800 (CST) Received: from dggpemm500002.china.huawei.com (7.185.36.229) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 13 Jul 2021 15:27:02 +0800 Received: from [10.174.179.5] (10.174.179.5) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 13 Jul 2021 15:27:01 +0800 Subject: Re: [PATCH net-next 1/3] arm64: barrier: add DGH macros to control memory accesses merging From: Xiongfeng Wang To: Will Deacon , Guangbin Huang CC: , , , , , , , , , , , References: <1624360271-17525-1-git-send-email-huangguangbin2@huawei.com> <1624360271-17525-2-git-send-email-huangguangbin2@huawei.com> <20210622121630.GC30757@willie-the-truck> <0c8f931b-9da8-ffb0-4b7c-7d291e9af8aa@huawei.com> Message-ID: <3ef9ca7d-e203-2041-2b6a-ed73c5e8e7b6@huawei.com> Date: Tue, 13 Jul 2021 15:27:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <0c8f931b-9da8-ffb0-4b7c-7d291e9af8aa@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.5] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2021/6/29 19:11, Xiongfeng Wang wrote: > Hi Will, > > On 2021/6/22 20:16, Will Deacon wrote: >> On Tue, Jun 22, 2021 at 07:11:09PM +0800, Guangbin Huang wrote: >>> From: Xiongfeng Wang >>> >>> DGH prohibits merging memory accesses with Normal-NC or Device-GRE >>> attributes before the hint instruction with any memory accesses >>> appearing after the hint instruction. Provide macros to expose it to the >>> arch code. >> >> Hmm. >> >> The architecture states: >> >> | DGH is a hint instruction. A DGH instruction is not expected to be >> | performance optimal to merge memory accesses with Normal Non-cacheable >> | or Device-GRE attributes appearing in program order before the hint >> | instruction with any memory accesses appearing after the hint instruction >> | into a single memory transaction on an interconnect. >> >> which doesn't make a whole lot of sense to me, in all honesty. >> >>> Signed-off-by: Xiongfeng Wang >>> Signed-off-by: Cheng Jian >>> Signed-off-by: Yufeng Mo >>> --- >>> arch/arm64/include/asm/assembler.h | 7 +++++++ >>> arch/arm64/include/asm/barrier.h | 1 + >>> 2 files changed, 8 insertions(+) >>> >>> diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h >>> index 8418c1bd8f04..d723899328bd 100644 >>> --- a/arch/arm64/include/asm/assembler.h >>> +++ b/arch/arm64/include/asm/assembler.h >>> @@ -90,6 +90,13 @@ >>> .endm >>> >>> /* >>> + * Data gathering hint >>> + */ >>> + .macro dgh >>> + hint #6 >>> + .endm >>> + >>> +/* >>> * RAS Error Synchronization barrier >>> */ >>> .macro esb >>> diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h >>> index 451e11e5fd23..02e1735706d2 100644 >>> --- a/arch/arm64/include/asm/barrier.h >>> +++ b/arch/arm64/include/asm/barrier.h >>> @@ -22,6 +22,7 @@ >>> #define dmb(opt) asm volatile("dmb " #opt : : : "memory") >>> #define dsb(opt) asm volatile("dsb " #opt : : : "memory") >>> >>> +#define dgh() asm volatile("hint #6" : : : "memory") >> >> Although I'm fine with this in arm64, I don't think this is the interface >> which drivers should be using. Instead, once we know what this instruction >> is supposed to do, we should look at exposing it as part of the I/O barriers >> and providing a NOP implementation for other architectures. That way, >> drivers can use it without having to have the #ifdef CONFIG_ARM64 stuff that >> you have in the later patches here. > > How about we adding a interface called flush_wc_writeX(), which can be used to > flush the write-combined buffers to the device immediately. > I found it has been disscussed in the below link, but it is unnessary in their > situation. > https://patchwork.ozlabs.org/project/netdev/patch/20200102180830.66676-3-liran.alon@oracle.com/ Do you have some suggestions on this problem ? How about we adding an interface called flush_wc_writeX() ? Thanks, Xiongfeng > > Thanks, > Xiongfeng > >> >> Will >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >> . >>