Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp957375lqh; Sun, 5 May 2024 09:12:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJWLtURYq1C3OYdrZ/NZhm9LAj+CspVZuvX7fZDM2akt72fUOQbcP69eNcHm4tS8Xef8+hoh/QfyMlpKYcUowJ723T8mj+RgF90InzOQ== X-Google-Smtp-Source: AGHT+IEPPuBcrfW0jfreS9q3qzHwEwQKiSzTtBe2d4P40z0ebOwOCvDT/ae3LPSKa27moiOmfMEp X-Received: by 2002:a05:6512:2159:b0:51d:3655:6134 with SMTP id s25-20020a056512215900b0051d36556134mr5086058lfr.7.1714925531943; Sun, 05 May 2024 09:12:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714925531; cv=pass; d=google.com; s=arc-20160816; b=WLtP71iZBqImyVgLhIPpe+btWLcWJqN3N0/DOVjXl5AypMqHwF9+44De34LXw/z5C8 w10vpqXOBSBcDDZUnDj9OZww+wS1N0XbE5dn/4T+yIXTJdyxvFzFjS0MQyX5WbLdoGvH ttWpcydxT6vdZ/WL/5P9WHibNo8ETdj6VyOrNVR/QvF9mea66IrQZGMdyPul8dZTWHS9 RzyMCt5x/qTBCUt9mmoSQtQaxUOqCJIqnWNx7OwmDsbzCm5RjjSCO9cpCGYxI7SfLPeG UxWMIMHdDDS+JPl6ciiZDvfCA1kM+I3qzeIbx6YZ3nF/FmYpug1wQJ9kkwWzfEAyZpuu bhsw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bP6HuoUMXi9ivDdJhuywQ3Y30eb1dSG7Z8hyYP5sWNc=; fh=Hur1Ox4UVY8CJ+UkFvS1tjjuIJbfjIxUd04pOdDk42c=; b=jcOzXOhBAf1Ce4bBe3nw0hGdGkhfy+7pPeu9/gXobSF0HGYK242Nw1s/65hwNVSVcy f4RRrvyMZWu8A4lZybNZg6pk008UirXFYhuUE4xvLsNR8Lldl2oKUM01j0PNkJ7nFs/J RzPGY9Xytqw/yV+svpVMiEPJzce8EwZoi/yBf7py58UgIWLfleD+lZA8gS9SC29oIX80 +Q+aFlaBHVwA+vS523Hgpt6YMlfCMMpS0t7WqYLSPJ1QfFWavv04x4u5UmugSu/WFF6G +aoLaJtseeyeH4Be4wSuArST7EXScQSPaB5iRgPq93X0gSpd3nOpILqwo2pq1fuBT3QN lPog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T7Y2tIoI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169049-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id pw27-20020a17090720bb00b00a59aa2b29b4si1702284ejb.499.2024.05.05.09.12.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 09:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169049-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T7Y2tIoI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169049-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 92F961F20F4D for ; Sun, 5 May 2024 16:12:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 622657BAE7; Sun, 5 May 2024 16:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="T7Y2tIoI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66C277A158; Sun, 5 May 2024 16:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714925362; cv=none; b=eMrmVblxj//QKJaQ8LhBZaNLSpukb7WjYvGcCH0K9drc3GCAluLPu3FJ+Xz6CfTPxIYkPyGpr+v6HvrQFl08moDA57mjC7M0SaNogVd+b8qDzGw4Gn9xUWcljUPEWrEBL8iYrg4qfgxeD7Pp/QrubWbtT2O3GZgj9N5zcRndcZg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714925362; c=relaxed/simple; bh=IjQRyjekukMjpd5h0+fXfebHcomYxPC0ei8vi/yCB1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UmvzSdjND36Ed7K9HUmFgDGdCi/fwPz+tTKeDy8WMG7M0tIZtY0CNJsqNRCIdTlbNTlzSxZ2KXdpZB5FjrlhHWwBnRgY9fPBmYk1Y5YvNW0l0FjZQWHikeRfvLYX7R30OSrFAUbgZOFYLJcgpkqQfx8xrYFsNlS1LVX747cPMpA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=T7Y2tIoI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC4ABC113CC; Sun, 5 May 2024 16:09:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714925362; bh=IjQRyjekukMjpd5h0+fXfebHcomYxPC0ei8vi/yCB1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T7Y2tIoI+ouDiNcQpQ86aQxIzvrgfLXieAAtowk4KtTkMUCc8jxPAWO18JJ7SD9Xt UGr6EXLLow4ZiiZ9f1+fF0t/CKI95SkQ5wNiCan6darR1D58vauIEK88aQiX0uY+yK fFic9b/6Dr9IMMoO9aumzLI/hH0HrlsLDUsj4bpN4eBOrAuFq5d4d7SBei5FXxjNvb Qcolv2fZ6kgJVW4Pl5ylISFS6jnJLMVovlleGEduKhjiJeQ2hBhy43GrygVJ8E5Xuh cAZFS/Jh3HvrD6rXC8n01vsku8OgU0v1fZ9t/8pvT0jjsUQjs6FrZnrM7QlqVnOESq LuLV4gmANK50Q== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Alexandre Ghiti , Andrew Morton , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Donald Dutile , Eric Chanudet , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Liviu Dudau , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Michael Ellerman , Mike Rapoport , Nadav Amit , Palmer Dabbelt , Peter Zijlstra , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rick Edgecombe , Russell King , Sam Ravnborg , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH RESEND v8 13/16] x86/ftrace: enable dynamic ftrace without CONFIG_MODULES Date: Sun, 5 May 2024 19:06:25 +0300 Message-ID: <20240505160628.2323363-14-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240505160628.2323363-1-rppt@kernel.org> References: <20240505160628.2323363-1-rppt@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Mike Rapoport (IBM)" Dynamic ftrace must allocate memory for code and this was impossible without CONFIG_MODULES. With execmem separated from the modules code, execmem_text_alloc() is available regardless of CONFIG_MODULES. Remove dependency of dynamic ftrace on CONFIG_MODULES and make CONFIG_DYNAMIC_FTRACE select CONFIG_EXECMEM in Kconfig. Signed-off-by: Mike Rapoport (IBM) --- arch/x86/Kconfig | 1 + arch/x86/kernel/ftrace.c | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 4474bf32d0a4..f2917ccf4fb4 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -34,6 +34,7 @@ config X86_64 select SWIOTLB select ARCH_HAS_ELFCORE_COMPAT select ZONE_DMA32 + select EXECMEM if DYNAMIC_FTRACE config FORCE_DYNAMIC_FTRACE def_bool y diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index c8ddb7abda7c..8da0e66ca22d 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -261,8 +261,6 @@ void arch_ftrace_update_code(int command) /* Currently only x86_64 supports dynamic trampolines */ #ifdef CONFIG_X86_64 -#ifdef CONFIG_MODULES -/* Module allocation simplifies allocating memory for code */ static inline void *alloc_tramp(unsigned long size) { return execmem_alloc(EXECMEM_FTRACE, size); @@ -271,14 +269,6 @@ static inline void tramp_free(void *tramp) { execmem_free(tramp); } -#else -/* Trampolines can only be created if modules are supported */ -static inline void *alloc_tramp(unsigned long size) -{ - return NULL; -} -static inline void tramp_free(void *tramp) { } -#endif /* Defined as markers to the end of the ftrace default trampolines */ extern void ftrace_regs_caller_end(void); -- 2.43.0