From patchwork Mon Apr 15 04:24:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "liwei (GF)" X-Patchwork-Id: 10900081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 038E7922 for ; Mon, 15 Apr 2019 04:19:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D52DE1FEBA for ; Mon, 15 Apr 2019 04:19:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5F2228563; Mon, 15 Apr 2019 04:19:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1AA131FEBA for ; Mon, 15 Apr 2019 04:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0UOeSjPDNeJkcs7oGoHunhCBb9Ox3vmtvxVnTmgYoGo=; b=OoZ1CTpBV45wZD bvZ8l6B6g4ivFehIHlvDEfB0j9/CyZUkatJlMSeA4UTzeIlpAUytWw2ipvSmOmHXVb2QjdvkED0IE K0c4KarpDatnitS9KIgWJHSkFnAMg6jugz86BzXcmKoDtJHuk+20/XCLYuTkANtDyBqqaES6ZV1gL 3thtDqNUzcMY4WscabU5QaAxadR/amOVNQ+q6S66GpDRwon79AkDRCnTlBlAHpHmz5wykRpJRnGEO p0ZM3ApywOOsEGjEaSWRrvN8VRfd8LBaZ+MNo5/KdQjI5gR1Hr/gkQUHreEOQe2FW0l0p/w4Yl6N5 nfrLBIMKAbYu3lTA81ZQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFt5n-0007k9-1Y; Mon, 15 Apr 2019 04:19:39 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFt5i-0007jk-F1 for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2019 04:19:36 +0000 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 37C2A33D0DC6FDCEEC5D; Mon, 15 Apr 2019 12:19:25 +0800 (CST) Received: from euler.huawei.com (10.175.104.193) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.408.0; Mon, 15 Apr 2019 12:19:15 +0800 From: Wei Li To: , , , , , , , , , , Subject: [RFC PATCH] arm64: no need to make pmr visible immediately Date: Mon, 15 Apr 2019 12:24:34 +0800 Message-ID: <20190415042434.46465-1-liwei391@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.104.193] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190414_211934_844262_4CF59066 X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We don't need to make pmr visible immediately when enabling irq. After removing the "dsb", i did a benchmark and the result shows there is nearly no performance degradation (<1%) when enabling pseudo nmi: Processor: ARMv8 Cortex-A72 (64 Cores), Motherboard: Huawei BC11SPCD (1.58 BIOS), Memory: 16 x 32 GB DDR4-2400MT/s Samsung M393A4K40BB1-CRC, Disk: 4 x 300GB Seagate ST300MM0048 + 2 x 4001GB HUS726040ALA610, Graphics: Huawei Hi1710 [iBMC Intelligent Management chip w/VGA support] OS: EulerOS 2.0, Kernel: 4.19.33-test+ (aarch64), Compiler: GCC 7.3.0, File-System: ext4, Screen Resolution: 800x600 Stream 2013-01-17 Type: Copy MB/s > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 87220 |===================================== 4.19.33-test+ no nmi #1 ..... 88203 |===================================== 4.19.33-test+ no nmi #2 ..... 87590 |===================================== 4.19.33-test+ nmi no dsb #2 . 87003 |==================================== Stream 2013-01-17 Type: Scale MB/s > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 89157 |==================================== 4.19.33-test+ no nmi #1 ..... 90970 |===================================== 4.19.33-test+ no nmi #2 ..... 90089 |===================================== 4.19.33-test+ nmi no dsb #2 . 89601 |==================================== Stream 2013-01-17 Type: Triad MB/s > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 89969 |==================================== 4.19.33-test+ no nmi #1 ..... 92012 |===================================== 4.19.33-test+ no nmi #2 ..... 91287 |===================================== 4.19.33-test+ nmi no dsb #2 . 90475 |==================================== Stream 2013-01-17 Type: Add MB/s > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 89882 |==================================== 4.19.33-test+ no nmi #1 ..... 91343 |===================================== 4.19.33-test+ no nmi #2 ..... 90837 |===================================== 4.19.33-test+ nmi no dsb #2 . 90371 |===================================== 7-Zip Compression 16.02 Compress Speed Test MIPS > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 56894 |===================================== 4.19.33-test+ no nmi #1 ..... 56558 |===================================== 4.19.33-test+ no nmi #2 ..... 54814 |==================================== 4.19.33-test+ nmi no dsb #2 . 55703 |==================================== C-Ray 1.1 Total Time - 4K, 16 Rays Per Pixel Seconds < Lower Is Better 4.19.33-test+ nmi no dsb #1 . 29.19 |=================================== 4.19.33-test+ no nmi #1 ..... 30.70 |===================================== 4.19.33-test+ no nmi #2 ..... 29.73 |==================================== 4.19.33-test+ nmi no dsb #2 . 29.55 |==================================== XZ Compression 5.2.4 Compressing ubuntu-16.04.3-server-i386.img, Compression Level 9 Seconds < Lower Is Better 4.19.33-test+ nmi no dsb #1 . 159 |======================================= 4.19.33-test+ no nmi #1 ..... 158 |======================================= 4.19.33-test+ no nmi #2 ..... 158 |======================================= 4.19.33-test+ nmi no dsb #2 . 158 |======================================= Redis 4.0.8 Test: LPOP Requests Per Second > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 360331 |==================================== 4.19.33-test+ no nmi #1 ..... 352945 |=================================== 4.19.33-test+ no nmi #2 ..... 357336 |==================================== 4.19.33-test+ nmi no dsb #2 . 358403 |==================================== Redis 4.0.8 Test: SADD Requests Per Second > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 444682 |==================================== 4.19.33-test+ no nmi #1 ..... 420772 |================================== 4.19.33-test+ no nmi #2 ..... 433746 |=================================== 4.19.33-test+ nmi no dsb #2 . 420890 |================================== Redis 4.0.8 Test: LPUSH Requests Per Second > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 361561 |==================================== 4.19.33-test+ no nmi #1 ..... 361402 |==================================== 4.19.33-test+ no nmi #2 ..... 347875 |=================================== 4.19.33-test+ nmi no dsb #2 . 355313 |=================================== Redis 4.0.8 Test: GET Requests Per Second > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 490271 |==================================== 4.19.33-test+ no nmi #1 ..... 479466 |=================================== 4.19.33-test+ no nmi #2 ..... 481711 |=================================== 4.19.33-test+ nmi no dsb #2 . 495635 |==================================== Redis 4.0.8 Test: SET Requests Per Second > Higher Is Better 4.19.33-test+ nmi no dsb #1 . 393653 |=================================== 4.19.33-test+ no nmi #1 ..... 392973 |=================================== 4.19.33-test+ no nmi #2 ..... 391346 |=================================== 4.19.33-test+ nmi no dsb #2 . 404225 |==================================== Signed-off-by: Wei Li Link: https://www.spinics.net/lists/arm-kernel/msg719005.html --- arch/arm64/include/asm/irqflags.h | 12 ++++-------- arch/arm64/include/asm/kvm_host.h | 1 - arch/arm64/kernel/entry.S | 2 -- arch/arm64/kvm/hyp/switch.c | 1 - 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h index 7bc6a79f31c4..a670996a6710 100644 --- a/arch/arm64/include/asm/irqflags.h +++ b/arch/arm64/include/asm/irqflags.h @@ -41,10 +41,8 @@ static inline void arch_local_irq_enable(void) { asm volatile(ALTERNATIVE( - "msr daifclr, #2 // arch_local_irq_enable\n" - "nop", - "msr_s " __stringify(SYS_ICC_PMR_EL1) ",%0\n" - "dsb sy", + "msr daifclr, #2 // arch_local_irq_enable", + "msr_s " __stringify(SYS_ICC_PMR_EL1) ",%0", ARM64_HAS_IRQ_PRIO_MASKING) : : "r" ((unsigned long) GIC_PRIO_IRQON) @@ -113,10 +111,8 @@ static inline unsigned long arch_local_irq_save(void) static inline void arch_local_irq_restore(unsigned long flags) { asm volatile(ALTERNATIVE( - "msr daif, %0\n" - "nop", - "msr_s " __stringify(SYS_ICC_PMR_EL1) ", %0\n" - "dsb sy", + "msr daif, %0", + "msr_s " __stringify(SYS_ICC_PMR_EL1) ", %0", ARM64_HAS_IRQ_PRIO_MASKING) : : "r" ((int)flags) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 17541276fcc7..8b912b372378 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -485,7 +485,6 @@ static inline void kvm_arm_vhe_guest_enter(void) */ if (system_uses_irq_prio_masking()) { gic_write_pmr(GIC_PRIO_IRQON); - dsb(sy); } } diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 42ca7d43e040..45eeaf237383 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -279,8 +279,6 @@ alternative_else_nop_endif alternative_if ARM64_HAS_IRQ_PRIO_MASKING ldr x20, [sp, #S_PMR_SAVE] msr_s SYS_ICC_PMR_EL1, x20 - /* Ensure priority change is seen by redistributor */ - dsb sy alternative_else_nop_endif ldp x21, x22, [sp, #S_PC] // load ELR, SPSR diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index c6def1fd7e91..9990aca5191e 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -550,7 +550,6 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu) */ if (system_uses_irq_prio_masking()) { gic_write_pmr(GIC_PRIO_IRQON); - dsb(sy); } vcpu = kern_hyp_va(vcpu);