Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp129712lqf; Fri, 26 Apr 2024 01:36:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXfR8nPoe4UdAVsPezz+8UaXdRdp556u/iYMGKOVHrr/Rs+NCDH6EK1L5e0Cae2hxqcoWykgm26Cbb65ALfMFMdvMdSCCy1F3YaHDENaQ== X-Google-Smtp-Source: AGHT+IH/PQBIhsaMZwpdEF3b7znvXZl2/1KfCGCI2rvP5Ur9GqjiWtDYxyaU3Ng5pV6fNfXzdVNc X-Received: by 2002:a05:620a:3b94:b0:78f:ff6:f743 with SMTP id ye20-20020a05620a3b9400b0078f0ff6f743mr1961388qkn.22.1714120589721; Fri, 26 Apr 2024 01:36:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714120589; cv=pass; d=google.com; s=arc-20160816; b=ZS6aZhcvPBUqBCSx2gnImoZCuxRwf9ySO9K/QKBG1aBtixm1wqu2ZjXVTOjvAmoIAf r+SJHltN2WOqt99MUl/NiTEsi0Sax02D0rNzOabYdtSVnxPOFqQCuk2kKTrVU/SUx/Sl o+7NuPyFulpU6xMUHZZfTaavdRmb0SDS0EfTUk3PmNja8TR43c70j27OsiORoYe9qHJw 4/9X/IG5c2seDFxCrrWjCPVpWgYe2FgW7R1+J+fj0045JvwioQADyEbpbS2XFY53LFLH UCXEQdK5FQpBeqV4p7V6Ui84MRgC4se+6YZ8Nnwhq4V04ARMBqAHcFsDDYhmFf6ph4J0 v6Ww== 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=CzSJNj8w8iUnmlgWvNYhDvD5pl9OAXL/ljrL7Y6PMxw=; b=kE/6pohk0ghXlOC98bSPwspDcePow86V6QbH1EWfnsuTIPiE0d1Fl7tgsEGUAtySMq SAfVpegjmG7EzF0C+mHeHszzh3RC9ISYQ04tXie0QBw06BBGuS4UxeAawcZVWuslK2T3 lK+KaygmloOOaTR74c0dcZNdUG2zMXNhKQ+zOLskVhKAFf0de2tA4JeA7yt5yplXwiOk HTyx+u1d9Mgm0c3EoNo5YTzqcAg5D3xafpNXu9f3icCiyM6/OrgCMQ5Agt0E/etLM76M IT9A0cz+tUhfVoNTIXhndsEQYUQpS2B60J3QdImillrSbOX+KZAbcxvbdVDGH4vTBy2p 6igw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LA0moLCc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dy4-20020a05620a60c400b0078a176d6a36si18719873qkb.83.2024.04.26.01.36.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 01:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LA0moLCc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159711-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6A50B1C2133A for ; Fri, 26 Apr 2024 08:36:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 149F61474D4; Fri, 26 Apr 2024 08:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LA0moLCc" 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 1DF95146D73; Fri, 26 Apr 2024 08:31:39 +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=1714120299; cv=none; b=GniEfKcE5DaqCylh4xXsoORcgBrNlveUWxXCxX5EGr2snkptgGP5BIpzx3Syx11CWuNExRcKwMj20H8NpH+HmuvV/oLIbriROYXhOyhf0gNfX75hD13US8q4he35HqOf/flz1xxPBXFMGai9XFxQN79h+5MP1FxMu6A9260v+Ns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714120299; c=relaxed/simple; bh=IjQRyjekukMjpd5h0+fXfebHcomYxPC0ei8vi/yCB1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AmmMuU47BN6uLDP9QP6d3w0gQpzr0gpz1RlQdFNjrAnIg/n64OKtxJHSXjpqPU+Cg1ni7t0TDzmk4swCq4beYBkW4gbsGWOOQlwpVYjA5PpH7eHWQYsy+S8VEFb+H2v9iPqjIhZilHibgqZHxPbTkzSEXvWt9Xz5eap0gh48T0g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LA0moLCc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DA85C113CE; Fri, 26 Apr 2024 08:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714120299; bh=IjQRyjekukMjpd5h0+fXfebHcomYxPC0ei8vi/yCB1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LA0moLCc1XyAaxAPTvc2WyIttGhEB1PUkRgD8LjafqmW1PC2dnh9KEdiQSzuSb0T4 YpX/elYXFX8hxPbLkyV1qqjNauUZIgcZg3kzBpvpU6/SKuLo4yitJSpCtiFIFbCwVb ORmYodfdLWjNxtFIjvgEYglV8iMV/tWBwtMAZsyEEgjuUyNZeEVpzh+A6GJki4rfG/ DhmPLsgQ0pxg/0E49LfmzQ/p9zYIhFidW2Xoh1epuanPXsEfkllchRca++MFsCY3GX XMZ71Es0P9TwVba3X9SadBYfOb5dasZkd5McPlM57jv3qH/9znon6bHqyIjzUQqGd4 sYSWwWhOXkvXQ== 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 , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Michael Ellerman , Mike Rapoport , Nadav Amit , Palmer Dabbelt , Peter Zijlstra , 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 v6 13/16] x86/ftrace: enable dynamic ftrace without CONFIG_MODULES Date: Fri, 26 Apr 2024 11:28:51 +0300 Message-ID: <20240426082854.7355-14-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240426082854.7355-1-rppt@kernel.org> References: <20240426082854.7355-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