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 83AAFC3DA4A for ; Tue, 20 Aug 2024 11:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:Cc:From:References:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RGhsUiW4y2F+ufvMAwwPBRoPjTI5aULHKwxMFEifjh4=; b=rXI5l9CoWkR34ERFZvsu27bhBM W37ZhjHjHNrafGmMaNV6RiZqh+cKuLRCM1ob8Hb2ibsn5KrS8XzMD5Sa5o8pfswPdcP4oF+In2fVG EAxXd8oJvoh3AAtyrx9iiFlb13drilJ68AiA85dpDKY7L7mWmdC67ad1M8/kj9v15WidJZogBfVnX DlKAmLBQ69RvIbIDQm+C5NweZYC8mmxWOJQ1YnGBJcUcG2c1viLFJj8BVi5JwBJUPeeqCQxd1fbr1 TnJwamsoTaLBHk+2EtDUCXlswfvQ1PUa8SMipRSujdcNMWMJeKK5tJstAuogwn1prROVEVzapcFdT YEaPWZ+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgNIL-000000053cJ-0aWf; Tue, 20 Aug 2024 11:45:01 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgNGn-000000053I4-3d7E for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 11:43:27 +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 797EA1007; Tue, 20 Aug 2024 04:43:51 -0700 (PDT) Received: from [10.57.70.240] (unknown [10.57.70.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B98A63F73B; Tue, 20 Aug 2024 04:43:16 -0700 (PDT) Message-ID: <4f79f56a-4019-46eb-91dc-f137b714acb7@arm.com> Date: Tue, 20 Aug 2024 13:43:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/3] arm64: entry: Convert to generic entry To: Jinjie Ruan References: <20240629085601.470241-1-ruanjinjie@huawei.com> <20240629085601.470241-4-ruanjinjie@huawei.com> Content-Language: en-GB From: Kevin Brodsky Cc: catalin.marinas@arm.com, will@kernel.org, oleg@redhat.com, tglx@linutronix.de, peterz@infradead.org, luto@kernel.org, kees@kernel.org, wad@chromium.org, rostedt@goodmis.org, arnd@arndb.de, ardb@kernel.org, broonie@kernel.org, mark.rutland@arm.com, rick.p.edgecombe@intel.com, leobras@redhat.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org In-Reply-To: <20240629085601.470241-4-ruanjinjie@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240820_044326_050662_BB45857E X-CRM114-Status: GOOD ( 20.69 ) 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 On 29/06/2024 10:56, Jinjie Ruan wrote: > Currently, x86, Riscv, Loongarch use the generic entry. Convert arm64 > to use the generic entry infrastructure from kernel/entry/*. The generic > entry makes maintainers' work easier and codes more elegant, which also > removed duplicate 150+ LOC. The changes are below: > > - Remove TIF_SYSCALL_* flag, _TIF_WORK_MASK, _TIF_SYSCALL_WORK > > - Remove syscall_trace_enter/exit() and use generic one. > > - Remove *enter_from/exit_to_kernel_mode(), and wrap with generic > irqentry_enter/exit(). > > - Remove *enter_from/exit_to_user_mode(), and wrap with generic > irqentry_enter_from/exit_to_user_mode(). > > - Remove arm64_enter/exit_nmi() and use generic irqentry_nmi_enter/exit(). > > - Remove PREEMPT_DYNAMIC code, as generic entry will do it ok by > implementing arch_irqentry_exit_need_resched(). This is looking good to me overall, moving to using the generic helpers is a clear improvement. I've tried my best to check that the new implementation is functionally equivalent to the old. Ignoring additions in the generic code (such as additional instrumentation_{begin,end}() pairs or assertions), this seems to be the case, with one exception. The MTE operations are done in a slightly different order on entry: * mte_disable_tco_entry() was called *after* the generic lockdep/CT functions in __enter_from_user_mode(). It is now called before those generic operations - arch_enter_from_user_mode() called at the beginning of enter_from_user_mode(). * Similarly mte_disable_tco_entry() and mte_check_tfsr_entry() was called after the generic operations in enter_from_kernel_mode(), and they are now called after - arch_enter_from_kernel_mode() called at the beginning of irqentry_enter(). I am not under the impression that these ordering changes are problematic, but I may be missing something. > [...] > > -/* > - * Handle IRQ/context state management when entering from kernel mode. > - * Before this function is called it is not safe to call regular kernel code, > - * instrumentable code, or any code which may trigger an exception. > - * > - * This is intended to match the logic in irqentry_enter(), handling the kernel > - * mode transitions only. > - */ > -static __always_inline void __enter_from_kernel_mode(struct pt_regs *regs) > -{ > - regs->exit_rcu = false; exit_rcu in struct pt_regs is unused now that these functions are gone so it can be removed. > [...] > > @@ -259,48 +74,6 @@ static void noinstr arm64_exit_el1_dbg(struct pt_regs *regs) arm64_{enter,exit}_el1_dbg() have apparently no generic counterparts we can replace them with, but maybe we could align them with the generic functions some more? Specifically, I'm thinking about making them return/take an irqentry_state_t just like irqentry_nmi_{enter,exit}(). This way we can get rid of struct pt_regs::lockdep_hardirqs, which is now only used by those functions. > lockdep_hardirqs_on(CALLER_ADDR0); > } > > -#ifdef CONFIG_PREEMPT_DYNAMIC > -DEFINE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched); The key is declared in asm/preempt.h, that declaration should also be removed. Kevin > [...]