From patchwork Wed Jul 17 08:43:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11047469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4012C6C5 for ; Wed, 17 Jul 2019 08:44:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D23C286AC for ; Wed, 17 Jul 2019 08:44:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FBA128716; Wed, 17 Jul 2019 08:44:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C9847286AC for ; Wed, 17 Jul 2019 08:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date: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=QBBX192oDGMOD6M4FSEJHhJe29YPPAL+jiiHq0gVlR4=; b=CXYEfZOS46c5FI 63FbAt4DJ7MWjlLfEJviVB0HdDbAenN3OoXHd7P3r4p1jsJArYDhZS38R6RTRN7r1Z+Pqn1KvUIVa gCM4jWlhAPGjdSPy0PpFuYVik3XhL+QG0pMJe/jMJLUcAc80mA6rEGc6tJYlrhchPp7EQQ7ktGi86 6iHYqsnrrnlGH0gYS1WPZph7x2ruJPV4maXClakPdd3L20+yYOikoyWqyLfnejMPzjYeEKNamv6Wh 1tR076bVzT2lJl0lCi0Z39H3EpO8ZIwL4X75cAivw+MhnlVAw7K9YU2FwXPthWZYmQsuhkdnnESh7 kZzT61/0MT2hmeAiKGTQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hnfXl-00038I-GL; Wed, 17 Jul 2019 08:44:09 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hnfXh-0002wC-DU for linux-arm-kernel@lists.infradead.org; Wed, 17 Jul 2019 08:44:07 +0000 Received: from pd9ef1cb8.dip0.t-ipconnect.de ([217.239.28.184] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hnfXc-0000rM-8D; Wed, 17 Jul 2019 10:44:00 +0200 Date: Wed, 17 Jul 2019 10:43:59 +0200 (CEST) From: Thomas Gleixner To: LAK Subject: [PATCH] arm64: Avoid pointless schedule_preempt_irq() invocations Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190717_014405_599756_63EE4A50 X-CRM114-Status: GOOD ( 10.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Zijlstra , Catalin Marinas , Will Deacon , LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When preempt_count is zero on return from interrupt then schedule_preempt_irq() is invoked even if TIF_NEED_RESCHED is not set. That does not make sense because schedule_preempt_irq() has to go through a full __schedule() for nothing in that case. Check TIF_NEED_RESCHED and invoke schedule_preempt_irq() only if set. Signed-off-by: Thomas Gleixner --- Found while staring at some RT wrecakge in that area. --- arch/arm64/kernel/entry.S | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -680,6 +680,10 @@ alternative_if ARM64_HAS_IRQ_PRIO_MASKIN orr x24, x24, x0 alternative_else_nop_endif cbnz x24, 1f // preempt count != 0 || NMI return path + + ldr x0, [tsk, #TSK_TI_FLAGS] // get flags + tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? + bl preempt_schedule_irq // irq en/disable is done inside 1: #endif