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=-5.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 A1D87C4338F for ; Wed, 4 Aug 2021 08:54:25 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 12B3660EBC for ; Wed, 4 Aug 2021 08:54:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 12B3660EBC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Gflsq5ZgXz3cW4 for ; Wed, 4 Aug 2021 18:54:23 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=fk37KOcr; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1030; helo=mail-pj1-x1030.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=fk37KOcr; dkim-atps=neutral Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4GflsJ017Vz302G for ; Wed, 4 Aug 2021 18:53:54 +1000 (AEST) Received: by mail-pj1-x1030.google.com with SMTP id b1-20020a17090a8001b029017700de3903so5168654pjn.1 for ; Wed, 04 Aug 2021 01:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=jAaZlMkl00zT0OtQniQ7FZrvBURnMn0WpyG8CxlOJn4=; b=fk37KOcrmxMPrw7cXIiBvrn80IgC1iRB7IkdNmQkax/PkAu2NsEsTirizGutmU0QG3 VOTUOnlbIbIdLU0C4uyIcoRR6n4b/fVNrmKQNEezNIobfi1RL5uwvOj39pFxVgRTEy7H AvGcHpBt8z3iaVpcL+yI3PzBkSXCtI3XLjQQkvm8URA0+/IcP1KxVDb7Xyk2csBABKZ+ OTv00GJ1mmF+6sI5vx+ExobgY5rfNtwZNlDkIr38Dd5SRIl39N6BIHjCT7AfiPFL/gqH Y5n/jMA4zpg1cXov+VHFc1ZKEG6zqaiOIa2bttWvHaATHK+M8V1EEGMEaPbbEaP1hTA0 oNdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=jAaZlMkl00zT0OtQniQ7FZrvBURnMn0WpyG8CxlOJn4=; b=oBz1/nQUY6JiS6keSPSHzeslkTbta9LfkwynBxpXVkzjLt/VBdvr0SeojHRmvG0Oih vUp21i6t89MG7PxIAcsyG83bhgmV0g76Pw0Yh6dORG7VNNUvo8YrMWaB05p7wVdgHHmc y5DCKtFbRn8N7fF0N3Shj5aW1mKQsaRWI4fgpTQmXe1B9djKTQm5Ly+APzfwmRZ5YOUJ 1Ix1MnQk37riwcQtQmP9SHfU8IK33xv6oXb5PmzuZT3iwTVOpVX4EA8dyt940kxjfjnf FwsSD9ALUqETROSpXxtqrja0AKkTJb3kJL1SXwMgx0KZUXhaVMxKz+NvwcQ2/cmLQZNm HnYA== X-Gm-Message-State: AOAM532f+oVJXgDugTGi4bRP5L8oQQl4GQr9oxDDn0rsiLdsTtcyCQso 2fZnboO1au0S6TzCuKDPhCQ= X-Google-Smtp-Source: ABdhPJwcXvw0oSoxqi2MuD7Y5yzBqeL8SRppbr8D0zPLRVYAgmrTaQA5Pd9K8CuLIjyynNaYi0XY+Q== X-Received: by 2002:a17:902:b78b:b029:12c:6f89:51aa with SMTP id e11-20020a170902b78bb029012c6f8951aamr21910891pls.3.1628067232884; Wed, 04 Aug 2021 01:53:52 -0700 (PDT) Received: from localhost (60-242-181-102.static.tpgi.com.au. [60.242.181.102]) by smtp.gmail.com with ESMTPSA id u13sm1893006pfh.123.2021.08.04.01.53.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 01:53:52 -0700 (PDT) Date: Wed, 04 Aug 2021 18:53:47 +1000 From: Nicholas Piggin Subject: Re: [PATCH] powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare() To: Benjamin Herrenschmidt , Christophe Leroy , Michael Ellerman , Paul Mackerras References: <1628064412.48kzr1eula.astroid@bobo.none> In-Reply-To: MIME-Version: 1.0 Message-Id: <1628067212.yli25q0lwj.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Excerpts from Christophe Leroy's message of August 4, 2021 6:37 pm: >=20 >=20 > Le 04/08/2021 =C3=A0 10:08, Nicholas Piggin a =C3=A9crit=C2=A0: >> Excerpts from Christophe Leroy's message of August 4, 2021 3:27 pm: >>> 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 >>=20 >> Probably okay to do now things are ironing out. >>=20 >> Unless we want to make a new define for interrupt handler debug and put >> a bunch of these asserts under it. There's quite a lot more here, and >> in asm/interrupt.h, etc. >=20 > But that one is so trivial that I'm not sure there is any point in keepin= g it even as a kind of=20 > additional DEBUG level, unless you want those BUG_ONs because you don't t= rust the compiler. Fair point. Acked-by: Nicholas Piggin