From patchwork Wed Oct 19 14:41:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 13011909 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 8C0B3C4332F for ; Wed, 19 Oct 2022 15:01:16 +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=z7aXcAvTUoZrNfqgX8eKG1WsguHufS18tNi6whle+tE=; b=xWIK0pl6ty00dK SfP2D4ALq4OeYZI8eXrOyOQFh0E1eEwPLYzNqgqzzn/NbRBkQ+R4JAwnJdBXU+ND36RUK/jufrFGw KTqao4IqLmOCAYMgw7rrOIOoywZz8FgEhawo7DHnIN5j6qALYoG05avpeyBzPHHCalg8N3fpB8yAU sYGuVocU8kQ+gg2QMlDU8LUl2SL0rp0iixxkUAbp0M3p0/Y+iBrJAjmJIv3H17EnoP9aBjiry9ilz PUlh517qfOIQQ7SOSDANjcRuQZZX85vrko4nqazdAo7RvshulvbkvA46J8dSrgOASZLKcxvCqlG6Q T+cDUpY06ZkGrOztPr5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olAY2-002ydv-Lh; Wed, 19 Oct 2022 14:59:59 +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 1olAGG-002qSO-EW for linux-arm-kernel@lists.infradead.org; Wed, 19 Oct 2022 14:41:38 +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 369AC1FB; Wed, 19 Oct 2022 07:41:37 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 031693F7D8; Wed, 19 Oct 2022 07:41:29 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, james.morse@arm.com, joey.gouly@arm.com, mark.rutland@arm.com, peterz@infradead.org, will@kernel.org Subject: [PATCH v2 0/9] arm64: rework UNDEFINED instruction traps Date: Wed, 19 Oct 2022 15:41:14 +0100 Message-Id: <20221019144123.612388-1-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221019_074136_596879_49C282C4 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This series reworks the way UNDEFINED instruction traps are handled, removing some dynamic data structure manipulation and related locking. This makes the code a bit simpler and removes some unnecessary bottlenecks when traps are handled. My original aim for this series was to get rid of the RCU_NONIDLE() call in cpu_suspend(), requiring the removal of the undef_hook list manipulation. In the process of looking at that I figured we had a set of related problems with UNDEF handling and deprecated instruction handling, which this series addresses. This series does not remove the RCU_NONIDLE() call from cpu_suspend() as removing that will require further rework of the suspend code (e.g. for noinstr safety). I've tested this series in VMs on ThunderX2 (for the ID reg emulation changes) and a Raspberry Pi 4 (for the armv8_deprecated changes), as described in the relevant commits. Since v1 [1]: * Rebase atop v6.1-rc1 * Fix typos [1] https://lore.kernel.org/linux-arm-kernel/20220928102659.247510-1-mark.rutland@arm.com/ Thanks, Mark. Mark Rutland (9): arm64: allow kprobes on EL0 handlers arm64: split EL0/EL1 UNDEF handlers arm64: factor out EL1 SSBS emulation hook arm64: factor insn read out of call_undef_hook() arm64: rework EL0 MRS emulation arm64: armv8_deprecated: fold ops into insn_emulation arm64: armv8_deprecated move emulation functions arm64: armv8_deprecated: move aarch32 helper earlier arm64: armv8_deprecated: rework deprected instruction handling arch/arm64/include/asm/cpufeature.h | 3 +- arch/arm64/include/asm/exception.h | 7 +- arch/arm64/include/asm/spectre.h | 2 + arch/arm64/include/asm/traps.h | 19 +- arch/arm64/kernel/armv8_deprecated.c | 567 +++++++++++++-------------- arch/arm64/kernel/cpufeature.c | 23 +- arch/arm64/kernel/entry-common.c | 8 +- arch/arm64/kernel/proton-pack.c | 26 +- arch/arm64/kernel/traps.c | 93 ++--- 9 files changed, 345 insertions(+), 403 deletions(-)