From patchwork Thu Jan 31 18:23:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Schneider X-Patchwork-Id: 10791151 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 0AFD291E for ; Thu, 31 Jan 2019 18:24:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01392283B2 for ; Thu, 31 Jan 2019 18:24:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E98B4283BF; Thu, 31 Jan 2019 18:24:02 +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 3D235283BD for ; Thu, 31 Jan 2019 18:24:02 +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:Date:Subject:To :From: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=hw+rbOgjBn9yK2vzPllBRFsH4So8l9nxFGosWnO7hxY=; b=b9KOj23WNrMqTD ohgLH5RzXpeLtoXwvFrVUGtH8pgqN73a0TxrWLqr8JbT9d4qQZ4JBS0ljD+whS/td/c4TkdKhTl1h iDASCsVJnokYhVt+dLLENEauEHEr6L401XNkVmPLDqQiyXpitgevpC34kHbiWdEAMhGdcyp8dNO4P /4JfC+5ducx+/kcx94JaHZ0feKFwGsCpOscMJRgHMY4I/1+5xSaqs2hJPOk0C7AVWYhURsPasGBt/ ETpWc/7x48paDHvrs65iaQDDHBb+zWV4GL0gII6lRko9ZMfqWlM8Apkj/NCqHaXN8jsuGgebkzma7 lzCvoj/9pMRP/9d89nUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gpH0K-0003wz-Mo; Thu, 31 Jan 2019 18:24:00 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gpH0H-0003wA-5q for linux-arm-kernel@lists.infradead.org; Thu, 31 Jan 2019 18:23:58 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 16EAEA78; Thu, 31 Jan 2019 10:23:55 -0800 (PST) Received: from e113632-lin.cambridge.arm.com (e113632-lin.cambridge.arm.com [10.1.194.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8DA963F59C; Thu, 31 Jan 2019 10:23:52 -0800 (PST) From: Valentin Schneider To: linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/3] arm/arm64: entry: Remove need_resched() loop Date: Thu, 31 Jan 2019 18:23:36 +0000 Message-Id: <20190131182339.9835-1-valentin.schneider@arm.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190131_102357_225533_424A324D X-CRM114-Status: GOOD ( 10.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Jonathan Corbet , linux-doc@vger.kernel.org, Marc Zyngier , Catalin Marinas , Julien Thierry , Will Deacon , Russell King , Peter Zijlstra , Julien Grall , Ingo Molnar , Thomas Gleixner , linux-arm-kernel@lists.infradead.org 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 A while back (before [1]), i386 had this in the tail of its irq handling code: need_resched: movl TI_flags(%ebp), %ecx # need_resched set ? testb $_TIF_NEED_RESCHED, %cl jz restore_all testl $IF_MASK,EFLAGS(%esp) # interrupts off (exception path) ? jz restore_all sti call preempt_schedule cli movl $0,TI_preempt_count(%ebp) jmp need_resched preempt_schedule() already had an inner need_resched() loop introduced by commit 4d0b85ea4610 ("[PATCH] kernel preemption bits (2/2)") and the outer loop was needed since, as the above commit explains, it was possible to return from preempt_schedule(), get an interrupt and have need_resched() true. This was eventually changed when preempt_schedule_irq() was introduced by [1]: commit b268264c6299 ("[PATCH] sched: fix preemption race (Core/i386)") which moved the enabling & disabling of interrupts inside the then new preempt_schedule_irq(). From then on, the arch-code loop was no longer necessary, providing preempt_schedule_irq() was used. This was talked over on LKML in [2]. It's worth noting that it seems most archs calling preempt_schedule_irq() have that outer loop, and for most of them it really looks like they could get rid of it as well. FWIW the suspects are $ grep -r -I "preempt_schedule_irq" arch/ | cut -d/ -f2 | sort | uniq arc arm arm64 c6x csky h8300 ia64 m68k microblaze mips nds32 nios2 parisc powerpc s390 sh sparc x86 xtensa - Patches 1-2 remove the loop for arm & arm64 - Patch 3 adds a bit of documentation to point out the loop isn't needed to try and spread the word. [2]: https://lore.kernel.org/lkml/cc989920-a13b-d53b-db83-1584a7f53edc@arm.com/ Valentin Schneider (3): arm64: entry: Remove unneeded need_resched() loop ARM: entry: Remove unneeded need_resched() loop sched/Documentation: Point out use of preempt_schedule_irq() Documentation/scheduler/sched-arch.txt | 10 ++++++++++ arch/arm/kernel/entry-armv.S | 12 +----------- arch/arm64/kernel/entry.S | 11 +---------- 3 files changed, 12 insertions(+), 21 deletions(-) --- 2.20.1