From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB57EC4338F for ; Wed, 25 Aug 2021 06:56:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B437B61052 for ; Wed, 25 Aug 2021 06:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238542AbhHYG44 (ORCPT ); Wed, 25 Aug 2021 02:56:56 -0400 Received: from ozlabs.org ([203.11.71.1]:54381 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232273AbhHYG4v (ORCPT ); Wed, 25 Aug 2021 02:56:51 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4GvcFc43ytz9sRf; Wed, 25 Aug 2021 16:56:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1629874565; bh=jSlsrM1HwMJvkNNLTTYatOR6fzYRjXvzYjOwr9yNskQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=aCB2aXtlQfFCgiUkftH6/Do/ODK3fAMwydmKyqU4Qs/jlULSY4ST4uY/SN7FgNRZf D2VriOe51K+kzhkcDehiISDHUD1T3NltEfnSI0gslH8WXsZoimlPZ0/eII3DO/1slt gnbd1P3fZuPKP3dRxX0xEKu4nZYG82nmfaRm8YWXq921tg6+KAacsjqQUM36jT1vaS 9JW8ScwrUy8UUJ1/JPjfmspves05/kq1sDkCXhrCWBmJxHNsTQ1rItG/dis+Yw+5CG Zpa/1JiUMbKQSvIY02jLgn0sxQx1EmZeKh485JNT9peMbi7v8SQnYRxuk8B0+xwCYG phIfScszNAVzw== From: Michael Ellerman To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , npiggin@gmail.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v3 1/3] powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare() In-Reply-To: References: <385ead49ccb66a259b25fee3eebf0bd4094068f3.1629707037.git.christophe.leroy@csgroup.eu> <87zgt6aybp.fsf@mpe.ellerman.id.au> Date: Wed, 25 Aug 2021 16:56:01 +1000 Message-ID: <87wnoaau7y.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy writes: > Le 25/08/2021 =C3=A0 07:27, Michael Ellerman a =C3=A9crit=C2=A0: >> Christophe Leroy writes: >>> In those hot functions that are called at every interrupt, any saved >>> cycle is worth it. >>> >>> interrupt_exit_user_prepare() and interrupt_exit_kernel_prepare() are >>> called from three places: >>> - From entry_32.S >>> - From interrupt_64.S >>> - From interrupt_exit_user_restart() and interrupt_exit_kernel_restart() >>> >>> In entry_32.S, there are inambiguously called based on MSR_PR: >>> >>> interrupt_return: >>> lwz r4,_MSR(r1) >>> addi r3,r1,STACK_FRAME_OVERHEAD >>> andi. r0,r4,MSR_PR >>> beq .Lkernel_interrupt_return >>> bl interrupt_exit_user_prepare >>> ... >>> .Lkernel_interrupt_return: >>> bl interrupt_exit_kernel_prepare >>> >>> In interrupt_64.S, that's similar: >>> >>> interrupt_return_\srr\(): >>> ld r4,_MSR(r1) >>> andi. r0,r4,MSR_PR >>> beq interrupt_return_\srr\()_kernel >>> interrupt_return_\srr\()_user: /* make backtraces match the _kernel va= riant */ >>> addi r3,r1,STACK_FRAME_OVERHEAD >>> bl interrupt_exit_user_prepare >>> ... >>> interrupt_return_\srr\()_kernel: >>> addi r3,r1,STACK_FRAME_OVERHEAD >>> bl interrupt_exit_kernel_prepare >>> >>> In interrupt_exit_user_restart() and interrupt_exit_kernel_restart(), >>> MSR_PR is verified respectively by BUG_ON(!user_mode(regs)) and >>> BUG_ON(user_mode(regs)) prior to calling interrupt_exit_user_prepare() >>> and interrupt_exit_kernel_prepare(). >>> >>> The verification in interrupt_exit_user_prepare() and >>> interrupt_exit_kernel_prepare() are therefore useless and can be remove= d. >>> >>> Signed-off-by: Christophe Leroy >>> Acked-by: Nicholas Piggin >>> --- >>> arch/powerpc/kernel/interrupt.c | 2 -- >>> 1 file changed, 2 deletions(-) >>=20 >> I'll pick this one up independent of the other two patches. > > Second patch should be ok as well, no ? Yeah I guess. I'm not sure if we'll want to keep cpu_has_msr_ri() if we have a CONFIG_PPC_MSR_RI, but that's a pretty minor detail. So yeah I'll take patch 2 as well. cheers