Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3477755pxj; Tue, 15 Jun 2021 01:37:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwugjn8uegXcnul8yYij2AGzt3MFVbcuAPwQ+mGJblj5IqId9xhx+a44gEyVvXLML65VTlm X-Received: by 2002:a17:906:4f91:: with SMTP id o17mr19793942eju.219.1623746223260; Tue, 15 Jun 2021 01:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623746223; cv=none; d=google.com; s=arc-20160816; b=Wo6pPgwQmzizZrDOSfMm46FPvcFO4DLkn61j83WvylrmEv0EsqJkzoWkEfyYxrner4 6yPbkccrtvFdiHnqVDb3nyiWEFmDpRQyMAnS/Q7ECJ+SOBtVvm70KVJ3bQ70FqQmS0v0 o9zgVaQQCFG+4UU4FR7eX0FrrhhDz4whteMepeY+0f9rXBUTebsXIqA9NHTZ9DcGrjCo 2tRvNF4buytlHeROqKdO149qvAPh3+v+CPXW4ojDd4PjoIfAF86EalTzM+VVjzpbiQ8E xYNf1aBrzZVYdeyrburPEd6zRkkLm0SVt4l0uKZIVHJ93rc/m1KiRUkKMb2IJ3iwA7Pg f+fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:references:in-reply-to :message-id; bh=qhHG0ig2upSUP0ivXqcLGRu5k85TW0/nGQgRfNKDc3M=; b=CB65Zs8xLdIGMr25xeDsNUVPgom64eI55vz+aqSVBEyFm1vqRZyvo2Ppa1wrqXIUku 6MukfsA2qkQSVYpcakI+lxqNpaMVyx8O60C7sqUF7cHJeOGon21na1jxGemtjyXL7LZ/ TkOkqvkm+je9+/3STEU/om8dTfqkYXkkpLgGTMDbRK0YzsgWdrEO7Qh3y14wqMNiylnh vsrP/Fkx9WQQPB9t6F9nNRR9UkjNZGBYYfPuGhS2nqnHSsIP35IbdnYjeh9MFhQSczvh inwxb/kAg2DsUz4H04wm9iD7UUnLdAnat3bmQzyQBy0ENk1Zw/B/ylFpSRW/1A7Pv0rt Bwww== 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 se21si16456001ejb.114.2021.06.15.01.36.41; Tue, 15 Jun 2021 01:37:03 -0700 (PDT) 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 S231224AbhFOIfj (ORCPT + 99 others); Tue, 15 Jun 2021 04:35:39 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:23497 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231193AbhFOIfh (ORCPT ); Tue, 15 Jun 2021 04:35:37 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4G41mj0mBDzB8nN; Tue, 15 Jun 2021 10:33:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D0bhppiUnCbn; Tue, 15 Jun 2021 10:33:25 +0200 (CEST) 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 4G41mg5w40zB8hP; Tue, 15 Jun 2021 10:33:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B9B2E8B7A5; Tue, 15 Jun 2021 10:33:23 +0200 (CEST) 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 vWn6E5pBcIEZ; Tue, 15 Jun 2021 10:33:23 +0200 (CEST) Received: from po9473vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7F8438B7B5; Tue, 15 Jun 2021 10:33:23 +0200 (CEST) Received: by po9473vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 5BA0966264; Tue, 15 Jun 2021 08:33:23 +0000 (UTC) Message-Id: <65529943d40f82efb3a9c0d1ab4cdd542f0ca163.1623745949.git.christophe.leroy@csgroup.eu> In-Reply-To: <8071cd2e2f2bdc0711e6ac435dff4a09ff21fee2.1623745949.git.christophe.leroy@csgroup.eu> References: <8071cd2e2f2bdc0711e6ac435dff4a09ff21fee2.1623745949.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH v3 3/5] powerpc/interrupt: Interchange prep_irq_for_{kernel_enabled/user}_exit() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , npiggin@gmail.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 15 Jun 2021 08:33:23 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org prep_irq_for_user_exit() is a superset of prep_irq_for_kernel_enabled_exit(). In order to allow refactoring in following patch, interchange the two. This will allow prep_irq_for_user_exit() to call a renamed version of prep_irq_for_kernel_enabled_exit(). Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- arch/powerpc/kernel/interrupt.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c index b9558372adc0..9780c26f19cf 100644 --- a/arch/powerpc/kernel/interrupt.c +++ b/arch/powerpc/kernel/interrupt.c @@ -46,27 +46,28 @@ static inline bool exit_must_hard_disable(void) * This should be called with local irqs disabled, but if they were previously * enabled when the interrupt handler returns (indicating a process-context / * synchronous interrupt) then irqs_enabled should be true. + * + * restartable is true then EE/RI can be left on because interrupts are handled + * with a restart sequence. */ -static notrace __always_inline bool prep_irq_for_user_exit(void) +static notrace __always_inline bool prep_irq_for_kernel_enabled_exit(bool restartable) { - user_enter_irqoff(); /* This must be done with RI=1 because tracing may touch vmaps */ trace_hardirqs_on(); #ifdef CONFIG_PPC32 __hard_EE_RI_disable(); #else - if (exit_must_hard_disable()) + if (exit_must_hard_disable() || !restartable) __hard_EE_RI_disable(); /* This pattern matches prep_irq_for_idle */ if (unlikely(lazy_irq_pending_nocheck())) { - if (exit_must_hard_disable()) { + if (exit_must_hard_disable() || !restartable) { local_paca->irq_happened |= PACA_IRQ_HARD_DIS; __hard_RI_enable(); } trace_hardirqs_off(); - user_exit_irqoff(); return false; } @@ -74,28 +75,26 @@ static notrace __always_inline bool prep_irq_for_user_exit(void) return true; } -/* - * restartable is true then EE/RI can be left on because interrupts are handled - * with a restart sequence. - */ -static notrace __always_inline bool prep_irq_for_kernel_enabled_exit(bool restartable) +static notrace __always_inline bool prep_irq_for_user_exit(void) { + user_enter_irqoff(); /* This must be done with RI=1 because tracing may touch vmaps */ trace_hardirqs_on(); #ifdef CONFIG_PPC32 __hard_EE_RI_disable(); #else - if (exit_must_hard_disable() || !restartable) + if (exit_must_hard_disable()) __hard_EE_RI_disable(); /* This pattern matches prep_irq_for_idle */ if (unlikely(lazy_irq_pending_nocheck())) { - if (exit_must_hard_disable() || !restartable) { + if (exit_must_hard_disable()) { local_paca->irq_happened |= PACA_IRQ_HARD_DIS; __hard_RI_enable(); } trace_hardirqs_off(); + user_exit_irqoff(); return false; } -- 2.25.0