Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp89313lqj; Thu, 11 Apr 2024 10:34:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWh7fGCfrxJqR67hSeqEzbRLR5LCxTE4b7Bz7USpOMCqBY/e9IIjZKwBkYqzOQNaJLHqFG2ai84maT/0RDgyVvqN+Sy9PaeRwalXYO/oA== X-Google-Smtp-Source: AGHT+IF6c9FRD79QI8p7CIS3kgS/z2DcJakgfevbH0QDyE7xx964vJAUsNVn131kgN29Mb7Py03i X-Received: by 2002:a50:d519:0:b0:56e:368c:b09d with SMTP id u25-20020a50d519000000b0056e368cb09dmr323504edi.24.1712856886497; Thu, 11 Apr 2024 10:34:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712856886; cv=pass; d=google.com; s=arc-20160816; b=RTEgRUjBEGvfZ7+/5QN+9TOH5QOo+tZSKlF9lEDX+ezkoA6coMueHkUdXESJglvOQT c3ZT3mtDkiulKhHVjauUqplQQCZWN31byfesemo/xsgg0CNEbYhnWIrSAFx/BmUTf4DY sPQIgORABvnpFLncebE+Ps6s8ZW3fp4asZmJvbfY3loqBnLQ7N3F6Swq10Iy+FOFJJw0 aZLIwkDxKPX6PoX2WvVT1ANxfwWZ898+WeN8EJez9jTkh2MqDBM0BkK6lRtvLn+ckyG4 Cmh8HmiBLBUFmJypvrZvblrGvGxIHHMds1qTOiDECOAJYF2TFNLRdcsE5+/ptiIKf8Jt sBaw== 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=43XC4vW3C9EMzl2QgJ3oj/sFfpbUSDLKB3H0nJ6PbwQ=; fh=SgAimfoqqdos20VWKa/NZoWkGX6dsss6oX4o+VgWJ6E=; b=010lQhnmjFRtOEDgWIZI6aU+EAL9Hf2f5H4H85tS16/5Lauc42QfYcfetqJ3aX97VG Q9rglWruHx0DUjZjZIu6VzGaA39hUP/vzMXM5XlC5Jpuf6c0u3cZG6u0lwRhtUY5OSGf H0FQZMWA9c4aTuGd3YmL3lTRzF1BlJ9t1Ng53CYYEm2A+9yocJpeVSYRXEhAiXXXpe9b qNKuCkjy5hZRjddSEWcgiciH+uWGyapbDlOjxDO4x1XWPCCCFXjJnpqffRNHESj7ahM6 5xxMYxYzBUdHBMM5D6+OvNi20bhZWn19hHDxoUMrIadoQQlNkRgu9+hH8i7erjLF00XQ g0Ow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KWHNNAcI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-141266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141266-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 y7-20020a056402440700b0056e232f0e46si940386eda.349.2024.04.11.10.34.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 10:34:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141266-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=KWHNNAcI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-141266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141266-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 3E0661F226A2 for ; Thu, 11 Apr 2024 17:34:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECD7F13792D; Thu, 11 Apr 2024 16:03:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KWHNNAcI" 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 01A5D13777C; Thu, 11 Apr 2024 16:03:50 +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=1712851431; cv=none; b=qyMdM2CJ5ZVrdXkJo9WdSR4sgIx2Gc19ZGsiIwYfUWfxS+bfnvaRJ+ZRSN/S0rjalWMHov1A4f4v5lfGHvC7wmT3J+Mkhlvj7s0mzge/J8vJVb40AERxaH0pp7fzjJG8QcYNZGEVFFaLMbrpIt0Ku9hKce9EJ8OxQ/lD2thLcBE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712851431; c=relaxed/simple; bh=tleyEU1lUC0BC39QIzg11FQLbY7rS2GjqFF25yuhwvw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ed8c7Ykp/599FNUW+DeXoXfObA/dOXTqMkCArsD+JwC+j1flZ64zoMxAVdW5aLvNOOizf2veK7KgxwjL8aOTqcjJHOvq9R+afIa/uIjZEk+7r9MddILMYhmPQechUdV/qBNBsMmEOBw0+6x0Jrl8iEi0CLl0L+Finx3wlq+eEh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KWHNNAcI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B264BC072AA; Thu, 11 Apr 2024 16:03:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712851430; bh=tleyEU1lUC0BC39QIzg11FQLbY7rS2GjqFF25yuhwvw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KWHNNAcIx/mLULvyCHWFsS1YLjSZIaezlJX+m72pGZE/RNEbdBx5UBl+FwhfwbSxC fdiUBt+vEpaP3R/bm42w8LxmAlAgfVm0TZBD86qoaEKsjkv1HZ/9uJh3DXf39hjl+Z S/10ZwZSzTC3Znq9H07mRCjK8broyIQBbWWLJf3tk8B+pnbnTfmsA14YuXJlRy7DTL I6xnz4e0u5vePgQqBHaVpuuAl5Img7qwFaNWAmNczEjvOPFISuS2S3W3ypFIfEcoS8 gbo3+vyOWtGb9NM4v6WJPlqh5O74/8/XHwwwKYKPbAH9YXX8m9nHRw7GlWJhdO6RJ+ v5BXTq7XKxO3A== 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 , Michael Ellerman , Mike Rapoport , Nadav Amit , Palmer Dabbelt , Puranjay Mohan , Rick Edgecombe , Russell King , 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 v4 12/15] x86/ftrace: enable dynamic ftrace without CONFIG_MODULES Date: Thu, 11 Apr 2024 19:00:48 +0300 Message-ID: <20240411160051.2093261-13-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411160051.2093261-1-rppt@kernel.org> References: <20240411160051.2093261-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 e87ddbdaaeb2..5100a769ffda 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