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 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 CD50BC433EF for ; Tue, 30 Nov 2021 13:01:00 +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:MIME-Version:Message-Id:Date:Subject:Cc :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=iu/Rpn6KJVdxm0iT1M1nt6oyLqgma9lV8NLirasaEeA=; b=FvqdTIzTT2A6HB le3cKoqsS+LJXw5VvAC+EE8DRrbw+Fy9rWrx3x0/yAsF+es90aqOqgBVcKjXN+64nQIQseha6uJ8+ a+Mfrtr/b2yD0RGUxmB/c/AECc9gIfglk8224Y/KFLeVmWAhNAgHNleQ0j+ludzDXn4YbKikujqYO tS00ZxXj0RhngfvkpPa7Rcwdp7P+PT93OzZXXDn31HWsCjGXhuO3caZ7cEi1EZbXra9YyAS9gitpZ 5Nnu6+DTfiNXOnNa8W1DCbj/bM1AvcuFsWHVBEYQ9xc+TRDpaFcXSwXpycMXT8i7ZeFinGwRjvYFM LrArwWSSRV2L7suEYWQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ms2j7-005CLA-WD; Tue, 30 Nov 2021 12:59:18 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ms2j3-005CKK-NR for linux-arm-kernel@lists.infradead.org; Tue, 30 Nov 2021 12:59:15 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id F247DCE19E4; Tue, 30 Nov 2021 12:59:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 159ABC53FC7; Tue, 30 Nov 2021 12:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638277150; bh=ifJp8Ivau9WMymUWSMdkhZRAJzxj0TEWB/A2iGEofZI=; h=From:To:Cc:Subject:Date:From; b=vEYnD2RrtS0SqguySz2i/okQvQgvNOhheyhqwVSdNRTFcT0SvJXzJwixfah+gyTvh 4PKXXPz+Ei+jbLWsvQ8T3PgH9QCg+TwjNuOl6BtlWHcjAAPddC1UcF1fdhSkwQY/+m +ERqrFF71tKqj1+tQrOD8mJXghM3tFuBtacrT649+5Y+LY2aHZAjq0P5ktNDAy0x0M Y/lCq6/ZN3xLjVPKCXEiNaP+E6RS0N507sjpqH6wTwkMNzYPVP1jub//2gI5HgsZ50 534Dl2wAqOZWKnN/rj4HjYfaUYdCU4YLsW78zJD0EMMy8Ec2ynwJwy3QIjhljOVKP4 9sYOLYqRsbwVQ== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: Ard Biesheuvel , Nicolas Pitre , Arnd Bergmann , Kees Cook , Keith Packard , Linus Walleij , Nick Desaulniers , Tony Lindgren Subject: [PATCH v2 00/12] ARM: enable IRQ stacks and vmap'ed stacks for UP Date: Tue, 30 Nov 2021 13:58:49 +0100 Message-Id: <20211130125901.3054-1-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5679; h=from:subject; bh=ifJp8Ivau9WMymUWSMdkhZRAJzxj0TEWB/A2iGEofZI=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBhpiAG3/UgPvRxFnp+Mj4Xm+1/YxNTxu+EUCHe9OKZ vLmEcUyJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYaYgBgAKCRDDTyI5ktmPJHPcDA CXi3pPYr3MamV4EbdiPeg4jfcmPZbh+X32mKstzO/exEsZ+InLOhiFS0tSyVlt/SKfOlOV3ZSIxAL+ /b7b376GHMDtg9E3uWxK+NrxvDQMy262/1ZU+bBcd4VYx2fd++Jk1Cx/fbPjy7Uml+Xl7DSDLOTFp3 yvsv1DG+7wVeIIn0REJgE/idko7r03erp3KPw3tzjdl1hTsEwPgxfAxUkwygbcph4k6XTKhyY9MOWB JyzqV0htOzzlUChJww5Bf9XPlRu5jQBrEu2e0AxifPDWIT5YUscjtJrUTvVzkcfFcznhM3wKepn7SB oOepMUrhxxG05sMDJx6h6gMTyR1+N7wcFbAwuzXUSoVW3G//t+oVymVgaVtwLFrJDw1QsEf2yZoJqA ZPp7ZXh0NMYpDhmVGSRSjf2KZBFhIqv0NEKyzftSsyovcEwmEuLmMCJzyD/RAQLKLK7LNAWhbY3Uds Ig6Qm9YRCjdlQ9Pq7N/mUFSlaRIvMZqyZPj5z7T0ObvFE= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211130_045914_168907_6E7F126C X-CRM114-Status: GOOD ( 25.04 ) 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 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 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 Ard Biesheuvel (7): 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 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 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/kernel/asm-offsets.c | 3 - arch/arm/kernel/entry-armv.S | 48 ++--- arch/arm/kernel/entry-common.S | 10 +- arch/arm/kernel/entry-header.S | 13 +- 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 | 23 +++ 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 + 36 files changed, 656 insertions(+), 502 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 -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel