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 1FFEEC433F5 for ; Fri, 26 Nov 2021 10:11:54 +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=T9oeWY5ELCSgGLzQchkFGdCMLvrey9lS/2FmvzdH/Oc=; b=o2QWAVRweUoMYK 59D8ANVifFEU9ZukP6wAbkUONIf//K/TH0FKgYcDArBfRGZQC2VYJYfvL6rfX+/efoOBGoeHGt6qz ss/pk6AUu08r5no4WEzNsnL6LpGNu1DgqOPXWK2wokZmWph4wZuxQe3uvW73s65Nklso8156ubJY9 8puZ4EzKxRpSLw6ZPMFihEmKj7yaQqHj8hCUxTGMlDbLdpQv+teYBVwyWOhuVhJcdXk6aW+xTZJbL 34Ts9Odz3VPS4gdrPIxETW1bUq2NYsvxfb7QPwOUkuoL8bEnlBtSD6Q9aQzpVdVGELuVY26jC1TCn qP5LTDfOcK3XQo1LrDng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqYBS-009tg4-IF; Fri, 26 Nov 2021 10:10:23 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqYBN-009tdO-A4 for linux-arm-kernel@lists.infradead.org; Fri, 26 Nov 2021 10:10:18 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4310D60F94; Fri, 26 Nov 2021 10:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637921416; bh=aNtPsTc03NzeZIZFp5v8+Ua+1JXiOCK9uDBhhz9/B7o=; h=From:To:Cc:Subject:Date:From; b=qz0hJBCT+RWWbTplcj76RpQGwU1Aq/9IhButoxSL7t9J0b8Mx8mmBMmVdcGUspCRX XEnFbVqiOXb06tyPP7FY35LnFC6NgBIWdu70eZBRx7PELp+2efIxI0e8i7nAKpcQXX dJntv1nTV1qzPFL5cesKojpUTgix8Wco6Qcbc3oeqYr0qoMs6gWu9iTQ07MqbNQvUQ 7o6Dd0bxoTgc1ayiFmKMl0v6oDIUT2DLUUiUzbWVIFa0OflseTS0Zojr5YcXybnkW+ xql/g2+QQpCyQgnnYdWHoZ5M9E6EVZaH8cUD0RqUFEo4yzTxKhoSMB34ye/vXVOEZU aFIqnokuFr0XA== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Russell King , Nicolas Pitre , Arnd Bergmann , Kees Cook , Keith Packard , Linus Walleij , Nick Desaulniers , Tony Lindgren Subject: [RFC PATCH 0/6] ARM: enable IRQ stacks and vmap'ed stacks for UP Date: Fri, 26 Nov 2021 11:10:00 +0100 Message-Id: <20211126101006.3410322-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=3041; h=from:subject; bh=aNtPsTc03NzeZIZFp5v8+Ua+1JXiOCK9uDBhhz9/B7o=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBhoLJ3p5oubtpzyg2WrG6lKkWJmEvOXXJ59pDrBoVw jM5CQ/mJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYaCydwAKCRDDTyI5ktmPJGY9C/ 9fFvtan4+yVZuxh5jmJOo1ZkqxVpIxg93bvSVOc5vGttYhhImivwwYLtcH8wOK6mk0zdB5/vGyYmVl mhQgIcCegQLAau2J1wf5ZeLyOcEZJPpzWVof4JUwH5VeYdVObwKh6mBcqPxwXkq5qC8NigENtrnzzT qeLB9vBNAvSTrHfh4ERcML/uslKbi6ICW43WIdT9g4WToo5u80FSjwwIQHlavYVMtwopI6LfRWU9pu vBBxTaKQZPDJpcdeUbArKpjuzUucQGT8QyjhVs7BR8GxZp3JJg1OifOjj2zv96S0eHB3Ie+vIk7N9h 1soBhzqi4fHCJnjjvyHshhyE+KGpL6a4Eoigv2zaEO7D3xazQv1RgMShOg5f7mpMo5MtdzMUQ5MxNF QIwJrNGbddBRkfR/DybGAicC3EHk+K0Uh8fLIiYnZivoPLlz0gYgA2EovDmt6yvQtPjh//11r9hrGU Lb7zNUeAQsNhwo7jvHygMm70EViBZCLwE9pXh1O5fs4Os= 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-20211126_021017_438984_D304503D X-CRM114-Status: GOOD ( 18.20 ) 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. 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 (6): ARM: entry: preserve thread_info pointer in switch_to ARM: module: implement support for PC-relative group relocations ARM: percpu: add SMP_ON_UP support ARM: smp: defer TPIDRURO update for SMP v6 configurations too ARM: use TLS register for 'current' on !SMP as well ARM: implement THREAD_INFO_IN_TASK for uniprocessor systems arch/arm/Kconfig | 10 +- arch/arm/include/asm/assembler.h | 136 +++++++++++++++----- arch/arm/include/asm/current.h | 56 +++++++- arch/arm/include/asm/elf.h | 3 + arch/arm/include/asm/percpu.h | 29 ++++- arch/arm/include/asm/switch_to.h | 3 +- arch/arm/include/asm/thread_info.h | 27 ---- arch/arm/include/asm/tls.h | 4 +- arch/arm/kernel/asm-offsets.c | 3 - arch/arm/kernel/entry-armv.S | 26 ++-- arch/arm/kernel/entry-header.S | 8 +- arch/arm/kernel/head-common.S | 4 +- arch/arm/kernel/module.c | 63 +++++++++ arch/arm/kernel/process.c | 7 +- arch/arm/kernel/traps.c | 4 + arch/arm/mm/Kconfig | 1 + 16 files changed, 289 insertions(+), 95 deletions(-) -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel