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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD30EC77B7E for ; Fri, 26 May 2023 02:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=/uoUqiCFQr+plfCM05DbTHW0uh3DEv14N36jW+Vu5Lw=; b=EwlRFkwGGnGda/ aeTYp7V67MDQbDjZK9pcXBWpnv1WqZV3uKXugLCQuTF1O/Kpf0/HMXXC188hpxcPKMfmk+iNEogxq nqo8JtZS/rkiWu/YzuV9ZiFapqapBeAPoupz+vuW48DFmqv65b4sBKNlYXuBnktjedsbdobgyX3Bz nt2Xg3l+9IRaeZTaQU9h8jDepWI0BKpJ8iIHC+V57iyiXTyvDAEdWCGpUHJY1WVyhH9CFOoSwAC21 m1eO4MvJz+6ZQjrwRM9ipMANp/v4YPNpZsBJLc22kskTBa1k0jL//NTIzlREiZTgpAPQi9Ra7rITN XjGN9Io4/JBUyDMe4JRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q2NVT-000nGU-1u; Fri, 26 May 2023 02:48:43 +0000 Received: from smtpbg150.qq.com ([18.132.163.193]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2NVP-000nDH-0A for linux-arm-kernel@lists.infradead.org; Fri, 26 May 2023 02:48:41 +0000 X-QQ-mid: bizesmtp70t1685069241tg9eukbg Received: from localhost.localdomain ( [113.200.76.118]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 26 May 2023 10:47:19 +0800 (CST) X-QQ-SSF: 01400000000000D0H000000A0000020 X-QQ-FEAT: bxl6T7YCY0tGWntTJOeKyNLVzmvBNeDWB6wwqMpDJPQoaPHUEBJoKI2Vo1gkF 81fZjsq6OQJQALRQXfRt4A4zAzf/9wfp8gFaHzvoeZGmlSo2rachYrMOIE9GslYO5Ocm2Ao kA+pNMZwdx7iB9ypOhyhLOas9/b/lUhZpYi9mKMPSy7psfdL/mE5Ltphtyexe4+yqfEnCwH 047VQEuJdQA/U9tPGniMSP6HZ/TSM45vb8xwzp9YFIT8c22nIhk3msTmoyhawahmffYj9v/ d6OwCjDnD/wClvUllxFSXDhj+Etu75fagp0naTyvEgTUM0iu8czWqtyLz83lpRaq909x6Zc okIMQmBmQ/Rq5Nw2i67rD/yzjmqL0r+TotnHI3xeKjMg+2ozOfFUJEY1hGfDQ== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 14127560699008684279 From: Guo Hui To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org Cc: keescook@chromium.org, broonie@kernel.org, yury.norov@gmail.com, gregkh@linuxfoundation.org, Jason@zx2c4.com, wangxiaohua@uniontech.com, Guo Hui Subject: [PATCH] arm64: syscall: unmask DAIF for tracing status Date: Fri, 26 May 2023 10:47:15 +0800 Message-Id: <20230526024715.8773-1-guohui@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybglogicsvrsz:qybglogicsvrsz4a-0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230525_194839_662878_244F113A X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The following code: static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, const syscall_fn_t syscall_table[]) { ... if (!has_syscall_work(flags) && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) { local_daif_mask(); flags = read_thread_flags(); -------------------------------- A if (!has_syscall_work(flags) && !(flags & _TIF_SINGLESTEP)) return; local_daif_restore(DAIF_PROCCTX); } trace_exit: syscall_trace_exit(regs); ------- B } 1. The flags in the if conditional statement should be used in the same way as the flags in the function syscall_trace_exit, because DAIF is not shielded in the function syscall_trace_exit, so when the flags are obtained in line A of the code, there is no need to shield DAIF. Don't care about the modification of flags after line A. 2. Masking DAIF caused syscall performance to deteriorate by about 10%. The Unixbench single core syscall performance data is as follows: Machine: Kunpeng 920 Mask DAIF: System Call Overhead 1172314.1 lps (10.0 s, 7 samples) System Benchmarks Partial Index BASELINE RESULT INDEX System Call Overhead 15000.0 1172314.1 781.5 ======== System Benchmarks Index Score (Partial Only) 781.5 Unmask DAIF: System Call Overhead 1287944.6 lps (10.0 s, 7 samples) System Benchmarks Partial Index BASELINE RESULT INDEX System Call Overhead 15000.0 1287944.6 858.6 ======== System Benchmarks Index Score (Partial Only) 858.6 Signed-off-by: Guo Hui --- arch/arm64/kernel/syscall.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c index da84cf855c44..5a668d7f3c1f 100644 --- a/arch/arm64/kernel/syscall.c +++ b/arch/arm64/kernel/syscall.c @@ -147,11 +147,9 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, * exit regardless, as the old entry assembly did. */ if (!has_syscall_work(flags) && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) { - local_daif_mask(); flags = read_thread_flags(); if (!has_syscall_work(flags) && !(flags & _TIF_SINGLESTEP)) return; - local_daif_restore(DAIF_PROCCTX); } trace_exit: -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel