Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp534226pxb; Tue, 9 Feb 2021 06:38:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxt/4/MKELPJUzmLybXYwHL7dCuRyfJaHRaXAyN8Lm6T+rUD+nlJqbZmrw01SMm0k+lI8OW X-Received: by 2002:a05:6402:1342:: with SMTP id y2mr23605444edw.105.1612881529514; Tue, 09 Feb 2021 06:38:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612881529; cv=none; d=google.com; s=arc-20160816; b=tcoUDcC8Gsik3fACc0pW1VrJ06YaQ4rQaPol5Irq+eoriQ8XaKyhnwU58mHuisx43j 8//1Sb+331QicNd0AtMEmLsNIBBvJN/sh8FiuwxuUXv32x+Bk5B7RkpeUYHo4ipqjcPK XzeYukl/sVk0uX9vs4fLm7pSkS6pO/30ENH/vNRhLd3VZwWdkhPt47z5TMMGq5vD3/hM agkj6bbVxxf7bboi9cgJE8MvMw5Bc8T6kWWKNefCgjM9kxuobiJZUhM8msqF6iA9yNLy YpMhykn732wYHJN1/mUQyZYyAajJEOeerUNqoEazO2E/FAM1mgz7JuY9TfmRZvr/PHal 8dwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=BCcKG2UhqfeETljF21X5d3Q/XPEyjnvGHxn5gCchifI=; b=iw9UeXDq4Yc3qH0W/diChsQn3vUwle5rcXCPnTu3E7jvbW999mRwfewWku0LyyAqWA IJdWP98tUL/xOhW9srEwTLNN+a4KIfWkl19YwJVqhYo2NNtkQSyggwbHbBLE99uyB0EN MJu2V3R/W1/MZfDZPogSyMCEKCOMHWjKynRZhSD75LQVmBYFimlhQIpxMT8x5XoQJpq0 WWthP4ESY4QpeI34FbU0H3F/sgW7dYtcdkhsU9Il3FwzXt/c0EchT98aDo2k+PU16vsW M9hOKnKnTpV/0egTK/Nv7CoXK5iL9X+4NjkM2/9NO/0EFOJxO89ERKemvRe+d9rHyJzv E7AA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r23si16645421edy.113.2021.02.09.06.38.26; Tue, 09 Feb 2021 06:38:49 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbhBIOen (ORCPT + 99 others); Tue, 9 Feb 2021 09:34:43 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:56019 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232111AbhBIOdE (ORCPT ); Tue, 9 Feb 2021 09:33:04 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4DZlhv0RfBz9v4gr; Tue, 9 Feb 2021 15:32:15 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id fOs53EM4PmCr; Tue, 9 Feb 2021 15:32:14 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4DZlht6RVKz9v4gp; Tue, 9 Feb 2021 15:32:14 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 489CD8B764; Tue, 9 Feb 2021 15:32:16 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id t8r2w_52bFFl; Tue, 9 Feb 2021 15:32:16 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BCB058B7E7; Tue, 9 Feb 2021 15:32:15 +0100 (CET) Subject: Re: [PATCH v5 19/22] powerpc/syscall: Optimise checks in beginning of system_call_exception() To: Nicholas Piggin , Benjamin Herrenschmidt , Michael Ellerman , msuchanek@suse.de, Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <3e48bb439357c6f72ae4343bf93bd29f0980eeb1.1612796617.git.christophe.leroy@csgroup.eu> <1612836170.502t0sssvi.astroid@bobo.none> From: Christophe Leroy Message-ID: Date: Tue, 9 Feb 2021 15:32:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <1612836170.502t0sssvi.astroid@bobo.none> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 09/02/2021 à 03:06, Nicholas Piggin a écrit : > Excerpts from Christophe Leroy's message of February 9, 2021 1:10 am: >> Combine all tests of regs->msr into a single logical one. > > Okay by me unless we choose to do the config option and put these all > under it. I think I would prefer that because sometimes the registers > are in a state you can't easily see what the values in the expression > were. In this case it doesn't matter so much because they should be in > regs in the interrupt frame. Yes indeed. I reword the commit log and tell that. > > Thanks, > Nick > >> >> Before the patch: >> >> 0: 81 6a 00 84 lwz r11,132(r10) >> 4: 90 6a 00 88 stw r3,136(r10) >> 8: 69 60 00 02 xori r0,r11,2 >> c: 54 00 ff fe rlwinm r0,r0,31,31,31 >> 10: 0f 00 00 00 twnei r0,0 >> 14: 69 63 40 00 xori r3,r11,16384 >> 18: 54 63 97 fe rlwinm r3,r3,18,31,31 >> 1c: 0f 03 00 00 twnei r3,0 >> 20: 69 6b 80 00 xori r11,r11,32768 >> 24: 55 6b 8f fe rlwinm r11,r11,17,31,31 >> 28: 0f 0b 00 00 twnei r11,0 >> >> After the patch: >> >> 0: 81 6a 00 84 lwz r11,132(r10) >> 4: 90 6a 00 88 stw r3,136(r10) >> 8: 7d 6b 58 f8 not r11,r11 >> c: 71 6b c0 02 andi. r11,r11,49154 >> 10: 0f 0b 00 00 twnei r11,0 >> >> 6 cycles less on powerpc 8xx (328 => 322 cycles). >> >> Signed-off-by: Christophe Leroy >> --- >> arch/powerpc/kernel/interrupt.c | 10 +++++++--- >> 1 file changed, 7 insertions(+), 3 deletions(-) >> >> diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c >> index 55e1aa18cdb9..8c38e8c95be2 100644 >> --- a/arch/powerpc/kernel/interrupt.c >> +++ b/arch/powerpc/kernel/interrupt.c >> @@ -28,6 +28,7 @@ notrace long system_call_exception(long r3, long r4, long r5, >> unsigned long r0, struct pt_regs *regs) >> { >> syscall_fn f; >> + unsigned long expected_msr; >> >> regs->orig_gpr3 = r3; >> >> @@ -39,10 +40,13 @@ notrace long system_call_exception(long r3, long r4, long r5, >> >> trace_hardirqs_off(); /* finish reconciling */ >> >> + expected_msr = MSR_PR; >> if (!IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x)) >> - BUG_ON(!(regs->msr & MSR_RI)); >> - BUG_ON(!(regs->msr & MSR_PR)); >> - BUG_ON(arch_irq_disabled_regs(regs)); >> + expected_msr |= MSR_RI; >> + if (IS_ENABLED(CONFIG_PPC32)) >> + expected_msr |= MSR_EE; >> + BUG_ON((regs->msr & expected_msr) ^ expected_msr); >> + BUG_ON(IS_ENABLED(CONFIG_PPC64) && arch_irq_disabled_regs(regs)); >> >> #ifdef CONFIG_PPC_PKEY >> if (mmu_has_feature(MMU_FTR_PKEY)) { >> -- >> 2.25.0 >> >>