Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1331845lqa; Mon, 29 Apr 2024 05:53:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVD9tl5shaKYkcv8zuDLVLpnimEkrBX8P6ILBMAMUbH/y5Vxsz/6l84L0Hq/isz71DIicNfl+zVjbvcQlS6pkq9vOKQSqyNUlELxHa5gg== X-Google-Smtp-Source: AGHT+IHDCoSAyyzGLinI/CJ/1Ws5WYDS8uAVb9H1dpxMlzQRkgPdkXv5TEP6IyShEj58mZZN78MQ X-Received: by 2002:a05:6871:7409:b0:22e:8a0c:ea26 with SMTP id nw9-20020a056871740900b0022e8a0cea26mr11799473oac.44.1714395201423; Mon, 29 Apr 2024 05:53:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714395201; cv=pass; d=google.com; s=arc-20160816; b=cGEROTINfOhAUTAIHj/yUGvAOM8TSryjsnT1bu4USR3mNCp1u5W3kgQFLezs2hcX3j cb6sYUwf1NHmBOGkNWGsFrYGsZ10Ycn0T3S3QTgS1XSooTRKn3weJqsRBqlw6uhJVKdh CQjEeXNyt2E1Se6GmRH+k0YeBfPaLzHdyuS0DlGUbCpnS1osda7MqOAi9ATI4y+Q8qLr Lu2bCFXTvYgF1oMQOTMt6keKEouTBb53LHdiOPhyDWN1k21bGO1DiRaIWOFqWONV/5TE ECblknAqNr5R/zPlGgPaFny4sKJdNyI0g08D4oDzQaqIGckMPrDBWB/MLPJx7WV/0Ymv N7rg== 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=y/zjTsFd2VOKclo50XT4i7BXDXoqEbwkGZfkxb/By3M=; b=KY/aiV7Qwbno0bm4gY9LGJ9Do1DOwQnaBJoCMF4PenRnnanV499iaUypSIJyOq68FC mCK++4DiIQxEOvPv9QmEzUBoAhofftDK5fO8iipwWFNMWQBna9/Ke7EDITSoBJL+eEhm EaSYCTYQsamz8EkhHQ6qJ25tMGj3OcjmqKn/+zR2bScc+QWeyPZTE+bw1WX0cq0FNwsK cGYlue18avhiTDcRuE1aK0xW5AA8IviEiFxscN5aO/XEYGBCl/QcHvJJfaMi+fiejDp8 sckCCjbI7IzExT8ePhwNpq7uKK6E2nPQuXLhz+UUDqFgHa1KC+owQMbecTqZjN+f+3fe 66Yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SPgdaeYp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-162235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162235-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j32-20020a635960000000b006006a1f030fsi13228103pgm.378.2024.04.29.05.53.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 05:53:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SPgdaeYp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-162235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162235-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3D441B27E87 for ; Mon, 29 Apr 2024 12:22:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA99D8120F; Mon, 29 Apr 2024 12:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SPgdaeYp" 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 DF52280039; Mon, 29 Apr 2024 12:19:06 +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=1714393147; cv=none; b=e60+bYVicJ96lMjj5KA8pIWTi7RBG8euYMqZdy5ztHHPW6+MAPbXzoDrZLQlO2gymaQnRusmHnYz1f0c8DnTb6wv5tgVZQ97aqCTjTQMYYcx15tzgGO2OukUF8CZ/uipzXxwsk4g/lp+fRdE3I6M/YbZNeUUz2CDd6fffwrjwMk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714393147; c=relaxed/simple; bh=IjQRyjekukMjpd5h0+fXfebHcomYxPC0ei8vi/yCB1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dG+8h4HfKcueRjCtTY7bxJdT8PXYLWF65/y0WpKU6TkPllSwS9Ds84pzBgKEsoBi4r9MbIHGoU8klvskqv18okb9pePUKiUIu6Rc3eAkD1rwrYQj2VV8cRqwKzH+0K+Vbhj7rBVEvVZnoJprm52e90wYDj+ANfL5GMN6/123HtQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SPgdaeYp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B74C4AF51; Mon, 29 Apr 2024 12:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714393146; bh=IjQRyjekukMjpd5h0+fXfebHcomYxPC0ei8vi/yCB1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SPgdaeYpabv0yHFmtuafEHgxX9ZhBEqjRbAHz/5OrYvplh1qL2PD46cmSJh5suetN MkVsDxw/Td7Y1re0PavY5BxsYWOYTVZ0toQRjMjgfi7wJUrE/gCo65MYq9y2mAmpuA dN1l/5M0x7M6kCdxTVfIdYgmZwlVZOFC2YnDZ6ehAMmmVizJWt+EyHyMrGsVUN5Mg2 RChPQ3gUYMGrhlVhXxe/Xqs3QcR5pvQ58YzMpD6UiLTiYy1Edv1UnecuUBwzl1Q0EA Pf9ONvjqTVc5Y9+LcfGa4WNrm/awTw0lvt7VBnXpkuN+acRAs394j6dfq2cKDLhnUf vkdtS4dR7I3og== 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 , =?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 v7 13/16] x86/ftrace: enable dynamic ftrace without CONFIG_MODULES Date: Mon, 29 Apr 2024 15:16:17 +0300 Message-ID: <20240429121620.1186447-14-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240429121620.1186447-1-rppt@kernel.org> References: <20240429121620.1186447-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