From patchwork Tue Dec 10 16:05:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13901629 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7287E77180 for ; Tue, 10 Dec 2024 16:06:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2EBC26B020B; Tue, 10 Dec 2024 11:06:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 29C986B020C; Tue, 10 Dec 2024 11:06:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 163AD6B020D; Tue, 10 Dec 2024 11:06:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EC3D56B020B for ; Tue, 10 Dec 2024 11:06:45 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6626C14075F for ; Tue, 10 Dec 2024 16:06:45 +0000 (UTC) X-FDA: 82879526562.19.AD1F02C Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf12.hostedemail.com (Postfix) with ESMTP id 3402F40010 for ; Tue, 10 Dec 2024 16:06:34 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=P8ZZHIvS; spf=pass (imf12.hostedemail.com: domain of arnd@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733846787; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=68dpRV7WNOR7sj/6rUmXieI5aMfCcTBO86KfdpRDwOQ=; b=XotCptLT5Fn6BHyh9fTOkYqAKpQxUdSyrjsUT8wx/AOIQJomREkokvTJEYu51Ja7A/eKwA QI4/3mWzDDERklCid8Lu1bofqVete1TCXIQ6dxESJglQS2OkWeKWx2Mby0IjX8LoYsxDua YQ9A4jbsWCvUwbrvoFgi5jXqR8gSZ5Y= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=P8ZZHIvS; spf=pass (imf12.hostedemail.com: domain of arnd@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733846787; a=rsa-sha256; cv=none; b=jJl9y/NOUe3rqiwTQs+S+RdqyzFw8NQ2ljxB3/f6Hgc/uk1V+h8aV6Gjgb1/iLfGNdiEF2 O8WOk25/U2hOorcAFNSPBcTnpqKASmCV+a87m7ziYowjvfFcMSkKBBlsdjQKfxQUBiqGPh 1LOeGvqtpWsXhw95s1KolvIhOJXco90= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 8DD7CA40F5D; Tue, 10 Dec 2024 16:04:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41C9CC4CEE8; Tue, 10 Dec 2024 16:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733846802; bh=nhIKrOVHXT3fUCBw4LPHGsOsiy5FD8A3uloS3DV+YHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P8ZZHIvSDkAlRtjuBdPZfIY3aU5cCBpzyB/i2Vv0HHj1O6+BciyVjba8Qkih/H+oH 8TtDjHvi5iAR5MM0ElcShiTGwZql1i32Y6428E+38PRhzgRtAWTKpfhzHJiPn84smK HJWY3mo1jKE1QGYdAFfrLrczgT25PXzoZxXyZngcTAjKXWCDBA2CPN3ZHKobWSi6Kp YPEzJWTJOIMs4W0CAIhrvEGezqOkDjf872n/KtyP4lCYe2TAn2G5E3eIEtTgkMqO5y 6R94PbszNkqgUUmIxY+fUeVVOLgne6LUFDtXRCNteNin/BkIZD+yk9ibqhphxRJ7mU pxz1jz8DVVEoQ== From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , linux-mm@kvack.org, linux-rt-devel@lists.linux.dev, Ard Biesheuvel , Clark Williams , Jason Baron , Josh Poimboeuf , Linus Walleij , Mark Rutland , Matthew Wilcox , Peter Zijlstra , Russell King , Sebastian Andrzej Siewior , Steven Rostedt , Thomas Gleixner Subject: [PATCH 1/4] ARM: Disable jump-label on PREEMPT_RT Date: Tue, 10 Dec 2024 17:05:53 +0100 Message-Id: <20241210160556.2341497-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210160556.2341497-1-arnd@kernel.org> References: <20241210160556.2341497-1-arnd@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 3402F40010 X-Rspamd-Server: rspam12 X-Stat-Signature: ogwishffoi5yo6hd3g4x5mpi5bwfuc6d X-Rspam-User: X-HE-Tag: 1733846794-718729 X-HE-Meta: U2FsdGVkX1/FFedGHRaCj3NwIdvvjdSvd1TrhEObIyJapEfjRL6nzBNiZOBC/p52f+BJI8eUnPbKC1Ua8GLKkC8e6D80lXv5sEj0J3pfYF1E62WjLr6UBW3EF8nOBevX8R3Jpe41bzpA3SgGzmhj0RBGJmZLw5QEYvF1zLjWMFPCtLMvIyL/2JapBqjFElhqbpU0OsPyM1GlKYlalCEsIb9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O7jZCwTOy+CdMX1m70kliTcKbG/v9yqwyFrD3zMA+TtvOiKhaPryIFtU0xA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner jump-labels are used to efficiently switch between two possible code paths. To achieve this, stop_machine() is used to keep the CPU in a known state while the opcode is modified. The usage of stop_machine() here leads to large latency spikes which can be observed on PREEMPT_RT. Jump labels may change the target during runtime and are not restricted to debug or "configuration/ setup" part of a PREEMPT_RT system where high latencies could be defined as acceptable. On 64-bit Arm, it is possible to use jump labels without the stop_machine() call, which architecturally provides a way to atomically change one 32-bit instruction word while keeping maintaining consistency, but this is not generally the case on 32-bit, in particular in thumb2 mode. Disable jump-label support on a PREEMPT_RT system when SMP is enabled. [bigeasy: Patch description.] [arnd: add !SMP case, extend changelog] Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior Cc: Mark Rutland Cc: Ard Biesheuvel Link: https://lkml.kernel.org/r/20220613182447.112191-2-bigeasy@linutronix.de Signed-off-by: Arnd Bergmann Reviewed-by: Linus Walleij --- I slightly changed the patch from the version currently in linux-rt.git to leave jump labels enabled on single-CPU kernels that are still fairly common on 32-bit arm. If there are no additional concerns about this version, I will forward it to Russell's patch system --- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index fb4e1da3bb98..ed850cc0ed3c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -80,7 +80,7 @@ config ARM select HAS_IOPORT if PCI || PCMCIA || ISA || ARCH_FOOTBRIDGE || ARCH_RPC select HAVE_ARCH_AUDITSYSCALL if AEABI && !OABI_COMPAT select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6 - select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU + select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU && (!PREEMPT_RT || !SMP) select HAVE_ARCH_KFENCE if MMU && !XIP_KERNEL select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL