Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E53FEC433EF for ; Fri, 3 Dec 2021 10:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Wcca04WQzmL8Hn+UtjZn4l12i4iVvzyhDJ479fxlbe8=; b=jYbQCNPLC52/p4DQPG0QN7Z87Z rY2kHQBsFcd3UsqxJVahi6/dpEMYaBjMTOCFnUkaYTkPCAYcp++cnfvxl6hQ82YGO+gkR9Nlb7KKX 4cqBvdQMpj0yrgQ5+p9DlRAZmVH76PtcRuhkGjN4k2AyoIi+4elhHSSPVSDMI75j/CgJxSKZDd4Ej uPdjHU+cu2X2i/0OEJ52ZHp4ihwMccyrJ2NcvxGX6DQeLdHrbM97xuHG73NSMf7Gdup4bwYUtTlyq Wf2a8B8ZbXH/7lh+zzaIycXyIbXFTeZPttvCnqIojIJot9xEitOnfBVmdwLXcwxCi7omgEX99yYJJ M5lKCnXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt65p-00FEPG-Kv; Fri, 03 Dec 2021 10:47:05 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt65l-00FEOd-JU for linux-arm-kernel@lists.infradead.org; Fri, 03 Dec 2021 10:47:03 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 77E0A1595; Fri, 3 Dec 2021 02:47:00 -0800 (PST) Received: from [10.57.0.218] (unknown [10.57.0.218]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E30023F5A1; Fri, 3 Dec 2021 02:46:57 -0800 (PST) Subject: Re: [PATCH v3 00/14] ARM: enable IRQ stacks and vmap'ed stacks for UP To: Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: Nicolas Pitre , Arnd Bergmann , Kees Cook , Keith Packard , Linus Walleij , Nick Desaulniers , Tony Lindgren , Marc Zyngier , Jesse Taube References: <20211203100903.334206-1-ardb@kernel.org> From: Vladimir Murzin Message-ID: <2641910b-9908-b1d2-510d-5a2e5472722d@arm.com> Date: Fri, 3 Dec 2021 10:46:59 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20211203100903.334206-1-ardb@kernel.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211203_024701_785432_7C58CD30 X-CRM114-Status: GOOD ( 33.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 12/3/21 10:08 AM, Ard Biesheuvel wrote: > First, enable the use of the TLS register to hold the 'current' pointer > for all configurations that can support it, including non-SMP ones that > target v6k or later CPUs, and multi-platform SMP ones that also support > v6 based UP systems. > > The remaining configurations are all strictly UP, which means we can > switch to a global variable to hold the current pointer. By doing this, > we can enable THREAD_INFO_IN_TASK, which moves thread info off the > stack, protecting it from overflows. It also permits us to enable IRQ > stacks and vmap'ed stacks for UP configurations as well. > > Supporting v6 cores without SMP extensions in SMP configurations (e.g., > omap2plus_defconfig or imx_v6_v7_defconfig) makes this a bit tricky, and > this is a feature we may consider dropping entirely in the future. But > for the time being, we can support this mode as well. > > The accesses to the global variable holding 'current' are constructed in > a way that ensures that no literal pool accesses (and associated D-cache > misses) are needed unless the access is from a module and module PLTs > are enabled. This means that accessing 'current' is just as costly as > before, as it used to require some arithmetic involving the stack > pointer and a load from the thread_info::task field. > > However, accessing thread_info itself now also involves a load, although > it should be noted that all thread_info and current accesses now go via > the same variable, which is therefore expected to be hot in the caches > at all times. > > Changes since v2: > - support THREAD_INFO_IN_TASK and the IRQ stack on v7m as well, > - incorporate a v7m cleanup from Vladimir to enable the above, > - avoid declaring smp_on_up globally, > - fix an oversight in the IOP32x IRQ #0 fix > - add some more acks > > Changes since RFC/v1: > - add five preparatory patches that move RiscPC, IOP32x and Footbridge > to GENERIC_IRQ_MULTI_HANDLER so that even these ancient platforms can > benefit from the IRQ stacks changes for UP that this series proposes > (contributed by Arnd) > - fix various issues related to SMP+v6 corner cases that were caught by > kernelci testing; > - add acks from Nico and Linus (thanks!) > > Cc: Russell King > Cc: Nicolas Pitre > Cc: Arnd Bergmann > Cc: Kees Cook > Cc: Keith Packard > Cc: Linus Walleij > Cc: Nick Desaulniers > Cc: Tony Lindgren > Cc: Marc Zyngier > Cc: Vladimir Murzin > Cc: Jesse Taube > > Ard Biesheuvel (8): > ARM: entry: preserve thread_info pointer in switch_to > ARM: module: implement support for PC-relative group relocations > ARM: assembler: add optimized ldr/str macros to load variables from > memory > ARM: percpu: add SMP_ON_UP support > ARM: use TLS register for 'current' on !SMP as well > ARM: smp: defer TPIDRURO update for SMP v6 configurations too > ARM: implement THREAD_INFO_IN_TASK for uniprocessor systems > ARM: v7m: enable support for IRQ stacks > > Arnd Bergmann (5): > ARM: riscpc: use GENERIC_IRQ_MULTI_HANDLER > ARM: footbridge: use GENERIC_IRQ_MULTI_HANDLER > ARM: iop32x: offset IRQ numbers by 1 > ARM: iop32x: use GENERIC_IRQ_MULTI_HANDLER > ARM: remove old-style irq entry > > Vladimir Murzin (1): > irqchip: nvic: Use GENERIC_IRQ_MULTI_HANDLER > > arch/arm/Kconfig | 22 +-- > arch/arm/include/asm/assembler.h | 185 ++++++++++++++++---- > arch/arm/include/asm/current.h | 37 ++-- > arch/arm/include/asm/elf.h | 3 + > arch/arm/include/asm/entry-macro-multi.S | 16 -- > arch/arm/include/asm/hardware/entry-macro-iomd.S | 131 -------------- > arch/arm/include/asm/insn.h | 24 +++ > arch/arm/include/asm/irq.h | 1 - > arch/arm/include/asm/mach/arch.h | 2 - > arch/arm/include/asm/percpu.h | 25 ++- > arch/arm/include/asm/switch_to.h | 3 +- > arch/arm/include/asm/thread_info.h | 27 --- > arch/arm/include/asm/tls.h | 13 +- > arch/arm/include/asm/v7m.h | 3 +- > arch/arm/kernel/asm-offsets.c | 3 - > arch/arm/kernel/entry-armv.S | 48 ++--- > arch/arm/kernel/entry-common.S | 16 +- > arch/arm/kernel/entry-header.S | 13 +- > arch/arm/kernel/entry-v7m.S | 39 +++-- > arch/arm/kernel/head-common.S | 4 +- > arch/arm/kernel/irq.c | 17 -- > arch/arm/kernel/module.c | 63 +++++++ > arch/arm/kernel/process.c | 7 +- > arch/arm/kernel/sleep.S | 4 +- > arch/arm/kernel/smp.c | 11 ++ > arch/arm/kernel/traps.c | 4 + > arch/arm/mach-footbridge/common.c | 87 +++++++++ > arch/arm/mach-footbridge/include/mach/entry-macro.S | 107 ----------- > arch/arm/mach-iop32x/cp6.c | 10 +- > arch/arm/mach-iop32x/include/mach/entry-macro.S | 31 ---- > arch/arm/mach-iop32x/include/mach/irqs.h | 2 +- > arch/arm/mach-iop32x/iop3xx.h | 1 + > arch/arm/mach-iop32x/irq.c | 29 ++- > arch/arm/mach-iop32x/irqs.h | 60 ++++--- > arch/arm/mach-rpc/fiq.S | 5 +- > arch/arm/mach-rpc/include/mach/entry-macro.S | 13 -- > arch/arm/mach-rpc/irq.c | 145 +++++++++++++++ > arch/arm/mm/Kconfig | 1 + > drivers/irqchip/Kconfig | 1 + > drivers/irqchip/irq-nvic.c | 22 +-- > 40 files changed, 695 insertions(+), 540 deletions(-) > delete mode 100644 arch/arm/include/asm/entry-macro-multi.S > delete mode 100644 arch/arm/include/asm/hardware/entry-macro-iomd.S > delete mode 100644 arch/arm/mach-footbridge/include/mach/entry-macro.S > delete mode 100644 arch/arm/mach-iop32x/include/mach/entry-macro.S > delete mode 100644 arch/arm/mach-rpc/include/mach/entry-macro.S > Tested-by: Vladimir Murzin # ARMv7M Thanks! Vladimir _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel